Page 1 of 1

How to solve this??

Posted: Wed Mar 17, 2010 1:26 am
by 8707

Code: Select all

if ($focus->column_fields['ticketstatus'] == "Closed")
{
    if ($focus->column_fields['cf_469'] =="" )
    {
        $focus->column_fields['cf_469'] = getUserFullName($current_user->id); 
        
    }
    if ($focus->column_fields['cf_629'] =="")
    {
        $focus->column_fields['cf_629'] = date('Y-m-d H:i'); 
    }
}
elseif ($focus->column_fields['ticketstatus'] == "Resolved")
{
    if ($focus->column_fields['cf_469'] =="")
    {
        $focus->column_fields['cf_469'] = getUserFullName($current_user->id); 
    }
    if ($focus->column_fields['cf_629'] =="")
    {
        $focus->column_fields['cf_629'] = date('Y-m-d H:i'); 
    }
}
else 
{
    $focus->column_fields['cf_629'] = ""; 
    $focus->column_fields['cf_469'] = ""; 
    $focus->column_fields['cf_630'] = "";
}
Hi all,

When status = resolved, cf_469 will capture current username and cf_629 will capture current date/time. But when status change to "closed", cf_469 and cf_629 is not empty, so it will not capture the current username and date.

So, i want to ask that how to automatic capture the username and date when status change from resolve to closed?

Re: How to solve this??

Posted: Wed Mar 17, 2010 8:26 pm
by JakeJ
Assuming that data is all in your database (mysql?), you might be better off doing it with a trigger. Then, when a status is changed, the trigger can capture that info and time stamp it.

Honestly, it's not really clear what you're looking for but that's the best I can do under the circumstances.