diff --git a/classes/Attachment.php b/classes/Attachment.php
index 59739f4a7..fc76a6954 100644
--- a/classes/Attachment.php
+++ b/classes/Attachment.php
@@ -47,17 +47,13 @@ class AttachmentCore extends ObjectModel
'file' => array('type' => self::TYPE_STRING, 'validate' => 'isGenericName', 'required' => true, 'size' => 40),
'mime' => array('type' => self::TYPE_STRING, 'validate' => 'isCleanHtml', 'required' => true, 'size' => 128),
'file_name' => array('type' => self::TYPE_STRING, 'validate' => 'isGenericName', 'size' => 128),
- 'name' => array('type' => 'FILL_ME', 'lang' => true, 'validate' => 'isGenericName', 'required' => true, 'size' => 32),
- 'description' => array('type' => 'FILL_ME', 'lang' => true, 'validate' => 'isCleanHtml'),
+
+ // Lang fields
+ 'name' => array('type' => self::TYPE_STRING, 'lang' => true, 'validate' => 'isGenericName', 'required' => true, 'size' => 32),
+ 'description' => array('type' => self::TYPE_STRING, 'lang' => true, 'validate' => 'isCleanHtml'),
),
);
- public function getTranslationsFieldsChild()
- {
- $this->validateFieldsLang();
- return $this->getTranslationsFields(array('name', 'description'));
- }
-
public function delete()
{
@unlink(_PS_DOWNLOAD_DIR_.$this->file);
diff --git a/classes/Attribute.php b/classes/Attribute.php
index 01bd1e7c5..ab2eb4eae 100644
--- a/classes/Attribute.php
+++ b/classes/Attribute.php
@@ -47,7 +47,9 @@ class AttributeCore extends ObjectModel
'id_attribute_group' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId', 'required' => true),
'color' => array('type' => self::TYPE_STRING, 'validate' => 'isColor'),
'position' => array('type' => self::TYPE_INT, 'validate' => 'isInt'),
- 'name' => array('type' => 'FILL_ME', 'lang' => true, 'validate' => 'isGenericName', 'required' => true, 'size' => 64),
+
+ // Lang fields
+ 'name' => array('type' => self::TYPE_STRING, 'lang' => true, 'validate' => 'isGenericName', 'required' => true, 'size' => 64),
),
);
@@ -69,17 +71,6 @@ class AttributeCore extends ObjectModel
parent::__construct($id, $id_lang, $id_shop);
}
- /**
- * Check then return multilingual fields for database interaction
- *
- * @return array Multilingual fields
- */
- public function getTranslationsFieldsChild()
- {
- $this->validateFieldsLang();
- return $this->getTranslationsFields(array('name'));
- }
-
public function delete()
{
$result = Db::getInstance()->executeS('
diff --git a/classes/AttributeGroup.php b/classes/AttributeGroup.php
index b999217e7..c85c3aa2d 100644
--- a/classes/AttributeGroup.php
+++ b/classes/AttributeGroup.php
@@ -47,8 +47,10 @@ class AttributeGroupCore extends ObjectModel
'is_color_group' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool'),
'group_type' => array('type' => self::TYPE_STRING),
'position' => array('type' => self::TYPE_INT, 'validate' => 'isInt'),
- 'name' => array('type' => 'FILL_ME', 'lang' => true, 'validate' => 'isGenericName', 'required' => true, 'size' => 64),
- 'public_name' => array('type' => 'FILL_ME', 'lang' => true, 'validate' => 'isGenericName', 'required' => true, 'size' => 64),
+
+ // Lang fields
+ 'name' => array('type' => self::TYPE_STRING, 'lang' => true, 'validate' => 'isGenericName', 'required' => true, 'size' => 64),
+ 'public_name' => array('type' => self::TYPE_STRING, 'lang' => true, 'validate' => 'isGenericName', 'required' => true, 'size' => 64),
),
);
@@ -84,17 +86,6 @@ class AttributeGroupCore extends ObjectModel
return $return;
}
- /**
- * Check then return multilingual fields for database interaction
- *
- * @return array Multilingual fields
- */
- public function getTranslationsFieldsChild()
- {
- $this->validateFieldsLang();
- return $this->getTranslationsFields(array('name', 'public_name'));
- }
-
public static function cleanDeadCombinations()
{
$attribute_combinations = Db::getInstance()->executeS('
diff --git a/classes/CMS.php b/classes/CMS.php
index 80dbad16d..a70b7be97 100644
--- a/classes/CMS.php
+++ b/classes/CMS.php
@@ -50,11 +50,11 @@ class CMSCore extends ObjectModel
'active' => array('type' => self::TYPE_BOOL),
// Lang fields
- 'meta_description' => array('type' => 'FILL_ME', 'lang' => true, 'validate' => 'isGenericName', 'size' => 255),
- 'meta_keywords' => array('type' => 'FILL_ME', 'lang' => true, 'validate' => 'isGenericName', 'size' => 255),
- 'meta_title' => array('type' => 'FILL_ME', 'lang' => true, 'validate' => 'isGenericName', 'required' => true, 'size' => 128),
- 'link_rewrite' => array('type' => 'FILL_ME', 'lang' => true, 'validate' => 'isLinkRewrite', 'required' => true, 'size' => 128),
- 'content' => array('type' => 'FILL_ME', 'lang' => true, 'validate' => 'isString', 'size' => 3999999999999),
+ 'meta_description' => array('type' => self::TYPE_STRING, 'lang' => true, 'validate' => 'isGenericName', 'size' => 255),
+ 'meta_keywords' => array('type' => self::TYPE_STRING, 'lang' => true, 'validate' => 'isGenericName', 'size' => 255),
+ 'meta_title' => array('type' => self::TYPE_STRING, 'lang' => true, 'validate' => 'isGenericName', 'required' => true, 'size' => 128),
+ 'link_rewrite' => array('type' => self::TYPE_STRING, 'lang' => true, 'validate' => 'isLinkRewrite', 'required' => true, 'size' => 128),
+ 'content' => array('type' => self::TYPE_HTML, 'lang' => true, 'validate' => 'isString', 'size' => 3999999999999),
),
);
@@ -63,18 +63,6 @@ class CMSCore extends ObjectModel
'objectsNodeName' => 'content_management_system',
);
- public function getTranslationsFieldsChild()
- {
- $this->validateFieldsLang();
- return $this->getTranslationsFields(array(
- 'meta_description',
- 'meta_keywords',
- 'meta_title',
- 'link_rewrite',
- 'content' => array('html' => true),
- ));
- }
-
public function add($autodate = true, $nullValues = false)
{
$this->position = CMS::getLastPosition((int)$this->id_cms_category);
diff --git a/classes/CMSCategory.php b/classes/CMSCategory.php
index a0a82a98c..57f604211 100644
--- a/classes/CMSCategory.php
+++ b/classes/CMSCategory.php
@@ -86,12 +86,12 @@ class CMSCategoryCore extends ObjectModel
'date_upd' => array('type' => self::TYPE_DATE, 'validate' => 'isDate'),
// Lang fields
- 'name' => array('type' => 'FILL_ME', 'lang' => true, 'validate' => 'isCatalogName', 'required' => true, 'size' => 64),
- 'link_rewrite' => array('type' => 'FILL_ME', 'lang' => true, 'validate' => 'isLinkRewrite', 'required' => true, 'size' => 64),
- 'description' => array('type' => 'FILL_ME', 'lang' => true, 'validate' => 'isCleanHtml'),
- 'meta_title' => array('type' => 'FILL_ME', 'lang' => true, 'validate' => 'isGenericName', 'size' => 128),
- 'meta_description' => array('type' => 'FILL_ME', 'lang' => true, 'validate' => 'isGenericName', 'size' => 255),
- 'meta_keywords' => array('type' => 'FILL_ME', 'lang' => true, 'validate' => 'isGenericName', 'size' => 255),
+ 'name' => array('type' => self::TYPE_STRING, 'lang' => true, 'validate' => 'isCatalogName', 'required' => true, 'size' => 64),
+ 'link_rewrite' => array('type' => self::TYPE_STRING, 'lang' => true, 'validate' => 'isLinkRewrite', 'required' => true, 'size' => 64),
+ 'description' => array('type' => self::TYPE_STRING, 'lang' => true, 'validate' => 'isCleanHtml'),
+ 'meta_title' => array('type' => self::TYPE_STRING, 'lang' => true, 'validate' => 'isGenericName', 'size' => 128),
+ 'meta_description' => array('type' => self::TYPE_STRING, 'lang' => true, 'validate' => 'isGenericName', 'size' => 255),
+ 'meta_keywords' => array('type' => self::TYPE_STRING, 'lang' => true, 'validate' => 'isGenericName', 'size' => 255),
),
);
@@ -100,17 +100,6 @@ class CMSCategoryCore extends ObjectModel
parent::__construct($id_cms_category, $id_lang);
}
- /**
- * Check then return multilingual fields for database interaction
- *
- * @return array Multilingual fields
- */
- public function getTranslationsFieldsChild()
- {
- $this->validateFieldsLang();
- return $this->getTranslationsFields(array('name', 'description', 'link_rewrite', 'meta_title', 'meta_keywords', 'meta_description'));
- }
-
public function add($autodate = true, $nullValues = false)
{
$this->position = self::getLastPosition((int)$this->id_parent);
diff --git a/classes/Carrier.php b/classes/Carrier.php
index 87a42d38a..b49fc988d 100644
--- a/classes/Carrier.php
+++ b/classes/Carrier.php
@@ -142,7 +142,7 @@ class CarrierCore extends ObjectModel
'deleted' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool'),
// Lang fields
- 'delay' => array('type' => 'FILL_ME', 'lang' => true, 'validate' => 'isGenericName', 'required' => true, 'size' => 128),
+ 'delay' => array('type' => self::TYPE_STRING, 'lang' => true, 'validate' => 'isGenericName', 'required' => true, 'size' => 128),
),
);
@@ -168,17 +168,6 @@ class CarrierCore extends ObjectModel
$this->name = Configuration::get('PS_SHOP_NAME');
}
- /**
- * Check then return multilingual fields for database interaction
- *
- * @return array Multilingual fields
- */
- public function getTranslationsFieldsChild()
- {
- $this->validateFieldsLang();
- return $this->getTranslationsFields(array('delay'));
- }
-
public function add($autodate = true, $null_values = false)
{
if (!parent::add($autodate, $null_values) || !Validate::isLoadedObject($this))
diff --git a/classes/CartRule.php b/classes/CartRule.php
index 131694559..2f2924722 100644
--- a/classes/CartRule.php
+++ b/classes/CartRule.php
@@ -94,17 +94,10 @@ class CartRuleCore extends ObjectModel
'date_upd' => array('type' => self::TYPE_DATE, 'validate' => 'isDate'),
// Lang fields
- 'name' => array('type' => 'FILL_ME', 'lang' => true, 'validate' => 'isCleanHtml', 'required' => true, 'size' => 254),
+ 'name' => array('type' => self::TYPE_STRING, 'lang' => true, 'validate' => 'isCleanHtml', 'required' => true, 'size' => 254),
),
);
- public function getTranslationsFieldsChild()
- {
- if (!$this->validateFieldsLang())
- return false;
- return $this->getTranslationsFields(array('name'));
- }
-
public function add($autodate = true, $nullValues = false)
{
if (!parent::add($autodate, $nullValues))
diff --git a/classes/Category.php b/classes/Category.php
index 8ef697abe..03b3c100f 100644
--- a/classes/Category.php
+++ b/classes/Category.php
@@ -90,19 +90,19 @@ class CategoryCore extends ObjectModel
'nleft' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedInt'),
'nright' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedInt'),
'level_depth' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedInt'),
- 'active' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool', 'required' => true, 'size' => 1),
+ 'active' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool', 'required' => true),
'id_parent' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedInt'),
'position' => array('type' => self::TYPE_INT),
'date_add' => array('type' => self::TYPE_DATE, 'validate' => 'isDate'),
'date_upd' => array('type' => self::TYPE_DATE, 'validate' => 'isDate'),
// Lang fields
- 'name' => array('type' => 'FILL_ME', 'lang' => true, 'validate' => 'isCatalogName', 'required' => true, 'size' => 64),
- 'link_rewrite' => array('type' => 'FILL_ME', 'lang' => true, 'validate' => 'isLinkRewrite', 'required' => true, 'size' => 64),
- 'description' => array('type' => 'FILL_ME', 'lang' => true, 'validate' => 'isString'),
- 'meta_title' => array('type' => 'FILL_ME', 'lang' => true, 'validate' => 'isGenericName', 'size' => 128),
- 'meta_description' => array('type' => 'FILL_ME', 'lang' => true, 'validate' => 'isGenericName', 'size' => 255),
- 'meta_keywords' => array('type' => 'FILL_ME', 'lang' => true, 'validate' => 'isGenericName', 'size' => 255),
+ 'name' => array('type' => self::TYPE_STRING, 'lang' => true, 'validate' => 'isCatalogName', 'required' => true, 'size' => 64),
+ 'link_rewrite' => array('type' => self::TYPE_STRING, 'lang' => true, 'validate' => 'isLinkRewrite', 'required' => true, 'size' => 64),
+ 'description' => array('type' => self::TYPE_HTML, 'lang' => true, 'validate' => 'isString'),
+ 'meta_title' => array('type' => self::TYPE_STRING, 'lang' => true, 'validate' => 'isGenericName', 'size' => 128),
+ 'meta_description' => array('type' => self::TYPE_STRING, 'lang' => true, 'validate' => 'isGenericName', 'size' => 255),
+ 'meta_keywords' => array('type' => self::TYPE_STRING, 'lang' => true, 'validate' => 'isGenericName', 'size' => 255),
),
);
@@ -140,24 +140,6 @@ class CategoryCore extends ObjectModel
return strip_tags(stripslashes($description));
}
- /**
- * Check then return multilingual fields for database interaction
- *
- * @return array Multilingual fields
- */
- public function getTranslationsFieldsChild()
- {
- $this->validateFieldsLang();
- return $this->getTranslationsFields(array(
- 'name',
- 'description' => array('html' => true),
- 'link_rewrite',
- 'meta_title',
- 'meta_keywords',
- 'meta_description',
- ));
- }
-
public function add($autodate = true, $nullValues = false)
{
$this->position = self::getLastPosition((int)$this->id_parent);
diff --git a/classes/Configuration.php b/classes/Configuration.php
index 7e5d700e1..dd57cb048 100644
--- a/classes/Configuration.php
+++ b/classes/Configuration.php
@@ -74,16 +74,14 @@ class ConfigurationCore extends ObjectModel
);
/**
- * Check then return multilingual fields for database interaction
- *
+ * @see ObjectModel::getFieldsLang()
* @return array Multilingual fields
*/
- public function getTranslationsFieldsChild()
+ public function getFieldsLang()
{
if (!is_array($this->value))
return true;
- $this->validateFieldsLang();
- return $this->getTranslationsFields(array('value'));
+ return $this->getFieldsLang();
}
/**
diff --git a/classes/Contact.php b/classes/Contact.php
index 7975fa602..24fbc78ca 100644
--- a/classes/Contact.php
+++ b/classes/Contact.php
@@ -52,22 +52,11 @@ class ContactCore extends ObjectModel
'customer_service' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool'),
// Lang fields
- 'name' => array('type' => 'FILL_ME', 'lang' => true, 'validate' => 'isGenericName', 'required' => true, 'size' => 32),
- 'description' => array('type' => 'FILL_ME', 'lang' => true, 'validate' => 'isCleanHtml'),
+ 'name' => array('type' => self::TYPE_STRING, 'lang' => true, 'validate' => 'isGenericName', 'required' => true, 'size' => 32),
+ 'description' => array('type' => self::TYPE_STRING, 'lang' => true, 'validate' => 'isCleanHtml'),
),
);
- /**
- * Check then return multilingual fields for database interaction
- *
- * @return array Multilingual fields
- */
- public function getTranslationsFieldsChild()
- {
- $this->validateFieldsLang();
- return $this->getTranslationsFields(array('name', 'description'));
- }
-
/**
* Return available contacts
*
diff --git a/classes/Country.php b/classes/Country.php
index 1d3956981..3607c47a4 100644
--- a/classes/Country.php
+++ b/classes/Country.php
@@ -84,7 +84,7 @@ class CountryCore extends ObjectModel
'display_tax_label' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool', 'required' => true),
// Lang fields
- 'name' => array('type' => 'FILL_ME', 'lang' => true, 'validate' => 'isGenericName', 'required' => true, 'size' => 64),
+ 'name' => array('type' => self::TYPE_STRING, 'lang' => true, 'validate' => 'isGenericName', 'required' => true, 'size' => 64),
),
);
@@ -96,17 +96,6 @@ class CountryCore extends ObjectModel
),
);
- /**
- * Check then return multilingual fields for database interaction
- *
- * @return array Multilingual fields
- */
- public function getTranslationsFieldsChild()
- {
- $this->validateFieldsLang();
- return $this->getTranslationsFields(array('name'));
- }
-
public function delete()
{
if (!parent::delete())
diff --git a/classes/Currency.php b/classes/Currency.php
index 19eada4e4..17d0b0ac0 100644
--- a/classes/Currency.php
+++ b/classes/Currency.php
@@ -65,7 +65,6 @@ class CurrencyCore extends ObjectModel
public static $definition = array(
'table' => 'currency',
'primary' => 'id_currency',
- 'multilang' => true,
'fields' => array(
'name' => array('type' => self::TYPE_STRING, 'validate' => 'isGenericName', 'required' => true, 'size' => 32),
'iso_code' => array('type' => self::TYPE_STRING, 'validate' => 'isLanguageIsoCode', 'required' => true, 'size' => 3),
diff --git a/classes/Feature.php b/classes/Feature.php
index 050a44276..5b614e0b1 100644
--- a/classes/Feature.php
+++ b/classes/Feature.php
@@ -41,7 +41,7 @@ class FeatureCore extends ObjectModel
'position' => array('type' => self::TYPE_INT, 'validate' => 'isInt'),
// Lang fields
- 'name' => array('type' => 'FILL_ME', 'lang' => true, 'validate' => 'isGenericName', 'required' => true, 'size' => 128),
+ 'name' => array('type' => self::TYPE_STRING, 'lang' => true, 'validate' => 'isGenericName', 'required' => true, 'size' => 128),
),
);
@@ -52,17 +52,6 @@ class FeatureCore extends ObjectModel
'fields' => array(),
);
- /**
- * Check then return multilingual fields for database interaction
- *
- * @return array Multilingual fields
- */
- public function getTranslationsFieldsChild()
- {
- $this->validateFieldsLang();
- return $this->getTranslationsFields(array('name'));
- }
-
/**
* Get a feature data for a given id_feature and id_lang
*
@@ -160,7 +149,7 @@ class FeatureCore extends ObjectModel
$this->clearCache();
$result = 1;
- $fields = $this->getTranslationsFieldsChild();
+ $fields = $this->getFieldsLang();
foreach ($fields as $field)
{
foreach (array_keys($field) as $key)
diff --git a/classes/FeatureValue.php b/classes/FeatureValue.php
index d62a16aaf..8312a69f9 100644
--- a/classes/FeatureValue.php
+++ b/classes/FeatureValue.php
@@ -48,7 +48,7 @@ class FeatureValueCore extends ObjectModel
'custom' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool'),
// Lang fields
- 'value' => array('type' => 'FILL_ME', 'lang' => true, 'validate' => 'isGenericName', 'required' => true, 'size' => 255),
+ 'value' => array('type' => self::TYPE_STRING, 'lang' => true, 'validate' => 'isGenericName', 'required' => true, 'size' => 255),
),
);
@@ -60,17 +60,6 @@ class FeatureValueCore extends ObjectModel
),
);
- /**
- * Check then return multilingual fields for database interaction
- *
- * @return array Multilingual fields
- */
- public function getTranslationsFieldsChild()
- {
- $this->validateFieldsLang();
- return $this->getTranslationsFields(array('value'));
- }
-
/**
* Get all values for a given feature
*
diff --git a/classes/Gender.php b/classes/Gender.php
index f88c62485..061c95090 100644
--- a/classes/Gender.php
+++ b/classes/Gender.php
@@ -45,7 +45,7 @@ class GenderCore extends ObjectModel
'type' => array('type' => self::TYPE_INT, 'required' => true),
// Lang fields
- 'name' => array('type' => 'FILL_ME', 'lang' => true, 'validate' => 'isString', 'required' => true, 'size' => 20),
+ 'name' => array('type' => self::TYPE_STRING, 'lang' => true, 'validate' => 'isString', 'required' => true, 'size' => 20),
),
);
@@ -56,19 +56,6 @@ class GenderCore extends ObjectModel
$this->image_dir = _PS_GENDERS_DIR_;
}
- /**
- * Check then return multilingual fields for database interaction
- *
- * @return array Multilingual fields
- */
- public function getTranslationsFieldsChild()
- {
- $this->validateFieldsLang();
- return $this->getTranslationsFields(array(
- 'name',
- ));
- }
-
public static function getGenders($id_lang = null)
{
if (is_null($id_lang))
diff --git a/classes/Group.php b/classes/Group.php
index ccd21cf35..59585bc7a 100644
--- a/classes/Group.php
+++ b/classes/Group.php
@@ -58,7 +58,7 @@ class GroupCore extends ObjectModel
'date_upd' => array('type' => self::TYPE_DATE, 'validate' => 'isDate'),
// Lang fields
- 'name' => array('type' => self::TYPE_INT, 'lang' => true, 'validate' => 'isGenericName', 'required' => true, 'size' => 32),
+ 'name' => array('type' => self::TYPE_STRING, 'lang' => true, 'validate' => 'isGenericName', 'required' => true, 'size' => 32),
),
);
@@ -67,13 +67,6 @@ class GroupCore extends ObjectModel
protected $webserviceParameters = array();
- public function getTranslationsFieldsChild()
- {
- if (!$this->validateFieldsLang())
- return false;
- return $this->getTranslationsFields(array('name'));
- }
-
public static function getGroups($id_lang)
{
return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
diff --git a/classes/Image.php b/classes/Image.php
index 50b7cbeb3..a8c26f11a 100644
--- a/classes/Image.php
+++ b/classes/Image.php
@@ -72,7 +72,7 @@ class ImageCore extends ObjectModel
'cover' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool'),
// Lang fields
- 'legend' => array('type' => 'FILL_ME', 'lang' => true, 'validate' => 'isGenericName', 'required' => true, 'size' => 128),
+ 'legend' => array('type' => self::TYPE_STRING, 'lang' => true, 'validate' => 'isGenericName', 'required' => true, 'size' => 128),
),
);
@@ -85,12 +85,6 @@ class ImageCore extends ObjectModel
$this->source_index = _PS_PROD_IMG_DIR_.'index.php';
}
- public function getTranslationsFieldsChild()
- {
- $this->validateFieldsLang();
- return $this->getTranslationsFields(array('legend'));
- }
-
public function add($autodate = true, $null_values = false)
{
if ($this->position <= 0)
diff --git a/classes/Manufacturer.php b/classes/Manufacturer.php
index 7ac526dd9..101bee475 100644
--- a/classes/Manufacturer.php
+++ b/classes/Manufacturer.php
@@ -79,11 +79,11 @@ class ManufacturerCore extends ObjectModel
'date_upd' => array('type' => self::TYPE_DATE),
// Lang fields
- 'description' => array('type' => 'FILL_ME', 'lang' => true, 'validate' => 'isString'),
- 'short_description' => array('type' => 'FILL_ME', 'lang' => true, 'validate' => 'isString', 'size' => 254),
- 'meta_title' => array('type' => 'FILL_ME', 'lang' => true, 'validate' => 'isGenericName', 'size' => 128),
- 'meta_description' => array('type' => 'FILL_ME', 'lang' => true, 'validate' => 'isGenericName', 'size' => 255),
- 'meta_keywords' => array('type' => 'FILL_ME', 'lang' => true, 'validate' => 'isGenericName'),
+ 'description' => array('type' => self::TYPE_HTML, 'lang' => true, 'validate' => 'isString'),
+ 'short_description' => array('type' => self::TYPE_HTML, 'lang' => true, 'validate' => 'isString', 'size' => 254),
+ 'meta_title' => array('type' => self::TYPE_STRING, 'lang' => true, 'validate' => 'isGenericName', 'size' => 128),
+ 'meta_description' => array('type' => self::TYPE_STRING, 'lang' => true, 'validate' => 'isGenericName', 'size' => 255),
+ 'meta_keywords' => array('type' => self::TYPE_STRING, 'lang' => true, 'validate' => 'isGenericName'),
),
);
@@ -109,19 +109,6 @@ class ManufacturerCore extends ObjectModel
$this->image_dir = _PS_MANU_IMG_DIR_;
}
- public function getTranslationsFieldsChild()
- {
- $this->validateFieldsLang();
-
- return $this->getTranslationsFields(array(
- 'meta_description',
- 'meta_keywords',
- 'meta_title',
- 'description' => array('html' => true),
- 'short_description' => array('html' => true),
- ));
- }
-
public function delete()
{
$address = new Address($this->id_address);
diff --git a/classes/Meta.php b/classes/Meta.php
index 88fb9f463..ae6d26d1a 100644
--- a/classes/Meta.php
+++ b/classes/Meta.php
@@ -46,19 +46,13 @@ class MetaCore extends ObjectModel
'page' => array('type' => self::TYPE_STRING, 'validate' => 'isFileName', 'required' => true, 'size' => 64),
// Lang fields
- 'title' => array('type' => 'FILL_ME', 'lang' => true, 'validate' => 'isGenericName', 'size' => 128),
- 'description' => array('type' => 'FILL_ME', 'lang' => true, 'validate' => 'isGenericName', 'size' => 255),
- 'keywords' => array('type' => 'FILL_ME', 'lang' => true, 'validate' => 'isGenericName', 'size' => 255),
- 'url_rewrite' => array('type' => 'FILL_ME', 'lang' => true, 'validate' => 'isLinkRewrite', 'size' => 255),
+ 'title' => array('type' => self::TYPE_STRING, 'lang' => true, 'validate' => 'isGenericName', 'size' => 128),
+ 'description' => array('type' => self::TYPE_STRING, 'lang' => true, 'validate' => 'isGenericName', 'size' => 255),
+ 'keywords' => array('type' => self::TYPE_STRING, 'lang' => true, 'validate' => 'isGenericName', 'size' => 255),
+ 'url_rewrite' => array('type' => self::TYPE_STRING, 'lang' => true, 'validate' => 'isLinkRewrite', 'size' => 255),
),
);
- public function getTranslationsFieldsChild()
- {
- $this->validateFieldsLang();
- return $this->getTranslationsFields(array('title', 'description', 'keywords', 'url_rewrite'));
- }
-
public static function getPages($excludeFilled = false, $addPage = false)
{
$selectedPages = array();
diff --git a/classes/ObjectModel.php b/classes/ObjectModel.php
index e496a9133..e0b9cee28 100644
--- a/classes/ObjectModel.php
+++ b/classes/ObjectModel.php
@@ -35,7 +35,7 @@ abstract class ObjectModelCore
const TYPE_STRING = 3;
const TYPE_FLOAT = 4;
const TYPE_DATE = 5;
- const TYPE_HTML = 5;
+ const TYPE_HTML = 6;
/**
* List of association types
@@ -174,10 +174,10 @@ abstract class ObjectModelCore
{
$this->id = (int)$id;
foreach ($result as $key => $value)
- if (key_exists($key, $this))
+ if (array_key_exists($key, $this))
$this->{$key} = $value;
- if (!$id_lang && method_exists($this, 'getTranslationsFieldsChild'))
+ if (!$id_lang && isset($this->def['multilang']) && $this->def['multilang'])
{
$sql = 'SELECT * FROM `'.pSQL(_DB_PREFIX_.$this->def['table']).'_lang`
WHERE `'.$this->def['primary'].'` = '.(int)$id
@@ -220,44 +220,103 @@ abstract class ObjectModelCore
public function getFields()
{
$this->validateFields();
+ return $this->formatFields();
+ }
+
+ /**
+ * Prepare multilang fields
+ *
+ * @return array
+ */
+ public function getFieldsLang()
+ {
+ // Retrocompatibility
+ if (method_exists($this, 'getTranslationsFieldsChild'))
+ return $this->getTranslationsFieldsChild();
+
+ $this->validateFieldsLang();
$fields = array();
+ if (is_null($this->id_lang))
+ foreach (Language::getLanguages(false) as $language)
+ $fields[$language['id_lang']] = $this->formatFields($language['id_lang']);
+ else
+ $fields = $this->formatFields($this->id_lang);
+
+ return $fields;
+ }
+
+ /**
+ * @param int $id_lang If this parameter is given, only take lang fields
+ * @return array
+ */
+ public function formatFields($id_lang = null)
+ {
+ $fields = array();
+
+ // Set primary key in fields
if ($this->id)
$fields[$this->def['primary']] = $this->id;
+ // Set id_lang field for multilang fields and id_shop for multishop field
+ if ($id_lang)
+ {
+ $fields['id_lang'] = $id_lang;
+ if ($this->id_shop && $this->isLangMultishop())
+ $fields['id_shop'] = (int)$this->id_shop;
+ }
+
foreach ($this->def['fields'] as $field => $data)
- if (!isset($data['lang']) || !$data['lang'])
- switch ($data['type'])
- {
- case self::TYPE_INT :
- $fields[$field] = (int)$this->$field;
- break;
+ {
+ // If $id_lang take only language fields, else take only classic fields
+ if (($id_lang && empty($data['lang'])) || (!$id_lang && !empty($data['lang'])))
+ continue;
- case self::TYPE_BOOL :
- $fields[$field] = (int)$this->$field;
- break;
+ // Get field value, if value is multilang and field is empty, use value from default lang
+ $value = $this->$field;
+ if ($id_lang && is_array($value))
+ {
+ if (!empty($value[$id_lang]))
+ $value = $value[$id_lang];
+ else if (!empty($data['required']))
+ $value = $value[Configuration::get('PS_LANG_DEFAULT')];
+ else
+ $value = '';
+ }
- case self::TYPE_FLOAT :
- $fields[$field] = (float)$this->$field;
- break;
+ // Format field value
+ switch ($data['type'])
+ {
+ case self::TYPE_INT :
+ $fields[$field] = (int)$value;
+ break;
- case self::TYPE_DATE :
- $fields[$field] = pSQL($this->$field);
- break;
+ case self::TYPE_BOOL :
+ $fields[$field] = (int)$value;
+ break;
- case self::TYPE_STRING :
- $fields[$field] = pSQL($this->$field);
- break;
+ case self::TYPE_FLOAT :
+ $fields[$field] = (float)$value;
+ break;
- case self::TYPE_STRING :
- $fields[$field] = pSQL($this->$field, true);
- break;
+ case self::TYPE_DATE :
+ $fields[$field] = pSQL($value);
+ break;
- default :
- if (method_exists($this, 'formatType'.$data['type']))
- $fields[$field] = $this->{'formatType'.$data['type']}($this->$field);
- break;
- }
+ case self::TYPE_STRING :
+ $fields[$field] = pSQL($value);
+ break;
+
+ case self::TYPE_HTML :
+ $fields[$field] = pSQL($value, true);
+ break;
+
+ default :
+ if (method_exists($this, 'formatType'.$data['type']))
+ $fields[$field] = $this->{'formatType'.$data['type']}($value);
+ break;
+ }
+ }
return $fields;
}
@@ -265,30 +324,35 @@ abstract class ObjectModelCore
/**
* Save current object to database (add or update)
*
- * return boolean Insertion result
+ * @param bool $null_values
+ * @param bool $autodate
+ * @return boolean Insertion result
*/
- public function save($nullValues = false, $autodate = true)
+ public function save($null_values = false, $autodate = true)
{
- return (int)($this->id) > 0 ? $this->update($nullValues) : $this->add($autodate, $nullValues);
+ return (int)$this->id > 0 ? $this->update($null_values) : $this->add($autodate, $null_values);
}
/**
* Add current object to database
*
- * return boolean Insertion result
+ * @param bool $null_values
+ * @param bool $autodate
+ * @return boolean Insertion result
*/
- public function add($autodate = true, $nullValues = false)
+ public function add($autodate = true, $null_values = false)
{
- /* Hook */
+ // @hook actionObject*AddBefore
Hook::exec('actionObject'.get_class($this).'AddBefore', array('object' => $this));
- /* Automatically fill dates */
- if ($autodate AND key_exists('date_add', $this))
+ // Automatically fill dates
+ if ($autodate && array_key_exists('date_add', $this))
$this->date_add = date('Y-m-d H:i:s');
- if ($autodate AND key_exists('date_upd', $this))
+ if ($autodate && array_key_exists('date_upd', $this))
$this->date_upd = date('Y-m-d H:i:s');
- /* Database insertion */
- if ($nullValues)
+
+ // Database insertion
+ if ($null_values)
$result = Db::getInstance()->autoExecuteWithNullValues(_DB_PREFIX_.$this->def['table'], $this->getFields(), 'INSERT');
else
$result = Db::getInstance()->autoExecute(_DB_PREFIX_.$this->def['table'], $this->getFields(), 'INSERT');
@@ -296,16 +360,17 @@ abstract class ObjectModelCore
if (!$result)
return false;
- /* Get object id in database */
+ // Get object id in database
$this->id = Db::getInstance()->Insert_ID();
$assos = Shop::getAssoTables();
- /* Database insertion for multilingual fields related to the object */
- if (method_exists($this, 'getTranslationsFieldsChild'))
+
+ // Database insertion for multilingual fields related to the object
+ if (isset($this->def['multilang']) && $this->def['multilang'])
{
- $fields = $this->getTranslationsFieldsChild();
+ $fields = $this->getFieldsLang();
$shops = Shop::getShops(true, null, true);
- if ($fields AND is_array($fields))
- foreach ($fields AS &$field)
+ if ($fields && is_array($fields))
+ foreach ($fields as &$field)
{
foreach (array_keys($field) AS $key)
if (!Validate::isTableOrIdentifier($key))
@@ -335,7 +400,7 @@ abstract class ObjectModelCore
$result &= $this->associateTo(Context::getContext()->shop->getGroupID(), 'group_shop');
}
- /* Hook */
+ // @hook actionObject*AddAfter
Hook::exec('actionObject'.get_class($this).'AddAfter', array('object' => $this));
return $result;
@@ -344,20 +409,22 @@ abstract class ObjectModelCore
/**
* Update current object to database
*
+ * @param bool $null_values
* @return boolean Update result
*/
- public function update($nullValues = false)
+ public function update($null_values = false)
{
- /* Hook */
+ // @hook actionObject*UpdateBefore
Hook::exec('actionObject'.get_class($this).'UpdateBefore', array('object' => $this));
$this->clearCache();
- /* Automatically fill dates */
- if (key_exists('date_upd', $this))
+
+ // Automatically fill dates
+ if (array_key_exists('date_upd', $this))
$this->date_upd = date('Y-m-d H:i:s');
- /* Database update */
- if ($nullValues)
+ // Database update
+ if ($null_values)
$result = Db::getInstance()->autoExecuteWithNullValues(_DB_PREFIX_.$this->def['table'], $this->getFields(), 'UPDATE', '`'.pSQL($this->def['primary']).'` = '.(int)($this->id));
else
$result = Db::getInstance()->autoExecute(_DB_PREFIX_.$this->def['table'], $this->getFields(), 'UPDATE', '`'.pSQL($this->def['primary']).'` = '.(int)($this->id));
@@ -365,9 +432,9 @@ abstract class ObjectModelCore
return false;
// Database update for multilingual fields related to the object
- if (method_exists($this, 'getTranslationsFieldsChild'))
+ if (isset($this->def['multilang']) && $this->def['multilang'])
{
- $fields = $this->getTranslationsFieldsChild();
+ $fields = $this->getFieldsLang();
if (is_array($fields))
{
foreach ($fields as $field)
@@ -407,7 +474,7 @@ abstract class ObjectModelCore
}
}
- /* Hook */
+ // @hook actionObject*UpdateAfter
Hook::exec('actionObject'.get_class($this).'UpdateAfter', array('object' => $this));
return $result;
@@ -416,23 +483,23 @@ abstract class ObjectModelCore
/**
* Delete current object from database
*
- * return boolean Deletion result
+ * @return boolean Deletion result
*/
public function delete()
{
- /* Hook */
+ // @hook actionObject*DeleteBefore
Hook::exec('actionObject'.get_class($this).'DeleteBefore', array('object' => $this));
$this->clearCache();
- /* Database deletion */
- $result = Db::getInstance()->execute('DELETE FROM `'.pSQL(_DB_PREFIX_.$this->def['table']).'` WHERE `'.pSQL($this->def['primary']).'` = '.(int)($this->id));
+ // Database deletion
+ $result = Db::getInstance()->execute('DELETE FROM `'.pSQL(_DB_PREFIX_.$this->def['table']).'` WHERE `'.pSQL($this->def['primary']).'` = '.(int)$this->id);
if (!$result)
return false;
- /* Database deletion for multilingual fields related to the object */
- if (method_exists($this, 'getTranslationsFieldsChild'))
- Db::getInstance()->execute('DELETE FROM `'.pSQL(_DB_PREFIX_.$this->def['table']).'_lang` WHERE `'.pSQL($this->def['primary']).'` = '.(int)($this->id));
+ // Database deletion for multilingual fields related to the object
+ if (isset($this->def['multilang']) && $this->def['multilang'])
+ Db::getInstance()->execute('DELETE FROM `'.pSQL(_DB_PREFIX_.$this->def['table']).'_lang` WHERE `'.pSQL($this->def['primary']).'` = '.(int)$this->id);
$assos = Shop::getAssoTables();
if (isset($assos[$this->def['table']]) && $assos[$this->def['table']]['type'] == 'shop')
@@ -442,7 +509,7 @@ abstract class ObjectModelCore
if (isset($assos[$this->def['table']]) && $assos[$this->def['table']]['type'] == 'group_shop')
Db::getInstance()->Execute('DELETE FROM `'._DB_PREFIX_.$this->def['table'].'_group_shop` WHERE `'.$this->def['primary'].'`='.(int)$this->id);
- /* Hook */
+ // @hook actionObject*DeleteAfter
Hook::exec('actionObject'.get_class($this).'DeleteAfter', array('object' => $this));
return $result;
@@ -451,6 +518,7 @@ abstract class ObjectModelCore
/**
* Delete several objects from database
*
+ * @param array $selection
* @return bool Deletion result
*/
public function deleteSelection($selection)
@@ -467,33 +535,30 @@ abstract class ObjectModelCore
/**
* Toggle object status in database
*
- * return boolean Update result
+ * @return boolean Update result
*/
public function toggleStatus()
{
- /* Object must have a variable called 'active' */
- if (!key_exists('active', $this))
+ // Object must have a variable called 'active'
+ if (!array_key_exists('active', $this))
throw new PrestashopException('property "active is missing in object '.get_class($this));
- /* Update active status on object */
+ // Update active status on object
$this->active = !(int)$this->active;
- /* Change status to active/inactive */
+ // Change status to active/inactive
return Db::getInstance()->execute('
- UPDATE `'.pSQL(_DB_PREFIX_.$this->def['table']).'`
- SET `active` = !`active`
- WHERE `'.pSQL($this->def['primary']).'` = '.(int)($this->id));
+ UPDATE `'.pSQL(_DB_PREFIX_.$this->def['table']).'`
+ SET `active` = !`active`
+ WHERE `'.pSQL($this->def['primary']).'` = '.(int)$this->id
+ );
}
/**
- * Prepare multilingual fields for database insertion
- *
- * @param array $fieldsArray Multilingual fields to prepare
- * return array Prepared fields for database insertion
+ * @deprecated 1.5.0 (use getFieldsLang())
*/
protected function getTranslationsFields($fieldsArray)
{
- /* WARNING : Product do not use this function, so do not forget to report any modification if necessary */
$fields = array();
if ($this->id_lang == NULL)
@@ -505,6 +570,9 @@ abstract class ObjectModelCore
return $fields;
}
+ /**
+ * @deprecated 1.5.0
+ */
protected function makeTranslationFields(&$fields, &$fieldsArray, $id_language)
{
$fields[$id_language]['id_lang'] = $id_language;
@@ -538,8 +606,12 @@ abstract class ObjectModelCore
/**
* Check for fields validity before database interaction
+ *
+ * @param bool $die
+ * @param bool $error_return
+ * @return bool|string
*/
- public function validateFields($die = true, $errorReturn = false)
+ public function validateFields($die = true, $error_return = false)
{
$fieldsRequired = array_merge($this->fieldsRequired, (isset(self::$fieldsRequiredDatabase[get_class($this)]) ? self::$fieldsRequiredDatabase[get_class($this)] : array()));
foreach ($fieldsRequired as $field)
@@ -547,45 +619,51 @@ abstract class ObjectModelCore
{
if ($die)
throw new PrestashopException('property empty : '.get_class($this).'->'.$field);
- return $errorReturn ? get_class($this).' -> '.$field.' is empty' : false;
+ return $error_return ? get_class($this).' -> '.$field.' is empty' : false;
}
+
foreach ($this->fieldsSize as $field => $size)
if (isset($this->{$field}) && Tools::strlen($this->{$field}) > $size)
{
if ($die)
throw new PrestashopException('fieldsize error : '.get_class($this).'->'.$field.' > '.$size);
- return $errorReturn ? get_class($this).' -> '.$field.' Length '.$size : false;
+ return $error_return ? get_class($this).' -> '.$field.' Length '.$size : false;
}
- $validate = new Validate();
+
foreach ($this->fieldsValidate as $field => $method)
- if (!method_exists($validate, $method))
+ if (!method_exists('Validate', $method))
throw new PrestashopException('Validation function not found. '.$method);
elseif (!empty($this->{$field}) && !call_user_func(array('Validate', $method), $this->{$field}))
{
if ($die)
throw new PrestashopException('Field not valid : '.get_class($this).'->'.$field.' = '.$this->{$field});
- return $errorReturn ? get_class($this).' -> '.$field.' = '.$this->{$field} : false;
+ return $error_return ? get_class($this).' -> '.$field.' = '.$this->{$field} : false;
}
return true;
}
/**
* Check for multilingual fields validity before database interaction
+ *
+ * @param bool $die
+ * @param bool $error_return
+ * @return bool|string
*/
- public function validateFieldsLang($die = true, $errorReturn = false)
+ public function validateFieldsLang($die = true, $error_return = false)
{
- $defaultLanguage = (int)(Configuration::get('PS_LANG_DEFAULT'));
+ $defaultLanguage = (int)Configuration::get('PS_LANG_DEFAULT');
foreach ($this->fieldsRequiredLang as $fieldArray)
{
if (!is_array($this->{$fieldArray}))
continue ;
- if (!$this->{$fieldArray} OR !sizeof($this->{$fieldArray}) OR ($this->{$fieldArray}[$defaultLanguage] !== '0' AND empty($this->{$fieldArray}[$defaultLanguage])))
+ if (!$this->{$fieldArray} || !count($this->{$fieldArray}) || ($this->{$fieldArray}[$defaultLanguage] !== '0' && empty($this->{$fieldArray}[$defaultLanguage])))
{
if ($die)
throw new PrestashopException('empty for default language : '.get_class($this).'->'.$fieldArray);
- return $errorReturn ? get_class($this).'->'.$fieldArray.' '.Tools::displayError('is empty for default language.') : false;
+ return $error_return ? get_class($this).'->'.$fieldArray.' '.Tools::displayError('is empty for default language.') : false;
}
}
+
foreach ($this->fieldsSizeLang as $fieldArray => $size)
{
if (!is_array($this->{$fieldArray}))
@@ -595,22 +673,22 @@ abstract class ObjectModelCore
{
if ($die)
throw new PrestashopException('fieldsize error '.get_class($this).'->'.$fieldArray.' length of '.$size.' for language');
- return $errorReturn ? get_class($this).'->'.$fieldArray.' '.Tools::displayError('Length').' '.$size.' '.Tools::displayError('for language') : false;
+ return $error_return ? get_class($this).'->'.$fieldArray.' '.Tools::displayError('Length').' '.$size.' '.Tools::displayError('for language') : false;
}
}
- $validate = new Validate();
+
foreach ($this->fieldsValidateLang as $fieldArray => $method)
{
if (!is_array($this->{$fieldArray}))
continue ;
foreach ($this->{$fieldArray} as $k => $value)
- if (!method_exists($validate, $method))
+ if (!method_exists('Validate', $method))
throw new PrestashopException('Validation function not found for lang: '.$method);
elseif (!empty($value) && !call_user_func(array('Validate', $method), $value))
{
if ($die)
- throw new PrestashopException('Field not valid : '.get_class($this).'->'.$field.' = '.$this->{$field}. 'for language '.$k);
- return $errorReturn ? Tools::displayError('The following field is invalid according to the validate method ').''.$method.':
('. get_class($this).'->'.$fieldArray.' = '.$value.' '.Tools::displayError('for language').' '.$k : false;
+ throw new PrestashopException('Field not valid : '.get_class($this).'->'.$fieldArray.' = '.$value. 'for language '.$k);
+ return $error_return ? Tools::displayError('The following field is invalid according to the validate method ').''.$method.':
('. get_class($this).'->'.$fieldArray.' = '.$value.' '.Tools::displayError('for language').' '.$k : false;
}
}
return true;
@@ -1148,6 +1226,10 @@ abstract class ObjectModelCore
else
$this->def['primary'] = $this->identifier;
+ // Check multilang retrocompatibility
+ if (method_exists($this, 'getTranslationsFieldsChild'))
+ $this->def['multilang'] = true;
+
// Retrocompatibility with $fieldsValidate, $fieldsRequired and $fieldsSize properties ($definition['fields'])
if (isset($this->def['fields']))
{
diff --git a/classes/Product.php b/classes/Product.php
index 30f919e16..c60642fb8 100644
--- a/classes/Product.php
+++ b/classes/Product.php
@@ -267,8 +267,8 @@ class ProductCore extends ObjectModel
'meta_title' => array('type' => self::TYPE_STRING, 'lang' => true, 'validate' => 'isGenericName', 'size' => 128),
'link_rewrite' => array('type' => self::TYPE_STRING, 'lang' => true, 'validate' => 'isLinkRewrite', 'required' => true, 'size' => 128),
'name' => array('type' => self::TYPE_STRING, 'lang' => true, 'validate' => 'isCatalogName', 'required' => true, 'size' => 128),
- 'description' => array('type' => self::TYPE_STRING, 'lang' => true, 'validate' => 'isString'),
- 'description_short' => array('type' => self::TYPE_STRING, 'lang' => true, 'validate' => 'isString'),
+ 'description' => array('type' => self::TYPE_HTML, 'lang' => true, 'validate' => 'isString'),
+ 'description_short' => array('type' => self::TYPE_HTML, 'lang' => true, 'validate' => 'isString'),
'available_now' => array('type' => self::TYPE_STRING, 'lang' => true, 'validate' => 'isGenericName', 'size' => 255),
'available_later' => array('type' => self::TYPE_STRING, 'lang' => true, 'validate' => 'IsGenericName', 'size' => 255),
),
@@ -429,27 +429,6 @@ class ProductCore extends ObjectModel
return $return;
}
- /**
- * Check then return multilingual fields for database interaction
- *
- * @return array Multilingual fields
- */
- public function getTranslationsFieldsChild()
- {
- $this->validateFieldsLang();
- return $this->getTranslationsFields(array(
- 'meta_description',
- 'meta_keywords',
- 'meta_title',
- 'link_rewrite',
- 'name',
- 'available_now',
- 'available_later',
- 'description' => array('html' => true),
- 'description_short' => array('html' => true),
- ));
- }
-
public static function initPricesComputation($id_customer = null)
{
if ($id_customer)
diff --git a/classes/Profile.php b/classes/Profile.php
index 5cd01bc8c..d4fac13be 100644
--- a/classes/Profile.php
+++ b/classes/Profile.php
@@ -39,21 +39,10 @@ class ProfileCore extends ObjectModel
'multilang' => true,
'fields' => array(
// Lang fields
- 'name' => array('type' => 'FILL_ME', 'lang' => true, 'validate' => 'isGenericName', 'required' => true, 'size' => 32),
+ 'name' => array('type' => self::TYPE_STRING, 'lang' => true, 'validate' => 'isGenericName', 'required' => true, 'size' => 32),
),
);
- /**
- * Check then return multilingual fields for database interaction
- *
- * @return array Multilingual fields
- */
- public function getTranslationsFieldsChild()
- {
- $this->validateFieldsLang();
- return $this->getTranslationsFields(array('name'));
- }
-
/**
* Get all available profiles
*
diff --git a/classes/QuickAccess.php b/classes/QuickAccess.php
index 587cb8c11..e8e27e546 100644
--- a/classes/QuickAccess.php
+++ b/classes/QuickAccess.php
@@ -48,21 +48,10 @@ class QuickAccessCore extends ObjectModel
'new_window' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool', 'required' => true),
// Lang fields
- 'name' => array('type' => 'FILL_ME', 'lang' => true, 'validate' => 'isGenericName', 'required' => true, 'size' => 32),
+ 'name' => array('type' => self::TYPE_STRING, 'lang' => true, 'validate' => 'isGenericName', 'required' => true, 'size' => 32),
),
);
- /**
- * Check then return multilingual fields for database interaction
- *
- * @return array Multilingual fields
- */
- public function getTranslationsFieldsChild()
- {
- $this->validateFieldsLang();
- return $this->getTranslationsFields(array('name'));
- }
-
/**
* Get all available quick_accesses
*
diff --git a/classes/Scene.php b/classes/Scene.php
index 6ebad1d78..e94ba1698 100644
--- a/classes/Scene.php
+++ b/classes/Scene.php
@@ -53,7 +53,7 @@ class SceneCore extends ObjectModel
'active' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool', 'required' => true),
// Lang fields
- 'name' => array('type' => 'FILL_ME', 'lang' => true, 'validate' => 'isGenericName', 'required' => true, 'size' => 100),
+ 'name' => array('type' => self::TYPE_STRING, 'lang' => true, 'validate' => 'isGenericName', 'required' => true, 'size' => 100),
),
);
@@ -70,17 +70,6 @@ class SceneCore extends ObjectModel
$this->image_dir = _PS_SCENE_IMG_DIR_;
}
- /**
- * Check then return multilingual fields for database interaction
- *
- * @return array Multilingual fields
- */
- public function getTranslationsFieldsChild()
- {
- $this->validateFieldsLang();
- return $this->getTranslationsFields(array('name'));
- }
-
public function update($nullValues = false)
{
if (!$this->updateZoneProducts())
diff --git a/classes/State.php b/classes/State.php
index edf01a615..637c88bb3 100644
--- a/classes/State.php
+++ b/classes/State.php
@@ -135,7 +135,7 @@ class StateCore extends ObjectModel
return false;
/* Database deletion for multilingual fields related to the object */
- if (method_exists($this, 'getTranslationsFieldsChild'))
+ if (!empty($this->def['multilang']))
Db::getInstance()->execute('DELETE FROM `'.pSQL(_DB_PREFIX_.$this->def['table']).'_lang` WHERE `'.$this->def['primary'].'` = '.(int)$this->id);
return $result;
}
diff --git a/classes/Supplier.php b/classes/Supplier.php
index 3bf3361fe..ddde78fff 100644
--- a/classes/Supplier.php
+++ b/classes/Supplier.php
@@ -80,10 +80,10 @@ class SupplierCore extends ObjectModel
'date_upd' => array('type' => self::TYPE_DATE, 'validate' => 'isDate'),
// Lang fields
- 'description' => array('type' => 'FILL_ME', 'lang' => true, 'validate' => 'isGenericName'),
- 'meta_title' => array('type' => 'FILL_ME', 'lang' => true, 'validate' => 'isGenericName', 'size' => 128),
- 'meta_description' => array('type' => 'FILL_ME', 'lang' => true, 'validate' => 'isGenericName', 'size' => 255),
- 'meta_keywords' => array('type' => 'FILL_ME', 'lang' => true, 'validate' => 'isGenericName', 'size' => 255),
+ 'description' => array('type' => self::TYPE_STRING, 'lang' => true, 'validate' => 'isGenericName'),
+ 'meta_title' => array('type' => self::TYPE_STRING, 'lang' => true, 'validate' => 'isGenericName', 'size' => 128),
+ 'meta_description' => array('type' => self::TYPE_STRING, 'lang' => true, 'validate' => 'isGenericName', 'size' => 255),
+ 'meta_keywords' => array('type' => self::TYPE_STRING, 'lang' => true, 'validate' => 'isGenericName', 'size' => 255),
),
);
@@ -106,12 +106,6 @@ class SupplierCore extends ObjectModel
return Tools::link_rewrite($this->name, false);
}
- public function getTranslationsFieldsChild()
- {
- $this->validateFieldsLang();
- return $this->getTranslationsFields(array('description', 'meta_title', 'meta_keywords', 'meta_description'));
- }
-
/**
* Return suppliers
*
diff --git a/classes/Tab.php b/classes/Tab.php
index 723916be3..1b88e3623 100644
--- a/classes/Tab.php
+++ b/classes/Tab.php
@@ -55,11 +55,10 @@ class TabCore extends ObjectModel
'class_name' => array('type' => self::TYPE_STRING, 'required' => true, 'size' => 64),
// Lang fields
- 'name' => array('type' => 'FILL_ME', 'lang' => true, 'validate' => 'isGenericName', 'required' => true, 'size' => 32),
+ 'name' => array('type' => self::TYPE_STRING, 'lang' => true, 'validate' => 'isGenericName', 'required' => true, 'size' => 32),
),
);
-
protected static $_getIdFromClassName = null;
public function getTranslationsFieldsChild()
diff --git a/classes/order/OrderMessage.php b/classes/order/OrderMessage.php
index 445ae1e87..97409a812 100644
--- a/classes/order/OrderMessage.php
+++ b/classes/order/OrderMessage.php
@@ -47,8 +47,8 @@ class OrderMessageCore extends ObjectModel
'date_add' => array('type' => self::TYPE_DATE, 'validate' => 'isDate'),
// Lang fields
- 'name' => array('type' => 'FILL_ME', 'lang' => true, 'validate' => 'isGenericName', 'required' => true, 'size' => 128),
- 'message' => array('type' => 'FILL_ME', 'lang' => true, 'validate' => 'isMessage', 'required' => true, 'size' => 1200),
+ 'name' => array('type' => self::TYPE_STRING, 'lang' => true, 'validate' => 'isGenericName', 'required' => true, 'size' => 128),
+ 'message' => array('type' => self::TYPE_STRING, 'lang' => true, 'validate' => 'isMessage', 'required' => true, 'size' => 1200),
),
);
@@ -60,12 +60,6 @@ class OrderMessageCore extends ObjectModel
)
);
- public function getTranslationsFieldsChild()
- {
- $this->validateFieldsLang();
- return $this->getTranslationsFields(array('name', 'message'));
- }
-
public static function getOrderMessages($id_lang)
{
return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
diff --git a/classes/order/OrderReturnState.php b/classes/order/OrderReturnState.php
index 9ff83d5a8..9cf67e4ae 100644
--- a/classes/order/OrderReturnState.php
+++ b/classes/order/OrderReturnState.php
@@ -44,21 +44,10 @@ class OrderReturnStateCore extends ObjectModel
'color' => array('type' => self::TYPE_STRING, 'validate' => 'isColor'),
// Lang fields
- 'name' => array('type' => 'FILL_ME', 'lang' => true, 'validate' => 'isGenericName', 'required' => true, 'size' => 64),
+ 'name' => array('type' => self::TYPE_STRING, 'lang' => true, 'validate' => 'isGenericName', 'required' => true, 'size' => 64),
),
);
- /**
- * Check then return multilingual fields for database interaction
- *
- * @return array Multilingual fields
- */
- public function getTranslationsFieldsChild()
- {
- $this->validateFieldsLang();
- return $this->getTranslationsFields(array('name'));
- }
-
/**
* Get all available order states
*
diff --git a/classes/order/OrderState.php b/classes/order/OrderState.php
index 6b0bdfc2b..07221fb24 100644
--- a/classes/order/OrderState.php
+++ b/classes/order/OrderState.php
@@ -74,8 +74,8 @@ class OrderStateCore extends ObjectModel
'hidden' => array('type' => self::TYPE_BOOL, 'validate' => 'isBool'),
// Lang fields
- 'name' => array('type' => 'FILL_ME', 'lang' => true, 'validate' => 'isGenericName', 'required' => true, 'size' => 64),
- 'template' => array('type' => 'FILL_ME', 'lang' => true, 'validate' => 'isTplName', 'size' => 64),
+ 'name' => array('type' => self::TYPE_STRING, 'lang' => true, 'validate' => 'isGenericName', 'required' => true, 'size' => 64),
+ 'template' => array('type' => self::TYPE_STRING, 'lang' => true, 'validate' => 'isTplName', 'size' => 64),
),
);
@@ -87,17 +87,6 @@ class OrderStateCore extends ObjectModel
),
);
- /**
- * Check then return multilingual fields for database interaction
- *
- * @return array Multilingual fields
- */
- public function getTranslationsFieldsChild()
- {
- $this->validateFieldsLang();
- return $this->getTranslationsFields(array('name', 'template'));
- }
-
/**
* Get all available order states
*
diff --git a/classes/stock/StockMvtReason.php b/classes/stock/StockMvtReason.php
index 3cc99e82b..5c2bd0201 100644
--- a/classes/stock/StockMvtReason.php
+++ b/classes/stock/StockMvtReason.php
@@ -59,7 +59,7 @@ class StockMvtReasonCore extends ObjectModel
'date_upd' => array('type' => self::TYPE_DATE, 'validate' => 'isDate'),
// Lang fields
- 'name' => array('type' => 'FILL_ME', 'lang' => true, 'validate' => 'isGenericName', 'required' => true, 'size' => 255),
+ 'name' => array('type' => self::TYPE_STRING, 'lang' => true, 'validate' => 'isGenericName', 'required' => true, 'size' => 255),
),
);
@@ -68,12 +68,6 @@ class StockMvtReasonCore extends ObjectModel
'objectNodeName' => 'stock_movement_reason',
);
- public function getTranslationsFieldsChild()
- {
- $this->validateFieldsLang();
- return $this->getTranslationsFields(array('name'));
- }
-
public static function getStockMvtReasons($id_lang, $sign = null)
{
$query = new DbQuery();
diff --git a/classes/stock/SupplyOrderState.php b/classes/stock/SupplyOrderState.php
index 28e6214d1..5029f5c5c 100755
--- a/classes/stock/SupplyOrderState.php
+++ b/classes/stock/SupplyOrderState.php
@@ -81,19 +81,10 @@ class SupplyOrderStateCore extends ObjectModel
'color' => array('type' => self::TYPE_STRING, 'validate' => 'isColor'),
// Lang fields
- 'name' => array('type' => 'FILL_ME', 'lang' => true, 'validate' => 'isGenericName', 'required' => true, 'size' => 128),
+ 'name' => array('type' => self::TYPE_STRING, 'lang' => true, 'validate' => 'isGenericName', 'required' => true, 'size' => 128),
),
);
- /**
- * @see ObjectModel::getTranslationsFieldsChild()
- */
- public function getTranslationsFieldsChild()
- {
- $this->validateFieldsLang();
- return $this->getTranslationsFields(array('name'));
- }
-
/**
* Gets the list of supply order states
*
diff --git a/classes/tax/Tax.php b/classes/tax/Tax.php
index 55ec0258f..5e3ece280 100644
--- a/classes/tax/Tax.php
+++ b/classes/tax/Tax.php
@@ -56,7 +56,7 @@ class TaxCore extends ObjectModel
'deleted' => array('type' => self::TYPE_BOOL),
// Lang fields
- 'name' => array('type' => 'FILL_ME', 'lang' => true, 'validate' => 'isGenericName', 'required' => true, 'size' => 32),
+ 'name' => array('type' => self::TYPE_STRING, 'lang' => true, 'validate' => 'isGenericName', 'required' => true, 'size' => 32),
),
);
@@ -68,17 +68,6 @@ class TaxCore extends ObjectModel
'objectsNodeName' => 'taxes',
);
- /**
- * Check then return multilingual fields for database interaction
- *
- * @return array Multilingual fields
- */
- public function getTranslationsFieldsChild()
- {
- $this->validateFieldsLang();
- return $this->getTranslationsFields(array('name'));
- }
-
public function delete()
{
/* Clean associations */