コード例 #1
0
ファイル: TicketsController.php プロジェクト: moay/shineisp
 /**
  * deleteNoteAction
  * Delete the ticket note
  * @return unknown_type
  */
 public function deletenoteAction()
 {
     $files = new Files();
     $noteId = $this->getRequest()->getParam('id');
     if (is_numeric($noteId)) {
         $ticketNote = TicketsNotes::getAllInfo($noteId);
         if (!empty($ticketNote[0])) {
             $ticketid = $ticketNote[0]['ticket_id'];
             TicketsNotes::deleteNote($noteId);
             $this->_helper->redirector('edit', 'tickets', 'admin', array('id' => $ticketid, 'mex' => 'Note has been deleted', 'status' => 'success'));
         }
     }
     $this->_helper->redirector('edit', 'tickets', 'admin', array('id' => $ticketid, 'mex' => 'Error on deleting the customer note', 'status' => 'danger'));
 }
コード例 #2
0
ファイル: Tickets.php プロジェクト: kokkez/shineisp
 /**
  * Send ticket by email
  * 
  * @param integer $id
  * @param boolean $isTicket
  * @param string $attachment
  */
 public static function send($id, $isTicket = true, $attachment = null)
 {
     $isp = Isp::getActiveISP();
     $placeholders = array();
     $customer_url = "";
     $admin_url = "";
     if ($isTicket) {
         $ticket = self::getAllInfo($id, null, true);
         $customer = $ticket[0]['Customers'];
         $operator = AdminUser::getAllInfo($ticket[0]['user_id']);
     } else {
         $ticket = TicketsNotes::getAllInfo($id);
         $customer = $ticket[0]['Tickets']['Customers'];
         $operator = AdminUser::getAllInfo($ticket[0]['Tickets']['user_id']);
     }
     if (!empty($ticket[0])) {
         if ($isp) {
             $ispmail = explode("@", $isp['email']);
             $retval = Shineisp_Commons_Utilities::getEmailTemplate('ticket_message');
             if ($retval) {
                 $s = $retval['subject'];
                 $ticketid = $ticket[0]['ticket_id'];
                 $in_reply_to = md5($ticketid);
                 $ispmail = "noreply@" . $ispmail[1];
                 $rec = Fastlinks::findlinks($ticketid, $customer['customer_id'], 'tickets');
                 if (!empty($rec[0]['code'])) {
                     $customer_url = "http://" . $_SERVER['HTTP_HOST'] . "/index/link/id/" . $rec[0]['code'];
                     $admin_url = "http://" . $_SERVER['HTTP_HOST'] . "/admin/login/link/id/" . $rec[0]['code'];
                 }
                 // Check the attachments
                 if (!empty($attachment) && file_exists(PUBLIC_PATH . $attachment)) {
                     $attachment = PUBLIC_PATH . $attachment;
                 }
                 if ($isTicket) {
                     $placeholders['subject'] = $ticket[0]['subject'];
                     $placeholders['description'] = $ticket[0]['description'];
                     $placeholders['date_open'] = Shineisp_Commons_Utilities::formatDateOut($ticket[0]['date_open']);
                     $placeholders['status'] = $ticket[0]['Statuses']['status'];
                 } else {
                     $placeholders['subject'] = $ticket[0]['Tickets']['subject'];
                     $placeholders['description'] = $ticket[0]['note'];
                     $placeholders['date_open'] = Shineisp_Commons_Utilities::formatDateOut($ticket[0]['Tickets']['date_open']);
                     $placeholders['status'] = $ticket[0]['Tickets']['Statuses']['status'];
                 }
                 $placeholders['customer'] = $customer['firstname'] . " " . $customer['lastname'] . " " . $customer['company'];
                 $placeholders['link'] = $customer_url;
                 $placeholders['company'] = $isp['company'];
                 $placeholders['issue_number'] = $ticketid;
                 $placeholders['operator'] = $operator['lastname'] . " " . $operator['firstname'];
                 // Send a message to the customer
                 Shineisp_Commons_Utilities::sendEmailTemplate(Contacts::getEmails($customer['customer_id']), 'ticket_message', $placeholders, $in_reply_to, $attachment, null, $isp, $customer['language_id']);
                 // Update the link for the administrator email
                 $placeholders['link'] = $admin_url . "/keypass/" . Shineisp_Commons_Hasher::hash_string($operator['email']);
                 Shineisp_Commons_Utilities::sendEmailTemplate($isp['email'], 'ticket_message', $placeholders, $in_reply_to, $attachment, null, $isp);
                 return true;
             }
         }
     }
     return false;
 }