// Changed the name of a multishop variable to multishop_specific, in order to avoid confusion

This commit is contained in:
dMetzger
2012-07-09 15:48:22 +00:00
parent 8b8069f024
commit b72deb7cb2
4 changed files with 12 additions and 12 deletions
+1 -1
View File
@@ -63,7 +63,7 @@ class CombinationCore extends ObjectModel
public static $definition = array( public static $definition = array(
'table' => 'product_attribute', 'table' => 'product_attribute',
'primary' => 'id_product_attribute', 'primary' => 'id_product_attribute',
'multishop' => true, 'multishop_specific' => true,
'fields' => array( 'fields' => array(
'id_product' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId', 'required' => true), 'id_product' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId', 'required' => true),
'location' => array('type' => self::TYPE_STRING, 'validate' => 'isGenericName', 'size' => 64), 'location' => array('type' => self::TYPE_STRING, 'validate' => 'isGenericName', 'size' => 64),
+8 -8
View File
@@ -200,7 +200,7 @@ abstract class ObjectModelCore
} }
// Get shop informations // Get shop informations
if (!empty($this->def['multishop'])) if (!empty($this->def['multishop_specific']))
$sql->leftJoin($this->def['table'].'_shop', 'c', 'a.'.$this->def['primary'].' = c.'.$this->def['primary'].' AND c.id_shop = '.(int)$this->id_shop); $sql->leftJoin($this->def['table'].'_shop', 'c', 'a.'.$this->def['primary'].' = c.'.$this->def['primary'].' AND c.id_shop = '.(int)$this->id_shop);
Cache::store($cache_id, Db::getInstance()->getRow($sql)); Cache::store($cache_id, Db::getInstance()->getRow($sql));
@@ -258,7 +258,7 @@ abstract class ObjectModelCore
$fields = $this->formatFields(self::FORMAT_COMMON); $fields = $this->formatFields(self::FORMAT_COMMON);
// For retro compatibility // For retro compatibility
if (!empty($this->def['multishop'])) if (!empty($this->def['multishop_specific']))
$fields = array_merge($fields, $this->getFieldsShop()); $fields = array_merge($fields, $this->getFieldsShop());
// Ensure that we get something to insert // Ensure that we get something to insert
@@ -446,7 +446,7 @@ abstract class ObjectModelCore
$this->id = Db::getInstance()->Insert_ID(); $this->id = Db::getInstance()->Insert_ID();
// Database insertion for multishop fields related to the object // Database insertion for multishop fields related to the object
if (!empty($this->def['multishop'])) if (!empty($this->def['multishop_specific']))
{ {
$fields = $this->getFieldsShop(); $fields = $this->getFieldsShop();
$fields[$this->def['primary']] = (int)$this->id; $fields[$this->def['primary']] = (int)$this->id;
@@ -527,7 +527,7 @@ abstract class ObjectModelCore
return false; return false;
// Database insertion for multishop fields related to the object // Database insertion for multishop fields related to the object
if (!empty($this->def['multishop'])) if (!empty($this->def['multishop_specific']))
{ {
$fields = $this->getFieldsShop(); $fields = $this->getFieldsShop();
$fields[$this->def['primary']] = (int)$this->id; $fields[$this->def['primary']] = (int)$this->id;
@@ -630,7 +630,7 @@ abstract class ObjectModelCore
$result = true; $result = true;
// Remove association to multishop table // Remove association to multishop table
if (!empty($this->def['multishop'])) if (!empty($this->def['multishop_specific']))
{ {
$id_shop_list = Shop::getContextListShopID(); $id_shop_list = Shop::getContextListShopID();
if (count($this->id_shop_list)) if (count($this->id_shop_list))
@@ -642,7 +642,7 @@ abstract class ObjectModelCore
$result &= Db::getInstance()->delete($this->def['table'].'_shop', '`'.$this->def['primary'].'`='.(int)$this->id); $result &= Db::getInstance()->delete($this->def['table'].'_shop', '`'.$this->def['primary'].'`='.(int)$this->id);
// Database deletion // Database deletion
$has_multishop_entries = !empty($this->def['multishop']) ? $this->hasMultishopEntries() : false; $has_multishop_entries = !empty($this->def['multishop_specific']) ? $this->hasMultishopEntries() : false;
if ($result && !$has_multishop_entries) if ($result && !$has_multishop_entries)
$result &= Db::getInstance()->delete($this->def['table'], '`'.pSQL($this->def['primary']).'` = '.(int)$this->id); $result &= Db::getInstance()->delete($this->def['table'], '`'.pSQL($this->def['primary']).'` = '.(int)$this->id);
@@ -1155,7 +1155,7 @@ abstract class ObjectModelCore
*/ */
public function hasMultishopEntries() public function hasMultishopEntries()
{ {
if (empty($this->def['multishop'])) if (empty($this->def['multishop_specific']))
return false; return false;
return (bool)Db::getInstance()->getValue('SELECT COUNT(*) FROM `'._DB_PREFIX_.$this->def['table'].'_shop` WHERE `'.$this->def['primary'].'` = '.(int)$this->id); return (bool)Db::getInstance()->getValue('SELECT COUNT(*) FROM `'._DB_PREFIX_.$this->def['table'].'_shop` WHERE `'.$this->def['primary'].'` = '.(int)$this->id);
@@ -1163,7 +1163,7 @@ abstract class ObjectModelCore
public function isMultishop() public function isMultishop()
{ {
return !empty($this->def['multishop']) || !empty($this->def['multilang_shop']); return !empty($this->def['multishop_specific']) || !empty($this->def['multilang_shop']);
} }
public function isLangMultishop() public function isLangMultishop()
+1 -1
View File
@@ -233,7 +233,7 @@ class ProductCore extends ObjectModel
'primary' => 'id_product', 'primary' => 'id_product',
'multilang' => true, 'multilang' => true,
'multilang_shop' => true, 'multilang_shop' => true,
'multishop' => true, 'multishop_specific' => true,
'fields' => array( 'fields' => array(
// Classic fields // Classic fields
'id_manufacturer' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId'), 'id_manufacturer' => array('type' => self::TYPE_INT, 'validate' => 'isUnsignedId'),
+2 -2
View File
@@ -1998,7 +1998,7 @@ class AdminControllerCore extends Controller
if ($this->multishop_context && Shop::isTableAssociated($this->table) && !empty($this->className)) if ($this->multishop_context && Shop::isTableAssociated($this->table) && !empty($this->className))
{ {
$def = ObjectModel::getDefinition($this->className); $def = ObjectModel::getDefinition($this->className);
if (Shop::getContext() != Shop::CONTEXT_ALL || !empty($def['multishop']) || !$this->context->employee->isSuperAdmin()) if (Shop::getContext() != Shop::CONTEXT_ALL || !empty($def['multishop_specific']) || !$this->context->employee->isSuperAdmin())
{ {
$idenfier_shop = Shop::getContextListShopID(); $idenfier_shop = Shop::getContextListShopID();
if (!$this->_group) if (!$this->_group)
@@ -2383,7 +2383,7 @@ class AdminControllerCore extends Controller
return; return;
$def = ObjectModel::getDefinition($this->className); $def = ObjectModel::getDefinition($this->className);
if (!empty($def['multishop'])) if (!empty($def['multishop_specific']))
return; return;
if (!Shop::isTableAssociated($this->table)) if (!Shop::isTableAssociated($this->table))