Merge branch 'development' of https://github.com/PrestaShop/PrestaShop into development

This commit is contained in:
gRoussac
2013-05-24 17:22:20 +02:00
4 changed files with 23 additions and 7 deletions
+2 -2
View File
@@ -71,7 +71,7 @@ class AttributeCore extends ObjectModel
public function delete() public function delete()
{ {
if (!$this->hasMultishopEntries()) if (!$this->hasMultishopEntries() || Shop::getContext() == Shop::CONTEXT_ALL)
{ {
$result = Db::getInstance()->executeS('SELECT id_product_attribute FROM '._DB_PREFIX_.'product_attribute_combination WHERE id_attribute = '.(int)$this->id); $result = Db::getInstance()->executeS('SELECT id_product_attribute FROM '._DB_PREFIX_.'product_attribute_combination WHERE id_attribute = '.(int)$this->id);
foreach ($result as $row) foreach ($result as $row)
@@ -343,4 +343,4 @@ class AttributeCore extends ObjectModel
return (is_numeric($position)) ? $position : -1; return (is_numeric($position)) ? $position : -1;
} }
} }
+12 -2
View File
@@ -70,6 +70,11 @@ class AttributeGroupCore extends ObjectModel
public function add($autodate = true, $nullValues = false) public function add($autodate = true, $nullValues = false)
{ {
if ($this->group_type == 'color')
$this->is_color_group = 1;
else
$this->is_color_group = 0;
if ($this->position <= 0) if ($this->position <= 0)
$this->position = AttributeGroup::getHigherPosition() + 1; $this->position = AttributeGroup::getHigherPosition() + 1;
@@ -80,11 +85,16 @@ class AttributeGroupCore extends ObjectModel
public function update($nullValues = false) public function update($nullValues = false)
{ {
if ($this->group_type == 'color')
$this->is_color_group = 1;
else
$this->is_color_group = 0;
$return = parent::update($nullValues); $return = parent::update($nullValues);
Hook::exec('actionAttributeGroupSave', array('id_attribute_group' => $this->id)); Hook::exec('actionAttributeGroupSave', array('id_attribute_group' => $this->id));
return $return; return $return;
} }
public static function cleanDeadCombinations() public static function cleanDeadCombinations()
{ {
$attribute_combinations = Db::getInstance()->executeS(' $attribute_combinations = Db::getInstance()->executeS('
@@ -109,7 +119,7 @@ class AttributeGroupCore extends ObjectModel
public function delete() public function delete()
{ {
if (!$this->hasMultishopEntries()) if (!$this->hasMultishopEntries() || Shop::getContext() == Shop::CONTEXT_ALL)
{ {
/* Select children in order to find linked combinations */ /* Select children in order to find linked combinations */
$attribute_ids = Db::getInstance()->executeS(' $attribute_ids = Db::getInstance()->executeS('
+3 -3
View File
@@ -466,7 +466,7 @@ class LanguageCore extends ObjectModel
public function delete() public function delete()
{ {
if (!$this->hasMultishopEntries()) if (!$this->hasMultishopEntries() || Shop::getContext() == Shop::CONTEXT_ALL)
{ {
if (empty($this->iso_code)) if (empty($this->iso_code))
$this->iso_code = Language::getIsoById($this->id); $this->iso_code = Language::getIsoById($this->id);
@@ -514,7 +514,7 @@ class LanguageCore extends ObjectModel
if (!parent::delete()) if (!parent::delete())
return false; return false;
if (!$this->hasMultishopEntries()) if (!$this->hasMultishopEntries() || Shop::getContext() == Shop::CONTEXT_ALL)
{ {
// delete images // delete images
$files_copy = array( $files_copy = array(
@@ -831,4 +831,4 @@ class LanguageCore extends ObjectModel
{ {
return (Language::countActiveLanguages() > 1); return (Language::countActiveLanguages() > 1);
} }
} }
+6
View File
@@ -311,6 +311,12 @@ abstract class ModuleCore
*/ */
public static function initUpgradeModule($module) public static function initUpgradeModule($module)
{ {
if (((int)$module->installed == 1) & (empty($module->database_version) === true))
{
Module::upgradeModuleVersion($module->name, $module->version);
$module->database_version = $module->version;
}
// Init cache upgrade details // Init cache upgrade details
self::$modules_cache[$module->name]['upgrade'] = array( self::$modules_cache[$module->name]['upgrade'] = array(
'success' => false, // bool to know if upgrade succeed or not 'success' => false, // bool to know if upgrade succeed or not