/** * Callback function for the 'update_status' event * @param xhelpTicket $ticket Ticket that was modified * @param xhelpStatus $oldstatus Original ticket status * @param xhelpStatus $newstatus New ticket status * @return bool True on success, false on error * @access public */ function update_status($ticket, $oldstatus, $newstatus) { global $xoopsUser; $logMessage =& $this->_hLog->create(); $logMessage->setVar('uid', $xoopsUser->getVar('uid')); $logMessage->setVar('ticketid', $ticket->getVar('id')); $logMessage->setVar('lastUpdated', $ticket->getVar('lastUpdated')); $logMessage->setVar('posted', $ticket->getVar('posted')); $logMessage->setVar('action', sprintf(_XHELP_LOG_UPDATE_STATUS, $oldstatus->getVar('description'), $newstatus->getVar('description'))); return $this->_hLog->insert($logMessage, true); }
/** * Event: update_status * Triggered after a ticket status change * Also See: batch_status, close_ticket, reopen_ticket * @param xhelpTicket $ticket The ticket that was modified * @param xhelpStatus $oldstatus The previous ticket status * @param xhelpStatus $newstatus The new ticket status */ function update_status($ticket, $oldstatus, $newstatus) { //notify staff department of change //notify submitter global $xoopsUser; $hDepartments =& xhelpGetHandler('department'); $tags = array(); $tags['TICKET_ID'] = $ticket->getVar('id'); $tags['TICKET_URL'] = XHELP_BASE_URL . '/ticket.php?id=' . $ticket->getVar('id'); // Added by marcan to get the ticket's subject available in the mail template $tags['TICKET_SUBJECT'] = $this->_ts->stripslashesGPC($ticket->getVar('subject', 'n')); // End of addition by marcan $tags['TICKET_OLD_STATUS'] = $oldstatus->getVar('description'); $tags['TICKET_OLD_STATE'] = xhelpGetState($oldstatus->getVar('state')); $tags['TICKET_STATUS'] = $newstatus->getVar('description'); $tags['TICKET_STATE'] = xhelpGetState($newstatus->getVar('state')); $tags['TICKET_UPDATEDBY'] = $xoopsUser->getVar('uname'); $tags['TICKET_DEPARTMENT'] = $this->_ts->stripslashesGPC($hDepartments->getNameById($ticket->getVar('department'))); $settings =& $this->_hNotification->get(XHELP_NOTIF_EDITSTATUS); $staff_setting = $settings->getVar('staff_setting'); $user_setting = $settings->getVar('user_setting'); if ($email_tpl = $this->_getEmailTpl('dept', 'changed_status', $this->_module, $template_id)) { $sendTo =& $this->_getSubscribedStaff($ticket, $email_tpl['bit_value'], $settings); $success = $this->_sendEvents($email_tpl, $sendTo, $tags); } if ($email_tpl = $this->_getEmailTpl('ticket', 'changed_this_status', $this->_module, $template_id)) { //$sendTo = $this->_getEmail($ticket->getVar('uid')); $sendTo = $this->_getSubscribedUsers($ticket->getVar('id')); $success = $this->_sendEvents($email_tpl, $sendTo, $tags); } }