/** * @param string $data * @param AW_Helpdesk3_Model_Ticket_History $history * * @return $this */ public function process($data, $history) { $notification = $history->getTicket()->getDepartment()->getEmailNotification(); //if current agent = getPrimaryAgent no email if (Mage::helper('aw_hdu3/ticket')->getCurrentDepartmentAgent()->getId() != $history->getTicket()->getDepartment()->getPrimaryAgent()->getId()) { $notification->sendToPrimaryAgentNotificationReassign($history); } //if current agent = getDepartmentAgentId no email if (Mage::helper('aw_hdu3/ticket')->getCurrentDepartmentAgent()->getId() != $data['to']) { $notification->sendToNewAssigneeNotificationReassign($history); } $history->getTicket()->setIsAgentChanged(true); return $this; }
/** * @param AW_Helpdesk3_Model_Ticket_History $event * * @return string|null */ protected function _getContentByEvent(AW_Helpdesk3_Model_Ticket_History $event) { $content = null; if ($event->getEventType() == AW_Helpdesk3_Model_Ticket_History_Event_Message::TYPE) { $eventData = $event->getEventData(); $content = $eventData['content']; if (null === $content && $event->getAttachmentCollection()->getSize() > 0) { $content = ''; } if (!$event->getData('initiator_department_agent_id')) { $content = nl2br($this->escapeHtml($content)); } //parse UID to link $url = $this->getUrl('helpdesk/customer/viewTicket', array('id' => '{id}')); $linkTemplate = "<a href='{$url}'>{uid}</a>"; $content = Mage::helper('aw_hdu3/ticket')->replaceUidToLink($content, $linkTemplate, $event->getTicket()->getCustomerEmail()); } return $content; }
/** * @param AW_Helpdesk3_Model_Ticket_History $history * * @return $this */ public function saveAdditionalData($history) { $write = $this->_getWriteAdapter(); $write->insert($this->getTable('aw_hdu3/ticket_history_additional'), array('ticket_history_id' => $history->getId(), 'department_agent_id' => $history->getTicket()->getDepartmentAgentId(), 'department_id' => $history->getTicket()->getDepartmentId(), 'status' => $history->getTicket()->getStatus(), 'priority' => $history->getTicket()->getPriority())); return $this; }
/** * @param string $template * @param AW_Helpdesk3_Model_Ticket_History $history * * @return $this */ protected function _sendNotificationToCustomer($template, $history) { $ticket = $history->getTicket(); $message = $history->getEventData(); $storeId = $ticket->getStoreId(); $storeLocaleCode = Mage::getStoreConfig('general/locale/code', $storeId); Mage::app()->getTranslator()->setLocale($storeLocaleCode); Mage::app()->getTranslator()->init('frontend', true); return $this->_send($template, $ticket->getCustomerEmail(), $ticket->getCustomerName(), $history->getAttachmentCollection()->getItems(), $ticket, array_merge($this->getTicketEmailVariables($ticket), array('message' => isset($message['content']) ? $message['content'] : '', 'external_link_html' => $this->_getCustomerExternalLinkHtml($ticket), 'allow_rate' => (bool) Mage::helper('aw_hdu3/config')->isAllowRate(), 'external_link_rate_1' => $this->_getRateExternalLinkHtml($ticket, 1), 'external_link_rate_2' => $this->_getRateExternalLinkHtml($ticket, 2), 'external_link_rate_3' => $this->_getRateExternalLinkHtml($ticket, 3), 'external_link_rate_4' => $this->_getRateExternalLinkHtml($ticket, 4), 'external_link_rate_5' => $this->_getRateExternalLinkHtml($ticket, 5), 'is_status_changed' => (bool) $ticket->getIsStatusChanged()))); }
/** * @param string $data * @param AW_Helpdesk3_Model_Ticket_History $history * * @return $this */ public function process($data, $history) { $history->getTicket()->setIsDepartmentChanged(true); return $this; }