Esempio n. 1
0
 /**
  * processAction
  * Update the record previously selected
  * @return unknown_type
  */
 public function processAction()
 {
     $NS = new Zend_Session_Namespace('Default');
     $request = $this->getRequest();
     $customer = $NS->customer['customer_id'];
     $this->view->title = $this->translator->translate("Ticket");
     $this->view->description = $this->translator->translate("Check the information before save again.");
     // Check if we have a POST request
     if (!$request->isPost()) {
         return $this->_helper->redirector('index');
     }
     // Get our form and validate it
     $form = $this->getForm('/tickets/process');
     // Invalid entries
     if (!$form->isValid($request->getPost())) {
         $this->view->form = $form;
         $this->view->canreply = true;
         return $this->_helper->viewRenderer('customform');
     }
     // Get the id
     $id = $this->getRequest()->getParam('ticket_id');
     $data = $request->getPost();
     $data['note'] = !empty($data['note']) ? $data['note'] : "-";
     //There is a problem with TinyMCE!
     $categoryId = !empty($data['category_id']) && is_numeric($data['category_id']) ? $data['category_id'] : null;
     if (is_numeric($id)) {
         TicketsNotes::saveIt($id, date('Y-m-d H:i:s'), $data['note'], $data['status']);
     } else {
         Tickets::saveIt(null, $customer, $data['subject'], $data['note'], $categoryId);
     }
     return $this->_helper->redirector('index', 'tickets', 'default', array('mex' => 'The task requested has been executed successfully.', 'status' => 'success'));
 }
Esempio n. 2
0
 /**
  * processAction
  * Update the record previously selected
  * @return unknown_type
  */
 public function processAction()
 {
     $redirector = Zend_Controller_Action_HelperBroker::getStaticHelper('redirector');
     $form = $this->getForm("/admin/tickets/process");
     $request = $this->getRequest();
     $this->view->title = $this->translator->translate("New Ticket");
     $this->view->description = $this->translator->translate("Here you can handle the ticket support.");
     // Create the buttons in the edit form
     $this->view->buttons = array(array("url" => "#", "label" => $this->translator->translate('Save'), "params" => array('css' => null, 'id' => 'submit')), array("url" => "/admin/tickets/list", "label" => $this->translator->translate('List'), "params" => array('css' => null, 'id' => 'submit')), array("url" => "/admin/tickets/new/", "label" => $this->translator->translate('New'), "params" => array('css' => null)));
     // Check if we have a POST request
     if (!$request->isPost()) {
         $this->_helper->redirector('list', 'tickets', 'admin');
     }
     if ($form->isValid($request->getPost())) {
         // Get the values posted
         $params = $request->getPost();
         // Get the id
         $id = $this->getRequest()->getParam('ticket_id');
         // create the ticket if not exist
         if (!is_numeric($id)) {
             $id = Tickets::saveIt(null, $params['customer_id'], $params['subject'], $params['note'], $params['category_id']);
             $redirector->gotoUrl("/admin/tickets/edit/id/{$id}#last");
         }
         $date = !empty($params['datetime']) ? Shineisp_Commons_Utilities::formatDateIn($params['datetime']) : null;
         $note = !empty($params['note']) ? $params['note'] : null;
         $status = !empty($params['status_id']) && is_numeric($params['status_id']) ? $params['status_id'] : null;
         $sendemail = !empty($params['sendemail']) && is_numeric($params['sendemail']) ? true : false;
         // Save the Ticket Note and send the email to the customer
         $ticketNote = TicketsNotes::saveIt($id, $date, $note, $status, true, null, $sendemail);
         // Update the sibling
         if (!empty($params['sibling_id']) && is_numeric($params['sibling_id'])) {
             Tickets::setSibling($id, $params['sibling_id']);
         }
         // Update the operator for the selected ticket
         if (!empty($params['user_id']) && is_numeric($params['user_id'])) {
             Tickets::setOperator($id, $params['user_id']);
         }
         // Update the ticket attaching the order
         if (!empty($params['order_id']) && is_numeric($params['order_id'])) {
             Tickets::setOrder($id, $params['order_id']);
         }
         $redirector->gotoUrl("/admin/tickets/edit/id/{$id}#last");
     } else {
         $this->view->form = $form;
         return $this->render('applicantform');
     }
 }