static function afterUpdate(TicketSatisfaction $ticketsatisfaction) { $config = PluginBehaviorsConfig::getInstance(); $ticket = new Ticket(); if ($config->getField('add_notif') && $ticket->getFromDB($ticketsatisfaction->getField('tickets_id')) && $ticketsatisfaction->input["date_answered"]) { NotificationEvent::raiseEvent('plugin_behaviors_replysurvey', $ticket); } }
static function pdfForTicket(PluginPdfSimplePDF $pdf, Ticket $ticket) { $survey = new TicketSatisfaction(); $pdf->setColumnsSize(100); $pdf->displayTitle("<b>" . __('Satisfaction survey') . "</b>"); if (!$survey->getFromDB($ticket->getID())) { $pdf->displayLine(__('No generated survey')); } else { if ($survey->getField('type') == 2) { $url = Entity::generateLinkSatisfaction($ticket); $pdf->displayLine(sprintf(__('%1$s (%2$s)'), __('External survey'), $url)); } else { if ($survey->getField('date_answered')) { $sat = $survey->getField('satisfaction'); $tabsat = array(0 => __('None'), 1 => __('1 star', 'pdf'), 2 => __('2 stars', 'pdf'), 3 => __('3 stars', 'pdf'), 4 => __('4 stars', 'pdf'), 5 => __('5 stars', 'pdf')); if (isset($tabsat[$sat])) { $sat = $tabsat[$sat] . " ({$sat}/5)"; } $pdf->displayLine('<b>' . sprintf(__('%1$s: %2$s'), __('Response date to the satisfaction survey') . '</b>', Html::convDateTime($survey->getField('date_answered')))); $pdf->displayLine('<b>' . sprintf(__('%1$s: %2$s'), __('Satisfaction with the resolution of the ticket') . '</b>', $sat)); $pdf->displayText('<b>' . sprintf(__('%1$s: %2$s'), __('Comments') . '</b>', $survey->getField('comment'))); } else { // No answer $pdf->displayLine(sprintf(__('%1$s: %2$s'), __('Creation date of the satisfaction survey'), Html::convDateTime($survey->getField('date_begin')))); $pdf->displayLine(__('No answer', 'pdf')); } } } $pdf->displaySpace(); }
LICENSE This file is part of GLPI. GLPI 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. GLPI 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 GLPI. If not, see <http://www.gnu.org/licenses/>. -------------------------------------------------------------------------- */ /** @file * @brief */ include '../inc/includes.php'; Session::checkLoginUser(); $inquest = new TicketSatisfaction(); if (isset($_POST["update"])) { $inquest->check($_POST["tickets_id"], UPDATE); $inquest->update($_POST); Event::log($inquest->getField('tickets_id'), "ticket", 4, "tracking", sprintf(__('%s updates an item'), $_SESSION["glpiname"])); Html::back(); } Html::displayErrorAndDie('Lost');
/** * Answer to the ticket satisfaction survey * for an authenticated user * * @param $params array of options (ticket, id2name) * @param $protocol the communication protocol used * * @return array of hashtable as glpi.getTicket **/ static function methodsetTicketSatisfaction($params, $protocol) { global $DB, $CFG_GLPI; if (isset($params['help'])) { return array('ticket' => 'integer,mandatory', 'id2name' => 'bool,optional', 'satisfaction' => 'integer,mandatory', 'comment' => 'text,optional', 'help' => 'bool,optional'); } if (!Session::getLoginUserID()) { return self::Error($protocol, WEBSERVICES_ERROR_NOTAUTHENTICATED); } $ticket = new Ticket(); if (!isset($params['ticket'])) { return self::Error($protocol, WEBSERVICES_ERROR_MISSINGPARAMETER, '', 'ticket'); } if (!isset($params['satisfaction'])) { return self::Error($protocol, WEBSERVICES_ERROR_MISSINGPARAMETER, '', 'satisfaction'); } if (!is_numeric($params['satisfaction']) || $params['satisfaction'] < 0 || $params['satisfaction'] > 5) { return self::Error($protocol, WEBSERVICES_ERROR_BADPARAMETER, '', 'satisfaction=' . $params['satisfaction']); } if (!$ticket->can($params['ticket'], 'r')) { return self::Error($protocol, WEBSERVICES_ERROR_NOTFOUND, '', 'ticket'); } $inquest = new TicketSatisfaction(); if (!$inquest->getFromDB($params['ticket'])) { return self::Error($protocol, WEBSERVICES_ERROR_NOTFOUND, '', 'satisfaction'); } $input = array('id' => $inquest->getField('id'), 'tickets_id' => $inquest->getField('tickets_id'), 'satisfaction' => $params['satisfaction']); if (isset($params['comment'])) { $input['comment'] = addslashes($params['comment']); } if (!$inquest->can($params['ticket'], 'w')) { return self::Error($protocol, WEBSERVICES_ERROR_NOTALLOWED); } if ($inquest->update($input)) { unset($params['satisfaction'], $params['comment']); return self::methodGetTicket($params, $protocol); } return self::Error($protocol, WEBSERVICES_ERROR_FAILED, '', self::getDisplayError()); }
This file is part of GLPI. GLPI 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. GLPI 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 GLPI; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -------------------------------------------------------------------------- */ // ---------------------------------------------------------------------- // Original Author of file: // Purpose of file: // ---------------------------------------------------------------------- define('GLPI_ROOT', '..'); include GLPI_ROOT . "/inc/includes.php"; $inquest = new TicketSatisfaction(); if (isset($_POST["update"])) { $inquest->check($_POST["tickets_id"], 'w'); $inquest->update($_POST); Event::log($inquest->getField('tickets_id'), "ticket", 4, "tracking", $_SESSION["glpiname"] . " " . $LANG['log'][21]); glpi_header($_SERVER['HTTP_REFERER']); } displayErrorAndDie('Lost');