[-] CORE : fixed bug #PSCFV-4634 - Object::cleanPosition() is no longer call in controller but in Object::delete();

This commit is contained in:
vAugagneur
2012-10-03 09:36:25 +00:00
parent cd118e81de
commit 773bbd86d6
6 changed files with 12 additions and 8 deletions
+1
View File
@@ -139,6 +139,7 @@ class AttributeGroupCore extends ObjectModel
IN (SELECT id_attribute FROM `'._DB_PREFIX_.'attribute` WHERE `id_attribute_group` = '.(int)$this->id.')') === false || IN (SELECT id_attribute FROM `'._DB_PREFIX_.'attribute` WHERE `id_attribute_group` = '.(int)$this->id.')') === false ||
Db::getInstance()->execute('DELETE FROM `'._DB_PREFIX_.'attribute` WHERE `id_attribute_group` = '.(int)$this->id) === false) Db::getInstance()->execute('DELETE FROM `'._DB_PREFIX_.'attribute` WHERE `id_attribute_group` = '.(int)$this->id) === false)
return false; return false;
$this->cleanPositions();
} }
$return = parent::delete(); $return = parent::delete();
if ($return) if ($return)
+1
View File
@@ -202,6 +202,7 @@ class CarrierCore extends ObjectModel
{ {
if (!parent::delete()) if (!parent::delete())
return false; return false;
$this->cleanPositions();
return (Db::getInstance()->execute('DELETE FROM '._DB_PREFIX_.'cart_rule_carrier WHERE id_carrier = '.(int)$this->id) && return (Db::getInstance()->execute('DELETE FROM '._DB_PREFIX_.'cart_rule_carrier WHERE id_carrier = '.(int)$this->id) &&
$this->deleteTaxRulesGroup(Shop::getShops(true, null, true))); $this->deleteTaxRulesGroup(Shop::getShops(true, null, true)));
+3 -2
View File
@@ -287,6 +287,7 @@ class DispatcherCore
case self::FC_ADMIN : case self::FC_ADMIN :
$tab = Tab::getInstanceFromClassName($this->controller); $tab = Tab::getInstanceFromClassName($this->controller);
$retrocompatibility_admin_tab = null; $retrocompatibility_admin_tab = null;
if ($tab->module) if ($tab->module)
{ {
if (file_exists(_PS_MODULE_DIR_.$tab->module.'/'.$tab->class_name.'.php')) if (file_exists(_PS_MODULE_DIR_.$tab->module.'/'.$tab->class_name.'.php'))
@@ -636,7 +637,7 @@ class DispatcherCore
return $this->controller; return $this->controller;
$controller = Tools::getValue('controller'); $controller = Tools::getValue('controller');
if (isset($controller) && is_string($controller) && preg_match('/^([0-9a-z_-]+)\?(.*)=(.*)$/Ui', $controller, $m)) if (isset($controller) && is_string($controller) && preg_match('/^([0-9a-z_-]+)\?(.*)=(.*)$/Ui', $controller, $m))
{ {
$controller = $m[1]; $controller = $m[1];
@@ -648,7 +649,7 @@ class DispatcherCore
if (!Validate::isControllerName($controller)) if (!Validate::isControllerName($controller))
$controller = false; $controller = false;
// Use routes ? (for url rewriting) // Use routes ? (for url rewriting)
if ($this->use_routes && !$controller) if ($this->use_routes && !$controller)
{ {
+3 -1
View File
@@ -668,7 +668,9 @@ class ProductCore extends ObjectModel
// If there are still entries in product_shop, don't remove completly the product // If there are still entries in product_shop, don't remove completly the product
if ($this->hasMultishopEntries()) if ($this->hasMultishopEntries())
return true; return true;
Product::cleanPositions($this->id);
Hook::exec('actionProductDelete', array('product' => $this)); Hook::exec('actionProductDelete', array('product' => $this));
if (!$result || if (!$result ||
!GroupReduction::deleteProductReduction($this->id) || !GroupReduction::deleteProductReduction($this->id) ||
-4
View File
@@ -571,11 +571,7 @@ class AdminControllerCore extends Controller
$this->redirect_after = self::$currentIndex.'&conf=1&token='.$this->token; $this->redirect_after = self::$currentIndex.'&conf=1&token='.$this->token;
} }
elseif ($object->delete()) elseif ($object->delete())
{
if (method_exists($object, 'cleanPositions'))
$object->cleanPositions();
$this->redirect_after = self::$currentIndex.'&conf=1&token='.$this->token; $this->redirect_after = self::$currentIndex.'&conf=1&token='.$this->token;
}
$this->errors[] = Tools::displayError('An error occurred during deletion.'); $this->errors[] = Tools::displayError('An error occurred during deletion.');
} }
} }
+4 -1
View File
@@ -278,8 +278,11 @@ class AdminTabsControllerCore extends AdminController
// Temporary add the position depend of the selection of the parent category // Temporary add the position depend of the selection of the parent category
if (!Tools::isSubmit('id_tab')) // @todo Review if (!Tools::isSubmit('id_tab')) // @todo Review
$_POST['position'] = Tab::getNbTabs(Tools::getValue('id_parent')); $_POST['position'] = Tab::getNbTabs(Tools::getValue('id_parent'));
parent::postProcess();
} }
if (!count($this->errors))
parent::postProcess();
} }
protected function afterImageUpload() protected function afterImageUpload()