Sub Click(Source As Button)
Dim session As New NotesSession
Dim wksp As New notesuiworkspace
Dim uidoc As notesuidocument
Dim doc As NotesDocument
Dim messagestext As String
Dim messagessplit As Variant
Dim messageslist List As String
Dim x As Variant
Dim i As Integer
Dim message As String
Dim messageintern As String
Dim messagestringsplit As Variant
Dim thisdate As New NotesDateTime("")
Dim ok As Boolean
Dim evalstring As String
Dim evalvar As Variant
Dim isnotesuser As Boolean
Dim notesitem As notesitem
Dim docmailsend As String
Dim user As String
Set uidoc = wksp.CurrentDocument
holders = uidoc.document.LockHolders
If holders(0) <> "" Then
Forall h In holders
lockmessage = lockmessage & h & Chr(13)
End Forall
Messagebox lockmessage,, "Lock holders"
Exit Sub
End If
' if the uidoc is not in editmode set it
If uidoc.EditMode= False Then
uidoc.EditMode=True
End If
Call thisdate.setnow
' build a list for the message strings
messagestext = uidoc.fieldgettext("MESSAGES")
messagessplit = Split(messagestext,";")
For I = 0 To Ubound(messagessplit) Step 1
x = Split(messagessplit(i),"=")
messageslist(x(0)) = x(1)
Next
' get the actual user
user = session.UserName
uidoc.Document.supporter = user
' set some fields in the uidoc
uidoc.document.Status = "1"
uidoc.document.Priority= "1"
uidoc.document.OpenedByIT = thisdate.LocalTime
' Call uidoc.FieldSetText("Supporter","1") is either set by dispatcher or by creating the ticket manually
uidoc.document.RequestedBy = uidoc.document.Supporter(0)
' build the messagestring depending on the defined key
'message = messageslist("msgTicketAssigned")
'PW PROGRAMMIERT ANFANG
message = MessageslistitemNotExists(messageslist, "msgTicketAssigned",2)
'PW PROGRAMMIERT ENDE
' use the LogActions function for logging entrys.
Ok = logActions(uidoc,"UserAccepted","",thisdate.Dateonly, thisdate.timeonly,"","","","")
If ok = False Then
' was not assgned due to an error in the logAction Script
Exit Sub
End If
' check if the user is a notes user because only this ones get documents with links
Evalstring = |@unique(@NameLookup ( [Exhaustive]; "| + uidoc.Document.user(0) + |" ;"FullName"))|
EvalVar = CheckAndEvaluate(Evalstring, uidoc.document)
If Isempty(EvalVar) Then
isnotesuser = False
Else
isnotesuser = True
End If
' check if there is a field that steers mail information sending
If itemTextExists(uidoc.Document,"fldMailIfAccepted") = True Then
Set notesitem = uidoc.Document.GetFirstItem("fldMailIfAccepted")
docmailsend = notesitem.text
Else
docmailsend = ""
End If
'set the doc
Set doc = uidoc.Document
' send the mail either as mail with link or as mail
If Ucase(GetConfigDocByKey ("NoNotification")) = "YES" Or docmailsend = "NO" Or (Ucase(GetConfigDocByKey ("MailIfAccepted")) <> "YES" And docmailsend = "")Then
' do not do anything
Else
If Ucase(GetConfigDocByKey ("MailIfAcceptedLink")) = "YES" And Isnotesuser = True Then
BoolLink = True
Else
BoolLink = False
End If
' Send Mail with Link
OK = Spoofmessage(_
GetConfigDocByKey("sendMailonBehalfof"),_
doc.user, _
doc.otherusers,_
message,_
MessageslistitemNotExists(messageslist, "msgTicketClick",2),_
doc,_
"",_
GetConfigDocByKey("MailIfAcceptedBodyFieldName"),_
BoolLink,_
True,_
"BugReport",_
"IsAcceptedMail")
End If
Call doc.Save(True,False)
Call uidoc.Reload
Call uidoc.Refresh
End Sub