This commit is contained in:
Jose Gonzalez 2020-12-02 15:49:13 +01:00
parent bd17efa3dd
commit 4760e0b20c
2 changed files with 25 additions and 2 deletions

View File

@ -763,6 +763,7 @@ if ($config['menu_type'] == 'classic') {
page: 'include/ajax/order_interpreter',
method: 'getResult',
text: $('#keywords').val(),
enterprise: <?php echo (int) enterprise_installed(); ?>,
},
success: function (data) {
$('#result_order').html(data);

View File

@ -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 '<li class="list_found" name="'.$iterator.'" id="'.$iterator.'">';
echo '
Go to &nbsp;
@ -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.