From 4760e0b20cef43c29ec3f8291db18d8cd48571d9 Mon Sep 17 00:00:00 2001 From: Jose Gonzalez Date: Wed, 2 Dec 2020 15:49:13 +0100 Subject: [PATCH] Fix --- pandora_console/general/header.php | 1 + .../include/class/OrderInterpreter.class.php | 26 +++++++++++++++++-- 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/pandora_console/general/header.php b/pandora_console/general/header.php index e26f5cd950..f577bb7318 100644 --- a/pandora_console/general/header.php +++ b/pandora_console/general/header.php @@ -763,6 +763,7 @@ if ($config['menu_type'] == 'classic') { page: 'include/ajax/order_interpreter', method: 'getResult', text: $('#keywords').val(), + enterprise: , }, success: function (data) { $('#result_order').html(data); diff --git a/pandora_console/include/class/OrderInterpreter.class.php b/pandora_console/include/class/OrderInterpreter.class.php index e9e93c75e2..75ed77fcde 100644 --- a/pandora_console/include/class/OrderInterpreter.class.php +++ b/pandora_console/include/class/OrderInterpreter.class.php @@ -380,7 +380,7 @@ class OrderInterpreter extends Wizard // Take value from input search. $text = get_parameter('text', ''); - $array_found = []; + $enterprise = (bool) get_parameter('enterprise', false); $iterator = 0; $more_results = 0; @@ -394,7 +394,7 @@ class OrderInterpreter extends Wizard __('GO TO '.$value['name']) ) && $value['acl'] ) { - if ($iterator <= 9) { + if ($iterator <= 9 && $this->canShowItem($enterprise, $this->pages_menu[$key]['url'])) { echo '
  • '; echo ' Go to   @@ -432,6 +432,28 @@ class OrderInterpreter extends Wizard } + /** + * Determines if the element must be shown or not. + * + * @param boolean $isEnterprise Define if the console is Enterprise. + * @param string $url Url of the element for select. + * + * @return boolean + */ + private function canShowItem(bool $isEnterprise, string $url) + { + $canShow = false; + + $hasEnterpriseLocation = strpos($url, '&sec2=enterprise') !== false; + + if (($isEnterprise === false && $hasEnterpriseLocation === false) || $isEnterprise === true) { + $canShow = true; + } + + return $canShow; + } + + /** * Load JS content. * function to create JS actions.