// Remove $langMultiShop from all classes, and add 'multishop' in $definition instead
git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@10922 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
+1
-2
@@ -110,8 +110,6 @@ class CarrierCore extends ObjectModel
|
|||||||
/** @var int grade of the shipping delay (0 for longest, 9 for shortest) */
|
/** @var int grade of the shipping delay (0 for longest, 9 for shortest) */
|
||||||
public $grade;
|
public $grade;
|
||||||
|
|
||||||
protected $langMultiShop = true;
|
|
||||||
|
|
||||||
protected $fieldsRequired = array('name', 'active');
|
protected $fieldsRequired = array('name', 'active');
|
||||||
protected $fieldsSize = array('name' => 64, 'grade' => 1);
|
protected $fieldsSize = array('name' => 64, 'grade' => 1);
|
||||||
protected $fieldsValidate = array('id_tax_rules_group' => 'isInt', 'name' => 'isCarrierName', 'active' => 'isBool',
|
protected $fieldsValidate = array('id_tax_rules_group' => 'isInt', 'name' => 'isCarrierName', 'active' => 'isBool',
|
||||||
@@ -126,6 +124,7 @@ class CarrierCore extends ObjectModel
|
|||||||
'table' => 'carrier',
|
'table' => 'carrier',
|
||||||
'primary' => 'id_carrier',
|
'primary' => 'id_carrier',
|
||||||
'multilang' => true,
|
'multilang' => true,
|
||||||
|
'multishop' => true,
|
||||||
);
|
);
|
||||||
|
|
||||||
protected static $price_by_weight = array();
|
protected static $price_by_weight = array();
|
||||||
|
|||||||
@@ -74,8 +74,6 @@ class CategoryCore extends ObjectModel
|
|||||||
/** @var string Object last modification date */
|
/** @var string Object last modification date */
|
||||||
public $date_upd;
|
public $date_upd;
|
||||||
|
|
||||||
protected $langMultiShop = true;
|
|
||||||
|
|
||||||
public $groupBox;
|
public $groupBox;
|
||||||
|
|
||||||
protected static $_links = array();
|
protected static $_links = array();
|
||||||
@@ -107,6 +105,7 @@ class CategoryCore extends ObjectModel
|
|||||||
'table' => 'category',
|
'table' => 'category',
|
||||||
'primary' => 'id_category',
|
'primary' => 'id_category',
|
||||||
'multilang' => true,
|
'multilang' => true,
|
||||||
|
'multishop' => true,
|
||||||
);
|
);
|
||||||
|
|
||||||
/** @var string id_image is the category ID when an image exists and 'default' otherwise */
|
/** @var string id_image is the category ID when an image exists and 'default' otherwise */
|
||||||
|
|||||||
+1
-2
@@ -42,12 +42,11 @@ class MetaCore extends ObjectModel
|
|||||||
protected $fieldsSizeLang = array('title' => 128, 'description' => 255, 'keywords' => 255, 'url_rewrite' => 255);
|
protected $fieldsSizeLang = array('title' => 128, 'description' => 255, 'keywords' => 255, 'url_rewrite' => 255);
|
||||||
protected $fieldsValidateLang = array('title' => 'isGenericName', 'description' => 'isGenericName', 'keywords' => 'isGenericName', 'url_rewrite' => 'isLinkRewrite');
|
protected $fieldsValidateLang = array('title' => 'isGenericName', 'description' => 'isGenericName', 'keywords' => 'isGenericName', 'url_rewrite' => 'isLinkRewrite');
|
||||||
|
|
||||||
protected $langMultiShop = true;
|
|
||||||
|
|
||||||
public static $definition = array(
|
public static $definition = array(
|
||||||
'table' => 'meta',
|
'table' => 'meta',
|
||||||
'primary' => 'id_meta',
|
'primary' => 'id_meta',
|
||||||
'multilang' => true,
|
'multilang' => true,
|
||||||
|
'multishop' => true,
|
||||||
);
|
);
|
||||||
|
|
||||||
public function getFields()
|
public function getFields()
|
||||||
|
|||||||
+15
-12
@@ -70,8 +70,6 @@ abstract class ObjectModelCore
|
|||||||
/** @var array Multilingual fields validity functions for admin panel forms */
|
/** @var array Multilingual fields validity functions for admin panel forms */
|
||||||
protected $fieldsValidateLang = array();
|
protected $fieldsValidateLang = array();
|
||||||
|
|
||||||
protected $langMultiShop = false;
|
|
||||||
|
|
||||||
/** @var array tables */
|
/** @var array tables */
|
||||||
protected $tables = array();
|
protected $tables = array();
|
||||||
|
|
||||||
@@ -92,6 +90,11 @@ abstract class ObjectModelCore
|
|||||||
*/
|
*/
|
||||||
public static $definition = array();
|
public static $definition = array();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var array Contain current object definition
|
||||||
|
*/
|
||||||
|
protected $def;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns object validation rules (fields validity)
|
* Returns object validation rules (fields validity)
|
||||||
*
|
*
|
||||||
@@ -128,23 +131,23 @@ abstract class ObjectModelCore
|
|||||||
{
|
{
|
||||||
// For retrocompatibility, we continue to use $this->table and $this->identifier property.
|
// For retrocompatibility, we continue to use $this->table and $this->identifier property.
|
||||||
// When all objects will implement $definition static in 1.6, we will remove it.
|
// When all objects will implement $definition static in 1.6, we will remove it.
|
||||||
$definition = self::getDefinition($this);
|
$this->def = self::getDefinition($this);
|
||||||
if (isset($definition['table']))
|
if (isset($this->def['table']))
|
||||||
$this->table = $definition['table'];
|
$this->table = $this->def['table'];
|
||||||
if (isset($definition['primary']))
|
if (isset($this->def['primary']))
|
||||||
$this->identifier = $definition['primary'];
|
$this->identifier = $this->def['primary'];
|
||||||
|
|
||||||
|
|
||||||
if (!is_null($id_lang))
|
if (!is_null($id_lang))
|
||||||
$this->id_lang = (Language::getLanguage($id_lang) !== false) ? $id_lang : Configuration::get('PS_LANG_DEFAULT');
|
$this->id_lang = (Language::getLanguage($id_lang) !== false) ? $id_lang : Configuration::get('PS_LANG_DEFAULT');
|
||||||
|
|
||||||
if ($id_shop && $this->langMultiShop)
|
if ($id_shop && $this->isLangMultishop())
|
||||||
{
|
{
|
||||||
$this->id_shop = (int)$id_shop;
|
$this->id_shop = (int)$id_shop;
|
||||||
$this->getShopFromContext = false;
|
$this->getShopFromContext = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->langMultiShop && !$this->id_shop)
|
if ($this->isLangMultishop() && !$this->id_shop)
|
||||||
$this->id_shop = Context::getContext()->shop->getID(true);
|
$this->id_shop = Context::getContext()->shop->getID(true);
|
||||||
|
|
||||||
if (!Validate::isTableOrIdentifier($this->identifier) || !Validate::isTableOrIdentifier($this->table))
|
if (!Validate::isTableOrIdentifier($this->identifier) || !Validate::isTableOrIdentifier($this->table))
|
||||||
@@ -326,7 +329,7 @@ abstract class ObjectModelCore
|
|||||||
throw new PrestashopException('key '.$key.' is not a valid table or identifier');
|
throw new PrestashopException('key '.$key.' is not a valid table or identifier');
|
||||||
|
|
||||||
// If this table is linked to multishop system, update / insert for all shops from context
|
// If this table is linked to multishop system, update / insert for all shops from context
|
||||||
if ($this->langMultiShop)
|
if ($this->isLangMultishop())
|
||||||
{
|
{
|
||||||
$listShops = ($this->id_shop && !$this->getShopFromContext) ? array($this->id_shop) : Context::getContext()->shop->getListOfID();
|
$listShops = ($this->id_shop && !$this->getShopFromContext) ? array($this->id_shop) : Context::getContext()->shop->getListOfID();
|
||||||
foreach ($listShops as $shop)
|
foreach ($listShops as $shop)
|
||||||
@@ -469,7 +472,7 @@ abstract class ObjectModelCore
|
|||||||
{
|
{
|
||||||
$fields[$id_language]['id_lang'] = $id_language;
|
$fields[$id_language]['id_lang'] = $id_language;
|
||||||
$fields[$id_language][$this->identifier] = (int)($this->id);
|
$fields[$id_language][$this->identifier] = (int)($this->id);
|
||||||
if ($this->id_shop AND $this->langMultiShop)
|
if ($this->id_shop && $this->isLangMultishop())
|
||||||
$fields[$id_language]['id_shop'] = (int)$this->id_shop;
|
$fields[$id_language]['id_shop'] = (int)$this->id_shop;
|
||||||
foreach ($fieldsArray as $k => $field)
|
foreach ($fieldsArray as $k => $field)
|
||||||
{
|
{
|
||||||
@@ -908,7 +911,7 @@ abstract class ObjectModelCore
|
|||||||
|
|
||||||
public function isLangMultishop()
|
public function isLangMultishop()
|
||||||
{
|
{
|
||||||
return (int)$this->langMultiShop;
|
return isset($this->def['multishop']) && $this->def['multishop'] && isset($this->def['multilang']) && $this->def['multilang'];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
+1
-2
@@ -190,8 +190,6 @@ class ProductCore extends ObjectModel
|
|||||||
|
|
||||||
public $isFullyLoaded = false;
|
public $isFullyLoaded = false;
|
||||||
|
|
||||||
protected $langMultiShop = true;
|
|
||||||
|
|
||||||
public $cache_is_pack;
|
public $cache_is_pack;
|
||||||
public $cache_has_attachments;
|
public $cache_has_attachments;
|
||||||
public $is_virtual;
|
public $is_virtual;
|
||||||
@@ -265,6 +263,7 @@ class ProductCore extends ObjectModel
|
|||||||
'table' => 'product',
|
'table' => 'product',
|
||||||
'primary' => 'id_product',
|
'primary' => 'id_product',
|
||||||
'multilang' => true,
|
'multilang' => true,
|
||||||
|
'multishop' => true,
|
||||||
);
|
);
|
||||||
|
|
||||||
protected $webserviceParameters = array(
|
protected $webserviceParameters = array(
|
||||||
|
|||||||
Reference in New Issue
Block a user