function onOpenLimit($sendNotice = true) { global $cfg; //Log the limit notice as a warning for admin. $msg = sprintf('Max open tickets (%d) reached for %s ', $cfg->getMaxOpenTickets(), $this->getEmail()); sys::log(LOG_WARNING, 'Max. Open Tickets Limit (' . $this->getEmail() . ')', $msg); if (!$sendNotice || !$cfg->sendOverlimitNotice()) { return true; } //Send notice to user. $dept = $this->getDept(); if (!$dept || !($tpl = $dept->getTemplate())) { $tpl = $cfg->getDefaultTemplate(); } if (!$dept || !($email = $dept->getAutoRespEmail())) { $email = $cfg->getDefaultEmail(); } if ($tpl && ($msg = $tpl->getOverlimitMsgTemplate()) && $email) { $body = $this->replaceTemplateVars($msg['body']); $subj = $this->replaceTemplateVars($msg['subj']); $body = str_replace('%signature', $dept && $dept->isPublic() ? $dept->getSignature() : '', $body); $email->send($this->getEmail(), $subj, $body); } $client = $this->getClient(); //Alert admin...this might be spammy (no option to disable)...but it is helpful..I think. $msg = 'Max. open tickets reached for ' . $this->getEmail() . "\n" . 'Open ticket: ' . $client->getNumOpenTickets() . "\n" . 'Max Allowed: ' . $cfg->getMaxOpenTickets() . "\n\nNotice sent to the user."; Sys::alertAdmin('Overlimit Notice', $msg); return true; }