| Posted: 10/17/2005, 1:56 PM |
|
A strange problem (or perhaps I can't see the wood for the trees)...
I'm trying to implement set 4 fields when a record is edited and/or created as follows:
Created_User_ID
Created_Time
Modified_User_ID
Modified_Time
I thought I would be really clever and put the following code in common.php:
//FransCustomCode
function setCreatedInfo( &$form) {
$userID = CCGetSession(UserID);
$timeNow = date("Y-m-d H:i:s");
$form->Created_User_ID->SetValue($userID);
$form->Created_Time->SetValue($timeNow);
$form->Modified_User_ID->SetValue($userID);
$form->Modified_Time->SetValue($timeNow);
return 1;
}
function setModifiedInfo( &$form) {
$userID = CCGetSession(UserID);
$timeNow = date("Y-m-d H:i:s");
$form->Modified_User_ID->SetValue($userID);
$form->Modified_Time->SetValue($timeNow);
return 1;
}
//End FransCustomCode
I gave a "contacts_maint_edit" page which is an add/edit form for contacts and put in the following code:
Before Insert:
setCreatedInfo($contacts);
and before Update:
setModifiedInfo($contacts);
but to no avail.
I tried verifying the code by changing the before update code to:
$contacts->Modified_Time->SetValue(date("Y-m-d H:i:s"));
$contacts->Modified_User_ID->SetValue(CCGetUserID());
and neither field values are changed.
Can someone show me the light?
|