/** * @param Mirasvit_Helpdesk_Model_Email $email * * @return bool|Mirasvit_Helpdesk_Model_Ticket */ public function processEmail($email) { // $code = false; // if (Mage::getSingleton('helpdesk/config')->getNotificationIsShowCode()) { //get object by code from subject $code = Mage::helper('helpdesk/string')->getTicketCodeFromSubject($email->getSubject()); // } if (!$code) { $code = Mage::helper('helpdesk/string')->getTicketCodeFromBody($email->getBody()); } if (strpos($code, 'RMA') === 0 && $this->getConfig()->isActiveRma()) { return Mage::helper('rma/process')->processEmail($email, $code); } else { return Mage::helper('helpdesk/process')->processEmail($email, $code); } }
/** * @param Mirasvit_Helpdesk_Model_Email $email * * @return bool */ public function checkEmail($email) { $subject = ''; switch ($this->getScope()) { case 'headers': $subject = $email->getHeaders(); break; case 'subject': $subject = $email->getSubject(); break; case 'body': $subject = $email->getBody(); break; } $matches = array(); preg_match($this->getPattern(), $subject, $matches); if (count($matches) > 0) { return true; } else { return false; } }