'user', 'requestData' => [ 'ticketNumber' => [ 'validation' => DataValidator::validTicketNumber(), 'error' => ERRORS::INVALID_TICKET ] ] ]; } public function handler() { $ticketNumber = Controller::request('ticketNumber'); $ticket = Ticket::getByTicketNumber($ticketNumber); $user = Controller::getLoggedUser(); if(!Controller::isStaffLogged() && $ticket->author->id !== $user->id){ Response::respondError(ERRORS::NO_PERMISSION); return; } if(Controller::isStaffLogged() && $ticket->owner && $ticket->owner->id !== $user->id){ Response::respondError(ERRORS::NO_PERMISSION); return; } if(Controller::isStaffLogged()) { $ticket->unread = true; } 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(); } }