How to solve this??

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
8707
Forum Newbie
Posts: 11
Joined: Thu Jan 07, 2010 7:41 pm

How to solve this??

Post 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?
JakeJ
Forum Regular
Posts: 675
Joined: Thu Dec 10, 2009 6:27 pm

Re: How to solve this??

Post 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.
Post Reply