diff --git a/src/Ticket.php b/src/Ticket.php index 6a15894..3a4bf21 100644 --- a/src/Ticket.php +++ b/src/Ticket.php @@ -29,35 +29,6 @@ * -------------------------------------------------------------------------- */ -/* - ------------------------------------------------------------------------- - LICENSE - - This file is part of Transferticketentity plugin for GLPI. - - Transferticketentity is free software: you can redistribute it and/or modify - it under the terms of the GNU Affero General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - Transferticketentity is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU Affero General Public License for more details. - - You should have received a copy of the GNU Affero General Public License - along with Reports. If not, see . - - @category Ticket - @package Transferticketentity - @author Yannick Comba, Xavier Caillaud, Infotel - @copyright 2015-2026 Transferticketentity team - @license AGPL License 3.0 or (at your option) any later version - https://www.gnu.org/licenses/gpl-3.0.html - @link https://github.com/pluginsGLPI/transferticketentity/ - -------------------------------------------------------------------------- - */ - namespace GlpiPlugin\Transferticketentity; use Ajax; @@ -715,19 +686,29 @@ public function launchTicketTransfer($params) $ticket = new \Ticket(); $ticket->getFromDB($params['id_ticket']); - Session::addMessageAfterRedirect( - __( - "Successful transfer for ticket", - "transferticketentity", - ) . $ticket->getLink(), - true, - INFO, - ); - if ($ticket->getID() > 0) { - Html::redirect($CFG_GLPI["root_doc"] . "/front/ticket.form.php?id=" . (int) $ticket->getID()); + if ($ticket->can($ticket->getID(), READ)) { + Session::addMessageAfterRedirect( + __( + "Successful transfer for ticket", + "transferticketentity", + ) . $ticket->getLink(), + true, + INFO, + ); + + if ($ticket->getID() > 0) { + Html::redirect($CFG_GLPI["root_doc"] . "/front/ticket.form.php?id=" . (int) $ticket->getID()); + } else { + Html::back(); + } } else { - Html::back(); + Session::addMessageAfterRedirect( + __("Successful transfer for ticket", "transferticketentity"), + true, + INFO, + ); + Html::redirect(\Ticket::getSearchURL()); } } }