From 1f7efd408661defd90596c2b442df7bc85d3a46e Mon Sep 17 00:00:00 2001 From: Ivan Diaz Date: Sun, 23 Oct 2016 15:31:48 -0300 Subject: [PATCH 1/2] Ivan - Add all ticket events to Ticketevent datastore [skip ci] --- server/models/Ticketevent.php | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/server/models/Ticketevent.php b/server/models/Ticketevent.php index 81bab0c0..598eadb3 100644 --- a/server/models/Ticketevent.php +++ b/server/models/Ticketevent.php @@ -5,20 +5,21 @@ class Ticketevent extends DataStore { const COMMENT = 'COMMENT'; const ASSIGN = 'ASSIGN'; - const UNASSIGN = 'UNASSIGN'; + const UN_ASSIGN = 'UN_ASSIGN'; const CLOSE = 'CLOSE'; - const REOPEN = 'REOPEN'; + const RE_OPEN = 'RE_OPEN'; const DEPARTMENT_CHANGED = 'DEPARTMENT_CHANGED'; const PRIORITY_CHANGED = 'PRIORITY_CHANGED'; private static function getEventTypes() { return [ 'COMMENT', - 'UNASSIGN', + 'ASSIGN', + 'UN_ASSIGN', 'CLOSE', - 'REOPEN', + 'RE_OPEN', 'DEPARTMENT_CHANGED', - 'PRIORITY_CHANGED', + 'PRIORITY_CHANGED' ]; } From 66281df491a3f2f5b2f8a6aa136309462e0c9b11 Mon Sep 17 00:00:00 2001 From: AntonyAntonio Date: Sat, 19 Nov 2016 22:54:08 -0300 Subject: [PATCH 2/2] Guillermo - staff-get-all-tickets[skip ci] --- server/controllers/staff/assign-ticket.php | 9 ++++++++- server/controllers/staff/un-assign-ticket.php | 7 +++++++ server/controllers/ticket/change-department.php | 7 +++++++ server/controllers/ticket/change-priority.php | 7 +++++++ server/controllers/ticket/close.php | 7 +++++++ server/controllers/ticket/re-open.php | 6 ++++++ 6 files changed, 42 insertions(+), 1 deletion(-) diff --git a/server/controllers/staff/assign-ticket.php b/server/controllers/staff/assign-ticket.php index 30e3f37d..b92d3364 100644 --- a/server/controllers/staff/assign-ticket.php +++ b/server/controllers/staff/assign-ticket.php @@ -35,9 +35,16 @@ class AssignStaffController extends Controller { $this->user->sharedTicketList->add($this->ticket); $this->ticket->owner = $this->user; $this->ticket->unread = true; + $event = Ticketevent::getEvent(Ticketevent::ASSIGN); + $event->setProperties(array( + 'authorStaff' => Controller::getLoggedUser(), + 'date' => Date::getCurrentDate() + )); + $this->ticket->addEvent($event); + $this->ticket->store(); $this->user->store(); - + Response::respondSuccess(); } diff --git a/server/controllers/staff/un-assign-ticket.php b/server/controllers/staff/un-assign-ticket.php index 4454ef06..8179537e 100644 --- a/server/controllers/staff/un-assign-ticket.php +++ b/server/controllers/staff/un-assign-ticket.php @@ -27,6 +27,13 @@ class UnAssignStaffController extends Controller { $user->store(); $ticket->owner = null; $ticket->unread = true; + $event = Ticketevent::getEvent(Ticketevent::UN_ASSIGN); + $event->setProperties(array( + 'authorStaff' => Controller::getLoggedUser(), + 'date' => Date::getCurrentDate() + )); + + $ticket->addEvent($event); $ticket->store(); Response::respondSuccess(); } else { diff --git a/server/controllers/ticket/change-department.php b/server/controllers/ticket/change-department.php index bb916826..2891482b 100644 --- a/server/controllers/ticket/change-department.php +++ b/server/controllers/ticket/change-department.php @@ -33,6 +33,13 @@ class ChangeDepartmentController extends Controller { return; } + $event = Ticketevent::getEvent(Ticketevent::DEPARTMENT_CHANGED); + $event->setProperties(array( + 'authorStaff' => Controller::getLoggedUser(), + 'content' => $department->name, + 'date' => Date::getCurrentDate() + )); + $ticket->addEvent($event); $ticket->department = $department; $ticket->unread = true; $ticket->store(); diff --git a/server/controllers/ticket/change-priority.php b/server/controllers/ticket/change-priority.php index 49d4e3a5..24f9271e 100644 --- a/server/controllers/ticket/change-priority.php +++ b/server/controllers/ticket/change-priority.php @@ -29,6 +29,13 @@ class ChangePriorityController extends Controller { if($ticket->owner && $user->id === $ticket->owner->id) { $ticket->priority = $priority; $ticket->unread = true; + $event = Ticketevent::getEvent(Ticketevent::PRIORITY_CHANGED); + $event->setProperties(array( + 'authorStaff' => Controller::getLoggedUser(), + 'content' => $ticket->priority, + 'date' => Date::getCurrentDate() + )); + $ticket->addEvent($event); $ticket->store(); Response::respondSuccess(); } else { diff --git a/server/controllers/ticket/close.php b/server/controllers/ticket/close.php index 8e993477..6ed94ef7 100644 --- a/server/controllers/ticket/close.php +++ b/server/controllers/ticket/close.php @@ -37,6 +37,13 @@ class CloseController extends Controller { } else { $ticket->unreadStaff = true; } + $event = Ticketevent::getEvent(Ticketevent::CLOSE); + $event->setProperties(array( + 'authorStaff' => Controller::getLoggedUser(), + 'date' => Date::getCurrentDate() + )); + + $ticket->addEvent($event); $ticket->closed = true; $ticket->store(); Response::respondSuccess(); diff --git a/server/controllers/ticket/re-open.php b/server/controllers/ticket/re-open.php index d1332f52..325eb3e4 100644 --- a/server/controllers/ticket/re-open.php +++ b/server/controllers/ticket/re-open.php @@ -35,6 +35,12 @@ class ReOpenController extends Controller { } else { $ticket->unreadStaff = true; } + $event = Ticketevent::getEvent(Ticketevent::RE_OPEN); + $event->setProperties(array( + 'authorUser' => Controller::getLoggedUser(), + 'date' => Date::getCurrentDate() + )); + $ticket->addEvent($event); $ticket->closed = false; $ticket->store(); Response::respondSuccess();