Skip to content

Commit 8648807

Browse files
committed
fix: keep the user in the service catalog
Signed-off-by: Thierry Bugier <[email protected]>
1 parent bfe91dc commit 8648807

File tree

2 files changed

+19
-14
lines changed

2 files changed

+19
-14
lines changed

inc/wizard.class.php

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -105,18 +105,11 @@ public static function header($title) {
105105
echo '</a></li>';
106106

107107
if (Session::haveRight("reservation", ReservationItem::RESERVEANITEM)) {
108-
$found_available_res = $DB->request([
109-
'COUNT' => 'cpt',
110-
'FROM' => ReservationItem::getTable(),
111-
'WHERE' => getEntitiesRestrictCriteria(ReservationItem::getTable(), 'entities_id'),
112-
])->next();
113-
if ($found_available_res['cpt'] > 0) {
114-
echo '<li class="' . ($activeMenuItem == self::MENU_RESERVATIONS ? 'plugin_formcreator_selectedMenuItem' : '') . '">';
115-
echo '<a href="' . $CFG_GLPI["root_doc"].'/plugins/formcreator/front/reservationitem.php' . '">';
116-
echo '<span class="fa fa-calendar-check fa-calendar-check-o fc_list_icon" title="'.__('Book an asset', 'formcreator').'"></span>';
117-
echo '<span class="label">'.__('Book an asset', 'formcreator').'</span>';
118-
echo '</a></li>';
119-
}
108+
echo '<li class="' . ($activeMenuItem == self::MENU_RESERVATIONS ? 'plugin_formcreator_selectedMenuItem' : '') . '">';
109+
echo '<a href="' . $CFG_GLPI["root_doc"].'/plugins/formcreator/front/reservationitem.php' . '">';
110+
echo '<span class="fa fa-calendar-check fa-calendar-check-o fc_list_icon" title="'.__('Book an asset', 'formcreator').'"></span>';
111+
echo '<span class="label">'.__('Book an asset', 'formcreator').'</span>';
112+
echo '</a></li>';
120113
}
121114

122115
if (RSSFeed::canView()) {

setup.php

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -171,8 +171,8 @@ function plugin_init_formcreator() {
171171
}
172172
}
173173
}
174-
if (strpos($_SERVER['REQUEST_URI'], "front/ticket.form.php") !== false) {
175-
if (plugin_formcreator_replaceHelpdesk()) {
174+
if (plugin_formcreator_replaceHelpdesk()) {
175+
if (strpos($_SERVER['REQUEST_URI'], "front/ticket.form.php") !== false) {
176176
if (!isset($_POST['update'])) {
177177
$decodedUrl = [];
178178
$forceTab = '';
@@ -183,6 +183,18 @@ function plugin_init_formcreator() {
183183
Html::redirect($CFG_GLPI["root_doc"] . '/plugins/formcreator/front/issue.form.php?id=' . $_GET['id'] . '&sub_itemtype=Ticket' . $forceTab);
184184
}
185185
}
186+
187+
$pages = [
188+
'front/reservationitem.php' => 'plugins/formcreator/front/reservationitem.php',
189+
'front/helpdesk.faq.php' => 'plugins/formcreator/front/wizard.php',
190+
'front/ticket.php' => 'plugins/formcreator/front/issue.php',
191+
];
192+
foreach ($pages as $srcPage => $dstPage) {
193+
if (strpos($_SERVER['REQUEST_URI'], $srcPage) !== false && strpos($_SERVER['REQUEST_URI'], $dstPage) === false) {
194+
Html::redirect($CFG_GLPI["root_doc"] . '/' . $dstPage);
195+
break;
196+
}
197+
}
186198
}
187199

188200
// Massive Action definition

0 commit comments

Comments
 (0)