Skip to content

Commit

Permalink
fix: keep the user in the service catalog
Browse files Browse the repository at this point in the history
Signed-off-by: Thierry Bugier <[email protected]>
  • Loading branch information
btry committed Apr 21, 2020
1 parent 13ee703 commit 7f9451a
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 14 deletions.
17 changes: 5 additions & 12 deletions inc/wizard.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -105,18 +105,11 @@ public static function header($title) {
echo '</a></li>';

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 '<li class="' . ($activeMenuItem == self::MENU_RESERVATIONS ? 'plugin_formcreator_selectedMenuItem' : '') . '">';
echo '<a href="' . $CFG_GLPI["root_doc"].'/plugins/formcreator/front/reservationitem.php' . '">';
echo '<span class="fa fa-calendar-check fa-calendar-check-o fc_list_icon" title="'.__('Book an asset', 'formcreator').'"></span>';
echo '<span class="label">'.__('Book an asset', 'formcreator').'</span>';
echo '</a></li>';
}
echo '<li class="' . ($activeMenuItem == self::MENU_RESERVATIONS ? 'plugin_formcreator_selectedMenuItem' : '') . '">';
echo '<a href="' . $CFG_GLPI["root_doc"].'/plugins/formcreator/front/reservationitem.php' . '">';
echo '<span class="fa fa-calendar-check fa-calendar-check-o fc_list_icon" title="'.__('Book an asset', 'formcreator').'"></span>';
echo '<span class="label">'.__('Book an asset', 'formcreator').'</span>';
echo '</a></li>';
}

if (RSSFeed::canView()) {
Expand Down
16 changes: 14 additions & 2 deletions setup.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 = '';
Expand All @@ -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
Expand Down

0 comments on commit 7f9451a

Please sign in to comment.