| Sub Initialize |
| Dim session As New NotesSession |
| Dim agentLog As New NotesLog("Agent log") |
| |
| Call agentLog.OpenAgentLog |
| Call agentLog.LogAction( "Variablendeklaration") |
| |
| Dim TicketDB As NotesDatabase |
| Dim SupportDB As NotesDatabase |
| |
| Dim dbDirectory As NotesDirectory |
| |
| Dim dateTime As New NotesDateTime( Datenumber(1995, 3, 14) ) |
| Dim selection As String |
| Dim collection As NotesDocumentCollection |
| Dim ViewCollection As NotesViewEntryCollection |
| Dim ViewEntry As NotesViewEntry |
| |
| Dim SupportView As NotesView |
| Dim TicketView As NotesView |
| |
| Dim TicketDoc As NotesDocument |
| Dim SupportDoc As NotesDocument |
| |
| Dim SupportID As String |
| Dim TicketID As String |
| |
| Call agentLog.LogAction( "SupportDB zuweisen") |
| Set SupportDB = session.CurrentDatabase |
| Call agentLog.LogAction( "View aus der Support DB holen") |
| Set SupportView = SupportDB.GetView("(v_ReqNumber)") |
| Call agentLog.LogAction( "Erstes Dok der View aus der Support DB holen") |
| Set SupportDoc = SupportView.GetFirstDocument |
| |
| Call agentLog.LogAction( "Max Count der View") |
| iCounter = SupportView.AllEntries.Count |
| Print iCounter + " Tickets zum abgleich mit der Ticket-DB in der Support-DB gefunden" |
| |
| Call agentLog.LogAction( "Ticket-DB holen") |
| Set TicketDB = session.GetDatabase("Maria_Notes","it-troubticket.nsf",False) |
| Call agentLog.LogAction( "View aus der Ticket-DB holen") |
| Set TicketView = TicketDB.GetView("(v_ReqNumber)") |
| |
| On Error Goto ErrHandler |
| |
| iCounterX = 0 |
| Call agentLog.LogAction( "Solange SupportDocs vorhanden sind (WEND Eintritt)") |
| While Not (SupportDoc Is Nothing) |
| Call agentLog.LogAction( "Support-ID holen") |
| SupportID = SupportDoc.ReqNumber(0) |
| Call agentLog.LogAction( "Support-ID: " + SupoortID) |
| Call agentLog.LogAction( "Selektion zusammensetzen") |
| selection = |@Contains( ReqNumber; "| + SupportID+ |" )| |
| Print "Suche in der Ticket-DB nach dem Ticket " + SupportID |
| |
| Call agentLog.LogAction( "Collection bilden indem Selection in der TicketDB gesucht wird") |
| Set collection = TicketDB.Search( selection, dateTime, 0 ) |
| Call agentLog.LogAction( "Erstes (und einziges) Dokument aus der Collection holen") |
| Set TicketDoc = collection.GetFirstDocument() |
| |
| Call agentLog.LogAction( "Prüfung ob Dokument in TicketDB vorhanden") |
| If (TicketDoc Is Nothing) Then |
| Call agentLog.LogAction( "Ticket mit der Support-ID " + SupportID + " in der TIcketDB nicht gefunden!") |
| Print "Ticket " + SupportID + " wurde nicht in der Ticket-DB gefunden! Nächstes Dokument (" + iCounterX + " / "+iCounter+")" |
| Call agentLog.LogAction( "Nächstes Dokument nehmen") |
| Goto EndeIf |
| End If |
| |
| Call agentLog.LogAction( "While TicketDoc is not nothing") |
| While Not TicketDoc Is Nothing |
| Call agentLog.LogAction( "Ticket-ID holen") |
| TicketID = TicketDoc.ReqNumber(0) |
| Call agentLog.LogAction( "Ticket-ID mit Support-ID vergleichen") |
| If (SupportID = TicketID) Then |
| Call agentLog.LogAction( "Ticket-ID == Support-ID") |
| Call agentLog.LogAction( "Solution holen") |
| tmpString=TicketDoc.GetItemValue("solution") |
| Call agentLog.LogAction( "Solution in Dok schreiben") |
| Call SupportDoc.ReplaceItemValue("solution", tmpString) |
| |
| Call agentLog.LogAction( "Kommentar für den Benutzer holen") |
| tmpString=TicketDoc.GetItemValue("tx_usercomment") |
| Call agentLog.LogAction( "Kommentar für den Benutzer schreiben") |
| Call SupportDoc.ReplaceItemValue("tx_usercomment", tmpString) |
| |
| Call agentLog.LogAction( "Status holen") |
| tmpString=TicketDoc.GetItemValue("Status") |
| Call agentLog.LogAction( "Status schreiben") |
| Call SupportDoc.ReplaceItemValue("Status", tmpString) |
| |
| Call agentLog.LogAction( "Supporter holen") |
| tmpString=TicketDoc.GetItemValue("supporter") |
| Call agentLog.LogAction( "Supporter schreiben") |
| Call SupportDoc.ReplaceItemValue("supporter",tmpString) |
| |
| Call agentLog.LogAction( "Dok speichern") |
| Call SupportDoc.Save(True, True) |
| Goto EndeIf |
| End If |
| Wend |
| EndeIf: |
| Call agentLog.LogAction( "Nächstes SupportDoc") |
| Set SupportDoc = SupportView.GetNextDocument(SupportDoc) |
| iCounterX = iCounterX +1 |
| Wend |
| |
| Print "Alle Tickets (" + iCounterX +" / " + iCounter + ") bearbeitet. ENDE" |
| ErrHandler: ' Error-handling routine |
| Call agentLog.LogAction( "Fehler in Zeile " & Erl) |
| Print "Error " & Err & " at line number " &Erl |
| Resume Next |
| Ende: |
| Call agentLog.Close |
| End Sub |
| |