Guillermo - Ticket-seen [skip ci]

This commit is contained in:
ivan 2016-10-21 16:12:17 -03:00
parent ef3bd809aa
commit 221288402e
9 changed files with 21 additions and 7 deletions

View File

@ -34,6 +34,7 @@ class AssignStaffController extends Controller {
} else {
$this->user->sharedTicketList->add($this->ticket);
$this->ticket->owner = $this->user;
$this->ticket->unread = true;
$this->ticket->store();
$this->user->store();

View File

@ -26,6 +26,7 @@ class UnAssignStaffController extends Controller {
$user->sharedTicketList->remove($ticket);
$user->store();
$ticket->owner = null;
$ticket->uread = true;
$ticket->store();
Response::respondSuccess();
} else {

View File

@ -34,6 +34,7 @@ class ChangeDepartmentController extends Controller {
}
$ticket->department = $department;
$ticket->unread = true;
$ticket->store();
Response::respondSuccess();
}

View File

@ -28,6 +28,7 @@ class ChangePriorityController extends Controller {
if($ticket->owner && $user->id === $ticket->owner->id) {
$ticket->priority = $priority;
$ticket->unread = true;
$ticket->store();
Response::respondSuccess();
} else {

View File

@ -32,6 +32,11 @@ class CloseController extends Controller {
return;
}
if(Controller::isStaffLogged()) {
$ticket->unread = true;
} else {
$ticket->unreadStaff = true;
}
$ticket->closed = true;
$ticket->store();
Response::respondSuccess();

View File

@ -51,11 +51,11 @@ class CommentController extends Controller {
));
if(Controller::isStaffLogged()) {
$comment->authorUser = Controller::getLoggedUser();
$this->ticket->unread = true;
} else {
$comment->authorUser = Controller::getLoggedUser();
$this->ticket->unreadStaff = true;
}
$comment->authorUser = Controller::getLoggedUser();
$this->ticket->addEvent($comment);
$this->ticket->store();
}

View File

@ -58,6 +58,7 @@ class CreateController extends Controller {
'file' => '',
'date' => Date::getCurrentDate(),
'unread' => false,
'unreadStaff' => true,
'closed' => false,
));

View File

@ -30,7 +30,11 @@ class ReOpenController extends Controller {
Response::respondError(ERRORS::NO_PERMISSION);
return;
}
if(Controller::isStaffLogged()) {
$ticket->unread = true;
} else {
$ticket->unreadStaff = true;
}
$ticket->closed = false;
$ticket->store();
Response::respondSuccess();

View File

@ -21,13 +21,13 @@ class SeenController extends Controller {
$user = Controller::getLoggedUser();
$ticket = Ticket::getByTicketNumber($ticketnumber);
if (Controller::isStaffLogged() && $ticket->owner_id === $user->id) {
if (Controller::isStaffLogged() && $ticket->owner && $ticket->owner->id === $user->id) {
$ticket->unreadStaff = false;
$ticket->store();
Response::respondSuccess();
return;
}
if (!Controller::isStaffLogged() && $user->id === $ticket->author_id) {
if (!Controller::isStaffLogged() && $ticket->author && $user->id === $ticket->author->id) {
$ticket->unread = false;
$ticket->store();
Response::respondSuccess();