Description
The Before audit log event is executed before a record is added to the log.
Syntax
OnAuditLog(action,params,table,keys,newvalues,oldvalues)
Arguments
action
the occured action.
params
params[0]: the user's IP address, params[1]: username.
table
the modified table.
keys
an array of key column values pointing to the current record.
newvalues
an array of field values added to the database. You can modify any of those fields, see Example 2.
oldvalues
an array of the previous field values. Applies to the Edit and Delete functions.
Return value
True: save the action in the log.
False: do not save the action in the log.
Applies to pages
All pages. Insert your code into the Before audit log event.
Example 1
If you do not want to record the actions done by the admin in the audit log, you can use the following code:
if params(1)="admin" then
OnAuditLog = false
Exit Function
end if
OnAuditLog = true
Example 2
Replace ID with the actual value from the lookup table and save it in the audit log.
if table="cars" then
newvalues("makeid") = DB_DBLookup(DB_PrepareSQL_1("select name from makes where id=:1", newvalues("makeid") ) )
end if
See also: