static function postAddCloseTicket($item) { if (!is_array($item->input) || !count($item->input)) { // Already cancel by another plugin return false; } $ticket = new Ticket(); if (isset($_POST['solution'])) { $item->input['solution'] = str_replace(array('\\r\\n', '\\r', '\\n'), '', $_POST['solution']); } // Get allowed status $config = new PluginMoreticketConfig(); $solution_status = array_keys(json_decode($config->solutionStatus(), true)); if (isset($item->input['id'])) { if (isset($item->input['status']) && isset($_POST['solutiontypes_id']) && isset($_POST['solution']) && in_array($item->input['status'], $solution_status)) { if (self::checkMandatory($_POST)) { // Then we add tickets informations $ticket->update(array('id' => $item->input['id'], 'solutiontypes_id' => $_POST['solutiontypes_id'], 'solution' => $_POST['solution'])); unset($_SESSION['glpi_plugin_moreticket_close']); } else { //$item->input = array(); $_SESSION['saveInput'][$item->getType()] = $item->input; $item->input = array(); } } } return true; }
LICENSE This file is part of Moreticket. Moreticket is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. Moreticket 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 General Public License for more details. You should have received a copy of the GNU General Public License along with Moreticket. If not, see <http://www.gnu.org/licenses/>. -------------------------------------------------------------------------- */ define('GLPI_ROOT', '../../..'); include GLPI_ROOT . "/inc/includes.php"; //change mimetype header("Content-type: application/javascript"); //not executed in self-service interface & right verification if ($_SESSION['glpiactiveprofile']['interface'] == "central") { $config = new PluginMoreticketConfig(); $use_waiting = $config->useWaiting(); $use_solution = $config->useSolution(); $solution_status = $config->solutionStatus(); $params = array('root_doc' => $CFG_GLPI['root_doc'], 'waiting' => CommonITILObject::WAITING, 'closed' => CommonITILObject::CLOSED, 'use_waiting' => $use_waiting, 'use_solution' => $use_solution, 'solution_status' => $solution_status); echo "moreticket(" . json_encode($params) . ");"; }