Domino 9 und frühere Versionen > ND8: Administration & Userprobleme
Agent prüft keine Doppeleinträge mehr
Driri:
Du solltest Dir mal in der Scriptbibliothek "TimeReport" die Funktion "isValidTimeRecord" anschauen. Dort wird vermutlich die Validierung bzw. die Suche nach Doppeleinträgen stattfinden.
tron55:
--- Zitat ---Option Public
Option Declare
Function isValidTimeRecord( doc As NotesDocument ) As Integer
On Error Goto catch
Const Button = 16
Const Title = "Error!"
isValidTimeRecord = 1
Dim tr As NotesDocument
Dim startItem As NotesItem, endeItem As NotesItem, dateItem As NotesItem
Dim start As NotesDateTime, ende As NotesDateTime, reportDate As NotesDateTime
Dim keys(1) As String
Set startItem = doc.getFirstItem("TimeReportHourStart")
Set endeItem = doc.getFirstItem("TimeReportHourEnd")
Set dateItem = doc.getFirstItem("TimeReportDate")
Set start = startItem.DateTimeValue
Set ende = endeItem.DateTimeValue
Set reportDate = dateItem.DateTimeValue
Dim coll As NotesDocumentCollection
Dim userTimeReportsView As NotesView
Dim db As NotesDatabase
Dim key As String
Set db = doc.ParentDatabase
Set userTimeReportsView = db.getView("(UserTimeReports)")
keys(0) = doc.TimeReportUser(0)
keys(1) = reportDate.dateonly
If( Instr(1, keys(1), ".") > 0 ) Then
' we need to convert into the format mm/dd/yyyy because it is used in the view
keys(1) = Mid$( reportDate.DateOnly, 4, 2) + "/" + Mid$(reportDate.DateOnly, 1,2) + "/" + Mid$(reportDate.DateOnly, 7,4)
End If
' Call logMsg( "1", "Inside isValidTimeRecord for " + keys(0) + " " + keys(1))
Set coll = userTimeReportsView.getAllDocumentsByKey( keys, True )
Dim timeFrom As NotesDateTime, timeUntil As NotesDateTime
Dim chstartItem As NotesItem, chendeItem As NotesItem
Dim chstart As NotesDateTime, chende As NotesDateTime
Set tr = coll.getFirstDocument()
While ( Not tr Is Nothing And isValidTimeRecord)
Set chstartItem = tr.getFirstItem("TimeReportHourStart")
Set chendeItem = tr.getFirstItem("TimeReportHourEnd")
Set chstart = chstartItem.DateTimeValue
Set chende = chendeItem.DateTimeValue
If( chStart.TimeDifference( ende ) >= 0 Or start.TimeDifference( chEnde) >= 0) Then
'Everything is ok
'if the work is overlapping at midnight, then it is necessary to stop at 00:00 and start a new entry at the next day
Else
If( tr.UniversalID <> doc.UniversalID) Then
Msgbox "There is a time conflict with the activity "+tr.Subject(0) + " in project " + tr.ProjectName(0), button, title
isValidTimeRecord = -1
End If
End If
Set tr = coll.getNextDocument(tr)
Wend
' Call logMsg( "1", "isValidTimeRecord has the value " + Cstr(isValidTimeRecord))
If( isValidTimeRecord = 1 ) Then
Dim frozenView As NotesView
Dim frozenDocs As NotesDocumentCollection
Dim frozenDoc As NotesDocument
Dim dtFreeze As NotesDateTime
Dim dtTimeReport As NotesDateTime
Set frozenView = db.GetView("(ActiveFrozenPeriods)")
Set frozenDocs = frozenView.GetAllDocumentsByKey(doc.ProjectName(0), True)
Set frozenDoc = frozenDocs.getFirstDocument()
Stop
While( Not frozenDoc Is Nothing)
If( frozenDoc.SubProjectSelection(0) <> "" ) Then
If( doc.ProjectPartName(0) <> frozenDoc.SubProjectSelection(0)) Then Goto nextFrozen
End If
If( frozenDoc.UserSelection(0) <> "" ) Then
If( doc.TimeReportUser(0) <> frozenDoc.UserSelection(0)) Then Goto nextFrozen
End If
Set dtFreeze = frozenDoc.GetFirstItem("FreezeDate").DateTimeValue
Set dtTimeReport = doc.GetFirstItem("TimeReportDate").DateTimeValue
If( dtTimeReport.TimeDifference( dtFreeze) <= 0 ) Then
isValidTimeRecord = -2
Msgbox "Time Record could not be saved. Period for this combination is already closed.", button, title
End If
nextFrozen:
Set frozenDoc = frozenDocs.GetNextDocument(frozenDoc)
Wend
End If
finally:
Exit Function
catch:
Msgbox Error$
isValidTimeRecord = -3
Resume finally
End Function
Function logMsg( nr As Integer, msg As String)
Dim s As New NotesSession
Dim db As NotesDatabase
Dim doc As NotesDocument
Set db = s.CurrentDatabase
Set doc = New NotesDocument( db )
doc.form = "GeneralLog"
doc.msg = msg
doc.nr = nr
Call doc.save(True, True)
End Function
--- Ende Zitat ---
In meinem jugendlichen leichtsinn behaupte ich nun einfach mal :
Sieht doch eigentlich ok aus :-:
tron55:
--- Zitat von: ata am 19.09.11 - 13:45:44 ---1)Läuft die DB auf einem anderen Server?
2)Ist ein Server als ausführend eingetragen?
3)Wurde der Server umbenannt?
4)Was sagt das Agent-Log - wann lief der Agent zum letzten Mal?...
--- Ende Zitat ---
1)nein
2) nein vorher war niemand ausführend eingetragen nun ist Administrators dort eingetragen.
3)nein
4) angeblich lief webquerysave noch nie ???
Peter Klett:
Schau Dir mal die versteckte Ansicht an (STRG+SHIFT festhalten, mit der Maus Ansicht - Gehe zu... und dann die Ansicht "(UserTimeReports)" auswählen).
In welchem Format stehen die Datumsangaben? Vergleiche das mit dem Datumsformat, mit dem gesucht wird. Entgegen einem früheren Post von Dir sucht er nach dd/mm/yyyy und nicht nach dd/mm/yy. Da musst Du ganz genau sein. Zusätzlich solltest über Prints oder Msgbox ausgeben lassen, welchen Suchschlüssel er verwendet. Die Datumsformatierung ist "handgemacht" und muss nicht zwingend passen. Wenn das Datum zum Beispiel mit 19.9.2011 ausgegeben wird, reicht es nicht aus mit Mid zu arbeiten, wenn der Entwickler 19.09.2011 erwartet hat. Ich kann da nur den Befehl "Format" empfehlen, um Datum sauber in einen formatierten String umzuwandeln.
tron55:
Du hast "leider" vollkommen Recht, da ist es wieder.
Früher war das Format völlig ok, deswegen hat das auch geklappt.
Irgendwann macht er dann auf einmal wilde Punkte... wtf...
Wie kommt denn sowas und vor allen Dingen , wie stelle ich das am umkompliziertesten wieder um?
(das kann ja irgendwie nur ein Setting sein und kein Code)
Navigation
[0] Themen-Index
[#] Nächste Seite
[*] Vorherige Sete
Zur normalen Ansicht wechseln