* @package WB * @subpackage ITS */ WBClass::load('WBEvent_Handler' , 'WBEvent_Handler_Mail' , 'patI18n'); /** * WBEvent_Handler_ITS_MailRemind * * Send e-mail to assigned staff * * @version 1.0.0 * @package Wombat * @subpackage ITS */ class WBEvent_Handler_ITS_MailRemind extends WBEvent_Handler_Mail { /** * Handler config * * For parameter list see parent class, additional parameter: * * @see WBEvent_Handler_Mail * @var array */ protected $config = array( 'from' => '', 'fromindex' => '', 'rcpt' => '', 'rcptindex' => 'email', 'addrcpt' => '', 'lang' => '', 'langindex' => '', 'tmpl' => 'email', 'namespace' => '', 'limit' => 10 ); /** * User object * * @var WBUser */ private $user; /** * Ticket Lister * @var WBITS_TicketList */ private $ticketList; /** * Process event * * Prepare to send e-mail to assignee. Use parent class to actually send e-mail * * @param WBEvent $e * @return bool true to continue, false to stop processing * @throws Exception in case of error */ public function process(WBEvent $e) { $data = $e->get(); $e->set('status_display', patI18n::dgettext('wombat', 'its_status_' . $data['status'])); // check for assignee if (!isset($data['assigneduid']) || empty($data['assigneduid']) || 0 == $data['assigneduid']) { return true; } $this->user = WBClass::create('WBUser'); if (!$this->user->load($data['assigneduid'])) { return false; } $this->ticketList = WBClass::create('WBITS_TicketList'); $this->ticketList->useNamespace($this->config['namespace']); $clause = array(); $clause[] = array( 'field' => 'assigneduid', 'value' => $data['assigneduid'] ); $clause[] = array( 'field' => 'status', 'relation' => 'in', 'value' => array( 'assigned', 'waitforstaff', 'waitforcustomer' ) ); $opt = array( 'limit' => intval($this->config['limit']) ); $pager = $this->ticketList->getPager($clause, $options); $info = $pager->browse(); foreach ($info as $k => $v) { $e->set('pager_' . $k, $v); } if (0 >= $info['total']) { return true; } $list = $pager->get(); $e->set('tickets', $list); $user = $this->user->getData(); foreach ($user as $k => $v) { $e->set('user_' . $k, $v); } $this->config['rcpt'] = $user['email']; $this->config['lang'] = $user['lang']; return parent::process($e); } }