Edit updateLastVisit() function
Hi Jos,
Please replace the existing updateLastVisit() function with this new one below:
// MOD Last Visit by client and staff, Added by Masino Sinaga, Oct 19, 2009
function updateLastVisit($ticketID, $staffId=0) {
if ($staffId==0) {
if(db_query('UPDATE '.TICKET_VISIT_TABLE.'
SET lastvisitclient=NOW()
WHERE ticketID='.db_input($ticketID)) && db_affected_rows()){
return true;
} else {
$sqlinsert = 'REPLACE INTO '.TICKET_VISIT_TABLE.'
SET ticketID = '.db_input($ticketID).',
lastvisitclient = NOW()';
if(db_query($sqlinsert) && ($msgid=db_insert_id())) {
return true;
}
}
} else {
if(db_query('UPDATE '.TICKET_VISIT_TABLE.'
SET lastvisitstaff=NOW(), staff_id='.db_input($staffId).'
WHERE ticketID='.db_input($ticketID)) && db_affected_rows()){
return true;
} else {
$sqlinsert = 'REPLACE INTO '.TICKET_VISIT_TABLE.'
SET ticketID='.db_input($ticketID).',
lastvisitstaff=NOW(),
staff_id='.db_input($staffId).'';
if(db_query($sqlinsert) && ($msgid=db_insert_id())) {
return true;
}
}
}
return false;
}
I also have modified it on my original post. Hope it helps you.
Sincerely,
Masino Sinaga