diff --git a/classes/Address.php b/classes/Address.php index 487c83c1b..3357ad57e 100644 --- a/classes/Address.php +++ b/classes/Address.php @@ -107,8 +107,11 @@ class AddressCore extends ObjectModel 'city' => 'isCityName', 'other' => 'isMessage', 'phone' => 'isPhoneNumber', 'phone_mobile' => 'isPhoneNumber', 'deleted' => 'isBool', 'dni' => 'isDniLite'); - protected $table = 'address'; - protected $identifier = 'id_address'; + public static $definition = array( + 'table' => 'address', + 'primary' => 'id_address', + ); + protected $_includeVars = array('addressType' => 'table'); protected $_includeContainer = false; diff --git a/classes/AddressFormat.php b/classes/AddressFormat.php index 53979279f..332f14201 100644 --- a/classes/AddressFormat.php +++ b/classes/AddressFormat.php @@ -42,8 +42,10 @@ class AddressFormatCore extends ObjectModel protected $fieldsValidate = array ('format' => 'isGenericName'); /* MySQL does not allow 'order detail' for a table name */ - protected $table = 'address_format'; - protected $identifier = 'id_country'; + public static $definition = array( + 'table' => 'address_format', + 'primary' => 'id_country', + ); public static $requireFormFieldsList = array( 'firstname', diff --git a/classes/Alias.php b/classes/Alias.php index 67880b239..486bc8c4b 100644 --- a/classes/Alias.php +++ b/classes/Alias.php @@ -35,8 +35,10 @@ class AliasCore extends ObjectModel protected $fieldsSize = array('alias' => 255, 'search' => 255); protected $fieldsValidate = array('search' => 'isValidSearch', 'alias' => 'isValidSearch', 'active' => 'isBool'); - protected $table = 'alias'; - protected $identifier = 'id_alias'; + public static $definition = array( + 'table' => 'alias', + 'primary' => 'id_alias', + ); function __construct($id = NULL, $alias = NULL, $search = NULL, $id_lang = NULL) { diff --git a/classes/Attachment.php b/classes/Attachment.php index e37a0401f..66d764593 100644 --- a/classes/Attachment.php +++ b/classes/Attachment.php @@ -44,8 +44,11 @@ class AttachmentCore extends ObjectModel protected $fieldsSizeLang = array('name' => 32); protected $fieldsValidateLang = array('name' => 'isGenericName', 'description' => 'isCleanHtml'); - protected $table = 'attachment'; - protected $identifier = 'id_attachment'; + public static $definition = array( + 'table' => 'attachment', + 'primary' => 'id_attachment', + 'multilang' => true, + ); public function getFields() { diff --git a/classes/Attribute.php b/classes/Attribute.php index 5330303d0..7719f3409 100644 --- a/classes/Attribute.php +++ b/classes/Attribute.php @@ -42,8 +42,12 @@ class AttributeCore extends ObjectModel protected $fieldsSizeLang = array('name' => 64); protected $fieldsValidateLang = array('name' => 'isGenericName'); - protected $table = 'attribute'; - protected $identifier = 'id_attribute'; + public static $definition = array( + 'table' => 'attribute', + 'primary' => 'id_attribute', + 'multilang' => true, + ); + protected $image_dir = _PS_COL_IMG_DIR_; protected $webserviceParameters = array( diff --git a/classes/AttributeGroup.php b/classes/AttributeGroup.php index a679dfd47..a77f7decd 100644 --- a/classes/AttributeGroup.php +++ b/classes/AttributeGroup.php @@ -42,8 +42,11 @@ class AttributeGroupCore extends ObjectModel protected $fieldsSizeLang = array('name' => 64, 'public_name' => 64); protected $fieldsValidateLang = array('name' => 'isGenericName', 'public_name' => 'isGenericName', 'position' => 'isInt'); - protected $table = 'attribute_group'; - protected $identifier = 'id_attribute_group'; + public static $definition = array( + 'table' => 'attribute_group', + 'primary' => 'id_attribute_group', + 'multilang' => true, + ); protected $webserviceParameters = array( 'objectsNodeName' => 'product_options', diff --git a/classes/CMS.php b/classes/CMS.php index a1764ae03..97f36bae5 100644 --- a/classes/CMS.php +++ b/classes/CMS.php @@ -42,8 +42,11 @@ class CMSCore extends ObjectModel protected $fieldsSizeLang = array('meta_description' => 255, 'meta_keywords' => 255, 'meta_title' => 128, 'link_rewrite' => 128, 'content' => 3999999999999); protected $fieldsValidateLang = array('meta_description' => 'isGenericName', 'meta_keywords' => 'isGenericName', 'meta_title' => 'isGenericName', 'link_rewrite' => 'isLinkRewrite', 'content' => 'isString'); - protected $table = 'cms'; - protected $identifier = 'id_cms'; + public static $definition = array( + 'table' => 'cms', + 'primary' => 'id_cms', + 'multilang' => true, + ); protected $webserviceParameters = array( 'objectNodeName' => 'content', diff --git a/classes/CMSCategory.php b/classes/CMSCategory.php index 62cb9fba2..bb64444c0 100644 --- a/classes/CMSCategory.php +++ b/classes/CMSCategory.php @@ -81,8 +81,11 @@ class CMSCategoryCore extends ObjectModel protected $fieldsValidateLang = array('name' => 'isCatalogName', 'link_rewrite' => 'isLinkRewrite', 'description' => 'isCleanHtml', 'meta_title' => 'isGenericName', 'meta_description' => 'isGenericName', 'meta_keywords' => 'isGenericName'); - protected $table = 'cms_category'; - protected $identifier = 'id_cms_category'; + public static $definition = array( + 'table' => 'cms_category', + 'primary' => 'id_cms_category', + 'multilang' => true, + ); public function __construct($id_cms_category = NULL, $id_lang = NULL) { diff --git a/classes/Carrier.php b/classes/Carrier.php index 3aed129cd..1f6ae0097 100644 --- a/classes/Carrier.php +++ b/classes/Carrier.php @@ -122,8 +122,11 @@ class CarrierCore extends ObjectModel protected $fieldsSizeLang = array('delay' => 128); protected $fieldsValidateLang = array('delay' => 'isGenericName'); - protected $table = 'carrier'; - protected $identifier = 'id_carrier'; + public static $definition = array( + 'table' => 'carrier', + 'primary' => 'id_carrier', + 'multilang' => true, + ); protected static $price_by_weight = array(); protected static $price_by_weight2 = array(); diff --git a/classes/Cart.php b/classes/Cart.php index 16690ecf5..f30b59afd 100644 --- a/classes/Cart.php +++ b/classes/Cart.php @@ -105,8 +105,11 @@ class CartCore extends ObjectModel protected static $_carriers = null; protected static $_taxes_rate = null; protected static $_attributesLists = array(); - protected $table = 'cart'; - protected $identifier = 'id_cart'; + + public static $definition = array( + 'table' => 'cart', + 'primary' => 'id_cart', + ); protected $webserviceParameters = array( 'fields' => array( diff --git a/classes/CartRule.php b/classes/CartRule.php index 54fc400c5..18f9a82a3 100644 --- a/classes/CartRule.php +++ b/classes/CartRule.php @@ -59,7 +59,8 @@ class CartRuleCore extends ObjectModel public static $definition = array( 'table' => 'cart_rule', - 'primary' => 'id_cart_rule', + 'identifier' => 'id_cart_rule', + 'multilang' => true, ); protected $fieldsRequired = array('date_from', 'date_to'); diff --git a/classes/Category.php b/classes/Category.php index e852c9dc0..061ccc725 100644 --- a/classes/Category.php +++ b/classes/Category.php @@ -103,8 +103,11 @@ class CategoryCore extends ObjectModel 'meta_keywords' => 'isGenericName' ); - protected $table = 'category'; - protected $identifier = 'id_category'; + public static $definition = array( + 'table' => 'category', + 'primary' => 'id_category', + 'multilang' => true, + ); /** @var string id_image is the category ID when an image exists and 'default' otherwise */ public $id_image = 'default'; @@ -703,18 +706,20 @@ class CategoryCore extends ObjectModel ORDER BY `position` ASC'); } - /** return an array of all children of the current category + /** + * Return an array of all children of the current category * - * @return array rows of table category - * @todo return hydrateCollection + * @param int $id_lang + * @return Collection */ - public function getAllChildren() + public function getAllChildren($id_lang = null) { - return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS(' - SELECT * - FROM `'._DB_PREFIX_.'category` - WHERE '.(int)$this->nleft.' < nleft AND nright < '.(int)$this->nright - ); + if (is_null($id_lang)) + $id_lang = Context::getContext()->language->id; + + $categories = new Collection('Category', $id_lang); + $categories->where((int)$this->nleft.' < nleft AND nright < '.(int)$this->nright); + return $categories; } /** diff --git a/classes/Collection.php b/classes/Collection.php index 50a63fe5f..1f4cf959d 100644 --- a/classes/Collection.php +++ b/classes/Collection.php @@ -78,7 +78,9 @@ class CollectionCore implements Iterator, Countable $this->definition = ObjectModel::getDefinition($this->classname); if (!isset($this->definition['table'])) - throw new PrestashopException('Miss table in definition'); + throw new PrestashopException('Miss table in definition for class '.$this->classname); + else if (!isset($this->definition['primary'])) + throw new PrestashopException('Miss primary in definition for class '.$this->classname); $this->query = new DbQuery(); $this->query->select('a.*'); diff --git a/classes/Combination.php b/classes/Combination.php index 157494efe..6fdb78185 100644 --- a/classes/Combination.php +++ b/classes/Combination.php @@ -81,8 +81,10 @@ class CombinationCore extends ObjectModel 'available_date' => 'isDateFormat', ); - protected $table = 'product_attribute'; - protected $identifier = 'id_product_attribute'; + public static $definition = array( + 'table' => 'product_attribute', + 'primary' => 'id_product_attribute', + ); protected $webserviceParameters = array( 'objectNodeName' => 'combination', diff --git a/classes/CompareProduct.php b/classes/CompareProduct.php index 98a323a29..6a047e8f9 100644 --- a/classes/CompareProduct.php +++ b/classes/CompareProduct.php @@ -44,10 +44,10 @@ class CompareProductCore extends ObjectModel 'id_customer' => 'isUnsignedInt' ); - protected $table = 'compare'; - - protected $identifier = 'id_compare'; - + public static $definition = array( + 'table' => 'compare', + 'primary' => 'id_compare', + ); /** * Get all comapare products of the customer diff --git a/classes/Configuration.php b/classes/Configuration.php index a91616c7e..d48171fdf 100644 --- a/classes/Configuration.php +++ b/classes/Configuration.php @@ -48,8 +48,11 @@ class ConfigurationCore extends ObjectModel protected $fieldsSize = array('name' => 32); protected $fieldsValidate = array('name' => 'isConfigName', 'id_group_shop' => 'isUnsignedId', 'id_shop' => 'isUnsignedId'); - protected $table = 'configuration'; - protected $identifier = 'id_configuration'; + public static $definition = array( + 'table' => 'configuration', + 'primary' => 'id_configuration', + 'multilang' => true, + ); /** @var array Configuration cache */ protected static $_CONF; diff --git a/classes/Connection.php b/classes/Connection.php index 4c5fcb2d1..67934cc91 100644 --- a/classes/Connection.php +++ b/classes/Connection.php @@ -53,8 +53,10 @@ class ConnectionCore extends ObjectModel 'ip_address' => 'isInt', 'http_referer' => 'isAbsoluteUrl'); /* MySQL does not allow 'connection' for a table name */ - protected $table = 'connections'; - protected $identifier = 'id_connections'; + public static $definition = array( + 'table' => 'connections', + 'primary' => 'id_connections', + ); public function getFields() { diff --git a/classes/ConnectionsSource.php b/classes/ConnectionsSource.php index 9ff0a559d..9b99a85e4 100644 --- a/classes/ConnectionsSource.php +++ b/classes/ConnectionsSource.php @@ -38,8 +38,10 @@ class ConnectionsSourceCore extends ObjectModel protected $fieldsRequired = array('id_connections', 'date_add'); protected $fieldsValidate = array('id_connections' => 'isUnsignedId', 'http_referer' => 'isAbsoluteUrl', 'request_uri' => 'isUrl', 'keywords' => 'isMessage'); - protected $table = 'connections_source'; - protected $identifier = 'id_connections_source'; + public static $definition = array( + 'table' => 'connections_source', + 'primary' => 'id_connections_source', + ); public function getFields() { diff --git a/classes/Contact.php b/classes/Contact.php index cdfb7c2ef..709df5229 100644 --- a/classes/Contact.php +++ b/classes/Contact.php @@ -47,8 +47,11 @@ class ContactCore extends ObjectModel protected $fieldsSizeLang = array('name' => 32); protected $fieldsValidateLang = array('name' => 'isGenericName', 'description' => 'isCleanHtml'); - protected $table = 'contact'; - protected $identifier = 'id_contact'; + public static $definition = array( + 'table' => 'contact', + 'primary' => 'id_contact', + 'multilang' => true, + ); public function getFields() { diff --git a/classes/Country.php b/classes/Country.php index f8bdbb64b..0c9ea6428 100644 --- a/classes/Country.php +++ b/classes/Country.php @@ -93,8 +93,11 @@ class CountryCore extends ObjectModel ), ); - protected $table = 'country'; - protected $identifier = 'id_country'; + public static $definition = array( + 'table' => 'country', + 'primary' => 'id_country', + 'multilang' => true, + ); public function getFields() { diff --git a/classes/County.php b/classes/County.php index d4449ba8a..3d0f4e310 100644 --- a/classes/County.php +++ b/classes/County.php @@ -40,8 +40,10 @@ class CountyCore extends ObjectModel protected $fieldsSize = array('name' => 64); protected $fieldsValidate = array('name' => 'isGenericName', 'id_state' => 'isUnsignedId', 'active' => 'isBool'); - protected $table = 'county'; - protected $identifier = 'id_county'; + public static $definition = array( + 'table' => 'county', + 'primary' => 'id_county', + ); private static $_cache_get_counties = array(); private static $_cache_county_zipcode = array(); diff --git a/classes/Currency.php b/classes/Currency.php index 1f90e31aa..947fb3cef 100644 --- a/classes/Currency.php +++ b/classes/Currency.php @@ -64,8 +64,11 @@ class CurrencyCore extends ObjectModel protected $fieldsValidate = array('name' => 'isGenericName', 'iso_code' => 'isLanguageIsoCode', 'iso_code_num' => 'isNumericIsoCode', 'blank' => 'isInt', 'sign' => 'isGenericName', 'format' => 'isUnsignedId', 'decimals' => 'isBool', 'conversion_rate' => 'isFloat', 'deleted' => 'isBool', 'active' => 'isBool'); - protected $table = 'currency'; - protected $identifier = 'id_currency'; + public static $definition = array( + 'table' => 'currency', + 'primary' => 'id_currency', + 'multilang' => true, + ); /** @var array Currency cache */ static protected $currencies = array(); diff --git a/classes/Customer.php b/classes/Customer.php index 5830e071e..94c497d7c 100644 --- a/classes/Customer.php +++ b/classes/Customer.php @@ -142,8 +142,10 @@ class CustomerCore extends ObjectModel ), ); - protected $table = 'customer'; - protected $identifier = 'id_customer'; + public static $definition = array( + 'table' => 'customer', + 'primary' => 'id_customer', + ); protected static $_defaultGroupId = array(); protected static $_customerHasAddress = array(); diff --git a/classes/CustomerMessage.php b/classes/CustomerMessage.php index 7c9600580..d8b69d19c 100644 --- a/classes/CustomerMessage.php +++ b/classes/CustomerMessage.php @@ -37,8 +37,10 @@ class CustomerMessageCore extends ObjectModel public $private; public $date_add; - protected $table = 'customer_message'; - protected $identifier = 'id_customer_message'; + public static $definition = array( + 'table' => 'customer_message', + 'primary' => 'id_customer_message', + ); protected $fieldsRequired = array('message'); protected $fieldsSize = array('message' => 65000); diff --git a/classes/CustomerThread.php b/classes/CustomerThread.php index 715a8a1ac..e26fdf589 100644 --- a/classes/CustomerThread.php +++ b/classes/CustomerThread.php @@ -40,8 +40,10 @@ class CustomerThreadCore extends ObjectModel public $date_add; public $date_upd; - protected $table = 'customer_thread'; - protected $identifier = 'id_customer_thread'; + public static $definition = array( + 'table' => 'customer_thread', + 'primary' => 'id_customer_thread', + ); protected $fieldsRequired = array('id_lang', 'id_contact', 'token'); protected $fieldsSize = array('email' => 254); diff --git a/classes/DateRange.php b/classes/DateRange.php index 791dbcfac..eb7ef2c30 100644 --- a/classes/DateRange.php +++ b/classes/DateRange.php @@ -33,8 +33,10 @@ class DateRangeCore extends ObjectModel protected $fieldsRequired = array ('time_start', 'time_end'); protected $fieldsValidate = array ('time_start' => 'isDate', 'time_end' => 'isDate'); - protected $table = 'date_range'; - protected $identifier = 'id_date_range'; + public static $definition = array( + 'table' => 'date_range', + 'primary' => 'id_date_range', + ); public function getFields() { diff --git a/classes/Delivery.php b/classes/Delivery.php index bd116ece7..09f25edb1 100644 --- a/classes/Delivery.php +++ b/classes/Delivery.php @@ -67,8 +67,10 @@ class DeliveryCore extends ObjectModel 'price' => 'isPrice' ); - protected $table = 'delivery'; - protected $identifier = 'id_delivery'; + public static $definition = array( + 'table' => 'delivery', + 'primary' => 'id_delivery', + ); protected $webserviceParameters = array( 'objectsNodeName' => 'deliveries', diff --git a/classes/Employee.php b/classes/Employee.php index adc7883ed..90eb0d038 100644 --- a/classes/Employee.php +++ b/classes/Employee.php @@ -73,8 +73,10 @@ class EmployeeCore extends ObjectModel 'passwd' => 'isPasswdAdmin', 'active' => 'isBool', 'id_profile' => 'isInt', 'bo_color' => 'isColor', 'bo_theme' => 'isGenericName', 'bo_show_screencast' => 'isBool'); - protected $table = 'employee'; - protected $identifier = 'id_employee'; + public static $definition = array( + 'table' => 'employee', + 'primary' => 'id_employee', + ); protected $webserviceParameters = array( 'fields' => array( diff --git a/classes/Feature.php b/classes/Feature.php index 7af74dbea..d9c943ebb 100644 --- a/classes/Feature.php +++ b/classes/Feature.php @@ -38,8 +38,10 @@ class FeatureCore extends ObjectModel 'position' => 'isInt' ); - protected $table = 'feature'; - protected $identifier = 'id_feature'; + public static $definition = array( + 'table' => 'feature', + 'primary' => 'id_feature', + ); protected $webserviceParameters = array( 'objectsNodeName' => 'product_features', diff --git a/classes/FeatureValue.php b/classes/FeatureValue.php index 8473af1f0..363200cff 100644 --- a/classes/FeatureValue.php +++ b/classes/FeatureValue.php @@ -46,8 +46,11 @@ class FeatureValueCore extends ObjectModel protected $fieldsSizeLang = array('value' => 255); protected $fieldsValidateLang = array('value' => 'isGenericName'); - protected $table = 'feature_value'; - protected $identifier = 'id_feature_value'; + public static $definition = array( + 'table' => 'feature_value', + 'primary' => 'id_feature_value', + 'multilang' => true, + ); protected $webserviceParameters = array( 'objectsNodeName' => 'product_feature_values', diff --git a/classes/Group.php b/classes/Group.php index 75abcad44..ebd6aefe6 100644 --- a/classes/Group.php +++ b/classes/Group.php @@ -54,8 +54,11 @@ class GroupCore extends ObjectModel protected $fieldsSizeLang = array('name' => 32); protected $fieldsValidateLang = array('name' => 'isGenericName'); - protected $table = 'group'; - protected $identifier = 'id_group'; + public static $definition = array( + 'table' => 'group', + 'primary' => 'id_group', + 'multilang' => true, + ); protected static $cache_reduction = array(); protected static $group_price_display_method = array(); diff --git a/classes/GroupReduction.php b/classes/GroupReduction.php index b301b9b0d..142b84443 100644 --- a/classes/GroupReduction.php +++ b/classes/GroupReduction.php @@ -34,8 +34,10 @@ class GroupReductionCore extends ObjectModel protected $fieldsRequired = array('id_group', 'id_category', 'reduction'); protected $fieldsValidate = array('id_group' => 'isUnsignedId', 'id_category' => 'isUnsignedId', 'reduction' => 'isPrice'); - protected $table = 'group_reduction'; - protected $identifier = 'id_group_reduction'; + public static $definition = array( + 'table' => 'group_reduction', + 'primary' => 'id_group_reduction', + ); protected static $reduction_cache = array(); diff --git a/classes/Guest.php b/classes/Guest.php index f70ff478c..2ef23e711 100644 --- a/classes/Guest.php +++ b/classes/Guest.php @@ -60,9 +60,10 @@ class GuestCore extends ObjectModel 'accept_language' => 'isGenericName' ); - protected $table = 'guest'; - protected $identifier = 'id_guest'; - + public static $definition = array( + 'table' => 'guest', + 'primary' => 'id_guest', + ); protected $webserviceParameters = array( 'fields' => array( diff --git a/classes/Hook.php b/classes/Hook.php index 2fcd6e341..5f0c3cf3a 100644 --- a/classes/Hook.php +++ b/classes/Hook.php @@ -35,8 +35,10 @@ class HookCore extends ObjectModel protected $fieldsSize = array('name' => 32); protected $fieldsValidate = array('name' => 'isHookName'); - protected $table = 'hook'; - protected $identifier = 'id_hook'; + public static $definition = array( + 'table' => 'hook', + 'primary' => 'id_hook', + ); protected static $_hookModulesCache; diff --git a/classes/Image.php b/classes/Image.php index 07475c305..0c545ec26 100644 --- a/classes/Image.php +++ b/classes/Image.php @@ -67,8 +67,11 @@ class ImageCore extends ObjectModel protected $fieldsSizeLang = array('legend' => 128); protected $fieldsValidateLang = array('legend' => 'isGenericName'); - protected $table = 'image'; - protected $identifier = 'id_image'; + public static $definition = array( + 'table' => 'image', + 'primary' => 'id_image', + 'multilang' => true, + ); protected static $_cacheGetSize = array(); diff --git a/classes/ImageType.php b/classes/ImageType.php index b1d890ac9..7deb88700 100644 --- a/classes/ImageType.php +++ b/classes/ImageType.php @@ -70,8 +70,10 @@ class ImageTypeCore extends ObjectModel ); protected $fieldsSize = array('name' => 16); - protected $table = 'image_type'; - protected $identifier = 'id_image_type'; + public static $definition = array( + 'table' => 'image_type', + 'primary' => 'id_image_type', + ); /** * @var array Image types cache diff --git a/classes/Language.php b/classes/Language.php index 4b66c8d8c..04686cb27 100644 --- a/classes/Language.php +++ b/classes/Language.php @@ -55,8 +55,10 @@ class LanguageCore extends ObjectModel protected $fieldsValidate = array('name' => 'isGenericName', 'iso_code' => 'isLanguageIsoCode', 'language_code' => 'isLanguageCode', 'active' => 'isBool', 'is_rtl' => 'isBool', 'date_format_lite' => 'isPhpDateFormat', 'date_format_full' => 'isPhpDateFormat'); - protected $table = 'lang'; - protected $identifier = 'id_lang'; + public static $definition = array( + 'table' => 'lang', + 'primary' => 'id_lang', + ); /** @var array Languages cache */ protected static $_checkedLangs; diff --git a/classes/Logger.php b/classes/Logger.php index 67212d469..e082d7bfc 100644 --- a/classes/Logger.php +++ b/classes/Logger.php @@ -56,8 +56,10 @@ class LoggerCore extends ObjectModel protected $fieldsValidate = array('id_log' => 'isUnsignedId', 'severity' => 'isInt', 'error_code' => 'isUnsignedInt', 'message' => 'isMessage', 'object_id' => 'isUnsignedInt', 'object_type' => 'isName'); - protected $table = 'log'; - protected $identifier = 'id_log'; + public static $definition = array( + 'table' => 'log', + 'primary' => 'id_log', + ); protected static $is_present = array(); diff --git a/classes/Manufacturer.php b/classes/Manufacturer.php index 28cd6e3ce..47ace839a 100644 --- a/classes/Manufacturer.php +++ b/classes/Manufacturer.php @@ -81,8 +81,13 @@ class ManufacturerCore extends ObjectModel 'meta_description' => 'isGenericName', 'meta_keywords' => 'isGenericName' ); - protected $table = 'manufacturer'; - protected $identifier = 'id_manufacturer'; + + public static $definition = array( + 'table' => 'manufacturer', + 'primary' => 'id_manufacturer', + 'multilang' => true, + ); + protected $webserviceParameters = array( 'fields' => array( 'active' => array(), diff --git a/classes/Message.php b/classes/Message.php index ce2eb5a3c..197185c75 100644 --- a/classes/Message.php +++ b/classes/Message.php @@ -56,8 +56,10 @@ class MessageCore extends ObjectModel 'message' => 'isCleanHtml', 'id_cart' => 'isUnsignedId', 'id_order' => 'isUnsignedId', 'id_customer' => 'isUnsignedId', 'id_employee' => 'isUnsignedId', 'private' => 'isBool'); - protected $table = 'message'; - protected $identifier = 'id_message'; + public static $definition = array( + 'table' => 'message', + 'primary' => 'id_message', + ); public function getFields() { diff --git a/classes/Meta.php b/classes/Meta.php index acd05645a..f01bae43c 100644 --- a/classes/Meta.php +++ b/classes/Meta.php @@ -43,8 +43,12 @@ class MetaCore extends ObjectModel protected $fieldsValidateLang = array('title' => 'isGenericName', 'description' => 'isGenericName', 'keywords' => 'isGenericName', 'url_rewrite' => 'isLinkRewrite'); protected $langMultiShop = true; - protected $table = 'meta'; - protected $identifier = 'id_meta'; + + public static $definition = array( + 'table' => 'meta', + 'primary' => 'id_meta', + 'multilang' => true, + ); public function getFields() { diff --git a/classes/Module.php b/classes/Module.php index 6c354b717..af603e46d 100644 --- a/classes/Module.php +++ b/classes/Module.php @@ -68,9 +68,10 @@ abstract class ModuleCore protected $_errors = false; - protected $table = 'module'; - - protected $identifier = 'id_module'; + public static $definition = array( + 'table' => 'module', + 'primary' => 'id_module', + ); public static $_db; diff --git a/classes/Page.php b/classes/Page.php index 761226081..ecbf916b9 100644 --- a/classes/Page.php +++ b/classes/Page.php @@ -35,8 +35,10 @@ class PageCore extends ObjectModel protected $fieldsRequired = array ('id_page_type'); protected $fieldsValidate = array ('id_page_type' => 'isUnsignedId', 'id_object' => 'isUnsignedId'); - protected $table = 'page'; - protected $identifier = 'id_page'; + public static $definition = array( + 'table' => 'page', + 'primary' => 'id_page', + ); public function getFields() { diff --git a/classes/PaymentCC.php b/classes/PaymentCC.php index 826c4fa5d..b1172c919 100644 --- a/classes/PaymentCC.php +++ b/classes/PaymentCC.php @@ -49,8 +49,10 @@ class PaymentCCCore extends OrderPayment 'id_order' => 'isUnsignedId', 'id_currency' => 'isUnsignedId', 'amount' => 'isPrice', 'transaction_id' => 'isAnything', 'card_number' => 'isAnything', 'card_brand' => 'isAnything', 'card_expiration' => 'isAnything', 'card_holder' => 'isAnything'); - protected $table = 'payment_cc'; - protected $identifier = 'id_payment_cc'; + public static $definition = array( + 'table' => 'payment_cc', + 'primary' => 'id_payment_cc', + ); /** * @deprecated 1.5.0.2 diff --git a/classes/Product.php b/classes/Product.php index e21e886db..625617a39 100644 --- a/classes/Product.php +++ b/classes/Product.php @@ -261,8 +261,11 @@ class ProductCore extends ObjectModel 'meta_title' => 'isGenericName', 'link_rewrite' => 'isLinkRewrite', 'name' => 'isCatalogName', 'description' => 'isString', 'description_short' => 'isString', 'available_now' => 'isGenericName', 'available_later' => 'IsGenericName'); - protected $table = 'product'; - protected $identifier = 'id_product'; + public static $definition = array( + 'table' => 'product', + 'primary' => 'id_product', + 'multilang' => true, + ); protected $webserviceParameters = array( 'objectMethods' => array( diff --git a/classes/ProductDownload.php b/classes/ProductDownload.php index f3b647f9b..c3fea4ef9 100644 --- a/classes/ProductDownload.php +++ b/classes/ProductDownload.php @@ -86,8 +86,10 @@ class ProductDownloadCore extends ObjectModel 'is_shareable' => 'isUnsignedInt' ); - protected $table = 'product_download'; - protected $identifier = 'id_product_download'; + public static $definition = array( + 'table' => 'product_download', + 'primary' => 'id_product_download', + ); /** * Build a virtual product diff --git a/classes/Profile.php b/classes/Profile.php index 716230012..cee2948cf 100644 --- a/classes/Profile.php +++ b/classes/Profile.php @@ -34,8 +34,11 @@ class ProfileCore extends ObjectModel protected $fieldsSizeLang = array('name' => 32); protected $fieldsValidateLang = array('name' => 'isGenericName'); - protected $table = 'profile'; - protected $identifier = 'id_profile'; + public static $definition = array( + 'table' => 'profile', + 'primary' => 'id_profile', + 'multilang' => true, + ); public function getFields() { diff --git a/classes/QuickAccess.php b/classes/QuickAccess.php index 12bca3114..bf174d507 100644 --- a/classes/QuickAccess.php +++ b/classes/QuickAccess.php @@ -43,8 +43,11 @@ class QuickAccessCore extends ObjectModel protected $fieldsSizeLang = array('name' => 32); protected $fieldsValidateLang = array('name' => 'isGenericName'); - protected $table = 'quick_access'; - protected $identifier = 'id_quick_access'; + public static $definition = array( + 'table' => 'quick_access', + 'primary' => 'id_quick_access', + 'multilang' => true, + ); public function getFields() { diff --git a/classes/RangePrice.php b/classes/RangePrice.php index edccdb43a..6227fd9b7 100644 --- a/classes/RangePrice.php +++ b/classes/RangePrice.php @@ -34,8 +34,10 @@ class RangePriceCore extends ObjectModel protected $fieldsRequired = array('id_carrier', 'delimiter1', 'delimiter2'); protected $fieldsValidate = array('id_carrier' => 'isInt', 'delimiter1' => 'isUnsignedFloat', 'delimiter2' => 'isUnsignedFloat'); - protected $table = 'range_price'; - protected $identifier = 'id_range_price'; + public static $definition = array( + 'table' => 'range_price', + 'primary' => 'id_range_price', + ); protected $webserviceParameters = array( 'objectsNodeName' => 'price_ranges', diff --git a/classes/RangeWeight.php b/classes/RangeWeight.php index bd307ec6e..f8d6915ac 100644 --- a/classes/RangeWeight.php +++ b/classes/RangeWeight.php @@ -34,8 +34,10 @@ class RangeWeightCore extends ObjectModel protected $fieldsRequired = array('id_carrier', 'delimiter1', 'delimiter2'); protected $fieldsValidate = array('id_carrier' => 'isInt', 'delimiter1' => 'isUnsignedFloat', 'delimiter2' => 'isUnsignedFloat'); - protected $table = 'range_weight'; - protected $identifier = 'id_range_weight'; + public static $definition = array( + 'table' => 'range_weight', + 'primary' => 'id_range_weight', + ); protected $webserviceParameters = array( 'objectNodeName' => 'weight_range', diff --git a/classes/Referrer.php b/classes/Referrer.php index 749ef0f23..636ef0863 100644 --- a/classes/Referrer.php +++ b/classes/Referrer.php @@ -73,8 +73,10 @@ class ReferrerCore extends ObjectModel 'click_fee' => 'isFloat' ); - protected $table = 'referrer'; - protected $identifier = 'id_referrer'; + public static $definition = array( + 'table' => 'referrer', + 'primary' => 'id_referrer', + ); protected static $_join = '(r.http_referer_like IS NULL OR r.http_referer_like = \'\' OR cs.http_referer LIKE r.http_referer_like) AND (r.request_uri_like IS NULL OR r.request_uri_like = \'\' OR cs.request_uri LIKE r.request_uri_like) diff --git a/classes/RequestSql.php b/classes/RequestSql.php index 160aada0b..c8dd1d045 100644 --- a/classes/RequestSql.php +++ b/classes/RequestSql.php @@ -34,8 +34,10 @@ class RequestSqlCore extends ObjectModel protected $fieldsSize = array('name' => 200 , 'sql' => 400); protected $fieldsValidate = array('name' => 'isString', 'sql' => 'isString'); - protected $table = 'request_sql'; - protected $identifier = 'id_request_sql'; + public static $definition = array( + 'table' => 'request_sql', + 'primary' => 'id_request_sql', + ); public $tested = array('required' => array ('SELECT', 'FROM'), 'option' => array('WHERE', 'ORDER', 'LIMIT', 'HAVING', 'GROUP', 'UNION'), diff --git a/classes/Scene.php b/classes/Scene.php index b89069aea..0ea80c60c 100644 --- a/classes/Scene.php +++ b/classes/Scene.php @@ -42,8 +42,11 @@ class SceneCore extends ObjectModel /** @var array Products */ public $products; - protected $table = 'scene'; - protected $identifier = 'id_scene'; + public static $definition = array( + 'table' => 'scene', + 'primary' => 'id_scene', + 'multilang' => true, + ); protected $fieldsRequired = array('active'); protected $fieldsValidate = array('active' => 'isBool', 'zones' => 'isSceneZones', 'categories' => 'isArrayWithIds'); diff --git a/classes/SearchEngine.php b/classes/SearchEngine.php index fe2957140..cceff5c62 100644 --- a/classes/SearchEngine.php +++ b/classes/SearchEngine.php @@ -33,8 +33,10 @@ class SearchEngineCore extends ObjectModel protected $fieldsRequired = array ('server', 'getvar'); protected $fieldsValidate = array ('server' => 'isUrl', 'getvar' => 'isModuleName'); - protected $table = 'search_engine'; - protected $identifier = 'id_search_engine'; + public static $definition = array( + 'table' => 'search_engine', + 'primary' => 'id_search_engine', + ); public function getFields() { diff --git a/classes/SpecificPrice.php b/classes/SpecificPrice.php index 0e3abfebf..1c0ba1cc1 100644 --- a/classes/SpecificPrice.php +++ b/classes/SpecificPrice.php @@ -43,8 +43,10 @@ class SpecificPriceCore extends ObjectModel protected $fieldsRequired = array('id_product', 'id_shop', 'id_currency', 'id_country', 'id_group', 'price', 'from_quantity', 'reduction', 'reduction_type', 'from', 'to'); protected $fieldsValidate = array('id_group_shop' => 'isUnsignedId', 'id_product' => 'isUnsignedId', 'id_product_attribute' => 'isUnsignedId', 'id_shop' => 'isUnsignedId', 'id_country' => 'isUnsignedId', 'id_group' => 'isUnsignedId', 'price' => 'isPrice', 'from_quantity' => 'isUnsignedInt', 'reduction' => 'isPrice', 'reduction_type' => 'isReductionType', 'from' => 'isDateFormat', 'to' => 'isDateFormat'); - protected $table = 'specific_price'; - protected $identifier = 'id_specific_price'; + public static $definition = array( + 'table' => 'specific_price', + 'primary' => 'id_specific_price', + ); protected static $_specificPriceCache = array(); protected static $_cache_priorities = array(); diff --git a/classes/State.php b/classes/State.php index bd43b6cf9..7cd8459ed 100644 --- a/classes/State.php +++ b/classes/State.php @@ -46,8 +46,10 @@ class StateCore extends ObjectModel protected $fieldsSize = array('iso_code' => 4, 'name' => 32); protected $fieldsValidate = array('id_country' => 'isUnsignedId', 'id_zone' => 'isUnsignedId', 'iso_code' => 'isStateIsoCode', 'name' => 'isGenericName', 'active' => 'isBool'); - protected $table = 'state'; - protected $identifier = 'id_state'; + public static $definition = array( + 'table' => 'state', + 'primary' => 'id_state', + ); protected $webserviceParameters = array( 'fields' => array( diff --git a/classes/Store.php b/classes/Store.php index dbd2fc99c..b0c29e8a9 100644 --- a/classes/Store.php +++ b/classes/Store.php @@ -84,8 +84,10 @@ class StoreCore extends ObjectModel 'city' => 'isCityName', 'latitude' => 'isCoordinate', 'longitude' => 'isCoordinate', 'hours' => 'isSerializedArray', 'phone' => 'isPhoneNumber', 'fax' => 'isPhoneNumber', 'note' => 'isCleanHtml', 'email' => 'isEmail', 'active' => 'isBool'); - protected $table = 'store'; - protected $identifier = 'id_store'; + public static $definition = array( + 'table' => 'store', + 'primary' => 'id_store', + ); protected $webserviceParameters = array( 'fields' => array( diff --git a/classes/SubDomain.php b/classes/SubDomain.php index 3f0b22dce..6cd09e955 100644 --- a/classes/SubDomain.php +++ b/classes/SubDomain.php @@ -33,8 +33,10 @@ class SubDomainCore extends ObjectModel protected $fieldsSize = array('name' => 16); protected $fieldsValidate = array('name' => 'isSubDomainName'); - protected $table = 'subdomain'; - protected $identifier = 'id_subdomain'; + public static $definition = array( + 'table' => 'subdomain', + 'primary' => 'id_subdomain', + ); public function getFields() { diff --git a/classes/Supplier.php b/classes/Supplier.php index e887cc2bb..1e0b69184 100644 --- a/classes/Supplier.php +++ b/classes/Supplier.php @@ -70,8 +70,11 @@ class SupplierCore extends ObjectModel 'meta_keywords' => 'isGenericName' ); - protected $table = 'supplier'; - protected $identifier = 'id_supplier'; + public static $definition = array( + 'table' => 'supplier', + 'primary' => 'id_supplier', + 'multilang' => true, + ); protected $webserviceParameters = array( 'fields' => array( diff --git a/classes/Tab.php b/classes/Tab.php index e1b526ccb..aaa8845c3 100644 --- a/classes/Tab.php +++ b/classes/Tab.php @@ -53,8 +53,11 @@ class TabCore extends ObjectModel protected $fieldsSizeLang = array('name' => 32); protected $fieldsValidateLang = array('name' => 'isGenericName'); - protected $table = 'tab'; - protected $identifier = 'id_tab'; + public static $definition = array( + 'table' => 'tab', + 'primary' => 'id_tab', + 'multilang' => true, + ); protected static $_getIdFromClassName = null; diff --git a/classes/Tag.php b/classes/Tag.php index 304f65c43..7885ae2b6 100644 --- a/classes/Tag.php +++ b/classes/Tag.php @@ -36,8 +36,10 @@ class TagCore extends ObjectModel protected $fieldsRequired = array('id_lang', 'name'); protected $fieldsValidate = array('id_lang' => 'isUnsignedId', 'name' => 'isGenericName'); - protected $table = 'tag'; - protected $identifier = 'id_tag'; + public static $definition = array( + 'table' => 'tag', + 'primary' => 'id_tag', + ); protected $webserviceParameters = array( 'fields' => array( diff --git a/classes/Theme.php b/classes/Theme.php index 352cf37ea..460ce1ad0 100644 --- a/classes/Theme.php +++ b/classes/Theme.php @@ -31,8 +31,11 @@ class ThemeCore extends ObjectModel protected $fieldsSize = array('name' => 64); protected $fieldsValidate = array('name' => 'isGenericName'); - protected $table = 'theme'; - protected $identifier = 'id_theme'; + + public static $definition = array( + 'table' => 'theme', + 'primary' => 'id_theme', + ); public function getFields() { diff --git a/classes/Zone.php b/classes/Zone.php index 1f2f06156..2cadf3c9e 100644 --- a/classes/Zone.php +++ b/classes/Zone.php @@ -38,8 +38,10 @@ class ZoneCore extends ObjectModel protected $fieldsSize = array('name' => 64); protected $fieldsValidate = array('name' => 'isGenericName', 'active' => 'isBool'); - protected $table = 'zone'; - protected $identifier = 'id_zone'; + public static $definition = array( + 'table' => 'zone', + 'primary' => 'id_zone', + ); protected $webserviceParameters = array(); diff --git a/classes/order/Order.php b/classes/order/Order.php index d4b4bc339..df01d2d18 100644 --- a/classes/order/Order.php +++ b/classes/order/Order.php @@ -223,8 +223,11 @@ class OrderCore extends ObjectModel ); /* MySQL does not allow 'order' for a table name */ - protected $table = 'orders'; - protected $identifier = 'id_order'; + public static $definition = array( + 'table' => 'orders', + 'primary' => 'id_order', + ); + protected $_taxCalculationMethod = PS_TAX_EXC; protected static $_historyCache = array(); diff --git a/classes/order/OrderCartRule.php b/classes/order/OrderCartRule.php index 629751ef8..016d567f8 100644 --- a/classes/order/OrderCartRule.php +++ b/classes/order/OrderCartRule.php @@ -48,8 +48,10 @@ class OrderCartRuleCore extends ObjectModel protected $fieldsValidate = array ('id_order' => 'isUnsignedId', 'name' => 'isGenericName', 'value' => 'isInt'); /* MySQL does not allow 'order detail' for a table name */ - protected $table = 'order_cart_rule'; - protected $identifier = 'id_order_cart_rule'; + public static $definition = array( + 'table' => 'order_cart_rule', + 'primary' => 'id_order_cart_rule', + ); protected $webserviceParameters = array( 'fields' => array( diff --git a/classes/order/OrderDetail.php b/classes/order/OrderDetail.php index 4ba4c621f..0f6803c38 100644 --- a/classes/order/OrderDetail.php +++ b/classes/order/OrderDetail.php @@ -174,8 +174,10 @@ class OrderDetailCore extends ObjectModel 'total_price_tax_excl' => 'isPrice' ); - protected $table = 'order_detail'; - protected $identifier = 'id_order_detail'; + public static $definition = array( + 'table' => 'order_detail', + 'primary' => 'id_order_detail', + ); protected $webserviceParameters = array( 'fields' => array ( diff --git a/classes/order/OrderHistory.php b/classes/order/OrderHistory.php index b6519c818..7b76d36a9 100644 --- a/classes/order/OrderHistory.php +++ b/classes/order/OrderHistory.php @@ -47,8 +47,10 @@ class OrderHistoryCore extends ObjectModel protected $fieldsRequired = array('id_order', 'id_order_state'); protected $fieldsValidate = array('id_order' => 'isUnsignedId', 'id_order_state' => 'isUnsignedId', 'id_employee' => 'isUnsignedId'); - protected $table = 'order_history'; - protected $identifier = 'id_order_history'; + public static $definition = array( + 'table' => 'order_history', + 'primary' => 'id_order_history', + ); protected $webserviceParameters = array( 'objectsNodeName' => 'order_histories', diff --git a/classes/order/OrderMessage.php b/classes/order/OrderMessage.php index bef437bd9..3dd165dcb 100644 --- a/classes/order/OrderMessage.php +++ b/classes/order/OrderMessage.php @@ -44,8 +44,11 @@ class OrderMessageCore extends ObjectModel protected $fieldsSizeLang = array('name' => 128, 'message' => 1200); protected $fieldsValidateLang = array('name' => 'isGenericName', 'message' => 'isMessage'); - protected $table = 'order_message'; - protected $identifier = 'id_order_message'; + public static $definition = array( + 'table' => 'order_message', + 'primary' => 'id_order_message', + 'multilang' => true, + ); protected $webserviceParameters = array( 'fields' => array( diff --git a/classes/order/OrderReturn.php b/classes/order/OrderReturn.php index 74480a584..65e18ae68 100644 --- a/classes/order/OrderReturn.php +++ b/classes/order/OrderReturn.php @@ -53,8 +53,10 @@ class OrderReturnCore extends ObjectModel protected $fieldsRequired = array ('id_customer', 'id_order'); protected $fieldsValidate = array('id_customer' => 'isUnsignedId', 'id_order' => 'isUnsignedId', 'question' => 'isMessage'); - protected $table = 'order_return'; - protected $identifier = 'id_order_return'; + public static $definition = array( + 'table' => 'order_return', + 'primary' => 'id_order_return', + ); public function getFields() { diff --git a/classes/order/OrderReturnState.php b/classes/order/OrderReturnState.php index fb40e70f5..b46f4c774 100644 --- a/classes/order/OrderReturnState.php +++ b/classes/order/OrderReturnState.php @@ -38,8 +38,11 @@ class OrderReturnStateCore extends ObjectModel protected $fieldsSizeLang = array('name' => 64); protected $fieldsValidateLang = array('name' => 'isGenericName'); - protected $table = 'order_return_state'; - protected $identifier = 'id_order_return_state'; + public static $definition = array( + 'table' => 'order_return_state', + 'primary' => 'id_order_return_state', + 'multilang' => true, + ); public function getFields() { diff --git a/classes/order/OrderSlip.php b/classes/order/OrderSlip.php index 5e9e28a7e..bb116d7da 100644 --- a/classes/order/OrderSlip.php +++ b/classes/order/OrderSlip.php @@ -62,8 +62,10 @@ class OrderSlipCore extends ObjectModel protected $fieldsRequired = array ('id_customer', 'id_order', 'conversion_rate'); protected $fieldsValidate = array('id_customer' => 'isUnsignedId', 'id_order' => 'isUnsignedId', 'conversion_rate' => 'isFloat'); - protected $table = 'order_slip'; - protected $identifier = 'id_order_slip'; + public static $definition = array( + 'table' => 'order_slip', + 'primary' => 'id_order_slip', + ); public function getFields() { diff --git a/classes/order/OrderState.php b/classes/order/OrderState.php index a6beafb38..53c20c609 100644 --- a/classes/order/OrderState.php +++ b/classes/order/OrderState.php @@ -68,8 +68,11 @@ class OrderStateCore extends ObjectModel protected $fieldsSizeLang = array('name' => 64, 'template' => 64); protected $fieldsValidateLang = array('name' => 'isGenericName', 'template' => 'isTplName'); - protected $table = 'order_state'; - protected $identifier = 'id_order_state'; + public static $definition = array( + 'table' => 'order_state', + 'primary' => 'id_order_state', + 'multilang' => true, + ); protected $webserviceParameters = array( 'fields' => array( diff --git a/classes/shop/GroupShop.php b/classes/shop/GroupShop.php index 7ce7b236d..2f0429adf 100644 --- a/classes/shop/GroupShop.php +++ b/classes/shop/GroupShop.php @@ -45,8 +45,11 @@ class GroupShopCore extends ObjectModel 'share_stock' => 'isBool', 'name' => 'isGenericName', ); - protected $table = 'group_shop'; - protected $identifier = 'id_group_shop'; + + public static $definition = array( + 'table' => 'group_shop', + 'primary' => 'id_group_shop', + ); private static $assoTables = array( 'attribute_group' => array('type' => 'group_shop'), diff --git a/classes/shop/Shop.php b/classes/shop/Shop.php index 10f43e83b..59d55d0f5 100644 --- a/classes/shop/Shop.php +++ b/classes/shop/Shop.php @@ -54,8 +54,11 @@ class ShopCore extends ObjectModel 'active' => 'isBool', 'name' => 'isGenericName', ); - protected $table = 'shop'; - protected $identifier = 'id_shop'; + + public static $definition = array( + 'table' => 'shop', + 'primary' => 'id_shop', + ); /** @var array List of shops cached */ protected static $shops; diff --git a/classes/shop/ShopUrl.php b/classes/shop/ShopUrl.php index 5c765506e..2e2e89829 100644 --- a/classes/shop/ShopUrl.php +++ b/classes/shop/ShopUrl.php @@ -42,8 +42,10 @@ class ShopUrlCore extends ObjectModel protected $fieldsSize = array('domain' => 255, 'physical_uri' => 64, 'virtual_uri' => 64); protected $fieldsValidate = array('active' => 'isBool'); - protected $table = 'shop_url'; - protected $identifier = 'id_shop_url'; + public static $definition = array( + 'table' => 'shop_url', + 'primary' => 'id_shop_url', + ); public function getFields() { diff --git a/classes/stock/StockAvailable.php b/classes/stock/StockAvailable.php index 775c6f835..9bf4c411e 100644 --- a/classes/stock/StockAvailable.php +++ b/classes/stock/StockAvailable.php @@ -74,8 +74,10 @@ class StockAvailableCore extends ObjectModel 'out_of_stock' => 'isInt' ); - protected $table = 'stock_available'; - protected $identifier = 'id_stock_available'; + public static $definition = array( + 'table' => 'stock_available', + 'primary' => 'id_stock_available', + ); public function getFields() { diff --git a/classes/stock/StockMvt.php b/classes/stock/StockMvt.php index 74090244a..2ed0d2cc9 100644 --- a/classes/stock/StockMvt.php +++ b/classes/stock/StockMvt.php @@ -122,8 +122,10 @@ class StockMvtCore extends ObjectModel */ public $quantity; - protected $table = 'stock_mvt'; - protected $identifier = 'id_stock_mvt'; + public static $definition = array( + 'table' => 'stock_mvt', + 'primary' => 'id_stock_mvt', + ); protected $fieldsRequired = array( 'date_add', diff --git a/classes/stock/StockMvtReason.php b/classes/stock/StockMvtReason.php index 063f914d7..37de016d8 100644 --- a/classes/stock/StockMvtReason.php +++ b/classes/stock/StockMvtReason.php @@ -45,8 +45,12 @@ class StockMvtReasonCore extends ObjectModel /** @var boolean True if the movement reason has been deleted (staying in database as deleted) */ public $deleted = 0; - protected $table = 'stock_mvt_reason'; - protected $identifier = 'id_stock_mvt_reason'; + public static $definition = array( + 'table' => 'stock_mvt_reason', + 'primary' => 'id_stock_mvt_reason', + 'multilang' => true, + ); + protected $fieldsRequiredLang = array('name'); protected $fieldsSizeLang = array('name' => 255); protected $fieldsValidateLang = array('name' => 'isGenericName'); diff --git a/classes/stock/SupplyOrder.php b/classes/stock/SupplyOrder.php index 74e1bca86..3704f1f73 100755 --- a/classes/stock/SupplyOrder.php +++ b/classes/stock/SupplyOrder.php @@ -154,15 +154,10 @@ class SupplyOrderCore extends ObjectModel 'is_template' => 'isBool', ); - /** - * @var string Database table name - */ - protected $table = 'supply_order'; - - /** - * @var string Database ID name - */ - protected $identifier = 'id_supply_order'; + public static $definition = array( + 'table' => 'supply_order', + 'primary' => 'id_supply_order', + ); public function getFields() { diff --git a/classes/stock/SupplyOrderHistory.php b/classes/stock/SupplyOrderHistory.php index 082464c8e..dc5651b8d 100755 --- a/classes/stock/SupplyOrderHistory.php +++ b/classes/stock/SupplyOrderHistory.php @@ -76,15 +76,10 @@ class SupplyOrderHistoryCore extends ObjectModel 'date_add' => 'isDate' ); - /** - * @var string Database table name - */ - protected $table = 'supply_order_history'; - - /** - * @var string Database ID name - */ - protected $identifier = 'id_supply_order_history'; + public static $definition = array( + 'table' => 'supply_order_history', + 'primary' => 'id_supply_order_history', + ); public function getFields() { diff --git a/classes/stock/SupplyOrderReceiptHistory.php b/classes/stock/SupplyOrderReceiptHistory.php index 14796ae98..7712afb8b 100755 --- a/classes/stock/SupplyOrderReceiptHistory.php +++ b/classes/stock/SupplyOrderReceiptHistory.php @@ -82,15 +82,10 @@ class SupplyOrderReceiptHistoryCore extends ObjectModel 'date_add' => 'isDate' ); - /** - * @var string Database table name - */ - protected $table = 'supply_order_receipt_history'; - - /** - * @var string Database ID name - */ - protected $identifier = 'id_supply_order_receipt_history'; + public static $definition = array( + 'table' => 'supply_order_receipt_history', + 'primary' => 'id_supply_order_receipt_history', + ); public function getFields() { diff --git a/classes/stock/SupplyOrderState.php b/classes/stock/SupplyOrderState.php index d20d23bfe..513929211 100755 --- a/classes/stock/SupplyOrderState.php +++ b/classes/stock/SupplyOrderState.php @@ -78,15 +78,11 @@ class SupplyOrderStateCore extends ObjectModel protected $fieldsSizeLang = array('name' => 128); protected $fieldsValidateLang = array('name' => 'isGenericName'); - /** - * @var string Database table name - */ - protected $table = 'supply_order_state'; - - /** - * @var string Database ID name - */ - protected $identifier = 'id_supply_order_state'; + public static $definition = array( + 'table' => 'supply_order_state', + 'primary' => 'id_supply_order_state', + 'multilang' => true, + ); /** * @see ObjectModel::getFields() diff --git a/classes/stock/Warehouse.php b/classes/stock/Warehouse.php index e602ba3e9..45ae87cea 100644 --- a/classes/stock/Warehouse.php +++ b/classes/stock/Warehouse.php @@ -83,8 +83,10 @@ class WarehouseCore extends ObjectModel 'id_currency' => 'isUnsignedId' ); - protected $table = 'warehouse'; - protected $identifier = 'id_warehouse'; + public static $definition = array( + 'table' => 'warehouse', + 'primary' => 'id_warehouse', + ); public function getFields() { diff --git a/classes/tax/Tax.php b/classes/tax/Tax.php index 276c3c9c2..c26c230ae 100644 --- a/classes/tax/Tax.php +++ b/classes/tax/Tax.php @@ -49,8 +49,10 @@ class TaxCore extends ObjectModel protected $fieldsSizeLang = array('name' => 32); protected $fieldsValidateLang = array('name' => 'isGenericName'); - protected $table = 'tax'; - protected $identifier = 'id_tax'; + public static $definition = array( + 'table' => 'tax', + 'primary' => 'id_tax', + ); protected static $_product_country_tax = array(); protected static $_product_tax_via_rules = array(); diff --git a/classes/tax/TaxRule.php b/classes/tax/TaxRule.php index 32982e135..cf94c0de4 100644 --- a/classes/tax/TaxRule.php +++ b/classes/tax/TaxRule.php @@ -46,8 +46,10 @@ class TaxRuleCore extends ObjectModel 'behavior' => 'isUnsignedInt', 'description' => 'isString'); - protected $table = 'tax_rule'; - protected $identifier = 'id_tax_rule'; + public static $definition = array( + 'table' => 'tax_rule', + 'primary' => 'id_tax_rule', + ); public function getFields() { diff --git a/classes/tax/TaxRulesGroup.php b/classes/tax/TaxRulesGroup.php index f0db4eb84..ba17100da 100644 --- a/classes/tax/TaxRulesGroup.php +++ b/classes/tax/TaxRulesGroup.php @@ -37,8 +37,10 @@ class TaxRulesGroupCore extends ObjectModel protected $fieldsSize = array('name' => 64); protected $fieldsValidate = array('name' => 'isGenericName'); - protected $table = 'tax_rules_group'; - protected $identifier = 'id_tax_rules_group'; + public static $definition = array( + 'table' => 'tax_rules_group', + 'primary' => 'id_tax_rules_group', + ); protected static $_taxes = array(); diff --git a/classes/webservice/WebserviceKey.php b/classes/webservice/WebserviceKey.php index f640efc96..ae1bbeb63 100755 --- a/classes/webservice/WebserviceKey.php +++ b/classes/webservice/WebserviceKey.php @@ -40,9 +40,10 @@ class WebserviceKeyCore extends ObjectModel protected $fieldsSize = array('key' => 32); protected $fieldsValidate = array('active' => 'isBool'); - protected $table = 'webservice_account'; - protected $identifier = 'id_webservice_account'; - + public static $definition = array( + 'table' => 'webservice_account', + 'primary' => 'id_webservice_account', + ); public function add($autodate = true, $nullValues = false) {