************************************************************************************************** FUNCTION UpdateUserAndTime() * Function..........: UpdateUserAndTime * Author............: Gregory Adam thread #988451 / Nadya Nosonovsky / James Weil * Project...........: Visual Collections * Created...........: 02/02/2005 15:17:53 * Copyright.........: (c) Jzanus, LTD, 2005 * Major change list.: IF (VARTYPE(m.glDontUpdateUserAndTime) = "L" AND m.glDontUpdateUserAndTime) ; OR (TYPE(ALIAS()+".tLast_Updated_Date")="T" ; AND OLDVAL("tLast_Updated_Date")<> tLast_Updated_Date) && the new date was passed as part of replace command ELSE LOCAL lcFieldState, lnOccurrence, lnPos lcFieldState = SUBSTR(GETFLDSTATE(-1),2) && The first character returns deletion status lnOccurrence = 1 lnPos = AT('2', m.lcFieldState, m.lnOccurrence) DO WHILE m.lnPos > 0 IF FieldChanged(FIELD(m.lnPos)) REPLACE cLast_Updated_User WITH ; IIF(TYPE("m.goApp.cUserID") = "C", m.goApp.cUserID, getUserID()), ; tLast_Updated_Date WITH DATETIME() lnPos = 0 ENDIF IF m.lnPos > 0 lnOccurrence = m.lnOccurrence + 1 lnPos = AT('2', m.lcFieldState, m.lnOccurrence) ENDIF ENDDO ENDIF ENDFUNC *-------------------------------------------------------------------------- FUNCTION FieldChanged(tcFieldName) LOCAL llReturn DO CASE CASE ISNULL(OLDVAL(m.tcFieldName)) OR ISNULL(EVALUATE(m.tcFieldName)) llReturn = (ISNULL(OLDVAL(m.tcFieldName)) <> ISNULL(EVALUATE(m.tcFieldName)) ) OTHERWISE llReturn = (OLDVAL(m.tcFieldName) <> EVALUATE(m.tcFieldName)) ENDCASE RETURN m.llReturn ENDFUNC