// Fixed double module call
This commit is contained in:
1 parent
063fd9941c
commit
056ced75b5
1 file changed
+22
-25
+22
-25
@@ -315,27 +315,21 @@ class HookCore extends ObjectModel
|
|||||||
|
|
||||||
$sql->orderBy('hm.`position`');
|
$sql->orderBy('hm.`position`');
|
||||||
|
|
||||||
// Store results per hook name
|
|
||||||
$results = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql);
|
|
||||||
$list = array();
|
$list = array();
|
||||||
|
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql);
|
||||||
// Get all available payment module
|
foreach ($result as $row)
|
||||||
$payment_modules = array();
|
{
|
||||||
|
$row['hook'] = strtolower($row['hook']);
|
||||||
|
if (!isset($list[$row['hook']]))
|
||||||
|
$list[$row['hook']] = array();
|
||||||
|
|
||||||
if ($results)
|
$list[$row['hook']][] = array(
|
||||||
foreach ($results as $row)
|
'id_hook' => $row['id_hook'],
|
||||||
{
|
'module' => $row['module'],
|
||||||
$row['hook'] = strtolower($row['hook']);
|
'id_module' => $row['id_module'],
|
||||||
if (!isset($list[$row['hook']]))
|
'live_edit' => $row['live_edit'],
|
||||||
$list[$row['hook']] = array();
|
);
|
||||||
|
}
|
||||||
$list[$row['hook']][] = array(
|
|
||||||
'id_hook' => $row['id_hook'],
|
|
||||||
'module' => $row['module'],
|
|
||||||
'id_module' => $row['id_module'],
|
|
||||||
'live_edit' => $row['live_edit'],
|
|
||||||
);
|
|
||||||
}
|
|
||||||
if ($hook_name != 'displayPayment')
|
if ($hook_name != 'displayPayment')
|
||||||
{
|
{
|
||||||
Cache::store($cache_id, $list);
|
Cache::store($cache_id, $list);
|
||||||
@@ -353,14 +347,17 @@ class HookCore extends ObjectModel
|
|||||||
$hook_name = strtolower($hook_name);
|
$hook_name = strtolower($hook_name);
|
||||||
|
|
||||||
$return = array();
|
$return = array();
|
||||||
|
$inserted_modules = array();
|
||||||
if (isset($list[$hook_name]))
|
if (isset($list[$hook_name]))
|
||||||
$return = $list[$hook_name];
|
$return = $list[$hook_name];
|
||||||
|
foreach ($return as $module)
|
||||||
|
$inserted_modules[] = $module['id_module'];
|
||||||
if (isset($list[$retro_hook_name]))
|
if (isset($list[$retro_hook_name]))
|
||||||
$return = array_merge($return, $list[$retro_hook_name]);
|
foreach ($list[$retro_hook_name] as $retro_module_call)
|
||||||
|
if (!in_array($retro_module_call['id_module'], $inserted_modules))
|
||||||
|
$return[] = $retro_module_call;
|
||||||
|
|
||||||
if (count($return) > 0)
|
return (count($return) > 0 ? $return : false);
|
||||||
return $return;
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
return $list;
|
return $list;
|
||||||
@@ -417,7 +414,7 @@ class HookCore extends ObjectModel
|
|||||||
{
|
{
|
||||||
$exceptions = $moduleInstance->getExceptions($array['id_hook']);
|
$exceptions = $moduleInstance->getExceptions($array['id_hook']);
|
||||||
$controller = Dispatcher::getInstance()->getController();
|
$controller = Dispatcher::getInstance()->getController();
|
||||||
|
|
||||||
if (in_array($controller, $exceptions))
|
if (in_array($controller, $exceptions))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@@ -425,7 +422,7 @@ class HookCore extends ObjectModel
|
|||||||
$matching_name = array(
|
$matching_name = array(
|
||||||
'authentication' => 'auth',
|
'authentication' => 'auth',
|
||||||
'compare' => 'products-comparison',
|
'compare' => 'products-comparison',
|
||||||
);
|
);
|
||||||
if (isset($matching_name[$controller]) && in_array($matching_name[$controller], $exceptions))
|
if (isset($matching_name[$controller]) && in_array($matching_name[$controller], $exceptions))
|
||||||
continue;
|
continue;
|
||||||
if (Validate::isLoadedObject($context->employee) && !$moduleInstance->getPermission('view', $context->employee))
|
if (Validate::isLoadedObject($context->employee) && !$moduleInstance->getPermission('view', $context->employee))
|
||||||
|
|||||||
Reference in new issue
Block a user