Beispiel #1
0
 /**
  * @param AW_Helpdesk3_Model_Ticket $ticket
  *
  * @return bool
  */
 public function isEventHappened($ticket)
 {
     if (!$ticket->isObjectNew() && $ticket->getOrigData('department_agent_id') != $ticket->getDepartmentAgentId()) {
         $this->setEventData(array('from' => $ticket->getOrigData('department_agent_id'), 'to' => $ticket->getDepartmentAgentId()));
         return true;
     }
     return false;
 }
Beispiel #2
0
 /**
  * @param AW_Helpdesk3_Model_Ticket $ticket
  *
  * @return false
  */
 public function isEventHappened($ticket)
 {
     if (!$ticket->isObjectNew() && $ticket->getOrigData('priority') != $ticket->getPriority()) {
         $this->setEventData(array('from' => $ticket->getOrigData('priority'), 'to' => $ticket->getPriority()));
         return true;
     }
     return false;
 }
 /**
  * @param AW_Helpdesk3_Model_Ticket $ticket
  *
  * @return string
  */
 public function getStyleForTicketPriority(AW_Helpdesk3_Model_Ticket $ticket)
 {
     if ($this->_priorityCacheData === null) {
         /** @var AW_Helpdesk3_Model_Resource_Ticket_Priority_Collection $collection */
         $collection = Mage::getModel('aw_hdu3/ticket_priority')->getCollection()->addNotDeletedFilter();
         foreach ($collection->getData() as $value) {
             $this->_priorityCacheData[$value['id']] = $value;
         }
     }
     $priorityId = (int) $ticket->getPriority();
     if (!array_key_exists($priorityId, $this->_priorityCacheData)) {
         return '';
     }
     $style = '';
     if (!empty($this->_priorityCacheData[$priorityId]['background_color'])) {
         $bgColor = $this->_priorityCacheData[$priorityId]['background_color'];
         $bgColor = strpos($bgColor, '#') === FALSE ? '#' . $bgColor : $bgColor;
         $style .= "background-color:{$bgColor};";
     }
     if (!empty($this->_priorityCacheData[$priorityId]['font_color'])) {
         $textColor = $this->_priorityCacheData[$priorityId]['font_color'];
         $textColor = strpos($textColor, '#') === FALSE ? '#' . $textColor : $textColor;
         $style .= "color:{$textColor};";
     }
     return $style;
 }
Beispiel #4
0
 /**
  * @param AW_Helpdesk3_Model_Ticket $ticket
  *
  * @return int
  */
 public function getTicketRepliesCount(AW_Helpdesk3_Model_Ticket $ticket)
 {
     $collection = Mage::getModel('aw_hdu3/ticket_message')->getCollection();
     $collection->addFilterByTicketId($ticket->getId());
     return max($collection->getSize() - 1, 0);
 }
Beispiel #5
0
 /**
  * @param AW_Helpdesk3_Model_Ticket $ticket
  *
  * @return string
  */
 protected function _getCustomerExternalLinkHtml($ticket)
 {
     if (Mage::helper('aw_hdu3/config')->isAllowExternalViewForTickets($ticket->getStoreId())) {
         return Mage::helper('aw_hdu3')->__('You can view the ticket and reply from web interface from %s here %s.', '<a href="' . Mage::helper('aw_hdu3/ticket')->getExternalViewUrl($ticket) . '">', '</a>');
     }
     return '';
 }
Beispiel #6
0
 /**
  * @param AW_Helpdesk3_Model_Ticket $ticket
  *
  * @return string
  */
 public function getFirstTicketMessage(AW_Helpdesk3_Model_Ticket $ticket)
 {
     $collection = Mage::getModel('aw_hdu3/ticket_message')->getCollection();
     $collection->addFilterByTicketId($ticket->getId());
     $collection->addOrder('id', Varien_Data_Collection_Db::SORT_ORDER_ASC);
     return strip_tags($collection->getFirstItem()->getContent());
 }