• fix for US users

    By Brent Goedert 2 decades ago

    The (Insert New Time-Sheet) agent has a bug in the date format.

    You can replace the existing code under the "Initialize" with the following, and it will work.

    The only change is the addition of the "International" conditionals for the date format.

     

    Sub Initialize
        
    ' =====================================================================
    ' Created By www.sbacode.com [Barbieri Fabio] - Groupware Team (c) 2006
    ' Project:
    ' Creato: 16 Ottobre 2006  by Barbieri Fabio
    ' Modificato : 16 Ottobre 2006  by Barbieri Fabio
    ' Note:
    ' =====================================================================
        
        On Error Goto Errore    
        
        Dim oWs As New NotesUiWorkspace
        Dim Mess$
        Dim oDocApp As NotesDocument
        Dim doc As NotesDocument
        Dim oSession As New NotesSession
        Dim oDb As NotesDatabase
        Dim view As NotesView
        Dim vDate As String
        
        Set oDb = oSession.CurrentDatabase
        Set oDocApp = oDb.CreateDocument    
        
        Do
            Call oWs.DialogBox ("DLG01", True, True, True, , , , "Insert NEW Time-Sheet" ,oDocApp,True,True)
            Select Case oDocApp.DLGUscita(0)
            Case "OK"
                Exit Do
            Case "ANNULLA"
                Print "Cancelled operation."
                Exit Sub
            Case Else
                Beep
            End Select
        Loop
        
        If Not setHolidaysDate( vDate , oDocApp.DLG_user(0) , oDocApp.DLG_monthYear(0)  ) Then
            Exit Sub
        End If
        
        Set doc = oDb.CreateDocument    
        doc.monthYear    = oDocApp.DLG_monthYear(0)
        doc.customer =    oDocApp.DLG_customer(0)
        doc.activity =    oDocApp.DLG_activity(0)
        doc.user = oDocApp.DLG_user(0)
        
        doc.month    = Month(oDocApp.DLG_monthYear(0))
        doc.year    = Year(oDocApp.DLG_monthYear(0))
        
        doc.form = "TimeSheet"
    %REM
    Set Authors Fields
    %END REM
        
        Dim oName As New NotesName( oDocApp.DLG_user(0) )
        Dim vAuthors ( 1 ) As String
        
        vAuthors( 0 ) = "[Admin]"
        vAuthors( 1 ) = oName.Canonical
        Dim authorsItem As New NotesItem(doc, "docAuthors",  vAuthors, AUTHORS)
        
    %REM
    Set Readers Fields
    %END REM
        
        Dim vReaders ( 0 ) As String
        vReaders( 0 ) = "[Supervisor]"
        Dim readersItem As New NotesItem(doc, "docReaders",  vReaders, READERS)
        
        Dim sData$
        For i = 1 To 31
            'sData  = Cstr(i) + "/" + Cstr(doc.month(0)) + "/" + Cstr(doc.year(0) )
            Dim international As NotesInternational
            Set international = oSession.International
            If international.IsDateDMY Then
                sData  = Cstr(i) + "/" + Cstr(doc.month(0)) + "/" + Cstr(doc.year(0) )
            Elseif international.IsDateMDY Then
                sData  = Cstr(doc.month(0)) + "/" + Cstr(i) + "/" + Cstr(doc.year(0) )
            Elseif international.IsDateYMD Then
                sData  = Cstr(doc.year(0) + "/" + Cstr(doc.month(0)) + "/" +  Cstr(i))
            End If            
            Dim dtGiorno As New NotesDateTime( sData )
            If Not Trim(dtGiorno.DateOnly) = ""  Then
                'Msgbox Weekday(sData)
                Call doc.ReplaceItemValue("Weekday_" + Cstr(i), Weekday(sData))            
            End If
        Next i
        
        doc.CF_Holiday = vDate
        Call doc.save(-1,-1)
        
        Print "Operation Finished With Happening."
        
        Exit Sub
    Errore:
        Mess = "Errore   Agente: Insert  - Initialize  Riga errore : " + Str(Erl) + "  Definizione Errore : " + Error
        If Err Then
            Msgbox Mess        
            Err = 0    
        End If
        Exit Sub
    End Sub