Anyone?
Can anyone help or give me a little direction? I am willing to do the work I just need a little direction?
The class.cron.php is what calls the functions this is done from the autocron.php file.
class Cron {
// function MailFetcher() {
// require_once(INCLUDE_DIR.'class.mailfetch.php');
// MailFetcher:(); //Fetch mail..frequency is limited by email account setting.
// }
function TicketMonitor() {
Sys:(LOG_DEBUG,'Ticket Monitor','Checking for stale tickets.');
require_once(INCLUDE_DIR.'class.ticket.php');
require_once(INCLUDE_DIR.'class.lock.php');
Ticket:(); //Make stale tickets overdue
TicketLock:(); //Remove expired locks
}
function PurgeLogs() {
Sys:();
}
function run(){ //called by outside cron NOT autocron
// Cron:();
Cron:();
cron:();
}
}
?>
Looking at the TicketMonitor() function I see the following.
Ticket:(); //Make stale tickets overdue
'I check the class.ticket.php file and find the checkOverdue() function.
function checkOverdue(){
global $cfg;
if(($hrs=$cfg->getGracePeriod())) {
$sec=$hrs*3600;
$sql='SELECT ticket_id FROM '.TICKET_TABLE.' WHERE status=\'open\' AND isoverdue=0 '.
' AND ((reopened is NULL AND duedate is NULL AND TIME_TO_SEC(TIMEDIFF(NOW(),created))>='.$sec.') '.
' OR (reopened is NOT NULL AND duedate is NULL AND TIME_TO_SEC(TIMEDIFF(NOW(),reopened))>='.$sec.') '.
' OR (duedate is NOT NULL AND duedate<NOW()) '.
') ORDER BY created LIMIT 50'; //Age upto 50 tickets at a time?
}else{ //No aging....simply check duedates.
$sql='SELECT ticket_id FROM '.TICKET_TABLE.' WHERE status=\'open\' AND isoverdue=0 '.
' AND (duedate is NOT NULL AND duedate<NOW()) ORDER BY created LIMIT 100';
}
//echo $sql;
if(($stale=db_query($sql)) && db_num_rows($stale)){
while(list($id)=db_fetch_row($stale)){
$ticket = new Ticket($id);
if($ticket->markOverdue(true))
$ticket->logActivity('Ticket Marked Overdue','Ticket flagged as overdue by the system.');
}
}
}
Now I don't see where the "send email" is called.
But there should be away to check a ticket if it has all ready been marked as overdue and still opened and send an email. During this process the last updated is checked and compared to the grace period and updated as necessary. But where and what is the function flow.
Thanks,
ZeroEffect