Skip to content

Commit

Permalink
fix(issue): access to saved searches from service catalog
Browse files Browse the repository at this point in the history
  • Loading branch information
btry committed Nov 2, 2022
1 parent c81872e commit b748182
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 17 deletions.
6 changes: 5 additions & 1 deletion front/issue.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,11 @@
Html::displayRightError();
}
if (Session::getCurrentInterface() == "helpdesk") {
Html::helpHeader(__('Service catalog', 'formcreator'));
Html::helpHeader(
__('Service catalog', 'formcreator'),
'my_assistance_requests',
PluginFormcreatorIssue::class
);
} else {
Html::header(
__('Service catalog', 'formcreator'),
Expand Down
9 changes: 9 additions & 0 deletions inc/common.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -783,6 +783,15 @@ public static function hookRedefineMenu($menus) {
'default' => PluginFormcreatorIssue::getSearchURL(false),
'title' => __('My requests for assistance', 'formcreator'),
'icon' => 'fa-fw ti ti-list',
'content' => [
PluginFormcreatorIssue::class => [
'title' => __('My requests for assistance', 'formcreator'),
'icon' => 'fa-fw ti ti-list',
'links' => [
'lists' => '',
],
],
],
];

if (PluginFormcreatorEntityConfig::getUsedConfig('is_kb_separated', Session::getActiveEntity()) == PluginFormcreatorEntityConfig::CONFIG_KB_DISTINCT
Expand Down
3 changes: 2 additions & 1 deletion setup.php
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ function plugin_formcreator_hook(): void {
];
}
if (strpos($_SERVER['REQUEST_URI'], 'issue.php') !== false) {
$CFG_GLPI['javascript']['self-service']['none'] = [
$CFG_GLPI['javascript']['my_assistance_requests'][PluginFormcreatorIssue::class] = [
'dashboard',
'gridstack'
];
Expand All @@ -364,6 +364,7 @@ function plugin_formcreator_hook(): void {
}

$PLUGIN_HOOKS['menu_toadd']['formcreator']['helpdesk'] = PluginFormcreatorFormlist::class;
$PLUGIN_HOOKS['menu_toadd']['formcreator']['my_assistance_requests'] = PluginFormcreatorIssue::class;

// Massive Action definition
$PLUGIN_HOOKS['use_massive_action']['formcreator'] = 1;
Expand Down
46 changes: 31 additions & 15 deletions tests/3-unit/PluginFormcreatorCommon.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
*/
namespace tests\units;
use GlpiPlugin\Formcreator\Tests\CommonTestCase;
use PluginFormcreatorIssue;
use Ticket;
use User;

Expand Down Expand Up @@ -572,23 +573,29 @@ public function providerHookRedefineMenu() {
yield [
'input' => \Html::generateHelpMenu(),
'expected' => [
'seek_assistance' =>
[
'default' => 'plugins/formcreator/front/wizard.php',
'title' => 'Seek assistance',
'icon' => 'fa-fw ti ti-headset',
'seek_assistance' => [
'default' => 'plugins/formcreator/front/wizard.php',
'title' => 'Seek assistance',
'icon' => 'fa-fw ti ti-headset',
],
'my_assistance_requests' =>
[
'default' => '/plugins/formcreator/front/issue.php',
'title' => 'My requests for assistance',
'icon' => 'fa-fw ti ti-list',
'my_assistance_requests' => [
'default' => '/plugins/formcreator/front/issue.php',
'title' => 'My requests for assistance',
'icon' => 'fa-fw ti ti-list',
'content' => [
PluginFormcreatorIssue::class => [
'title' => __('My requests for assistance', 'formcreator'),
'icon' => 'fa-fw ti ti-list',
'links' => [
'lists' => '',
],
],
],
],
'reservation' =>
[
'default' => '/front/reservationitem.php',
'title' => 'Reservations',
'icon' => 'ti ti-calendar-event',
'reservation' => [
'default' => '/front/reservationitem.php',
'title' => 'Reservations',
'icon' => 'ti ti-calendar-event',
],
]
];
Expand Down Expand Up @@ -619,6 +626,15 @@ public function providerHookRedefineMenu() {
'default' => '/plugins/formcreator/front/issue.php',
'title' => 'My requests for assistance',
'icon' => 'fa-fw ti ti-list',
'content' => [
PluginFormcreatorIssue::class => [
'title' => __('My requests for assistance', 'formcreator'),
'icon' => 'fa-fw ti ti-list',
'links' => [
'lists' => '',
],
],
],
],
'reservation' =>
[
Expand Down

0 comments on commit b748182

Please sign in to comment.