[*] Classes: Add all fields in Hook class

git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@11782 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
rMalie
2011-12-27 10:36:15 +00:00
parent 2316a74075
commit 2a9fb74ec5
6 changed files with 49 additions and 34 deletions
+43 -21
View File
@@ -27,10 +27,26 @@
class HookCore extends ObjectModel class HookCore extends ObjectModel
{ {
/** @var string Name and Title */ /**
* @var string Hook name identifier
*/
public $name; public $name;
/**
* @var string Hook title (displayed in BO)
*/
public $title; public $title;
/**
* @var string Hook description
*/
public $description;
/**
* @var bool Is this hook usable with live edit ?
*/
public $live_edit = false;
/** /**
* @see ObjectModel::$definition * @see ObjectModel::$definition
*/ */
@@ -38,8 +54,11 @@ class HookCore extends ObjectModel
'table' => 'hook', 'table' => 'hook',
'primary' => 'id_hook', 'primary' => 'id_hook',
'fields' => array( 'fields' => array(
'name' => array('type' => self::TYPE_STRING, 'validate' => 'isHookName', 'required' => true, 'size' => 32), 'name' => array('type' => self::TYPE_STRING, 'validate' => 'isHookName', 'required' => true, 'size' => 32),
'title' => array('type' => self::TYPE_STRING), 'title' => array('type' => self::TYPE_STRING),
'description' => array('type' => self::TYPE_HTML),
'position' => array('type' => self::TYPE_BOOL),
'live_edit' => array('type' => self::TYPE_BOOL),
), ),
); );
@@ -48,9 +67,6 @@ class HookCore extends ObjectModel
protected static $_hook_modules_cache_exec = null; protected static $_hook_modules_cache_exec = null;
static $_hook_alias = null; static $_hook_alias = null;
/** /**
* Preload hook alias list * Preload hook alias list
* *
@@ -110,7 +126,6 @@ class HookCore extends ObjectModel
return ($result ? $result['id_hook'] : false); return ($result ? $result['id_hook'] : false);
} }
/** /**
* Return Hooks List * Return Hooks List
* *
@@ -124,7 +139,6 @@ class HookCore extends ObjectModel
'.($position ? 'WHERE h.`position` = 1' : '')); '.($position ? 'WHERE h.`position` = 1' : ''));
} }
/** /**
* Preload hook modules cache * Preload hook modules cache
* *
@@ -164,7 +178,6 @@ class HookCore extends ObjectModel
return true; return true;
} }
/** /**
* Return Hooks List * Return Hooks List
* *
@@ -182,8 +195,6 @@ class HookCore extends ObjectModel
return $list; return $list;
} }
/** /**
* Get Hook Module Cache Exec, testing hook name and retrocompatible hook name * Get Hook Module Cache Exec, testing hook name and retrocompatible hook name
* *
@@ -207,8 +218,6 @@ class HookCore extends ObjectModel
return false; return false;
} }
/** /**
* Execute modules for specified hook * Execute modules for specified hook
* *
@@ -358,8 +367,6 @@ class HookCore extends ObjectModel
return $return; return $return;
} }
public static function orderConfirmation($id_order) public static function orderConfirmation($id_order)
{ {
if (Validate::isUnsignedId($id_order)) if (Validate::isUnsignedId($id_order))
@@ -426,10 +433,6 @@ class HookCore extends ObjectModel
return Hook::exec('updateCarrier', array('id_carrier' => $id_carrier, 'carrier' => $carrier)); return Hook::exec('updateCarrier', array('id_carrier' => $id_carrier, 'carrier' => $carrier));
} }
/** /**
* Return hook ID from name * Return hook ID from name
* *
@@ -452,7 +455,6 @@ class HookCore extends ObjectModel
return ($result ? $result['id_hook'] : false); return ($result ? $result['id_hook'] : false);
} }
/** /**
* Called when quantity of a product is updated. * Called when quantity of a product is updated.
* *
@@ -470,47 +472,67 @@ class HookCore extends ObjectModel
'orderStatus' => $orderStatus)); 'orderStatus' => $orderStatus));
} }
/**
* @deprecated 1.5.0
*/
public static function updateQuantity($product, $order = null) public static function updateQuantity($product, $order = null)
{ {
Tools::displayAsDeprecated(); Tools::displayAsDeprecated();
return Hook::exec('updateQuantity', array('product' => $product, 'order' => $order)); return Hook::exec('updateQuantity', array('product' => $product, 'order' => $order));
} }
/**
* @deprecated 1.5.0
*/
public static function productFooter($product, $category) public static function productFooter($product, $category)
{ {
Tools::displayAsDeprecated(); Tools::displayAsDeprecated();
return Hook::exec('productFooter', array('product' => $product, 'category' => $category)); return Hook::exec('productFooter', array('product' => $product, 'category' => $category));
} }
/**
* @deprecated 1.5.0
*/
public static function productOutOfStock($product) public static function productOutOfStock($product)
{ {
Tools::displayAsDeprecated(); Tools::displayAsDeprecated();
return Hook::exec('productOutOfStock', array('product' => $product)); return Hook::exec('productOutOfStock', array('product' => $product));
} }
/**
* @deprecated 1.5.0
*/
public static function addProduct($product) public static function addProduct($product)
{ {
Tools::displayAsDeprecated(); Tools::displayAsDeprecated();
return Hook::exec('addProduct', array('product' => $product)); return Hook::exec('addProduct', array('product' => $product));
} }
/**
* @deprecated 1.5.0
*/
public static function updateProduct($product) public static function updateProduct($product)
{ {
Tools::displayAsDeprecated(); Tools::displayAsDeprecated();
return Hook::exec('updateProduct', array('product' => $product)); return Hook::exec('updateProduct', array('product' => $product));
} }
/**
* @deprecated 1.5.0
*/
public static function deleteProduct($product) public static function deleteProduct($product)
{ {
Tools::displayAsDeprecated(); Tools::displayAsDeprecated();
return Hook::exec('deleteProduct', array('product' => $product)); return Hook::exec('deleteProduct', array('product' => $product));
} }
/**
* @deprecated 1.5.0
*/
public static function updateProductAttribute($id_product_attribute) public static function updateProductAttribute($id_product_attribute)
{ {
Tools::displayAsDeprecated(); Tools::displayAsDeprecated();
return Hook::exec('updateProductAttribute', array('id_product_attribute' => $id_product_attribute)); return Hook::exec('updateProductAttribute', array('id_product_attribute' => $id_product_attribute));
} }
} }
-1
View File
@@ -813,7 +813,6 @@ CREATE TABLE `PREFIX_hook` (
`description` text, `description` text,
`position` tinyint(1) NOT NULL default '1', `position` tinyint(1) NOT NULL default '1',
`live_edit` tinyint(1) NOT NULL default '0', `live_edit` tinyint(1) NOT NULL default '0',
`is_native` tinyint(1) NOT NULL default '0',
PRIMARY KEY (`id_hook`), PRIMARY KEY (`id_hook`),
UNIQUE KEY `hook_name` (`name`) UNIQUE KEY `hook_name` (`name`)
) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8; ) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8;
-2
View File
@@ -544,8 +544,6 @@ ALTER TABLE `PREFIX_orders` ADD COLUMN `id_warehouse` int(10) unsigned DEFAULT 0
ALTER TABLE `PREFIX_cart` ADD COLUMN `order_reference` varchar(9) AFTER `id_cart`; ALTER TABLE `PREFIX_cart` ADD COLUMN `order_reference` varchar(9) AFTER `id_cart`;
ALTER TABLE `PREFIX_cart` ADD COLUMN `delivery_option` varchar(100) AFTER `id_carrier`; ALTER TABLE `PREFIX_cart` ADD COLUMN `delivery_option` varchar(100) AFTER `id_carrier`;
ALTER TABLE `PREFIX_hook` ADD `is_native` TINYINT( 1 ) NOT NULL DEFAULT '0';
ALTER TABLE `PREFIX_tax` ADD COLUMN `account_number` VARCHAR(64) NOT NULL; ALTER TABLE `PREFIX_tax` ADD COLUMN `account_number` VARCHAR(64) NOT NULL;
/* PHP:add_new_tab(AdminAttributeGenerator, fr:Générateur de déclinaisons|es:Combinations generator|en:Combinations generator|de:Combinations generator|it:Combinations generator, -1); */; /* PHP:add_new_tab(AdminAttributeGenerator, fr:Générateur de déclinaisons|es:Combinations generator|en:Combinations generator|de:Combinations generator|it:Combinations generator, -1); */;
-1
View File
@@ -813,7 +813,6 @@ CREATE TABLE `PREFIX_hook` (
`description` text, `description` text,
`position` tinyint(1) NOT NULL default '1', `position` tinyint(1) NOT NULL default '1',
`live_edit` tinyint(1) NOT NULL default '0', `live_edit` tinyint(1) NOT NULL default '0',
`is_native` tinyint(1) NOT NULL default '0',
PRIMARY KEY (`id_hook`), PRIMARY KEY (`id_hook`),
UNIQUE KEY `hook_name` (`name`) UNIQUE KEY `hook_name` (`name`)
) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8; ) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8;
+6 -7
View File
@@ -1,5 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<entity_hook> <entity_hook>
<fields id="name" class="Hook">
<field name="name"/>
<field name="title"/>
<field name="description"/>
<field name="live_edit"/>
</fields>
<entities> <entities>
<hook id="displayPayment" live_edit="1" is_native="0"> <hook id="displayPayment" live_edit="1" is_native="0">
<name>displayPayment</name> <name>displayPayment</name>
@@ -432,11 +438,4 @@
<description>Display extra informations inside the "my account" block</description> <description>Display extra informations inside the "my account" block</description>
</hook> </hook>
</entities> </entities>
<fields id="name" class="Hook">
<field name="name"/>
<field name="title"/>
<field name="description"/>
<field name="live_edit"/>
<field name="is_native"/>
</fields>
</entity_hook> </entity_hook>
-2
View File
@@ -493,6 +493,4 @@ ALTER TABLE `PREFIX_specific_price` ADD `id_product_attribute` INT UNSIGNED NOT
ALTER TABLE `PREFIX_specific_price` DROP INDEX `id_product`; ALTER TABLE `PREFIX_specific_price` DROP INDEX `id_product`;
ALTER TABLE `PREFIX_specific_price` ADD INDEX `id_product` (`id_product`, `id_product_attribute`, `id_shop`, `id_currency`, `id_country`, `id_group`, `from_quantity`, `from`, `to`); ALTER TABLE `PREFIX_specific_price` ADD INDEX `id_product` (`id_product`, `id_product_attribute`, `id_shop`, `id_currency`, `id_country`, `id_group`, `from_quantity`, `from`, `to`);
ALTER TABLE `PREFIX_hook` ADD `is_native` TINYINT( 1 ) NOT NULL DEFAULT '0';
/* PHP:add_new_tab(AdminAttributeGenerator, fr:Générateur de combinaisons|es:Combinations generator|en:Combinations generator|de:Combinations generator|it:Combinations generator, 1); */; /* PHP:add_new_tab(AdminAttributeGenerator, fr:Générateur de combinaisons|es:Combinations generator|en:Combinations generator|de:Combinations generator|it:Combinations generator, 1); */;