PluginProbe
Fluent Support – Helpdesk & Customer Support Ticket System / 1.5.3
Fluent Support – Helpdesk & Customer Support Ticket System v1.5.3
2.4.0 2.3.2 2.3.1 2.3.0 2.2.1 2.2.0 trunk 1.10.0 1.10.1 1.10.2 1.10.3 1.10.4 1.10.5 1.4.0 1.4.1 1.4.2 1.4.5 1.4.6 1.4.7 1.5.0 1.5.1 1.5.2 1.5.3 1.5.4 1.5.5 All 68 releases
fluent-support / app / Services / Tickets / TicketService.php

TicketService.php in Fluent Support – Helpdesk & Customer Support Ticket System 1.5.3, at app/Services/Tickets/TicketService.php

68 lines 2.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace FluentSupport\App\Services\Tickets;
4
5 use FluentSupport\App\Models\Conversation;
6
7 class TicketService
8 {
9 public function close($ticket, $person, $internalNote = '')
10 {
11 if ($ticket->status != 'closed') {
12 $ticket->status = 'closed';
13 $ticket->resolved_at = current_time('mysql');
14 $ticket->closed_by = $person->id;
15 $ticket->total_close_time = current_time('timestamp') - strtotime($ticket->created_at);
16 $ticket->save();
17 do_action('fluent_support/ticket_closed', $ticket, $person);
18 do_action('fluent_support/ticket_closed_by_' . $person->person_type, $ticket, $person);
19
20 if(!$internalNote) {
21 $internalNote = __('Ticket has been closed', 'fluent-support');
22 }
23
24 Conversation::create([
25 'ticket_id' => $ticket->id,
26 'person_id' => $person->id,
27 'conversation_type' => 'internal_info',
28 'content' => $internalNote
29 ]);
30
31 }
32
33 return $ticket;
34 }
35
36 public function reopen($ticket, $person)
37 {
38 if ($ticket->status == 'closed') {
39 $ticket->status = 'active';
40 $ticket->waiting_since = current_time('mysql');
41 $ticket->save();
42 do_action('fluent_support/ticket_reopen', $ticket, $person);
43 do_action('fluent_support/ticket_reopen_by_' . $person->person_type, $ticket, $person);
44 Conversation::create([
45 'ticket_id' => $ticket->id,
46 'person_id' => $person->id,
47 'conversation_type' => 'internal_info',
48 'content' => __('Ticket has been reopened', 'fluent-support')
49 ]);
50 }
51
52 return $person;
53 }
54
55 public function onAgentChange($ticket, $person){
56 Conversation::create([
57 'ticket_id' => $ticket->id,
58 'person_id' => $person->id,
59 'conversation_type' => 'internal_info',
60 'content' => $ticket->agent->full_name !== $person->full_name ?
61 __($person->full_name .' assign '. $ticket->agent->full_name .' in this ticket' , 'fluent-support') :
62 __($person->full_name. ' assign this ticket to self', 'fluent-support')
63 ]);
64
65 return $person;
66 }
67 }
68