* @package WB * @subpackage ITS */ WBClass::load('WBEvent_Handler' , 'WBEvent_Handler_Mail' , 'patI18n'); /** * WBEvent_Handler_ITS_MailStaff * * Send e-mail to assigned staff * * @version 1.0.0 * @package Wombat * @subpackage ITS */ class WBEvent_Handler_ITS_MailAssignee extends WBEvent_Handler_Mail { /** * Handler config * * For parameter list see parent class, additional parameter: * - "skipsame" Don't send e-mail if editing user is the same as recipient * * @see WBEvent_Handler_Mail * @var array */ protected $config = array( 'from' => '', 'fromindex' => '', 'rcpt' => '', 'rcptindex' => 'email', 'addrcpt' => '', 'lang' => '', 'langindex' => '', 'tmpl' => 'email', 'skipsame' => '1' ); /** * User object * * @var WBUser */ private $user; /** * 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; } // don't send an e-mail if ticket was saved by myself if (!empty($this->config['skipsame']) && 0 < intval($this->config['skipsame']) && $data['uid'] == $data['assigneduid']) { return true; } $this->user = WBClass::create('WBUser'); if (!$this->user->load($data['assigneduid'])) { return false; } $user = $this->user->getData(); $this->config['rcpt'] = $user['email']; $this->config['lang'] = $user['lang']; return parent::process($e); } }