From 7f9451a84db3781967871ade9c531cb4d102f8a0 Mon Sep 17 00:00:00 2001 From: Thierry Bugier Date: Thu, 16 Apr 2020 14:44:41 +0200 Subject: [PATCH] fix: keep the user in the service catalog Signed-off-by: Thierry Bugier --- inc/wizard.class.php | 17 +++++------------ setup.php | 16 ++++++++++++++-- 2 files changed, 19 insertions(+), 14 deletions(-) diff --git a/inc/wizard.class.php b/inc/wizard.class.php index a1012b253..8ea8980ef 100644 --- a/inc/wizard.class.php +++ b/inc/wizard.class.php @@ -105,18 +105,11 @@ public static function header($title) { echo ''; if (Session::haveRight("reservation", ReservationItem::RESERVEANITEM)) { - $found_available_res = $DB->request([ - 'COUNT' => 'cpt', - 'FROM' => ReservationItem::getTable(), - 'WHERE' => getEntitiesRestrictCriteria(ReservationItem::getTable(), 'entities_id'), - ])->next(); - if ($found_available_res['cpt'] > 0) { - echo '
  • '; - echo ''; - echo ''; - echo ''.__('Book an asset', 'formcreator').''; - echo '
  • '; - } + echo '
  • '; + echo ''; + echo ''; + echo ''.__('Book an asset', 'formcreator').''; + echo '
  • '; } if (RSSFeed::canView()) { diff --git a/setup.php b/setup.php index 323b5dfc6..9cbd30c27 100644 --- a/setup.php +++ b/setup.php @@ -171,8 +171,8 @@ function plugin_init_formcreator() { } } } - if (strpos($_SERVER['REQUEST_URI'], "front/ticket.form.php") !== false) { - if (plugin_formcreator_replaceHelpdesk()) { + if (plugin_formcreator_replaceHelpdesk()) { + if (strpos($_SERVER['REQUEST_URI'], "front/ticket.form.php") !== false) { if (!isset($_POST['update'])) { $decodedUrl = []; $forceTab = ''; @@ -183,6 +183,18 @@ function plugin_init_formcreator() { Html::redirect($CFG_GLPI["root_doc"] . '/plugins/formcreator/front/issue.form.php?id=' . $_GET['id'] . '&sub_itemtype=Ticket' . $forceTab); } } + + $pages = [ + 'front/reservationitem.php' => 'plugins/formcreator/front/reservationitem.php', + 'front/helpdesk.faq.php' => 'plugins/formcreator/front/wizard.php', + 'front/ticket.php' => 'plugins/formcreator/front/issue.php', + ]; + foreach ($pages as $srcPage => $dstPage) { + if (strpos($_SERVER['REQUEST_URI'], $srcPage) !== false && strpos($_SERVER['REQUEST_URI'], $dstPage) === false) { + Html::redirect($CFG_GLPI["root_doc"] . '/' . $dstPage); + break; + } + } } // Massive Action definition