diff --git a/admin-dev/ajax.php b/admin-dev/ajax.php index 616072ec5..10992a728 100644 --- a/admin-dev/ajax.php +++ b/admin-dev/ajax.php @@ -244,7 +244,7 @@ if (Tools::isSubmit('ajaxCategoriesPositions')) { if (isset($position) && $category->updatePosition($way, $position)) { - Module::hookExec('categoryUpdate'); + Hook::exec('categoryUpdate'); die(true); } else @@ -605,7 +605,7 @@ if (Tools::isSubmit('getHookableModuleList')) include_once(_PS_MODULE_DIR_.$module['name'].'/'.$module['name'].'.php'); $mod = new $module['name'](); if ($mod->isHookableOn($hook_name)) - $hookableModulesList[] = array('id' => (int)$mod->id, 'name' => $mod->displayName, 'display' => Module::hookExec($hook_name, array(), (int)$mod->id)); + $hookableModulesList[] = array('id' => (int)$mod->id, 'name' => $mod->displayName, 'display' => Hook::exec($hook_name, array(), (int)$mod->id)); } } die(Tools::jsonEncode($hookableModulesList)); diff --git a/admin-dev/footer.inc.php b/admin-dev/footer.inc.php index 0686d3734..cbc320b52 100644 --- a/admin-dev/footer.inc.php +++ b/admin-dev/footer.inc.php @@ -27,7 +27,7 @@ echo ' - '.Module::hookExec('backOfficeFooter').' + '.Hook::exec('backOfficeFooter').' - '.Module::hookExec('featureValueForm', array('id_feature_value' => $obj->id)).' + '.Hook::exec('featureValueForm', array('id_feature_value' => $obj->id)).'
@@ -98,7 +98,7 @@ class AdminFeaturesValues extends AdminTab */ public function postProcess($token = NULL) { - Module::hookExec('postProcessFeatureValue', + Hook::exec('postProcessFeatureValue', array('errors' => &$this->_errors)); // send _errors as reference to allow postProcessFeatureValue to stop saving process if(Tools::getValue('submitDel'.$this->table)) @@ -121,4 +121,4 @@ class AdminFeaturesValues extends AdminTab else parent::postProcess(); } -} \ No newline at end of file +} diff --git a/admin-dev/tabs/AdminImport.php b/admin-dev/tabs/AdminImport.php index 70c278e88..de5ffec38 100644 --- a/admin-dev/tabs/AdminImport.php +++ b/admin-dev/tabs/AdminImport.php @@ -485,7 +485,7 @@ class AdminImport extends AdminTab foreach ($imagesTypes AS $k => $imageType) imageResize($tmpfile, $path.'-'.stripslashes($imageType['name']).'.jpg', $imageType['width'], $imageType['height']); if (in_array($imageType['id_image_type'], $watermark_types)) - Module::hookExec('watermark', array('id_image' => $id_image, 'id_product' => $id_entity)); + Hook::exec('watermark', array('id_image' => $id_image, 'id_product' => $id_entity)); } else { @@ -1864,4 +1864,4 @@ class AdminImport extends AdminTab { $this->_warnings[] = $product_name.(isset($product_id) ? ' (ID '.$product_id.')' : '').' '.Tools::displayError($message); } -} \ No newline at end of file +} diff --git a/admin-dev/tabs/AdminStatsTab.php b/admin-dev/tabs/AdminStatsTab.php index 8d380a3a3..3ad6c27f5 100644 --- a/admin-dev/tabs/AdminStatsTab.php +++ b/admin-dev/tabs/AdminStatsTab.php @@ -225,7 +225,7 @@ abstract class AdminStatsTab extends AdminPreferences if (!isset($moduleInstance)) $moduleInstance = Module::getInstanceByName($moduleName); if ($moduleInstance AND $moduleInstance->active) - echo Module::hookExec('AdminStatsModules', NULL, $moduleInstance->id); + echo Hook::exec('AdminStatsModules', NULL, $moduleInstance->id); else echo $this->l('Module not found', 'AdminStatsTab'); } diff --git a/classes/AdminController.php b/classes/AdminController.php index 0ecd0cd91..ab6d2e6ab 100644 --- a/classes/AdminController.php +++ b/classes/AdminController.php @@ -1050,8 +1050,8 @@ class AdminControllerCore extends Controller 'pic_dir' => _THEME_PROD_PIC_DIR_ )); $this->context->smarty->assign(array( - 'HOOK_HEADER' => Module::hookExec('backOfficeHeader'), - 'HOOK_TOP' => Module::hookExec('backOfficeTop'), + 'HOOK_HEADER' => Hook::exec('backOfficeHeader'), + 'HOOK_TOP' => Hook::exec('backOfficeTop'), )); } @@ -1132,7 +1132,7 @@ class AdminControllerCore extends Controller )); $this->context->smarty->assign(array( - 'HOOK_FOOTER' => Module::hookExec('backOfficeFooter'), + 'HOOK_FOOTER' => Hook::exec('backOfficeFooter'), )); } diff --git a/classes/Attribute.php b/classes/Attribute.php index 39cd43c06..ccbc60622 100644 --- a/classes/Attribute.php +++ b/classes/Attribute.php @@ -110,7 +110,7 @@ class AttributeCore extends ObjectModel $return = parent::delete(); if ($return) - Module::hookExec('afterDeleteAttribute', array('id_attribute' => $this->id)); + Hook::exec('afterDeleteAttribute', array('id_attribute' => $this->id)); return $return; } @@ -118,7 +118,7 @@ class AttributeCore extends ObjectModel { $return = parent::update($null_values); if ($return) - Module::hookExec('afterSaveAttribute', array('id_attribute' => $this->id)); + Hook::exec('afterSaveAttribute', array('id_attribute' => $this->id)); return $return; } @@ -129,7 +129,7 @@ class AttributeCore extends ObjectModel $return = parent::add($autodate, $null_values); if ($return) - Module::hookExec('afterSaveAttribute', array('id_attribute' => $this->id)); + Hook::exec('afterSaveAttribute', array('id_attribute' => $this->id)); return $return; } diff --git a/classes/AttributeGroup.php b/classes/AttributeGroup.php index 95ac8afc2..a679dfd47 100644 --- a/classes/AttributeGroup.php +++ b/classes/AttributeGroup.php @@ -76,14 +76,14 @@ class AttributeGroupCore extends ObjectModel $this->position = AttributeGroup::getHigherPosition() + 1; $return = parent::add($autodate, true); - Module::hookExec('afterSaveAttributeGroup', array('id_attribute_group' => $this->id)); + Hook::exec('afterSaveAttributeGroup', array('id_attribute_group' => $this->id)); return $return; } public function update($nullValues = false) { $return = parent::update($nullValues); - Module::hookExec('afterSaveAttributeGroup', array('id_attribute_group' => $this->id)); + Hook::exec('afterSaveAttributeGroup', array('id_attribute_group' => $this->id)); return $return; } @@ -149,7 +149,7 @@ class AttributeGroupCore extends ObjectModel return false; $return = parent::delete(); if ($return) - Module::hookExec('afterDeleteAttributeGroup', array('id_attribute_group' => $this->id)); + Hook::exec('afterDeleteAttributeGroup', array('id_attribute_group' => $this->id)); return $return; } diff --git a/classes/Cart.php b/classes/Cart.php index ce2d69f7e..482f2bc78 100644 --- a/classes/Cart.php +++ b/classes/Cart.php @@ -167,7 +167,7 @@ class CartCore extends ObjectModel public function add($autodate = true, $nullValues = false) { $return = parent::add($autodate); - Module::hookExec('cart'); + Hook::exec('cart'); return $return; } @@ -179,7 +179,7 @@ class CartCore extends ObjectModel unset(self::$_totalWeight[$this->id]); $this->_products = NULL; $return = parent::update(); - Module::hookExec('cart'); + Hook::exec('cart'); return $return; } diff --git a/classes/Category.php b/classes/Category.php index 122ae1006..8af71f242 100644 --- a/classes/Category.php +++ b/classes/Category.php @@ -183,7 +183,7 @@ class CategoryCore extends ObjectModel if (!isset($this->doNotRegenerateNTree) || !$this->doNotRegenerateNTree) self::regenerateEntireNtree(); $this->updateGroup($this->groupBox); - Module::hookExec('categoryAddition', array('category' => $this)); + Hook::exec('categoryAddition', array('category' => $this)); return $ret; } @@ -208,7 +208,7 @@ class CategoryCore extends ObjectModel self::regenerateEntireNtree(); $this->recalculateLevelDepth($this->id_category); } - Module::hookExec('categoryUpdate', array('category' => $this)); + Hook::exec('categoryUpdate', array('category' => $this)); return $ret; } @@ -218,7 +218,7 @@ class CategoryCore extends ObjectModel public function toggleStatus() { $result = parent::toggleStatus(); - Module::hookExec('categoryUpdate'); + Hook::exec('categoryUpdate'); return $result; } @@ -347,7 +347,7 @@ class CategoryCore extends ObjectModel if (!isset($this->doNotRegenerateNTree) || !$this->doNotRegenerateNTree) self::regenerateEntireNtree(); - Module::hookExec('categoryDeletion', array('category' => $this)); + Hook::exec('categoryDeletion', array('category' => $this)); /* Delete Categories in GroupReduction */ foreach ($to_delete as $category) @@ -1055,7 +1055,7 @@ class CategoryCore extends ObjectModel SET `position` = '.(int)$position.' WHERE `id_parent` = '.(int)$moved_category['id_parent'].' AND `id_category`='.(int)$moved_category['id_category'])); - Module::hookExec('categoryUpdate'); + Hook::exec('categoryUpdate'); return $result; } diff --git a/classes/Feature.php b/classes/Feature.php index ad90a077c..f5709a7a1 100644 --- a/classes/Feature.php +++ b/classes/Feature.php @@ -113,7 +113,7 @@ class FeatureCore extends ObjectModel public function add($autodate = true, $nullValues = false) { $return = parent::add($autodate, true); - Module::hookExec('afterSaveFeature', array('id_feature' => $this->id)); + Hook::exec('afterSaveFeature', array('id_feature' => $this->id)); return $return; } @@ -127,7 +127,7 @@ class FeatureCore extends ObjectModel $return = parent::delete(); if($return) - Module::hookExec('afterDeleteFeature', array('id_feature' => $this->id)); + Hook::exec('afterDeleteFeature', array('id_feature' => $this->id)); /* Reinitializing position */ $this->cleanPositions(); @@ -155,7 +155,7 @@ class FeatureCore extends ObjectModel Db::getInstance()->AutoExecute(_DB_PREFIX_.$this->table.'_lang', $field, 'UPDATE', '`'. pSQL($this->identifier).'` = '.(int)$this->id.' AND `id_lang` = '.(int)$field['id_lang']); } - Module::hookExec('afterSaveFeature', array('id_feature' => $this->id)); + Hook::exec('afterSaveFeature', array('id_feature' => $this->id)); return $result; } diff --git a/classes/FeatureValue.php b/classes/FeatureValue.php index 957b498b6..d514a35e1 100644 --- a/classes/FeatureValue.php +++ b/classes/FeatureValue.php @@ -171,7 +171,7 @@ class FeatureValueCore extends ObjectModel { $return = parent::add($autodate, $nullValues); if ($return) - Module::hookExec('afterSaveFeatureValue', array('id_feature_value' => $this->id)); + Hook::exec('afterSaveFeatureValue', array('id_feature_value' => $this->id)); return $return; } @@ -182,7 +182,7 @@ class FeatureValueCore extends ObjectModel $return = parent::delete(); if ($return) - Module::hookExec('afterDeleteFeatureValue', array('id_feature_value' => $this->id)); + Hook::exec('afterDeleteFeatureValue', array('id_feature_value' => $this->id)); return $return; } @@ -190,7 +190,7 @@ class FeatureValueCore extends ObjectModel { $return = parent::update($nullValues); if ($return) - Module::hookExec('afterSaveFeatureValue', array('id_feature_value' => $this->id)); + Hook::exec('afterSaveFeatureValue', array('id_feature_value' => $this->id)); return $return; } -} \ No newline at end of file +} diff --git a/classes/FileUploader.php b/classes/FileUploader.php index 79bbb4e06..70bc9dbd9 100755 --- a/classes/FileUploader.php +++ b/classes/FileUploader.php @@ -91,7 +91,7 @@ class qqUploadedFileXhr return array('error' => Tools::displayError('An error occurred while copying image:').' '.stripslashes($imageType['name'])); } unlink($tmpName); - Module::hookExec('watermark', array('id_image' => $id_image, 'id_product' => $id_product)); + Hook::exec('watermark', array('id_image' => $id_image, 'id_product' => $id_product)); $lang = Context::getContext()->employee->id_lang; foreach (Language::getLanguages(false) as $l) diff --git a/classes/FrontController.php b/classes/FrontController.php index da7627ca2..4c5e5357b 100755 --- a/classes/FrontController.php +++ b/classes/FrontController.php @@ -543,9 +543,9 @@ class FrontControllerCore extends Controller 'content_only' => (int)Tools::getValue('content_only') )); $this->context->smarty->assign(array( - 'HOOK_HEADER' => Module::hookExec('header'), - 'HOOK_TOP' => Module::hookExec('top'), - 'HOOK_LEFT_COLUMN' => Module::hookExec('leftColumn') + 'HOOK_HEADER' => Hook::exec('header'), + 'HOOK_TOP' => Hook::exec('top'), + 'HOOK_LEFT_COLUMN' => Hook::exec('leftColumn') )); if ((Configuration::get('PS_CSS_THEME_CACHE') OR Configuration::get('PS_JS_THEME_CACHE')) AND is_writable(_PS_THEME_DIR_.'cache')) @@ -564,8 +564,8 @@ class FrontControllerCore extends Controller public function initFooter() { $this->context->smarty->assign(array( - 'HOOK_RIGHT_COLUMN' => Module::hookExec('rightColumn', array('cart' => $this->context->cart)), - 'HOOK_FOOTER' => Module::hookExec('footer'), + 'HOOK_RIGHT_COLUMN' => Hook::exec('rightColumn', array('cart' => $this->context->cart)), + 'HOOK_FOOTER' => Hook::exec('footer'), )); } diff --git a/classes/Hook.php b/classes/Hook.php index d39c8dd1a..61b5cc9c6 100644 --- a/classes/Hook.php +++ b/classes/Hook.php @@ -29,6 +29,7 @@ class HookCore extends ObjectModel { /** @var string Name */ public $name; + public $title; protected $fieldsRequired = array('name'); protected $fieldsSize = array('name' => 32); @@ -37,12 +38,16 @@ class HookCore extends ObjectModel protected $table = 'hook'; protected $identifier = 'id_hook'; + protected static $_hookModulesCache; + static $preloadModulesFromHooks = null; + static $preloadHookAlias = null; public function getFields() { $this->validateFields(); $fields['name'] = pSQL($this->name); + $fields['title'] = pSQL($this->title); return $fields; } @@ -95,6 +100,15 @@ class HookCore extends ObjectModel '.($position ? 'WHERE h.`position` = 1' : '')); } + static public function preloadHookAlias() + { + if (!is_null(self::$preloadHookAlias)) + return ; + $hookAliasList = Db::getInstance()->executeS('SELECT * FROM `'._DB_PREFIX_.'hook_alias`'); + foreach ($hookAliasList as $ha) + self::$preloadHookAlias[$ha['alias']] = $ha['name']; + } + static public function preloadModulesFromHooks() { if (!is_null(self::$preloadModulesFromHooks)) @@ -138,23 +152,144 @@ class HookCore extends ObjectModel return $list; } - static public function newOrder($cart, $order, $customer, $currency, $orderStatus) + + + + + /** + * Execute modules for specified hook + * + * @param string $hook_name Hook Name + * @param array $hookArgs Parameters for the functions + * @return string modules output + */ + public static function exec($hook_name, $hookArgs = array(), $id_module = NULL) { - return Module::hookExec('newOrder', array( - 'cart' => $cart, - 'order' => $order, - 'customer' => $customer, - 'currency' => $currency, - 'orderStatus' => $orderStatus)); + $context = Context::getContext(); + if ((!empty($id_module) && !Validate::isUnsignedId($id_module)) || !Validate::isHookName($hook_name)) + die(Tools::displayError()); + + self::preloadHookAlias(); + $hook_name_retro = strtolower($hook_name); + if (isset(self::$preloadHookAlias[$hook_name])) + $hook_name = self::$preloadHookAlias[$hook_name]; + + $live_edit = false; + if (!isset($hookArgs['cookie']) || !$hookArgs['cookie']) + $hookArgs['cookie'] = $context->cookie; + if (!isset($hookArgs['cart']) || !$hookArgs['cart']) + $hookArgs['cart'] = $context->cart; + $hook_name = strtolower($hook_name); + + if (!isset(self::$_hookModulesCache)) + { + $db = Db::getInstance(_PS_USE_SQL_SLAVE_); + $list = $context->shop->getListOfID(); + if (isset($context->customer) && $context->customer->isLogged()) + $groups = $context->customer->getGroups(); + + $sql = 'SELECT h.`name` as hook, m.`id_module`, h.`id_hook`, m.`name` as module, h.`live_edit` + FROM `'._DB_PREFIX_.'module` m + LEFT JOIN `'._DB_PREFIX_.'hook_module` hm + ON hm.`id_module` = m.`id_module`'; + if (isset($context->customer) && $context->customer->isLogged()) + $sql .= ' + LEFT JOIN `'._DB_PREFIX_.'group_module_restriction` gmr + ON gmr.`id_module` = m.`id_module`'; + $sql .= ' + LEFT JOIN `'._DB_PREFIX_.'hook` h + ON hm.`id_hook` = h.`id_hook` + WHERE (SELECT COUNT(*) FROM '._DB_PREFIX_.'module_shop ms WHERE ms.id_module = m.id_module AND ms.id_shop IN('.implode(', ', $list).')) = '.count($list).' + AND hm.id_shop IN('.implode(', ', $list).')'; + if (isset($context->customer) && $context->customer->isLogged()) + $sql .= ' + AND (gmr.`authorized` = 1 AND gmr.`id_group` IN('.implode(', ', $groups).'))'; + $sql .= ' + GROUP BY hm.id_hook, hm.id_module + ORDER BY hm.`position`'; + $result = $db->executeS($sql, false); + self::$_hookModulesCache = array(); + + if ($result) + while ($row = $db->nextRow()) + { + $row['hook'] = strtolower($row['hook']); + if (!isset(self::$_hookModulesCache[$row['hook']])) + self::$_hookModulesCache[$row['hook']] = array(); + self::$_hookModulesCache[$row['hook']][] = array('id_hook' => $row['id_hook'], 'module' => $row['module'], 'id_module' => $row['id_module'], 'live_edit' => $row['live_edit']); + } + } + + if (!isset(self::$_hookModulesCache[$hook_name]) && !isset(self::$_hookModulesCache[$hook_name_retro])) + return; + + $hookModulesCache = array(); + if (isset(self::$_hookModulesCache[$hook_name])) + $hookModulesCache = self::$_hookModulesCache[$hook_name]; + if (isset(self::$_hookModulesCache[$hook_name_retro])) + $hookModulesCache = self::$_hookModulesCache[$hook_name_retro]; + + $altern = 0; + $output = ''; + foreach ($hookModulesCache as $array) + { + if ($id_module && $id_module != $array['id_module']) + continue; + if (!($moduleInstance = Module::getInstanceByName($array['module']))) + continue; + + $exceptions = $moduleInstance->getExceptions($array['id_hook']); + if (in_array(Dispatcher::getInstance()->getController(), $exceptions)) + continue; + if (isset($context->employee) && !$moduleInstance->getPermission('view', $context->employee)) + continue; + + $hook_callable = is_callable(array($moduleInstance, 'hook'.$hook_name)); + $hook_retro_callable = is_callable(array($moduleInstance, 'hook'.$hook_name_retro)); + if (($hook_callable || $hook_retro_callable) && Module::preCall($moduleInstance->name)) + { + $hookArgs['altern'] = ++$altern; + + if ($hook_callable) + $display = call_user_func(array($moduleInstance, 'hook'.$hook_name), $hookArgs); + else if ($hook_retro_callable) + $display = call_user_func(array($moduleInstance, 'hook'.$hook_name_retro), $hookArgs); + if ($array['live_edit'] && ((Tools::isSubmit('live_edit') && Tools::getValue('ad') && (Tools::getValue('liveToken') == sha1(Tools::getValue('ad')._COOKIE_KEY_))))) + { + $live_edit = true; + $output .= ' +
+ ' + .$moduleInstance->displayName.' + + + + + '.$display.'
'; + } + else + $output .= $display; + } + } + return ($live_edit ? '
' : '').$output.($live_edit ? '
' : ''); } + + + + + + + static public function updateOrderStatus($newOrderStatusId, $id_order) { $order = new Order((int)($id_order)); $newOS = new OrderState((int)($newOrderStatusId), $order->id_lang); - $return = ((int)($newOS->id) == Configuration::get('PS_OS_PAYMENT')) ? Module::hookExec('paymentConfirm', array('id_order' => (int)($order->id))) : true; - $return = Module::hookExec('updateOrderStatus', array('newOrderStatus' => $newOS, 'id_order' => (int)($order->id))) AND $return; + $return = ((int)($newOS->id) == Configuration::get('PS_OS_PAYMENT')) ? Hook::exec('paymentConfirm', array('id_order' => (int)($order->id))) : true; + $return = Hook::exec('updateOrderStatus', array('newOrderStatus' => $newOS, 'id_order' => (int)($order->id))) AND $return; return $return; } @@ -162,7 +297,7 @@ class HookCore extends ObjectModel { $order = new Order((int)($id_order)); $newOS = new OrderState((int)($newOrderStatusId), $order->id_lang); - $return = Module::hookExec('postUpdateOrderStatus', array('newOrderStatus' => $newOS, 'id_order' => (int)($order->id))); + $return = Hook::exec('postUpdateOrderStatus', array('newOrderStatus' => $newOS, 'id_order' => (int)($order->id))); return $return; } @@ -172,39 +307,57 @@ class HookCore extends ObjectModel * @param Product * @param Order */ + static public function newOrder($cart, $order, $customer, $currency, $orderStatus) + { + Tools::displayAsDeprecated(); + return Hook::exec('newOrder', array( + 'cart' => $cart, + 'order' => $order, + 'customer' => $customer, + 'currency' => $currency, + 'orderStatus' => $orderStatus)); + } + static public function updateQuantity($product, $order = null) { - return Module::hookExec('updateQuantity', array('product' => $product, 'order' => $order)); + Tools::displayAsDeprecated(); + return Hook::exec('updateQuantity', array('product' => $product, 'order' => $order)); } static public function productFooter($product, $category) { - return Module::hookExec('productFooter', array('product' => $product, 'category' => $category)); + Tools::displayAsDeprecated(); + return Hook::exec('productFooter', array('product' => $product, 'category' => $category)); } static public function productOutOfStock($product) { - return Module::hookExec('productOutOfStock', array('product' => $product)); + Tools::displayAsDeprecated(); + return Hook::exec('productOutOfStock', array('product' => $product)); } static public function addProduct($product) { - return Module::hookExec('addProduct', array('product' => $product)); + Tools::displayAsDeprecated(); + return Hook::exec('addProduct', array('product' => $product)); } static public function updateProduct($product) { - return Module::hookExec('updateProduct', array('product' => $product)); + Tools::displayAsDeprecated(); + return Hook::exec('updateProduct', array('product' => $product)); } static public function deleteProduct($product) { - return Module::hookExec('deleteProduct', array('product' => $product)); + Tools::displayAsDeprecated(); + return Hook::exec('deleteProduct', array('product' => $product)); } static public function updateProductAttribute($id_product_attribute) { - return Module::hookExec('updateProductAttribute', array('id_product_attribute' => $id_product_attribute)); + Tools::displayAsDeprecated(); + return Hook::exec('updateProductAttribute', array('id_product_attribute' => $id_product_attribute)); } static public function orderConfirmation($id_order) @@ -222,7 +375,7 @@ class HookCore extends ObjectModel $params['objOrder'] = $order; $params['currencyObj'] = $currency; - return Module::hookExec('orderConfirmation', $params); + return Hook::exec('orderConfirmation', $params); } } return false; @@ -243,7 +396,7 @@ class HookCore extends ObjectModel $params['objOrder'] = $order; $params['currencyObj'] = $currency; - return Module::hookExec('paymentReturn', $params, (int)($id_module)); + return Hook::exec('paymentReturn', $params, (int)($id_module)); } } return false; @@ -253,7 +406,7 @@ class HookCore extends ObjectModel { if (!is_object($pdf) OR !Validate::isUnsignedId($id_order)) return false; - return Module::hookExec('PDFInvoice', array('pdf' => $pdf, 'id_order' => $id_order)); + return Hook::exec('PDFInvoice', array('pdf' => $pdf, 'id_order' => $id_order)); } static public function backBeforePayment($module) @@ -261,14 +414,14 @@ class HookCore extends ObjectModel $params['module'] = strval($module); if (!$params['module']) return false; - return Module::hookExec('backBeforePayment', $params); + return Hook::exec('backBeforePayment', $params); } static public function updateCarrier($id_carrier, $carrier) { if (!Validate::isUnsignedId($id_carrier) OR !is_object($carrier)) return false; - return Module::hookExec('updateCarrier', array('id_carrier' => $id_carrier, 'carrier' => $carrier)); + return Hook::exec('updateCarrier', array('id_carrier' => $id_carrier, 'carrier' => $carrier)); } } diff --git a/classes/Module.php b/classes/Module.php index 02d6088f6..85fa9686f 100644 --- a/classes/Module.php +++ b/classes/Module.php @@ -78,7 +78,6 @@ abstract class ModuleCore public $limited_countries = array(); protected static $modulesCache; - protected static $_hookModulesCache; protected static $_INSTANCE = array(); @@ -343,13 +342,26 @@ abstract class ModuleCore if (!isset($this->id) OR !is_numeric($this->id)) return false; + // Retrocompatibility + Hook::preloadHookAlias(); + if (isset(Hook::$preloadHookAlias[$hook_name])) + $hook_name = Hook::$preloadHookAlias[$hook_name]; + // Get hook id $sql = 'SELECT `id_hook` FROM `'._DB_PREFIX_.'hook` WHERE `name` = \''.pSQL($hook_name).'\''; $hookID = Db::getInstance()->getValue($sql); if (!$hookID) - return false; + { + $newHook = new Hook(); + $newHook->name = pSQL($hook_name); + $newHook->title = pSQL($hook_name); + $newHook->add(); + $hookID = $newHook->id; + if (!$hookID) + return false; + } if (is_null($shopList)) $shopList = Shop::getShops(true, null, true); @@ -402,6 +414,11 @@ abstract class ModuleCore // Get hook id if a name is given as argument if (!is_numeric($hook_id)) { + // Retrocompatibility + Hook::preloadHookAlias(); + if (isset(Hook::$preloadHookAlias[$hook_id])) + $hook_id = Hook::$preloadHookAlias[$hook_id]; + $sql = 'SELECT `id_hook` FROM `'._DB_PREFIX_.'hook` WHERE `name` = \''.pSQL($hook_id).'\''; @@ -775,118 +792,24 @@ abstract class ModuleCore */ public static function hookExec($hook_name, $hookArgs = array(), $id_module = NULL) { - $context = Context::getContext(); - if ((!empty($id_module) && !Validate::isUnsignedId($id_module)) || !Validate::isHookName($hook_name)) - die(Tools::displayError()); - - $live_edit = false; - if (!isset($hookArgs['cookie']) || !$hookArgs['cookie']) - $hookArgs['cookie'] = $context->cookie; - if (!isset($hookArgs['cart']) || !$hookArgs['cart']) - $hookArgs['cart'] = $context->cart; - $hook_name = strtolower($hook_name); - - if (!isset(self::$_hookModulesCache)) - { - $db = Db::getInstance(_PS_USE_SQL_SLAVE_); - $list = $context->shop->getListOfID(); - if (isset($context->customer) && $context->customer->isLogged()) - $groups = $context->customer->getGroups(); - - $sql = 'SELECT h.`name` as hook, m.`id_module`, h.`id_hook`, m.`name` as module, h.`live_edit` - FROM `'._DB_PREFIX_.'module` m - LEFT JOIN `'._DB_PREFIX_.'hook_module` hm - ON hm.`id_module` = m.`id_module`'; - if (isset($context->customer) && $context->customer->isLogged()) - $sql .= ' - LEFT JOIN `'._DB_PREFIX_.'group_module_restriction` gmr - ON gmr.`id_module` = m.`id_module`'; - $sql .= ' - LEFT JOIN `'._DB_PREFIX_.'hook` h - ON hm.`id_hook` = h.`id_hook` - WHERE (SELECT COUNT(*) FROM '._DB_PREFIX_.'module_shop ms WHERE ms.id_module = m.id_module AND ms.id_shop IN('.implode(', ', $list).')) = '.count($list).' - AND hm.id_shop IN('.implode(', ', $list).')'; - if (isset($context->customer) && $context->customer->isLogged()) - $sql .= ' - AND (gmr.`authorized` = 1 AND gmr.`id_group` IN('.implode(', ', $groups).'))'; - $sql .= ' - GROUP BY hm.id_hook, hm.id_module - ORDER BY hm.`position`'; - $result = $db->executeS($sql, false); - self::$_hookModulesCache = array(); - - if ($result) - while ($row = $db->nextRow()) - { - $row['hook'] = strtolower($row['hook']); - if (!isset(self::$_hookModulesCache[$row['hook']])) - self::$_hookModulesCache[$row['hook']] = array(); - self::$_hookModulesCache[$row['hook']][] = array('id_hook' => $row['id_hook'], 'module' => $row['module'], 'id_module' => $row['id_module'], 'live_edit' => $row['live_edit']); - } - } - - if (!isset(self::$_hookModulesCache[$hook_name])) - return; - - $altern = 0; - $output = ''; - foreach (self::$_hookModulesCache[$hook_name] as $array) - { - if ($id_module && $id_module != $array['id_module']) - continue; - if (!($moduleInstance = Module::getInstanceByName($array['module']))) - continue; - - $exceptions = $moduleInstance->getExceptions($array['id_hook']); - if (in_array(Dispatcher::getInstance()->getController(), $exceptions)) - continue; - if (isset($context->employee) && !$moduleInstance->getPermission('view', $context->employee)) - continue; - - if (is_callable(array($moduleInstance, 'hook'.$hook_name))) - { - $hookArgs['altern'] = ++$altern; - - $display = call_user_func(array($moduleInstance, 'hook'.$hook_name), $hookArgs); - if ($array['live_edit'] && ((Tools::isSubmit('live_edit') && Tools::getValue('ad') && (Tools::getValue('liveToken') == sha1(Tools::getValue('ad')._COOKIE_KEY_))))) - { - $live_edit = true; - $output .= ' -
- ' - .$moduleInstance->displayName.' - - - - - '.$display.'
'; - } - else - $output .= $display; - } - } - return ($live_edit ? '
' : '').$output.($live_edit ? '
' : ''); + Tools::displayAsDeprecated(); + return Hook::exec($hook_name, $hookArgs, $id_module); } public static function hookExecPayment() { - $context = Context::getContext(); - $hookArgs = array('cookie' => $context->cookie, 'cart' => $context->cart); - $output = ''; - - $result = self::getPaymentModules(); - - if ($result) - foreach ($result AS $module) - if (($moduleInstance = Module::getInstanceByName($module['name'])) AND is_callable(array($moduleInstance, 'hookpayment'))) - if (!$moduleInstance->currencies OR ($moduleInstance->currencies AND sizeof(Currency::checkPaymentCurrencies($moduleInstance->id)))) - $output .= call_user_func(array($moduleInstance, 'hookpayment'), $hookArgs); - return $output; + Tools::displayAsDeprecated(); + return Hook::exec('payment'); } + public static function preCall($moduleName) + { + return true; + } + + + /** * Returns the list of the payment module associated to the current customer * @see PaymentModule::getInstalledPaymentModules() if you don't care about the context @@ -901,6 +824,10 @@ abstract class ModuleCore if (isset($context->customer)) $groups = $context->customer->getGroups(); + $hookPayment = 'Payment'; + if (Db::getInstance()->getValue('SELECT `id_hook` FROM `'._DB_PREFIX_.'hook` WHERE `name` = \'displayPayment\'')) + $hookPayment = 'displayPayment'; + $list = Context::getContext()->shop->getListOfID(); $sql = 'SELECT DISTINCT h.`id_hook`, m.`name`, hm.`position` FROM `'._DB_PREFIX_.'module_country` mc @@ -913,7 +840,7 @@ abstract class ModuleCore $sql .= ' LEFT JOIN `'._DB_PREFIX_.'group_module_restriction` gmr ON gmr.`id_module` = m.`id_module`'; $sql .= ' - WHERE h.`name` = \'payment\' + WHERE h.`name` = \''.$hookPayment.'\' AND mc.id_country = '.(int)($billing->id_country).' AND mc.id_shop = '.(int)$context->shop->getID(true).' AND mg.id_shop = '.(int)$context->shop->getID(true).' diff --git a/classes/ObjectModel.php b/classes/ObjectModel.php index 1e26508ad..1e2832c8e 100644 --- a/classes/ObjectModel.php +++ b/classes/ObjectModel.php @@ -205,6 +205,9 @@ abstract class ObjectModelCore if (!Validate::isTableOrIdentifier($this->table)) die(Tools::displayError('not table or identifier : ').$this->table); + /* Hook */ + Hook::exec('actionObject'.get_class($this).'AddBefore'); + /* Automatically fill dates */ if ($autodate AND key_exists('date_add', $this)) $this->date_add = date('Y-m-d H:i:s'); @@ -258,6 +261,10 @@ abstract class ObjectModelCore if (isset($assos[$this->table]) && $assos[$this->table]['type'] == 'group_shop') $result &= $this->associateTo(Context::getContext()->shop->getGroupID(), 'group_shop'); } + + /* Hook */ + Hook::exec('actionObject'.get_class($this).'AddAfter'); + return $result; } @@ -271,6 +278,9 @@ abstract class ObjectModelCore if (!Validate::isTableOrIdentifier($this->identifier) OR !Validate::isTableOrIdentifier($this->table)) die(Tools::displayError()); + /* Hook */ + Hook::exec('actionObject'.get_class($this).'UpdateBefore'); + $this->clearCache(); /* Automatically fill dates */ if (key_exists('date_upd', $this)) @@ -326,6 +336,10 @@ abstract class ObjectModelCore } } } + + /* Hook */ + Hook::exec('actionObject'.get_class($this).'UpdateAfter'); + return $result; } @@ -339,6 +353,9 @@ abstract class ObjectModelCore if (!Validate::isTableOrIdentifier($this->identifier) OR !Validate::isTableOrIdentifier($this->table)) die(Tools::displayError()); + /* Hook */ + Hook::exec('actionObject'.get_class($this).'DeleteBefore'); + $this->clearCache(); /* Database deletion */ @@ -349,6 +366,10 @@ abstract class ObjectModelCore /* Database deletion for multilingual fields related to the object */ if (method_exists($this, 'getTranslationsFieldsChild')) Db::getInstance()->execute('DELETE FROM `'.pSQL(_DB_PREFIX_.$this->table).'_lang` WHERE `'.pSQL($this->identifier).'` = '.(int)($this->id)); + + /* Hook */ + Hook::exec('actionObject'.get_class($this).'DeleteAfter'); + return $result; } diff --git a/classes/PaymentCC.php b/classes/PaymentCC.php index 3722b8f52..2158a40cb 100644 --- a/classes/PaymentCC.php +++ b/classes/PaymentCC.php @@ -65,7 +65,7 @@ class PaymentCCCore extends ObjectModel { if (parent::add($autodate, $nullValues)) { - Module::hookExec('paymentCCAdded', array('paymentCC' => $this)); + Hook::exec('paymentCCAdded', array('paymentCC' => $this)); return true; } return false; diff --git a/classes/PaymentModule.php b/classes/PaymentModule.php index 3e3f35f3c..d4c1eba6d 100644 --- a/classes/PaymentModule.php +++ b/classes/PaymentModule.php @@ -293,11 +293,11 @@ abstract class PaymentModuleCore extends Module $message->update(); } - // Hook new order + // Hook validate order $orderStatus = new OrderState((int)$id_order_state, (int)$order->id_lang); if (Validate::isLoadedObject($orderStatus)) { - Hook::newOrder($cart, $order, $customer, $currency, $orderStatus); + Hook::exec('newOrder', array('cart' => $cart, 'order' => $order, 'customer' => $customer, 'currency' => $currency, 'orderStatus' => $orderStatus)); foreach ($cart->getProducts() AS $product) if ($orderStatus->logable) ProductSale::addProductSale((int)$product['id_product'], (int)$product['cart_quantity']); @@ -513,7 +513,7 @@ abstract class PaymentModuleCore extends Module $modules = PaymentModuleCore::getInstalledPaymentModules(); foreach ($modules as $module) $id_module_list[] = $module['id_module']; -} + } foreach ($id_module_list as $id_module) $values .= '('.(int)$id_module.','.(int)$id_currency.'),'; @@ -547,5 +547,19 @@ abstract class PaymentModuleCore extends Module AND m.`active` = 1 '); } + + + public static function preCall($moduleName) + { + if (!parent::preCall($moduleName)) + return false; + + if (($moduleInstance = Module::getInstanceByName($moduleName))) + if (!$moduleInstance->currencies OR ($moduleInstance->currencies AND sizeof(Currency::checkPaymentCurrencies($moduleInstance->id)))) + return true; + + return false; + } + } diff --git a/classes/Product.php b/classes/Product.php index d09a456fd..f68be0e42 100644 --- a/classes/Product.php +++ b/classes/Product.php @@ -391,14 +391,14 @@ class ProductCore extends ObjectModel { if (!parent::add($autodate, $nullValues)) return false; - Module::hookExec('afterSaveProduct', array('id_product' => $this->id)); + Hook::exec('afterSaveProduct', array('id_product' => $this->id)); return true; } public function update($nullValues = false) { $return = parent::update($nullValues); - Module::hookExec('afterSaveProduct', array('id_product' => $this->id)); + Hook::exec('afterSaveProduct', array('id_product' => $this->id)); return $return; } @@ -590,7 +590,7 @@ class ProductCore extends ObjectModel if (!GroupReduction::deleteProductReduction($this->id)) return false; - Hook::deleteProduct($this); + Hook::exec('deleteProduct', array('product' => $this)); if (!parent::delete() OR !$this->deleteCategories(true) OR !$this->deleteImages() OR @@ -1061,7 +1061,7 @@ class ProductCore extends ObjectModel if (!Db::getInstance()->AutoExecute(_DB_PREFIX_.'product_attribute', $data, 'UPDATE', '`id_product_attribute` = '.(int)($id_product_attribute)) OR !Db::getInstance()->execute('DELETE FROM `'._DB_PREFIX_.'product_attribute_image` WHERE `id_product_attribute` = '.(int)($id_product_attribute))) return false; if ($quantity) - Hook::updateProductAttribute($id_product_attribute); + Hook::exec('updateProductAttribute', array('id_product_attribute' => $id_product_attribute)); Product::updateDefaultAttribute($this->id); if (empty($id_images)) return true; @@ -1094,7 +1094,7 @@ class ProductCore extends ObjectModel */ public function deleteProductAttributes() { - Module::hookExec('deleteProductAttribute', array('id_product_attribute' => 0, 'id_product' => $this->id, 'deleteAllAttributes' => true)); + Hook::exec('deleteProductAttribute', array('id_product_attribute' => 0, 'id_product' => $this->id, 'deleteAllAttributes' => true)); $result = Db::getInstance()->execute(' DELETE FROM `'._DB_PREFIX_.'product_attribute_combination` @@ -1239,7 +1239,7 @@ class ProductCore extends ObjectModel if (!$this->id || !$id_product_attribute OR !is_numeric($id_product_attribute)) return false; - Module::hookExec('deleteProductAttribute', array('id_product_attribute' => $id_product_attribute, 'id_product' => $this->id, 'deleteAllAttributes' => false)); + Hook::exec('deleteProductAttribute', array('id_product_attribute' => $id_product_attribute, 'id_product' => $this->id, 'deleteAllAttributes' => false)); $sql = 'DELETE FROM `'._DB_PREFIX_.'product_attribute` WHERE `id_product_attribute` = '.$id_product_attribute.' @@ -3257,7 +3257,7 @@ class ProductCore extends ObjectModel if ($stockMvt->add()) { $this->quantity = $this->getStock(); - Hook::updateQuantity($this, null); + Hook::exec('updateQuantity', array('product' => $this, 'order' => null)); return true; } return false; diff --git a/classes/Tools.php b/classes/Tools.php index 6f05419b3..4eedeeb66 100644 --- a/classes/Tools.php +++ b/classes/Tools.php @@ -1526,7 +1526,7 @@ FileETag INode MTime Size fwrite($write_fd, "\n\n".trim($specific_after)); fclose($write_fd); - Module::hookExec('afterCreateHtaccess'); + Hook::exec('afterCreateHtaccess'); return true; } diff --git a/controllers/admin/AdminCustomersController.php b/controllers/admin/AdminCustomersController.php index 8b9272387..4946667f0 100644 --- a/controllers/admin/AdminCustomersController.php +++ b/controllers/admin/AdminCustomersController.php @@ -517,7 +517,7 @@ class AdminCustomersControllerCore extends AdminController 'messages' => $messages, // Display hook specified to this page : AdminCustomers - 'hook' => Module::hookExec('adminCustomers', array('id_customer' => $customer->id)), + 'hook' => Hook::exec('adminCustomers', array('id_customer' => $customer->id)), // Groups 'groups' => $groups, diff --git a/controllers/admin/AdminHomeController.php b/controllers/admin/AdminHomeController.php index ae51d4925..d11e1cde9 100644 --- a/controllers/admin/AdminHomeController.php +++ b/controllers/admin/AdminHomeController.php @@ -554,7 +554,7 @@ class AdminHomeControllerCore extends AdminController $tpl_vars['last_orders'] =$this->getLastOrders(); $tpl_vars['tips_optimization'] = $this->_displayOptimizationTips(); - $HOOK_BACKOFFICEHOME = Module::hookExec('backOfficeHome'); + $HOOK_BACKOFFICEHOME = Hook::exec('backOfficeHome'); $tpl_vars['HOOK_BACKOFFICEHOME'] = $HOOK_BACKOFFICEHOME; $smarty->assign($tpl_vars); diff --git a/controllers/admin/AdminMetaController.php b/controllers/admin/AdminMetaController.php index d88106885..f9de19e79 100644 --- a/controllers/admin/AdminMetaController.php +++ b/controllers/admin/AdminMetaController.php @@ -206,7 +206,7 @@ class AdminMetaControllerCore extends AdminController else $_POST['url_rewrite_'.$lang['id_lang']] = Tools::getValue('url_rewrite_1'); } - Module::hookExec('afterSaveAdminMeta'); + Hook::exec('afterSaveAdminMeta'); } return parent::postProcess(); diff --git a/controllers/admin/AdminOrdersController.php b/controllers/admin/AdminOrdersController.php index 717243e00..7814e80c4 100755 --- a/controllers/admin/AdminOrdersController.php +++ b/controllers/admin/AdminOrdersController.php @@ -364,14 +364,14 @@ class AdminOrdersControllerCore extends AdminController $updProduct['stock_quantity'] = (int)($newProductQty); $product['stock_quantity'] = $updProduct['stock_quantity']; } - Hook::updateQuantity($product, $order); + Hook::exec('updateQuantity', array('product' => $product, 'order' => $order)); } } // Delete product if (!$order->deleteProduct($order, $orderDetail, $qtyCancelProduct)) $this->_errors[] = Tools::displayError('An error occurred during deletion of the product.').' '.$orderDetail->product_name.''; - Module::hookExec('cancelProduct', array('order' => $order, 'id_order_detail' => $id_order_detail)); + Hook::exec('cancelProduct', array('order' => $order, 'id_order_detail' => $id_order_detail)); } if (!sizeof($this->_errors) AND $customizationList) foreach ($customizationList AS $id_customization => $id_order_detail) @@ -397,7 +397,7 @@ class AdminOrdersControllerCore extends AdminController $this->_errors[] = Tools::displayError('Cannot generate credit slip'); else { - Module::hookExec('orderSlip', array('order' => $order, 'productList' => $full_product_list, 'qtyList' => $full_quantity_list)); + Hook::exec('orderSlip', array('order' => $order, 'productList' => $full_product_list, 'qtyList' => $full_quantity_list)); @Mail::Send((int)$order->id_lang, 'credit_slip', Mail::l('New credit slip regarding your order', $order->id_lang), $params, $customer->email, $customer->firstname.' '.$customer->lastname, NULL, NULL, NULL, NULL, _PS_MAIL_DIR_, true); @@ -547,8 +547,8 @@ class AdminOrdersControllerCore extends AdminController // Assign Hook $this->context->smarty->assign(array( - 'HOOK_INVOICE' => Module::hookExec('invoice', array('id_order' => $order->id)), - 'HOOK_ADMIN_ORDER' => Module::hookExec('adminOrder', array('id_order' => $order->id)) + 'HOOK_INVOICE' => Hook::exec('invoice', array('id_order' => $order->id)), + 'HOOK_ADMIN_ORDER' => Hook::exec('adminOrder', array('id_order' => $order->id)) )); } public function ajaxProcessSearchCustomers() diff --git a/controllers/admin/AdminProductsController.php b/controllers/admin/AdminProductsController.php index 49f6d267f..c8dbc4db4 100644 --- a/controllers/admin/AdminProductsController.php +++ b/controllers/admin/AdminProductsController.php @@ -328,7 +328,7 @@ class AdminProductsController extends AdminController $this->_errors[] = Tools::displayError('An error occurred while copying images.'); else { - Hook::addProduct($product); + Hook::exec('addProduct', array('product' => $product)); Search::indexation(false, $product->id); Tools::redirectAdmin(self::$currentIndex.'&id_category='.(!empty($_REQUEST['id_category'])?$_REQUEST['id_category']:'1').'&conf=19&token='.($token ? $token : $this->token)); } @@ -561,7 +561,7 @@ class AdminProductsController extends AdminController if (!$product->addStockMvt(Tools::getValue('attribute_mvt_quantity'), $id_reason, $id_product_attribute, null, $this->context->employee->id)) $this->_errors[] = Tools::displayError('An error occurred while updating qty.'); } - Hook::updateProductAttribute((int)$id_product_attribute); + Hook::exec('updateProductAttribute', array('id_product_attribute' => (int)$id_product_attribute)); $this->updateDownloadProduct($product, 1, $id_product_attribute); } else @@ -1081,7 +1081,7 @@ if (false) } @unlink($tmpName); - Module::hookExec('watermark', array('id_image' => $id_image, 'id_product' => $id_product)); + Hook::exec('watermark', array('id_image' => $id_image, 'id_product' => $id_product)); } } @@ -1195,7 +1195,7 @@ if (false) else if ($id_image = $this->addProductImage($object, Tools::getValue('resizer'))) { self::$currentIndex .= '&image_updated='.(int)Tools::getValue('id_image'); - Hook::updateProduct($object); + Hook::exec('updateProduct', array('product' => $object)); Search::indexation(false, $object->id); if (Tools::getValue('resizer') == 'man' && isset($id_image) && is_int($id_image) && $id_image) Tools::redirectAdmin(self::$currentIndex.'&id_product='.$object->id.'&id_category='.(!empty($_REQUEST['id_category'])?$_REQUEST['id_category']:'1').'&edit='.strval(Tools::getValue('productCreated')).'&id_image='.$id_image.'&imageresize&toconf=4&submitAddAndStay='.((Tools::isSubmit('submitAdd'.$this->table.'AndStay') || Tools::getValue('productCreated') == 'on') ? 'on' : 'off').'&token='.(($token ? $token : $this->token))); @@ -1253,7 +1253,7 @@ if (false) $this->_errors[] = Tools::displayError('An error occurred while adding tags.'); else if ($id_image = $this->addProductImage($object)) { - Hook::addProduct($object); + Hook::exec('addProduct', array('product' => $object)); Search::indexation(false, $object->id); // Save and preview diff --git a/controllers/front/AuthController.php b/controllers/front/AuthController.php index 57d413dc5..5f34001d8 100644 --- a/controllers/front/AuthController.php +++ b/controllers/front/AuthController.php @@ -118,8 +118,8 @@ class AuthControllerCore extends FrontController // Call a hook to display more information on form $this->context->smarty->assign(array( - 'HOOK_CREATE_ACCOUNT_FORM' => Module::hookExec('createAccountForm'), - 'HOOK_CREATE_ACCOUNT_TOP' => Module::hookExec('createAccountTop') + 'HOOK_CREATE_ACCOUNT_FORM' => Hook::exec('createAccountForm'), + 'HOOK_CREATE_ACCOUNT_TOP' => Hook::exec('createAccountTop') )); $this->setTemplate(_PS_THEME_DIR_.'authentication.tpl'); } @@ -235,7 +235,7 @@ class AuthControllerCore extends FrontController */ protected function processSubmitLogin() { - Module::hookExec('beforeAuthentication'); + Hook::exec('beforeAuthentication'); $passwd = trim(Tools::getValue('passwd')); $email = trim(Tools::getValue('email')); if (empty($email)) @@ -275,7 +275,7 @@ class AuthControllerCore extends FrontController $this->context->cart->id_address_delivery = Address::getFirstCustomerAddressId((int)($customer->id)); $this->context->cart->id_address_invoice = Address::getFirstCustomerAddressId((int)($customer->id)); $this->context->cart->update(); - Module::hookExec('authentication'); + Hook::exec('authentication'); // Login information have changed, so we check if the cart rules still apply CartRule::autoRemoveFromCart(); @@ -352,7 +352,7 @@ class AuthControllerCore extends FrontController $this->updateContext($customer); $this->context->cart->update(); - Module::hookExec('createAccount', array( + Hook::exec('createAccount', array( '_POST' => $_POST, 'newCustomer' => $customer )); @@ -472,7 +472,7 @@ class AuthControllerCore extends FrontController // If a logged guest logs in as a customer, the cart secure key was already set and needs to be updated $this->context->cart->update(); - Module::hookExec('createAccount', array( + Hook::exec('createAccount', array( '_POST' => $_POST, 'newCustomer' => $customer )); @@ -581,4 +581,4 @@ class AuthControllerCore extends FrontController $customer->firstname.' '.$customer->lastname ); } -} \ No newline at end of file +} diff --git a/controllers/front/CartController.php b/controllers/front/CartController.php index fc42b7cf3..ba23ffae7 100644 --- a/controllers/front/CartController.php +++ b/controllers/front/CartController.php @@ -213,8 +213,8 @@ class CartControllerCore extends FrontController } $result['summary'] = $this->context->cart->getSummaryDetails(); $result['customizedDatas'] = Product::getAllCustomizedDatas($this->context->cart->id, null, true); - $result['HOOK_SHOPPING_CART'] = Module::hookExec('shoppingCart', $result['summary']); - $result['HOOK_SHOPPING_CART_EXTRA'] = Module::hookExec('shoppingCartExtra', $result['summary']); + $result['HOOK_SHOPPING_CART'] = Hook::exec('shoppingCart', $result['summary']); + $result['HOOK_SHOPPING_CART_EXTRA'] = Hook::exec('shoppingCartExtra', $result['summary']); // Display reduced price (or not) without quantity discount if (Tools::getIsset('getproductprice')) diff --git a/controllers/front/CategoryController.php b/controllers/front/CategoryController.php index 167e61903..c87e421a8 100644 --- a/controllers/front/CategoryController.php +++ b/controllers/front/CategoryController.php @@ -162,7 +162,7 @@ class CategoryControllerCore extends FrontController public function assignProductList() { $hookExecuted = false; - Module::hookExec('productListAssign', array( + Hook::exec('productListAssign', array( 'nbProducts' => &$this->nbProducts, 'catProducts' => &$this->cat_products, 'hookExecuted' => &$hookExecuted, diff --git a/controllers/front/CompareController.php b/controllers/front/CompareController.php index a4a52eda0..9829759f5 100644 --- a/controllers/front/CompareController.php +++ b/controllers/front/CompareController.php @@ -159,7 +159,7 @@ class CompareControllerCore extends FrontController 'width' => $width, 'homeSize' => Image::getSize('home') )); - $this->context->smarty->assign('HOOK_EXTRA_PRODUCT_COMPARISON', Module::hookExec('extraProductComparison', array('list_ids_product' => $ids))); + $this->context->smarty->assign('HOOK_EXTRA_PRODUCT_COMPARISON', Hook::exec('extraProductComparison', array('list_ids_product' => $ids))); } } } diff --git a/controllers/front/GuestTrackingController.php b/controllers/front/GuestTrackingController.php index 80b44b99f..74db79538 100644 --- a/controllers/front/GuestTrackingController.php +++ b/controllers/front/GuestTrackingController.php @@ -156,8 +156,8 @@ class GuestTrackingControllerCore extends FrontController 'deliveryAddressFormatedValues' => $deliveryAddressFormatedValues)); if ($carrier->url && $order->shipping_number) $this->context->smarty->assign('followup', str_replace('@', $order->shipping_number, $carrier->url)); - $this->context->smarty->assign('HOOK_ORDERDETAILDISPLAYED', Module::hookExec('orderDetailDisplayed', array('order' => $order))); - Module::hookExec('OrderDetail', array('carrier' => $carrier, 'order' => $order)); + $this->context->smarty->assign('HOOK_ORDERDETAILDISPLAYED', Hook::exec('orderDetailDisplayed', array('order' => $order))); + Hook::exec('OrderDetail', array('carrier' => $carrier, 'order' => $order)); } public function setMedia() diff --git a/controllers/front/IndexController.php b/controllers/front/IndexController.php index 0f1ef81dc..e88b04c8f 100644 --- a/controllers/front/IndexController.php +++ b/controllers/front/IndexController.php @@ -35,7 +35,7 @@ class IndexControllerCore extends FrontController */ public function initContent() { - $this->context->smarty->assign('HOOK_HOME', Module::hookExec('home')); + $this->context->smarty->assign('HOOK_HOME', Hook::exec('home')); $this->setTemplate(_PS_THEME_DIR_.'index.tpl'); } } diff --git a/controllers/front/MyAccountController.php b/controllers/front/MyAccountController.php index e6a69984d..a2907abc4 100644 --- a/controllers/front/MyAccountController.php +++ b/controllers/front/MyAccountController.php @@ -48,7 +48,7 @@ class MyAccountControllerCore extends FrontController 'voucherAllowed' => (int)(Configuration::get('PS_VOUCHERS')), 'returnAllowed' => (int)(Configuration::get('PS_ORDER_RETURN')) )); - $this->context->smarty->assign('HOOK_CUSTOMER_ACCOUNT', Module::hookExec('customerAccount')); + $this->context->smarty->assign('HOOK_CUSTOMER_ACCOUNT', Hook::exec('customerAccount')); $this->setTemplate(_PS_THEME_DIR_.'my-account.tpl'); } diff --git a/controllers/front/OrderDetailController.php b/controllers/front/OrderDetailController.php index 859804041..3964519b7 100644 --- a/controllers/front/OrderDetailController.php +++ b/controllers/front/OrderDetailController.php @@ -192,8 +192,8 @@ class OrderDetailControllerCore extends FrontController )); if ($carrier->url && $order->shipping_number) $this->context->smarty->assign('followup', str_replace('@', $order->shipping_number, $carrier->url)); - $this->context->smarty->assign('HOOK_ORDERDETAILDISPLAYED', Module::hookExec('orderDetailDisplayed', array('order' => $order))); - Module::hookExec('OrderDetail', array('carrier' => $carrier, 'order' => $order)); + $this->context->smarty->assign('HOOK_ORDERDETAILDISPLAYED', Hook::exec('orderDetailDisplayed', array('order' => $order))); + Hook::exec('OrderDetail', array('carrier' => $carrier, 'order' => $order)); unset($carrier, $addressInvoice, $addressDelivery); } diff --git a/controllers/front/OrderFollowController.php b/controllers/front/OrderFollowController.php index 0e5f511d0..87c9539ca 100644 --- a/controllers/front/OrderFollowController.php +++ b/controllers/front/OrderFollowController.php @@ -67,7 +67,7 @@ class OrderFollowControllerCore extends FrontController $orderReturn->state = 1; $orderReturn->add(); $orderReturn->addReturnDetail($ids_order_detail, $order_qte_input, $customizationIds, $customizationQtyInput); - Module::hookExec('orderReturn', array('orderReturn' => $orderReturn)); + Hook::exec('orderReturn', array('orderReturn' => $orderReturn)); Tools::redirect('index.php?controller=order-follow'); } } diff --git a/controllers/front/OrderOpcController.php b/controllers/front/OrderOpcController.php index c0f87eff1..910ccd73c 100644 --- a/controllers/front/OrderOpcController.php +++ b/controllers/front/OrderOpcController.php @@ -67,7 +67,7 @@ class OrderOpcControllerCore extends ParentOrderController { $return = array( 'summary' => $this->context->cart->getSummaryDetails(), - 'HOOK_TOP_PAYMENT' => Module::hookExec('paymentTop'), + 'HOOK_TOP_PAYMENT' => Hook::exec('paymentTop'), 'HOOK_PAYMENT' => $this->_getPaymentMethods() ); die(Tools::jsonEncode($return)); @@ -84,7 +84,7 @@ class OrderOpcControllerCore extends ParentOrderController { $this->context->cookie->checkedTOS = (int)(Tools::getValue('checked')); die(Tools::jsonEncode(array( - 'HOOK_TOP_PAYMENT' => Module::hookExec('paymentTop'), + 'HOOK_TOP_PAYMENT' => Hook::exec('paymentTop'), 'HOOK_PAYMENT' => $this->_getPaymentMethods() ))); } @@ -137,7 +137,7 @@ class OrderOpcControllerCore extends ParentOrderController 'order_opc_adress' => $this->context->smarty->fetch(_PS_THEME_DIR_.'order-address.tpl'), 'block_user_info' => (isset($blockUserInfo) ? $blockUserInfo->hookTop(array()) : ''), 'carrier_list' => $this->_getCarrierList(), - 'HOOK_TOP_PAYMENT' => Module::hookExec('paymentTop'), + 'HOOK_TOP_PAYMENT' => Hook::exec('paymentTop'), 'HOOK_PAYMENT' => $this->_getPaymentMethods(), 'no_address' => 0, 'gift_price' => Tools::displayPrice(Tools::convertPrice(Product::getTaxCalculationMethod() == 1 ? $wrapping_fees : $wrapping_fees_tax_inc, new Currency((int)($this->context->cookie->id_currency)))) @@ -190,7 +190,7 @@ class OrderOpcControllerCore extends ParentOrderController $wrapping_fees_tax_inc = $wrapping_fees * (1 + (((float)($wrapping_fees_tax->rate) / 100))); $result = array_merge($result, array( 'summary' => $this->context->cart->getSummaryDetails(), - 'HOOK_TOP_PAYMENT' => Module::hookExec('paymentTop'), + 'HOOK_TOP_PAYMENT' => Hook::exec('paymentTop'), 'HOOK_PAYMENT' => $this->_getPaymentMethods(), 'gift_price' => Tools::displayPrice(Tools::convertPrice(Product::getTaxCalculationMethod() == 1 ? $wrapping_fees : $wrapping_fees_tax_inc, new Currency((int)($this->context->cookie->id_currency)))) )); @@ -256,8 +256,8 @@ class OrderOpcControllerCore extends ParentOrderController )); /* Call a hook to display more information on form */ self::$smarty->assign(array( - 'HOOK_CREATE_ACCOUNT_FORM' => Module::hookExec('createAccountForm'), - 'HOOK_CREATE_ACCOUNT_TOP' => Module::hookExec('createAccountTop') + 'HOOK_CREATE_ACCOUNT_FORM' => Hook::exec('createAccountForm'), + 'HOOK_CREATE_ACCOUNT_TOP' => Hook::exec('createAccountTop') )); $years = Tools::dateYears(); $months = Tools::dateMonths(); @@ -333,7 +333,7 @@ class OrderOpcControllerCore extends ParentOrderController 'carriers' => $carriers, 'default_carrier' => (int)(Configuration::get('PS_CARRIER_DEFAULT')), 'HOOK_EXTRACARRIER' => NULL, - 'HOOK_BEFORECARRIER' => Module::hookExec('beforeCarrier', array('carriers' => $carriers)) + 'HOOK_BEFORECARRIER' => Hook::exec('beforeCarrier', array('carriers' => $carriers)) )); } else @@ -343,7 +343,7 @@ class OrderOpcControllerCore extends ParentOrderController protected function _assignPayment() { $this->context->smarty->assign(array( - 'HOOK_TOP_PAYMENT' => ($this->isLogged ? Module::hookExec('paymentTop') : ''), + 'HOOK_TOP_PAYMENT' => ($this->isLogged ? Hook::exec('paymentTop') : ''), 'HOOK_PAYMENT' => $this->_getPaymentMethods() )); } @@ -389,7 +389,7 @@ class OrderOpcControllerCore extends ParentOrderController if ($this->context->cart->getOrderTotal() <= 0) return '

'; - $return = Module::hookExecPayment(); + $return = Hook::exec('payment'); if (!$return) return '

'.Tools::displayError('No payment method is available').'

'; return $return; @@ -412,8 +412,8 @@ class OrderOpcControllerCore extends ParentOrderController $result = array( 'checked' => $this->_setDefaultCarrierSelection($carriers), 'carriers' => $carriers, - 'HOOK_BEFORECARRIER' => Module::hookExec('beforeCarrier', array('carriers' => $carriers)), - 'HOOK_EXTRACARRIER' => Module::hookExec('extraCarrier', array('address' => $address_delivery)) + 'HOOK_BEFORECARRIER' => Hook::exec('beforeCarrier', array('carriers' => $carriers)), + 'HOOK_EXTRACARRIER' => Hook::exec('extraCarrier', array('address' => $address_delivery)) ); return $result; } diff --git a/controllers/front/ParentOrderController.php b/controllers/front/ParentOrderController.php index c6b35d512..09f86f669 100644 --- a/controllers/front/ParentOrderController.php +++ b/controllers/front/ParentOrderController.php @@ -222,7 +222,7 @@ class ParentOrderControllerCore extends FrontController else if (!$this->context->cart->isVirtualCart() && (int)(Tools::getValue('id_carrier')) == 0) $this->errors[] = Tools::displayError('Invalid carrier or no carrier selected'); - Module::hookExec('processCarrier', array('cart' => $this->context->cart)); + Hook::exec('processCarrier', array('cart' => $this->context->cart)); if (!$this->context->cart->update()) return false; @@ -293,8 +293,8 @@ class ParentOrderControllerCore extends FrontController 'currencyFormat' => $this->context->currency->format, 'currencyBlank' => $this->context->currency->blank)); $this->context->smarty->assign(array( - 'HOOK_SHOPPING_CART' => Module::hookExec('shoppingCart', $summary), - 'HOOK_SHOPPING_CART_EXTRA' => Module::hookExec('shoppingCartExtra', $summary) + 'HOOK_SHOPPING_CART' => Hook::exec('shoppingCart', $summary), + 'HOOK_SHOPPING_CART_EXTRA' => Hook::exec('shoppingCartExtra', $summary) )); } @@ -383,8 +383,8 @@ class ParentOrderControllerCore extends FrontController 'default_carrier' => (int)(Configuration::get('PS_CARRIER_DEFAULT')) )); $this->context->smarty->assign(array( - 'HOOK_EXTRACARRIER' => Module::hookExec('extraCarrier', array('address' => $address)), - 'HOOK_BEFORECARRIER' => Module::hookExec('beforeCarrier', array('carriers' => $carriers)) + 'HOOK_EXTRACARRIER' => Hook::exec('extraCarrier', array('address' => $address)), + 'HOOK_BEFORECARRIER' => Hook::exec('beforeCarrier', array('carriers' => $carriers)) )); } @@ -419,8 +419,8 @@ class ParentOrderControllerCore extends FrontController protected function _assignPayment() { $this->context->smarty->assign(array( - 'HOOK_TOP_PAYMENT' => Module::hookExec('paymentTop'), - 'HOOK_PAYMENT' => Module::hookExecPayment() + 'HOOK_TOP_PAYMENT' => Hook::exec('paymentTop'), + 'HOOK_PAYMENT' => Hook::exec('payment'), )); } diff --git a/controllers/front/ProductController.php b/controllers/front/ProductController.php index 67b0d3132..8c5203ae8 100644 --- a/controllers/front/ProductController.php +++ b/controllers/front/ProductController.php @@ -178,12 +178,12 @@ class ProductControllerCore extends FrontController 'attachments' => (($this->product->cache_has_attachments) ? $this->product->getAttachments($this->context->language->id) : array()), 'allow_oosp' => $this->product->isAvailableWhenOutOfStock((int)$this->product->out_of_stock), 'last_qties' => (int)Configuration::get('PS_LAST_QTIES'), - 'HOOK_EXTRA_LEFT' => Module::hookExec('extraLeft'), - 'HOOK_EXTRA_RIGHT' => Module::hookExec('extraRight'), - 'HOOK_PRODUCT_OOS' => Hook::productOutOfStock($this->product), - 'HOOK_PRODUCT_ACTIONS' => Module::hookExec('productActions'), - 'HOOK_PRODUCT_TAB' => Module::hookExec('productTab'), - 'HOOK_PRODUCT_TAB_CONTENT' => Module::hookExec('productTabContent'), + 'HOOK_EXTRA_LEFT' => Hook::exec('extraLeft'), + 'HOOK_EXTRA_RIGHT' => Hook::exec('extraRight'), + 'HOOK_PRODUCT_OOS' => Hook::exec('productOutOfStock', array('product' => $this->product)), + 'HOOK_PRODUCT_ACTIONS' => Hook::exec('productActions'), + 'HOOK_PRODUCT_TAB' => Hook::exec('productTab'), + 'HOOK_PRODUCT_TAB_CONTENT' => Hook::exec('productTabContent'), 'display_qties' => (int)Configuration::get('PS_DISPLAY_QTIES'), 'display_ht' => !Tax::excludeTaxeOption(), 'currencySign' => $this->context->currency->sign, @@ -499,7 +499,7 @@ class ProductControllerCore extends FrontController $this->context->smarty->assign('path', Tools::getPath((int)$this->product->id_category_default, $this->product->name)); $this->context->smarty->assign('categories', Category::getHomeCategories($this->context->language->id)); - $this->context->smarty->assign(array('HOOK_PRODUCT_FOOTER' => Hook::productFooter($this->product, $category))); + $this->context->smarty->assign(array('HOOK_PRODUCT_FOOTER' => Hook::exec('productFooter', array('product' => $this->product, 'category' => $category)))); } public function transformDescriptionWithImg($desc) diff --git a/controllers/front/SearchController.php b/controllers/front/SearchController.php index c7b308cee..3baafa1a8 100644 --- a/controllers/front/SearchController.php +++ b/controllers/front/SearchController.php @@ -64,7 +64,7 @@ class SearchControllerCore extends FrontController $this->n = abs((int)(Tools::getValue('n', Configuration::get('PS_PRODUCTS_PER_PAGE')))); $this->p = abs((int)(Tools::getValue('p', 1))); $search = Search::find($this->context->language->id, $query, $this->p, $this->n, $this->orderBy, $this->orderWay); - Module::hookExec('search', array('expr' => $query, 'total' => $search['total'])); + Hook::exec('search', array('expr' => $query, 'total' => $search['total'])); $nbProducts = $search['total']; $this->pagination($nbProducts); $this->context->smarty->assign(array( @@ -81,7 +81,7 @@ class SearchControllerCore extends FrontController $this->n = abs((int)(Tools::getValue('n', Configuration::get('PS_PRODUCTS_PER_PAGE')))); $this->p = abs((int)(Tools::getValue('p', 1))); $search = Search::find($this->context->language->id, $query, $this->p, $this->n, $this->orderBy, $this->orderWay); - Module::hookExec('search', array('expr' => $query, 'total' => $search['total'])); + Hook::exec('search', array('expr' => $query, 'total' => $search['total'])); $nbProducts = $search['total']; $this->pagination($nbProducts); $this->context->smarty->assign(array( @@ -96,7 +96,7 @@ class SearchControllerCore extends FrontController $nbProducts = (int)(Search::searchTag($this->context->language->id, $tag, true)); $this->pagination($nbProducts); $result = Search::searchTag($this->context->language->id, $tag, false, $this->p, $this->n, $this->orderBy, $this->orderWay); - Module::hookExec('search', array('expr' => $tag, 'total' => count($result))); + Hook::exec('search', array('expr' => $tag, 'total' => count($result))); $this->context->smarty->assign(array( 'search_tag' => $tag, 'products' => $result, // DEPRECATED (since to 1.4), not use this: conflict with block_cart module @@ -138,4 +138,4 @@ class SearchControllerCore extends FrontController if (!$this->instant_search && !$this->ajax_search) $this->addCSS(_THEME_CSS_DIR_.'product_list.css'); } -} \ No newline at end of file +} diff --git a/install-dev/sql/db.sql b/install-dev/sql/db.sql index 41d357abf..a5863b775 100644 --- a/install-dev/sql/db.sql +++ b/install-dev/sql/db.sql @@ -840,6 +840,14 @@ CREATE TABLE `PREFIX_hook` ( UNIQUE KEY `hook_name` (`name`) ) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8; +CREATE TABLE `PREFIX_hook_alias` ( + `id_hook_alias` int(10) unsigned NOT NULL auto_increment, + `alias` varchar(64) NOT NULL, + `name` varchar(64) NOT NULL, + PRIMARY KEY (`id_hook_alias`), + UNIQUE KEY `alias` (`alias`) +) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8; + CREATE TABLE `PREFIX_hook_module` ( `id_module` int(10) unsigned NOT NULL, `id_shop` INT(11) UNSIGNED NOT NULL DEFAULT '1', diff --git a/install-dev/sql/db_settings_lite.sql b/install-dev/sql/db_settings_lite.sql index b42100d06..6eabf0afd 100644 --- a/install-dev/sql/db_settings_lite.sql +++ b/install-dev/sql/db_settings_lite.sql @@ -1,91 +1,179 @@ SET NAMES 'utf8'; +INSERT INTO `PREFIX_hook_alias` (`id_hook_alias`, `name`, `alias`) VALUES +(1, 'displayPayment', 'payment'), +(2, 'actionValidateOrder', 'newOrder'), +(3, 'actionPaymentConfirmation', 'paymentConfirm'), +(4, 'displayPaymentReturn', 'paymentReturn'), +(5, 'actionUpdateQuantity', 'updateQuantity'), +(6, 'displayRightColumn', 'rightColumn'), +(7, 'displayLeftColumn', 'leftColumn'), +(8, 'displayHome', 'home'), +(9, 'displayHeader', 'header'), +(10, 'actionCartSave', 'cart'), +(11, 'actionAuthentication', 'authentication'), +(12, 'actionProductAdd', 'addproduct'), +(13, 'actionProductUpdate', 'updateproduct'), +(14, 'displayTop', 'top'), +(15, 'displayRightColumnProduct', 'extraRight'), +(16, 'actionProductDelete', 'deleteproduct'), +(17, 'displayFooterProduct', 'productfooter'), +(18, 'displayInvoice', 'invoice'), +(19, 'actionOrderStatusUpdate', 'updateOrderStatus'), +(20, 'displayAdminOrder', 'adminOrder'), +(21, 'displayFooter', 'footer'), +(22, 'displayPDFInvoice', 'PDFInvoice'), +(23, 'displayAdminCustomers', 'adminCustomers'), +(24, 'displayOrderConfirmation', 'orderConfirmation'), +(25, 'actionCustomerAccountAdd', 'createAccount'), +(26, 'displayCustomerAccount', 'customerAccount'), +(27, 'actionOrderSlipAdd', 'orderSlip'), +(28, 'displayProductTab', 'productTab'), +(29, 'displayProductTabContent', 'productTabContent'), +(30, 'displayShoppingCartFooter', 'shoppingCart'), +(31, 'displayCustomerAccountForm', 'createAccountForm'), +(32, 'displayAdminStatsModules', 'AdminStatsModules'), +(33, 'displayAdminStatsGraphEngine', 'GraphEngine'), +(34, 'actionOrderReturn', 'orderReturn'), +(35, 'displayProductButtons', 'productActions'), +(36, 'displayBackOfficeHome', 'backOfficeHome'), +(37, 'displayAdminStatsGridEngine', 'GridEngine'), +(38, 'actionWatermark', 'watermark'), +(39, 'actionProductCancel', 'cancelProduct'), +(40, 'displayLeftColumnProduct', 'extraLeft'), +(41, 'actionProductOutOfStock', 'productOutOfStock'), +(42, 'actionProductAttributeUpdate', 'updateProductAttribute'), +(43, 'displayCarrierList', 'extraCarrier'), +(44, 'displayShoppingCart', 'shoppingCartExtra'), +(45, 'actionSearch', 'search'), +(46, 'displayBeforePayment', 'backBeforePayment'), +(47, 'actionCarrierUpdate', 'updateCarrier'), +(48, 'actionOrderStatusPostUpdate', 'postUpdateOrderStatus'), +(49, 'displayCustomerAccountFormTop', 'createAccountTop'), +(50, 'displayBackOfficeHeader', 'backOfficeHeader'), +(51, 'displayBackOfficeTop', 'backOfficeTop'), +(52, 'displayBackOfficeFooter', 'backOfficeFooter'), +(53, 'actionProductAttributeDelete', 'deleteProductAttribute'), +(54, 'actionCarrierProcess', 'processCarrier'), +(55, 'actionOrderDetail', 'orderDetail'), +(56, 'displayBeforeCarrier', 'beforeCarrier'), +(57, 'displayOrderDetail', 'orderDetailDisplayed'), +(58, 'actionPaymentCCAdd', 'paymentCCAdded'), +(59, 'displayProductComparison', 'extraProductComparison'), +(60, 'actionCategoryAdd', 'categoryAddition'), +(61, 'actionCategoryUpdate', 'categoryUpdate'), +(62, 'actionCategoryDelete', 'categoryDeletion'), +(63, 'actionBeforeAuthentication', 'beforeAuthentication'), +(64, 'displayPaymentTop', 'paymentTop'), +(65, 'actionHtaccessCreate', 'afterCreateHtaccess'), +(66, 'actionAdminMetaSave', 'afterSaveAdminMeta'), +(67, 'displayAttributeGroupForm', 'attributeGroupForm'), +(68, 'actionAttributeGroupSave', 'afterSaveAttributeGroup'), +(69, 'actionAttributeGroupDelete', 'afterDeleteAttributeGroup'), +(70, 'displayFeatureForm', 'featureForm'), +(71, 'actionFeatureSave', 'afterSaveFeature'), +(72, 'actionFeatureDelete', 'afterDeleteFeature'), +(73, 'actionProductSave', 'afterSaveProduct'), +(74, 'actionProductListOverride', 'productListAssign'), +(75, 'displayAttributeGroupPostProcess', 'postProcessAttributeGroup'), +(76, 'displayFeaturePostProcess', 'postProcessFeature'), +(77, 'displayFeatureValueForm', 'featureValueForm'), +(78, 'displayFeatureValuePostProcess', 'postProcessFeatureValue'), +(79, 'actionFeatureValueDelete', 'afterDeleteFeatureValue'), +(80, 'actionFeatureValueSave', 'afterSaveFeatureValue'), +(81, 'displayAttributeForm', 'attributeForm'), +(82, 'actionAttributePostProcess', 'postProcessAttribute'), +(83, 'actionAttributeDelete', 'afterDeleteAttribute'), +(84, 'actionAttributeSave', 'afterSaveAttribute'), +(85, 'actionTaxManager', 'taxManager'); + + INSERT INTO `PREFIX_hook` (`id_hook`, `name`, `title`, `description`, `position`, `live_edit`) VALUES -(1, 'payment', 'Payment', NULL, 1, 1), -(2, 'newOrder', 'New orders', NULL, 0, 0), -(3, 'paymentConfirm', 'Payment confirmation', NULL, 0, 0), -(4, 'paymentReturn', 'Payment return', NULL, 0, 0), -(5, 'updateQuantity', 'Quantity update', 'Quantity is updated only when the customer effectively place his order.', 0, 0), -(6, 'rightColumn', 'Right column blocks', NULL, 1, 1), -(7, 'leftColumn', 'Left column blocks', NULL, 1, 1), -(8, 'home', 'Homepage content', NULL, 1, 1), -(9, 'header', 'Header of pages', 'A hook which allow you to do things in the header of each pages', 1, 0), -(10, 'cart', 'Cart creation and update', NULL, 0, 0), -(11, 'authentication', 'Successful customer authentication', NULL, 0, 0), -(12, 'addproduct', 'Product creation', NULL, 0, 0), -(13, 'updateproduct', 'Product Update', NULL, 0, 0), -(14, 'top', 'Top of pages', 'A hook which allow you to do things a the top of each pages.', 1, 0), -(15, 'extraRight', 'Extra actions on the product page (right column).', NULL, 0, 0), -(16, 'deleteproduct', 'Product deletion', 'This hook is called when a product is deleted', 0, 0), -(17, 'productfooter', 'Product footer', 'Add new blocks under the product description', 1, 1), -(18, 'invoice', 'Invoice', 'Add blocks to invoice (order)', 1, 0), -(19, 'updateOrderStatus', 'Order''s status update event', 'Launch modules when the order''s status of an order change.', 0, 0), -(20, 'adminOrder', 'Display in Back-Office, tab AdminOrder', 'Launch modules when the tab AdminOrder is displayed on back-office.', 0, 0), -(21, 'footer', 'Footer', 'Add block in footer', 1, 0), -(22, 'PDFInvoice', 'PDF Invoice', 'Allow the display of extra informations into the PDF invoice', 0, 0), -(23, 'adminCustomers', 'Display in Back-Office, tab AdminCustomers', 'Launch modules when the tab AdminCustomers is displayed on back-office.', 0, 0), -(24, 'orderConfirmation', 'Order confirmation page', 'Called on order confirmation page', 0, 0), -(25, 'createAccount', 'Successful customer create account', 'Called when new customer create account successfuled', 0, 0), -(26, 'customerAccount', 'Customer account page display in front office', 'Display on page account of the customer', 1, 0), -(27, 'orderSlip', 'Called when a order slip is created', 'Called when a quantity of one product change in an order.', 0, 0), -(28, 'productTab', 'Tabs on product page', 'Called on order product page tabs', 0, 0), -(29, 'productTabContent', 'Content of tabs on product page', 'Called on order product page tabs', 0, 0), -(30, 'shoppingCart', 'Shopping cart footer', 'Display some specific informations on the shopping cart page', 0, 0), -(31, 'createAccountForm', 'Customer account creation form', 'Display some information on the form to create a customer account', 1, 0), -(32, 'AdminStatsModules','Stats - Modules', NULL, 1, 0), -(33, 'GraphEngine','Graph Engines', NULL, 0, 0), -(34, 'orderReturn','Product returned', NULL, 0, 0), -(35, 'productActions', 'Product actions', 'Put new action buttons on product page', 1, 0), -(36, 'backOfficeHome', 'Administration panel homepage', NULL, 1, 0), -(37, 'GridEngine','Grid Engines', NULL, 0, 0), -(38, 'watermark','Watermark', NULL, 0, 0), -(39, 'cancelProduct', 'Product cancelled', 'This hook is called when you cancel a product in an order', 0, 0), -(40, 'extraLeft', 'Extra actions on the product page (left column).', NULL, 0, 0), -(41, 'productOutOfStock', 'Product out of stock', 'Make action while product is out of stock', 1, 0), -(42, 'updateProductAttribute', 'Product attribute update', NULL, 0, 0), -(43, 'extraCarrier', 'Extra carrier (module mode)', NULL, 0, 0), -(44, 'shoppingCartExtra', 'Shopping cart extra button', 'Display some specific informations', 1, 0), -(45, 'search', 'Search', NULL, 0, 0), -(46, 'backBeforePayment', 'Redirect in order process', 'Redirect user to the module instead of displaying payment modules', 0, 0), -(47, 'updateCarrier', 'Carrier Update', 'This hook is called when a carrier is updated', 0, 0), -(48, 'postUpdateOrderStatus', 'Post update of order status', NULL, 0, 0), -(49, 'createAccountTop', 'Block above the form for create an account', NULL, 1, 0), -(50, 'backOfficeHeader', 'Administration panel header', NULL , 0, 0), -(51, 'backOfficeTop', 'Administration panel hover the tabs', NULL , 1, 0), -(52, 'backOfficeFooter', 'Administration panel footer', NULL , 1, 0), -(53, 'deleteProductAttribute', 'Product Attribute Deletion', NULL, 0, 0), -(54, 'processCarrier', 'Carrier Process', NULL, 0, 0), -(55, 'orderDetail', 'Order Detail', 'To set the follow-up in smarty when order detail is called', 0, 0), -(56, 'beforeCarrier', 'Before carrier list', 'This hook is display before the carrier list on Front office', 1, 0), -(57, 'orderDetailDisplayed', 'Order detail displayed', 'Displayed on order detail on front office', 1, 0), -(58, 'paymentCCAdded', 'Payment CC added', 'Payment CC added', 0, 0), -(59, 'extraProductComparison', 'Extra Product Comparison', 'Extra Product Comparison', 0, 0), -(60, 'categoryAddition', 'Category creation', '', 0, 0), -(61, 'categoryUpdate', 'Category modification', '', 0, 0), -(62, 'categoryDeletion', 'Category removal', '', 0, 0), -(63, 'beforeAuthentication', 'Before Authentication', 'Before authentication', 0, 0), -(64, 'paymentTop', 'Top of payment page', 'Top of payment page', 0, 0), -(65, 'afterCreateHtaccess', 'After htaccess creation', 'After htaccess creation', 0, 0), -(66, 'afterSaveAdminMeta', 'After save configuration in AdminMeta', 'After save configuration in AdminMeta', 0, 0), -(67, 'attributeGroupForm', 'Add fileds to the form "attribute group"', 'Add fileds to the form "attribute group"', 0, 0), -(68, 'afterSaveAttributeGroup', 'On saving attribute group', 'On saving attribute group', 0, 0), -(69, 'afterDeleteAttributeGroup', 'On deleting attribute group', 'On deleting attribute group', 0, 0), -(70, 'featureForm', 'Add fields to the form "feature"', 'Add fields to the form "feature"', 0, 0), -(71, 'afterSaveFeature', 'On saving attribute feature', 'On saving attribute feature', 0, 0), -(72, 'afterDeleteFeature', 'On deleting attribute feature', 'On deleting attribute feature', 0, 0), -(73, 'afterSaveProduct', 'On saving products', 'On saving products', 0, 0), -(74, 'productListAssign', 'Assign product list to a category', 'Assign product list to a category', 0, 0), -(75, 'postProcessAttributeGroup', 'On post-process in admin attribute group', 'On post-process in admin attribute group', 0, 0), -(76, 'postProcessFeature', 'On post-process in admin feature', 'On post-process in admin feature', 0, 0), -(77, 'featureValueForm', 'Add fileds to the form "feature value"', 'Add fileds to the form "feature value"', 0, 0), -(78, 'postProcessFeatureValue', 'On post-process in admin feature value', 'On post-process in admin feature value', 0, 0), -(79, 'afterDeleteFeatureValue', 'On deleting attribute feature value', 'On deleting attribute feature value', 0, 0), -(90, 'afterSaveFeatureValue', 'On saving attribute feature value', 'On saving attribute feature value', 0, 0), -(91, 'attributeForm', 'Add fileds to the form "feature value"', 'Add fileds to the form "feature value"', 0, 0), -(92, 'postProcessAttribute', 'On post-process in admin feature value', 'On post-process in admin feature value', 0, 0), -(93, 'afterDeleteAttribute', 'On deleting attribute feature value', 'On deleting attribute feature value', 0, 0), -(94, 'afterSaveAttribute', 'On saving attribute feature value', 'On saving attribute feature value', 0, 0), -(95, 'taxManager', 'Tax Manager Factory', '' , 0, 0); +(1, 'displayPayment', 'Payment', NULL, 1, 1), +(2, 'actionValidateOrder', 'New orders', NULL, 0, 0), +(3, 'actionPaymentConfirmation', 'Payment confirmation', NULL, 0, 0), +(4, 'displayPaymentReturn', 'Payment return', NULL, 0, 0), +(5, 'actionUpdateQuantity', 'Quantity update', 'Quantity is updated only when the customer effectively place his order.', 0, 0), +(6, 'displayRightColumn', 'Right column blocks', NULL, 1, 1), +(7, 'displayLeftColumn', 'Left column blocks', NULL, 1, 1), +(8, 'displayHome', 'Homepage content', NULL, 1, 1), +(9, 'displayHeader', 'Header of pages', 'A hook which allow you to do things in the header of each pages', 1, 0), +(10, 'actionCartSave', 'Cart creation and update', NULL, 0, 0), +(11, 'actionAuthentication', 'Successful customer authentication', NULL, 0, 0), +(12, 'actionProductAdd', 'Product creation', NULL, 0, 0), +(13, 'actionProductUpdate', 'Product Update', NULL, 0, 0), +(14, 'displayTop', 'Top of pages', 'A hook which allow you to do things a the top of each pages.', 1, 0), +(15, 'displayRightColumnProduct', 'Extra actions on the product page (right column).', NULL, 0, 0), +(16, 'actionProductDelete', 'Product deletion', 'This hook is called when a product is deleted', 0, 0), +(17, 'displayFooterProduct', 'Product footer', 'Add new blocks under the product description', 1, 1), +(18, 'displayInvoice', 'Invoice', 'Add blocks to invoice (order)', 1, 0), +(19, 'actionOrderStatusUpdate', 'Order''s status update event', 'Launch modules when the order''s status of an order change.', 0, 0), +(20, 'displayAdminOrder', 'Display in Back-Office, tab AdminOrder', 'Launch modules when the tab AdminOrder is displayed on back-office.', 0, 0), +(21, 'displayFooter', 'Footer', 'Add block in footer', 1, 0), +(22, 'displayPDFInvoice', 'PDF Invoice', 'Allow the display of extra informations into the PDF invoice', 0, 0), +(23, 'displayAdminCustomers', 'Display in Back-Office, tab AdminCustomers', 'Launch modules when the tab AdminCustomers is displayed on back-office.', 0, 0), +(24, 'displayOrderConfirmation', 'Order confirmation page', 'Called on order confirmation page', 0, 0), +(25, 'actionCustomerAccountAdd', 'Successful customer create account', 'Called when new customer create account successfuled', 0, 0), +(26, 'displayCustomerAccount', 'Customer account page display in front office', 'Display on page account of the customer', 1, 0), +(27, 'actionOrderSlipAdd', 'Called when a order slip is created', 'Called when a quantity of one product change in an order.', 0, 0), +(28, 'displayProductTab', 'Tabs on product page', 'Called on order product page tabs', 0, 0), +(29, 'displayProductTabContent', 'Content of tabs on product page', 'Called on order product page tabs', 0, 0), +(30, 'displayShoppingCartFooter', 'Shopping cart footer', 'Display some specific informations on the shopping cart page', 0, 0), +(31, 'displayCustomerAccountForm', 'Customer account creation form', 'Display some information on the form to create a customer account', 1, 0), +(32, 'displayAdminStatsModules','Stats - Modules', NULL, 1, 0), +(33, 'displayAdminStatsGraphEngine','Graph Engines', NULL, 0, 0), +(34, 'actionOrderReturn','Product returned', NULL, 0, 0), +(35, 'displayProductButtons', 'Product actions', 'Put new action buttons on product page', 1, 0), +(36, 'displayBackOfficeHome', 'Administration panel homepage', NULL, 1, 0), +(37, 'displayAdminStatsGridEngine','Grid Engines', NULL, 0, 0), +(38, 'actionWatermark','Watermark', NULL, 0, 0), +(39, 'actionProductCancel', 'Product cancelled', 'This hook is called when you cancel a product in an order', 0, 0), +(40, 'displayLeftColumnProduct', 'Extra actions on the product page (left column).', NULL, 0, 0), +(41, 'actionProductOutOfStock', 'Product out of stock', 'Make action while product is out of stock', 1, 0), +(42, 'actionProductAttributeUpdate', 'Product attribute update', NULL, 0, 0), +(43, 'displayCarrierList', 'Extra carrier (module mode)', NULL, 0, 0), +(44, 'displayShoppingCart', 'Shopping cart extra button', 'Display some specific informations', 1, 0), +(45, 'actionSearch', 'Search', NULL, 0, 0), +(46, 'displayBeforePayment', 'Redirect in order process', 'Redirect user to the module instead of displaying payment modules', 0, 0), +(47, 'actionCarrierUpdate', 'Carrier Update', 'This hook is called when a carrier is updated', 0, 0), +(48, 'actionOrderStatusPostUpdate', 'Post update of order status', NULL, 0, 0), +(49, 'displayCustomerAccountFormTop', 'Block above the form for create an account', NULL, 1, 0), +(50, 'displayBackOfficeHeader', 'Administration panel header', NULL , 0, 0), +(51, 'displayBackOfficeTop', 'Administration panel hover the tabs', NULL , 1, 0), +(52, 'displayBackOfficeFooter', 'Administration panel footer', NULL , 1, 0), +(53, 'actionProductAttributeDelete', 'Product Attribute Deletion', NULL, 0, 0), +(54, 'actionCarrierProcess', 'Carrier Process', NULL, 0, 0), +(55, 'actionOrderDetail', 'Order Detail', 'To set the follow-up in smarty when order detail is called', 0, 0), +(56, 'displayBeforeCarrier', 'Before carrier list', 'This hook is display before the carrier list on Front office', 1, 0), +(57, 'displayOrderDetail', 'Order detail displayed', 'Displayed on order detail on front office', 1, 0), +(58, 'actionPaymentCCAdd', 'Payment CC added', 'Payment CC added', 0, 0), +(59, 'displayProductComparison', 'Extra Product Comparison', 'Extra Product Comparison', 0, 0), +(60, 'actionCategoryAdd', 'Category creation', '', 0, 0), +(61, 'actionCategoryUpdate', 'Category modification', '', 0, 0), +(62, 'actionCategoryDelete', 'Category removal', '', 0, 0), +(63, 'actionBeforeAuthentication', 'Before Authentication', 'Before authentication', 0, 0), +(64, 'displayPaymentTop', 'Top of payment page', 'Top of payment page', 0, 0), +(65, 'actionHtaccessCreate', 'After htaccess creation', 'After htaccess creation', 0, 0), +(66, 'actionAdminMetaSave', 'After save configuration in AdminMeta', 'After save configuration in AdminMeta', 0, 0), +(67, 'displayAttributeGroupForm', 'Add fileds to the form "attribute group"', 'Add fileds to the form "attribute group"', 0, 0), +(68, 'actionAttributeGroupSave', 'On saving attribute group', 'On saving attribute group', 0, 0), +(69, 'actionAttributeGroupDelete', 'On deleting attribute group', 'On deleting attribute group', 0, 0), +(70, 'displayFeatureForm', 'Add fields to the form "feature"', 'Add fields to the form "feature"', 0, 0), +(71, 'actionFeatureSave', 'On saving attribute feature', 'On saving attribute feature', 0, 0), +(72, 'actionFeatureDelete', 'On deleting attribute feature', 'On deleting attribute feature', 0, 0), +(73, 'actionProductSave', 'On saving products', 'On saving products', 0, 0), +(74, 'actionProductListOverride', 'Assign product list to a category', 'Assign product list to a category', 0, 0), +(75, 'displayAttributeGroupPostProcess', 'On post-process in admin attribute group', 'On post-process in admin attribute group', 0, 0), +(76, 'displayFeaturePostProcess', 'On post-process in admin feature', 'On post-process in admin feature', 0, 0), +(77, 'displayFeatureValueForm', 'Add fileds to the form "feature value"', 'Add fileds to the form "feature value"', 0, 0), +(78, 'displayFeatureValuePostProcess', 'On post-process in admin feature value', 'On post-process in admin feature value', 0, 0), +(79, 'actionFeatureValueDelete', 'On deleting attribute feature value', 'On deleting attribute feature value', 0, 0), +(90, 'actionFeatureValueSave', 'On saving attribute feature value', 'On saving attribute feature value', 0, 0), +(91, 'displayAttributeForm', 'Add fileds to the form "feature value"', 'Add fileds to the form "feature value"', 0, 0), +(92, 'actionAttributePostProcess', 'On post-process in admin feature value', 'On post-process in admin feature value', 0, 0), +(93, 'actionAttributeDelete', 'On deleting attribute feature value', 'On deleting attribute feature value', 0, 0), +(94, 'actionAttributeSave', 'On saving attribute feature value', 'On saving attribute feature value', 0, 0), +(95, 'actionTaxManager', 'Tax Manager Factory', '' , 0, 0); INSERT INTO `PREFIX_configuration` (`id_configuration`, `name`, `value`, `date_add`, `date_upd`) VALUES (1, 'PS_LANG_DEFAULT', '1', NOW(), NOW()), diff --git a/install-dev/sql/upgrade/1.5.0.1.sql b/install-dev/sql/upgrade/1.5.0.1.sql index 333b626ce..f097a11d8 100644 --- a/install-dev/sql/upgrade/1.5.0.1.sql +++ b/install-dev/sql/upgrade/1.5.0.1.sql @@ -316,3 +316,93 @@ INSERT INTO `PREFIX_configuration` (`name`, `value`, `date_add`, `date_upd`) ( ); UPDATE `PREFIX_tab` SET class_name = 'AdminCartRules' WHERE class_name = 'AdminDiscounts'; + + + + + +UPDATE `PREFIX_hook` SET `name` = 'displayPayment' WHERE `name` = 'payment'; +UPDATE `PREFIX_hook` SET `name` = 'actionValidateOrder' WHERE `name` = 'newOrder'; +UPDATE `PREFIX_hook` SET `name` = 'actionPaymentConfirmation' WHERE `name` = 'paymentConfirm'; +UPDATE `PREFIX_hook` SET `name` = 'displayPaymentReturn' WHERE `name` = 'paymentReturn'; +UPDATE `PREFIX_hook` SET `name` = 'actionUpdateQuantity' WHERE `name` = 'updateQuantity'; +UPDATE `PREFIX_hook` SET `name` = 'displayRightColumn' WHERE `name` = 'rightColumn'; +UPDATE `PREFIX_hook` SET `name` = 'displayLeftColumn' WHERE `name` = 'leftColumn'; +UPDATE `PREFIX_hook` SET `name` = 'displayHome' WHERE `name` = 'home'; +UPDATE `PREFIX_hook` SET `name` = 'displayHeader' WHERE `name` = 'header'; +UPDATE `PREFIX_hook` SET `name` = 'actionCartSave' WHERE `name` = 'cart'; +UPDATE `PREFIX_hook` SET `name` = 'actionAuthentication' WHERE `name` = 'authentication'; +UPDATE `PREFIX_hook` SET `name` = 'actionProductAdd' WHERE `name` = 'addproduct'; +UPDATE `PREFIX_hook` SET `name` = 'actionProductUpdate' WHERE `name` = 'updateproduct'; +UPDATE `PREFIX_hook` SET `name` = 'displayTop' WHERE `name` = 'top'; +UPDATE `PREFIX_hook` SET `name` = 'displayRightColumnProduct' WHERE `name` = 'extraRight'; +UPDATE `PREFIX_hook` SET `name` = 'actionProductDelete' WHERE `name` = 'deleteproduct'; +UPDATE `PREFIX_hook` SET `name` = 'displayFooterProduct' WHERE `name` = 'productfooter'; +UPDATE `PREFIX_hook` SET `name` = 'displayInvoice' WHERE `name` = 'invoice'; +UPDATE `PREFIX_hook` SET `name` = 'actionOrderStatusUpdate' WHERE `name` = 'updateOrderStatus'; +UPDATE `PREFIX_hook` SET `name` = 'displayAdminOrder' WHERE `name` = 'adminOrder'; +UPDATE `PREFIX_hook` SET `name` = 'displayFooter' WHERE `name` = 'footer'; +UPDATE `PREFIX_hook` SET `name` = 'displayPDFInvoice' WHERE `name` = 'PDFInvoice'; +UPDATE `PREFIX_hook` SET `name` = 'displayAdminCustomers' WHERE `name` = 'adminCustomers'; +UPDATE `PREFIX_hook` SET `name` = 'displayOrderConfirmation' WHERE `name` = 'orderConfirmation'; +UPDATE `PREFIX_hook` SET `name` = 'actionCustomerAccountAdd' WHERE `name` = 'createAccount'; +UPDATE `PREFIX_hook` SET `name` = 'displayCustomerAccount' WHERE `name` = 'customerAccount'; +UPDATE `PREFIX_hook` SET `name` = 'actionOrderSlipAdd' WHERE `name` = 'orderSlip'; +UPDATE `PREFIX_hook` SET `name` = 'displayProductTab' WHERE `name` = 'productTab'; +UPDATE `PREFIX_hook` SET `name` = 'displayProductTabContent' WHERE `name` = 'productTabContent'; +UPDATE `PREFIX_hook` SET `name` = 'displayShoppingCartFooter' WHERE `name` = 'shoppingCart'; +UPDATE `PREFIX_hook` SET `name` = 'displayCustomerAccountForm' WHERE `name` = 'createAccountForm'; +UPDATE `PREFIX_hook` SET `name` = 'displayAdminStatsModules' WHERE `name` = 'AdminStatsModules'; +UPDATE `PREFIX_hook` SET `name` = 'displayAdminStatsGraphEngine' WHERE `name` = 'GraphEngine'; +UPDATE `PREFIX_hook` SET `name` = 'actionOrderReturn' WHERE `name` = 'orderReturn'; +UPDATE `PREFIX_hook` SET `name` = 'displayProductButtons' WHERE `name` = 'productActions'; +UPDATE `PREFIX_hook` SET `name` = 'displayBackOfficeHome' WHERE `name` = 'backOfficeHome'; +UPDATE `PREFIX_hook` SET `name` = 'displayAdminStatsGridEngine' WHERE `name` = 'GridEngine'; +UPDATE `PREFIX_hook` SET `name` = 'actionWatermark' WHERE `name` = 'watermark'; +UPDATE `PREFIX_hook` SET `name` = 'actionProductCancel' WHERE `name` = 'cancelProduct'; +UPDATE `PREFIX_hook` SET `name` = 'displayLeftColumnProduct' WHERE `name` = 'extraLeft'; +UPDATE `PREFIX_hook` SET `name` = 'actionProductOutOfStock' WHERE `name` = 'productOutOfStock'; +UPDATE `PREFIX_hook` SET `name` = 'actionProductAttributeUpdate' WHERE `name` = 'updateProductAttribute'; +UPDATE `PREFIX_hook` SET `name` = 'displayCarrierList' WHERE `name` = 'extraCarrier'; +UPDATE `PREFIX_hook` SET `name` = 'displayShoppingCart' WHERE `name` = 'shoppingCartExtra'; +UPDATE `PREFIX_hook` SET `name` = 'actionSearch' WHERE `name` = 'search'; +UPDATE `PREFIX_hook` SET `name` = 'displayBeforePayment' WHERE `name` = 'backBeforePayment'; +UPDATE `PREFIX_hook` SET `name` = 'actionCarrierUpdate' WHERE `name` = 'updateCarrier'; +UPDATE `PREFIX_hook` SET `name` = 'actionOrderStatusPostUpdate' WHERE `name` = 'postUpdateOrderStatus'; +UPDATE `PREFIX_hook` SET `name` = 'displayCustomerAccountFormTop' WHERE `name` = 'createAccountTop'; +UPDATE `PREFIX_hook` SET `name` = 'displayBackOfficeHeader' WHERE `name` = 'backOfficeHeader'; +UPDATE `PREFIX_hook` SET `name` = 'displayBackOfficeTop' WHERE `name` = 'backOfficeTop'; +UPDATE `PREFIX_hook` SET `name` = 'displayBackOfficeFooter' WHERE `name` = 'backOfficeFooter'; +UPDATE `PREFIX_hook` SET `name` = 'actionProductAttributeDelete' WHERE `name` = 'deleteProductAttribute'; +UPDATE `PREFIX_hook` SET `name` = 'actionCarrierProcess' WHERE `name` = 'processCarrier'; +UPDATE `PREFIX_hook` SET `name` = 'actionOrderDetail' WHERE `name` = 'orderDetail'; +UPDATE `PREFIX_hook` SET `name` = 'displayBeforeCarrier' WHERE `name` = 'beforeCarrier'; +UPDATE `PREFIX_hook` SET `name` = 'displayOrderDetail' WHERE `name` = 'orderDetailDisplayed'; +UPDATE `PREFIX_hook` SET `name` = 'actionPaymentCCAdd' WHERE `name` = 'paymentCCAdded'; +UPDATE `PREFIX_hook` SET `name` = 'displayProductComparison' WHERE `name` = 'extraProductComparison'; +UPDATE `PREFIX_hook` SET `name` = 'actionCategoryAdd' WHERE `name` = 'categoryAddition'; +UPDATE `PREFIX_hook` SET `name` = 'actionCategoryUpdate' WHERE `name` = 'categoryUpdate'; +UPDATE `PREFIX_hook` SET `name` = 'actionCategoryDelete' WHERE `name` = 'categoryDeletion'; +UPDATE `PREFIX_hook` SET `name` = 'actionBeforeAuthentication' WHERE `name` = 'beforeAuthentication'; +UPDATE `PREFIX_hook` SET `name` = 'displayPaymentTop' WHERE `name` = 'paymentTop'; +UPDATE `PREFIX_hook` SET `name` = 'actionHtaccessCreate' WHERE `name` = 'afterCreateHtaccess'; +UPDATE `PREFIX_hook` SET `name` = 'actionAdminMetaSave' WHERE `name` = 'afterSaveAdminMeta'; +UPDATE `PREFIX_hook` SET `name` = 'displayAttributeGroupForm' WHERE `name` = 'attributeGroupForm'; +UPDATE `PREFIX_hook` SET `name` = 'actionAttributeGroupSave' WHERE `name` = 'afterSaveAttributeGroup'; +UPDATE `PREFIX_hook` SET `name` = 'actionAttributeGroupDelete' WHERE `name` = 'afterDeleteAttributeGroup'; +UPDATE `PREFIX_hook` SET `name` = 'displayFeatureForm' WHERE `name` = 'featureForm'; +UPDATE `PREFIX_hook` SET `name` = 'actionFeatureSave' WHERE `name` = 'afterSaveFeature'; +UPDATE `PREFIX_hook` SET `name` = 'actionFeatureDelete' WHERE `name` = 'afterDeleteFeature'; +UPDATE `PREFIX_hook` SET `name` = 'actionProductSave' WHERE `name` = 'afterSaveProduct'; +UPDATE `PREFIX_hook` SET `name` = 'actionProductListOverride' WHERE `name` = 'productListAssign'; +UPDATE `PREFIX_hook` SET `name` = 'displayAttributeGroupPostProcess' WHERE `name` = 'postProcessAttributeGroup'; +UPDATE `PREFIX_hook` SET `name` = 'displayFeaturePostProcess' WHERE `name` = 'postProcessFeature'; +UPDATE `PREFIX_hook` SET `name` = 'displayFeatureValueForm' WHERE `name` = 'featureValueForm'; +UPDATE `PREFIX_hook` SET `name` = 'displayFeatureValuePostProcess' WHERE `name` = 'postProcessFeatureValue'; +UPDATE `PREFIX_hook` SET `name` = 'actionFeatureValueDelete' WHERE `name` = 'afterDeleteFeatureValue'; +UPDATE `PREFIX_hook` SET `name` = 'actionFeatureValueSave' WHERE `name` = 'afterSaveFeatureValue'; +UPDATE `PREFIX_hook` SET `name` = 'displayAttributeForm' WHERE `name` = 'attributeForm'; +UPDATE `PREFIX_hook` SET `name` = 'actionAttributePostProcess' WHERE `name` = 'postProcessAttribute'; +UPDATE `PREFIX_hook` SET `name` = 'actionAttributeDelete' WHERE `name` = 'afterDeleteAttribute'; +UPDATE `PREFIX_hook` SET `name` = 'actionAttributeSave' WHERE `name` = 'afterSaveAttribute'; +UPDATE `PREFIX_hook` SET `name` = 'actionTaxManager' WHERE `name` = 'taxManager'; diff --git a/modules/blocklayered/config.xml b/modules/blocklayered/config.xml index 7ec5577d0..786dc0c35 100644 --- a/modules/blocklayered/config.xml +++ b/modules/blocklayered/config.xml @@ -2,7 +2,7 @@ blocklayered - + diff --git a/modules/blockmyaccount/blockmyaccount.php b/modules/blockmyaccount/blockmyaccount.php index 758df4770..7f3511f46 100644 --- a/modules/blockmyaccount/blockmyaccount.php +++ b/modules/blockmyaccount/blockmyaccount.php @@ -64,7 +64,7 @@ class BlockMyAccount extends Module $this->templateAssign(array( 'voucherAllowed' => (int)Configuration::get('PS_VOUCHERS'), 'returnAllowed' => (int)Configuration::get('PS_ORDER_RETURN'), - 'HOOK_BLOCK_MY_ACCOUNT' => Module::hookExec('myAccountBlock'), + 'HOOK_BLOCK_MY_ACCOUNT' => Hook::exec('myAccountBlock'), )); return $this->display(__FILE__, $this->name.'.tpl'); } diff --git a/modules/cashticket/config.xml b/modules/cashticket/config.xml index 4f31b4bf3..09c8e51e2 100755 --- a/modules/cashticket/config.xml +++ b/modules/cashticket/config.xml @@ -2,7 +2,7 @@ cashticket - + diff --git a/modules/dibs/config.xml b/modules/dibs/config.xml index 09778362a..c1d93c699 100644 --- a/modules/dibs/config.xml +++ b/modules/dibs/config.xml @@ -2,7 +2,7 @@ dibs - + diff --git a/modules/moneybookers/config.xml b/modules/moneybookers/config.xml index 0d703cb8e..d80970f08 100755 --- a/modules/moneybookers/config.xml +++ b/modules/moneybookers/config.xml @@ -2,7 +2,7 @@ moneybookers - + diff --git a/modules/ogone/config.xml b/modules/ogone/config.xml index 129c6930b..47f14addd 100755 --- a/modules/ogone/config.xml +++ b/modules/ogone/config.xml @@ -2,7 +2,7 @@ ogone - + diff --git a/modules/paypal/config.xml b/modules/paypal/config.xml index 90e59daf3..4153164f5 100755 --- a/modules/paypal/config.xml +++ b/modules/paypal/config.xml @@ -2,7 +2,7 @@ paypal - + diff --git a/modules/paypal/express/submit.php b/modules/paypal/express/submit.php index e38fec258..1a95540c6 100644 --- a/modules/paypal/express/submit.php +++ b/modules/paypal/express/submit.php @@ -189,7 +189,7 @@ function submitAccount() $context->cookie->logged = 1; $customer->logged = 1; $context->cookie->email = $customer->email; - Module::hookExec('createAccount', array( + Hook::exec('createAccount', array( '_POST' => $_POST, 'newCustomer' => $customer )); @@ -238,7 +238,7 @@ function submitLogin() $context->cookie->email = $customer->email; if (Configuration::get('PS_CART_FOLLOWING') AND (empty($context->cookie->id_cart) OR Cart::getNbProducts($context->cookie->id_cart) == 0)) $context->cookie->id_cart = Cart::lastNoneOrderedCart($customer->id); - Module::hookExec('authentication'); + Hook::exec('authentication'); // Next ! $payerID = strval(Tools::getValue('payerID')); diff --git a/modules/paysafecard/config.xml b/modules/paysafecard/config.xml index 8a21d6583..76d225dea 100755 --- a/modules/paysafecard/config.xml +++ b/modules/paysafecard/config.xml @@ -2,7 +2,7 @@ paysafecard - +