[~] Hook::get replaced by Hook::getIdByName
git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@7916 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
+22
-1
@@ -51,9 +51,12 @@ class HookCore extends ObjectModel
|
|||||||
*
|
*
|
||||||
* @param string $hookName Hook name
|
* @param string $hookName Hook name
|
||||||
* @return integer Hook ID
|
* @return integer Hook ID
|
||||||
|
*
|
||||||
|
* @deprecated since 1.5
|
||||||
*/
|
*/
|
||||||
static public function get($hookName)
|
static public function get($hookName)
|
||||||
{
|
{
|
||||||
|
Tools::displayAsDeprecated();
|
||||||
if (!Validate::isHookName($hookName))
|
if (!Validate::isHookName($hookName))
|
||||||
die(Tools::displayError());
|
die(Tools::displayError());
|
||||||
|
|
||||||
@@ -65,6 +68,25 @@ class HookCore extends ObjectModel
|
|||||||
return ($result ? $result['id_hook'] : false);
|
return ($result ? $result['id_hook'] : false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return hook ID from name
|
||||||
|
*
|
||||||
|
* @param string $hook_name Hook name
|
||||||
|
* @return integer Hook ID
|
||||||
|
*/
|
||||||
|
public static function getIdByName($hook_name)
|
||||||
|
{
|
||||||
|
if (!Validate::isHookName($hook_name))
|
||||||
|
die(Tools::displayError());
|
||||||
|
|
||||||
|
$result = Db::getInstance()->getRow('
|
||||||
|
SELECT `id_hook`, `name`
|
||||||
|
FROM `'._DB_PREFIX_.'hook`
|
||||||
|
WHERE `name` = \''.pSQL($hook_name).'\'');
|
||||||
|
|
||||||
|
return ($result ? $result['id_hook'] : false);
|
||||||
|
}
|
||||||
|
|
||||||
static public function getHooks($position = false)
|
static public function getHooks($position = false)
|
||||||
{
|
{
|
||||||
return Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('
|
return Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('
|
||||||
@@ -250,4 +272,3 @@ class HookCore extends ObjectModel
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -317,7 +317,7 @@ class MoneyBookers extends PaymentModule
|
|||||||
{
|
{
|
||||||
foreach(array('leftColumn', 'rightColumn') as $hookName)
|
foreach(array('leftColumn', 'rightColumn') as $hookName)
|
||||||
if ($this->isRegisteredInHook($hookName))
|
if ($this->isRegisteredInHook($hookName))
|
||||||
$this->unregisterHook(Hook::get($hookName));
|
$this->unregisterHook(Hook::getIdByName($hookName));
|
||||||
if (Tools::getValue('logo_position') == self::LEFT_COLUMN)
|
if (Tools::getValue('logo_position') == self::LEFT_COLUMN)
|
||||||
$this->registerHook('leftColumn');
|
$this->registerHook('leftColumn');
|
||||||
else if (Tools::getValue('logo_position') == self::RIGHT_COLUMN)
|
else if (Tools::getValue('logo_position') == self::RIGHT_COLUMN)
|
||||||
@@ -677,4 +677,3 @@ class MoneyBookers extends PaymentModule
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1247,13 +1247,15 @@ class shopimporter extends ImportModule
|
|||||||
if (isset($this->name))
|
if (isset($this->name))
|
||||||
$order->module = $this->name;
|
$order->module = $this->name;
|
||||||
|
|
||||||
|
$carrier = new Carrier((int)$item['id_carrier']);
|
||||||
|
|
||||||
$currency = new Currency($order->id_currency);
|
$currency = new Currency($order->id_currency);
|
||||||
$order->conversion_rate = $currency->conversion_rate;
|
$order->conversion_rate = $currency->conversion_rate;
|
||||||
$order->total_products = (float)$item['total_products'];
|
$order->total_products = (float)$item['total_products'];
|
||||||
$order->total_products_wt = (float)$item['total_products_wt'];
|
$order->total_products_wt = (float)$item['total_products_wt'];
|
||||||
$order->total_discounts = (float)$item['total_discounts'];
|
$order->total_discounts = (float)$item['total_discounts'];
|
||||||
$order->total_shipping = (float)$item['total_shipping'];
|
$order->total_shipping = (float)$item['total_shipping'];
|
||||||
$order->carrier_tax_rate = (float)Tax::getCarrierTaxRate((int)$item['id_carrier'], (int)$item[Configuration::get('PS_TAX_ADDRESS_TYPE')]);
|
$order->carrier_tax_rate = (float)$carrier->getTaxesRate(new Address((int)$item[Configuration::get('PS_TAX_ADDRESS_TYPE')]));
|
||||||
$order->total_wrapping = (float)$item['total_wrapping'];
|
$order->total_wrapping = (float)$item['total_wrapping'];
|
||||||
$order->total_paid = (float)$item['total_paid'];
|
$order->total_paid = (float)$item['total_paid'];
|
||||||
$order->total_paid_real = (float)$item['total_paid_real'];
|
$order->total_paid_real = (float)$item['total_paid_real'];
|
||||||
@@ -1267,3 +1269,4 @@ class shopimporter extends ImportModule
|
|||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|
||||||
|
|||||||
@@ -473,12 +473,12 @@ class ThemeInstallator extends Module
|
|||||||
{
|
{
|
||||||
Db::getInstance()->Execute('
|
Db::getInstance()->Execute('
|
||||||
INSERT INTO `'._DB_PREFIX_.'hook_module` (`id_module`, `id_shop`, `id_hook`, `position`)
|
INSERT INTO `'._DB_PREFIX_.'hook_module` (`id_module`, `id_shop`, `id_hook`, `position`)
|
||||||
VALUES ('.(int)$obj->id.', '.$shopID.', '.(int)Hook::get($hook[$count]).', '.(int)$position[$count].')');
|
VALUES ('.(int)$obj->id.', '.$shopID.', '.(int)Hook::getIdByName($hook[$count]).', '.(int)$position[$count].')');
|
||||||
if ($exceptions[$count])
|
if ($exceptions[$count])
|
||||||
foreach ($exceptions[$count] as $file_name)
|
foreach ($exceptions[$count] as $file_name)
|
||||||
Db::getInstance()->Execute('
|
Db::getInstance()->Execute('
|
||||||
INSERT INTO `'._DB_PREFIX_.'hook_module_exceptions` (`id_module`, `id_hook`, `file_name`)
|
INSERT INTO `'._DB_PREFIX_.'hook_module_exceptions` (`id_module`, `id_hook`, `file_name`)
|
||||||
VALUES ('.(int)$obj->id.', '.(int)Hook::get($hook[$count]).', "'.pSQL($file_name).'")');
|
VALUES ('.(int)$obj->id.', '.(int)Hook::getIdByName($hook[$count]).', "'.pSQL($file_name).'")');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (($val = (int)(Tools::getValue('nativeModules'))) != 1)
|
if (($val = (int)(Tools::getValue('nativeModules'))) != 1)
|
||||||
@@ -526,12 +526,12 @@ class ThemeInstallator extends Module
|
|||||||
{
|
{
|
||||||
Db::getInstance()->Execute('
|
Db::getInstance()->Execute('
|
||||||
INSERT INTO `'._DB_PREFIX_.'hook_module` (`id_module`, `id_shop`, `id_hook`, `position`)
|
INSERT INTO `'._DB_PREFIX_.'hook_module` (`id_module`, `id_shop`, `id_hook`, `position`)
|
||||||
VALUES ('.(int)$obj->id.', '.$shopID.', '.(int)Hook::get($hook[$count]).', '.(int)$position[$count].')');
|
VALUES ('.(int)$obj->id.', '.$shopID.', '.(int)Hook::getIdByName($hook[$count]).', '.(int)$position[$count].')');
|
||||||
foreach ($exceptions[$count] as $filename)
|
foreach ($exceptions[$count] as $filename)
|
||||||
if (!empty($filename))
|
if (!empty($filename))
|
||||||
Db::getInstance()->Execute('
|
Db::getInstance()->Execute('
|
||||||
INSERT INTO `'._DB_PREFIX_.'hook_module_exceptions` (`id_module`, id_shop, `id_hook`, `file_name`)
|
INSERT INTO `'._DB_PREFIX_.'hook_module_exceptions` (`id_module`, id_shop, `id_hook`, `file_name`)
|
||||||
VALUES ('.(int)$obj->id.', '.$shopID.', '.(int)Hook::get($hook[$count]).', "'.pSQL($filename).'")');
|
VALUES ('.(int)$obj->id.', '.$shopID.', '.(int)Hook::getIdByName($hook[$count]).', "'.pSQL($filename).'")');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1290,3 +1290,4 @@ class ThemeInstallator extends Module
|
|||||||
</form>';
|
</form>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -671,13 +671,13 @@ XML;
|
|||||||
if (Tools::getValue('trpd_hook_position') == 0)
|
if (Tools::getValue('trpd_hook_position') == 0)
|
||||||
{
|
{
|
||||||
Configuration::updateValue('TREEPODIA_HOOK', 0);
|
Configuration::updateValue('TREEPODIA_HOOK', 0);
|
||||||
$this->unregisterHook(Hook::get('productFooter'));
|
$this->unregisterHook(Hook::getIdByName('productFooter'));
|
||||||
$this->registerHook('extraLeft');
|
$this->registerHook('extraLeft');
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Configuration::updateValue('TREEPODIA_HOOK', 1);
|
Configuration::updateValue('TREEPODIA_HOOK', 1);
|
||||||
$this->unregisterHook(Hook::get('extraLeft'));
|
$this->unregisterHook(Hook::getIdByName('extraLeft'));
|
||||||
$this->registerHook('productFooter');
|
$this->registerHook('productFooter');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -91,7 +91,7 @@ class TrustedShops extends Module
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
$return = ($return) ? (parent::install() AND $this->registerHook('orderConfirmation') AND $this->registerHook('newOrder') AND $this->registerHook('rightColumn') AND $this->registerHook('paymentTop') AND $this->registerHook('orderConfirmation')) : $return;
|
$return = ($return) ? (parent::install() AND $this->registerHook('orderConfirmation') AND $this->registerHook('newOrder') AND $this->registerHook('rightColumn') AND $this->registerHook('paymentTop') AND $this->registerHook('orderConfirmation')) : $return;
|
||||||
$id_hook = Hook::get('payment');
|
$id_hook = Hook::getIdByName('payment');
|
||||||
$this->updatePosition($id_hook, 0, 1);
|
$this->updatePosition($id_hook, 0, 1);
|
||||||
return $return;
|
return $return;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user