Пример #1
0
 private function updateTicket($request)
 {
     $updated = false;
     $ticket = Ticket::find($request->get('ticket_id'));
     $status_id = $request->get('status_id');
     $priority_id = $request->get('priority_id');
     $ticket->status_id = $status_id;
     $ticket->priority_id = $priority_id;
     $updated = $ticket->isDirty();
     if ($updated) {
         $ticket->save();
         $history = new TicketHistory();
         $last_history = TicketHistory::where('ticket_id', $ticket->id)->orderBy("created_at", "DESC")->first();
         $history->previous_id = count($last_history) ? $last_history->id : NULL;
         $history->changer_id = Auth::user()->active_contact->id;
         $history->ticket_id = $ticket->id;
         $history->title = $ticket->title;
         $history->post = $ticket->post;
         $history->creator_id = $ticket->creator_id;
         $history->assignee_id = $ticket->assignee_id;
         $history->status_id = $ticket->status_id;
         $history->priority_id = $ticket->priority_id;
         $history->division_id = $ticket->division_id;
         $history->equipment_id = $ticket->equipment_id;
         $history->company_id = $ticket->company_id;
         $history->contact_id = $ticket->contact_id;
         $history->level_id = $ticket->level_id;
         $history->job_type_id = $ticket->job_type_id;
         $history->emails = $ticket->emails;
         $history->save();
     }
     return $updated;
 }
 /**
  * Lists all Ticket models.
  * @return mixed
  */
 public function actionIndex()
 {
     if (\Yii::$app->user->isGuest) {
         return $this->redirect('/site/denied/');
     }
     $user = \Yii::$app->user->identity;
     if (!$user->admin && count($user->organisations) == 0) {
         return $this->redirect('/site/denied/');
     }
     $dataProvider = new ActiveDataProvider(['query' => Ticket::find()]);
     return $this->render('index', ['dataProvider' => $dataProvider]);
 }
Пример #3
0
 protected function postUpdateProgress($ticketId, $progressId)
 {
     $ticket = Ticket::find($ticketId);
     //Loop through so that if any steps have been skipped we insert them as well.
     for ($i = $ticket->state_id + 1; $i <= (int) $progressId; $i++) {
         Progress::create(['state_id' => $i, 'ticket_id' => $ticketId, 'actioned_by' => Auth::user()->id]);
     }
     //Update the state on the ticket table
     $ticket->state_id = $progressId;
     $ticket->save();
     echo json_encode(['success' => 'true', 'message' => 'Progress updated']);
 }
Пример #4
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Ticket::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $this->load($params);
     if (!$this->validate()) {
         // uncomment the following line if you do not want to return any records when validation fails
         // $query->where('0=1');
         return $dataProvider;
     }
     $query->andFilterWhere(['idTicket' => $this->idTicket, 'MotivoTicket_idMotivoTicket' => $this->MotivoTicket_idMotivoTicket, 'RRHH_idRRHH' => $this->RRHH_idRRHH, 'tiporrhh_idTipoRRHH' => $this->tiporrhh_idTipoRRHH, 'Transporte_idTransporte' => $this->Transporte_idTransporte, 'Transporte_TIpoTransporte_idTIpoTransporte' => $this->Transporte_TIpoTransporte_idTIpoTransporte, 'Transporte_RRHH_idRRHH' => $this->Transporte_RRHH_idRRHH, 'Transporte_tiporrhh_idTipoRRHH' => $this->Transporte_tiporrhh_idTipoRRHH, 'Fecha' => $this->Fecha, 'Hora' => $this->Hora]);
     $query->andFilterWhere(['like', 'Descripcion', $this->Descripcion]);
     return $dataProvider;
 }
Пример #5
0
 public function repay(Request $request)
 {
     $input = $request->all();
     $ticketId = $input['ticket_id'];
     $ticket = Ticket::find($ticketId);
     if ($ticket == null) {
         Session::flash('message', 'Este ticket no existe');
         return redirect('salesman/devolutions');
     }
     return redirect('salesman/devolutions/new/' . $ticketId);
 }
Пример #6
0
 public static function sendTicketUpdate($id)
 {
     $ticket = Ticket::find($id);
     self::setSubject("Ticket Update | Ticket #" . $ticket->id . " | " . $ticket->anchestor(0)->changer->person->name());
     self::$view = "emails/ticket_update";
     self::$data['title'] = "Ticket #" . $ticket->id . " details changed by " . $ticket->anchestor(0)->changer->person->name();
     self::$data['ticket'] = $ticket;
     self::add('to', $ticket->assignee->email);
     $additional_emails = explode(",", $ticket->emails);
     foreach ($additional_emails as $email) {
         self::add('to', $email);
     }
     self::send();
     Activity::log("Email Ticket Update Send", self::$data);
 }