// Fix shop association on new object + some strict standard for Franck
This commit is contained in:
+16
-15
@@ -717,6 +717,7 @@ abstract class AdminTabCore
|
|||||||
{
|
{
|
||||||
$parent_id = (int)(Tools::getValue('id_parent', 1));
|
$parent_id = (int)(Tools::getValue('id_parent', 1));
|
||||||
$this->afterAdd($object);
|
$this->afterAdd($object);
|
||||||
|
$this->updateAssoShop($object->id);
|
||||||
// Save and stay on same form
|
// Save and stay on same form
|
||||||
if (Tools::isSubmit('submitAdd'.$this->table.'AndStay'))
|
if (Tools::isSubmit('submitAdd'.$this->table.'AndStay'))
|
||||||
Tools::redirectAdmin($currentIndex.'&'.$this->identifier.'='.$object->id.'&conf=3&update'.$this->table.'&token='.$token);
|
Tools::redirectAdmin($currentIndex.'&'.$this->identifier.'='.$object->id.'&conf=3&update'.$this->table.'&token='.$token);
|
||||||
@@ -868,21 +869,21 @@ abstract class AdminTabCore
|
|||||||
|
|
||||||
protected function updateAssoShop($id_object = false)
|
protected function updateAssoShop($id_object = false)
|
||||||
{
|
{
|
||||||
$assos = array();
|
$assos = array();
|
||||||
|
foreach ($_POST AS $k => $row)
|
||||||
foreach ($_POST AS $k => $row)
|
{
|
||||||
{
|
if (!preg_match('/^checkBoxShopAsso_'.$this->table.'_([0-9]+)?_([0-9]+)$/Ui', $k, $res))
|
||||||
if (!preg_match('/^checkBoxShopAsso_'.$this->table.'_([0-9]+)?_([0-9]+)$/Ui', $k, $res))
|
continue;
|
||||||
continue;
|
$id_asso_object = (!empty($res[1]) ? $res[1] : $id_object);
|
||||||
$id_asso_object = (!empty($res[1]) ? $res[1] : $id_object);
|
$assos[] = array('id_object' => (int)$id_asso_object, 'id_shop' => (int)$res[2]);
|
||||||
$assos[] = array('id_object' => (int)$id_asso_object, 'id_shop' => (int)$res[2]);
|
}
|
||||||
}
|
|
||||||
if (!sizeof($assos))
|
if (!sizeof($assos))
|
||||||
return;
|
return;
|
||||||
Db::getInstance()->Execute('DELETE FROM '._DB_PREFIX_.$this->table.'_shop'.($id_object ? ' WHERE `'.$this->identifier.'`='.(int)$id_object : ''));
|
Db::getInstance()->Execute('DELETE FROM '._DB_PREFIX_.$this->table.'_shop'.($id_object ? ' WHERE `'.$this->identifier.'`='.(int)$id_object : ''));
|
||||||
foreach ($assos AS $asso)
|
foreach ($assos AS $asso)
|
||||||
Db::getInstance()->Execute('INSERT INTO '._DB_PREFIX_.$this->table.'_shop(`'.pSQL($this->identifier).'`, id_shop)
|
Db::getInstance()->Execute('INSERT INTO '._DB_PREFIX_.$this->table.'_shop(`'.pSQL($this->identifier).'`, id_shop)
|
||||||
VALUES('.(int)$asso['id_object'].', '.(int)$asso['id_shop'].')');
|
VALUES('.(int)$asso['id_object'].', '.(int)$asso['id_shop'].')');
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function updateOptions($token)
|
protected function updateOptions($token)
|
||||||
|
|||||||
+1
-1
@@ -290,7 +290,7 @@ abstract class ModuleCore
|
|||||||
{
|
{
|
||||||
$sql = 'DELETE FROM '._DB_PREFIX_.'module_shop
|
$sql = 'DELETE FROM '._DB_PREFIX_.'module_shop
|
||||||
WHERE id_module = '.$this->id.'
|
WHERE id_module = '.$this->id.'
|
||||||
'.((!$foreAll) ? ' AND id_shop IN('.implode(', ', Shop::getListOfID($this->shopID, $this->shopGroupID)).')' : '');
|
'.((!$forceAll) ? ' AND id_shop IN('.implode(', ', Shop::getListOfID($this->shopID, $this->shopGroupID)).')' : '');
|
||||||
Db::getInstance()->execute($sql);
|
Db::getInstance()->execute($sql);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -476,7 +476,7 @@ class PayPal extends PaymentModule
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function validateOrder($id_cart, $id_order_state, $amountPaid, $paymentMethod = 'Unknown', $message = NULL, $extraVars = array(), $currency_special = NULL, $dont_touch_amount = false, $secure_key = false)
|
public function validateOrder($id_cart, $id_order_state, $amountPaid, $paymentMethod = 'Unknown', $message = NULL, $extraVars = array(), $currency_special = NULL, $dont_touch_amount = false, $secure_key = false, $id_group_shop = false, $id_shop = false)
|
||||||
{
|
{
|
||||||
if (!$this->active)
|
if (!$this->active)
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -1109,16 +1109,16 @@ class shopimporter extends ImportModule
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function cleanPositions($table)
|
public function cleanPositions($table, $shopList = null)
|
||||||
{
|
{
|
||||||
if($table == 'category')
|
if ($table == 'category')
|
||||||
{
|
{
|
||||||
//clean category position
|
//clean category position
|
||||||
$cat = Category::getCategories(1, false, false);
|
$cat = Category::getCategories(1, false, false);
|
||||||
foreach($cat AS $i => $categ)
|
foreach($cat AS $i => $categ)
|
||||||
Category::cleanPositions((int)($categ['id_category']));
|
Category::cleanPositions((int)($categ['id_category']));
|
||||||
}
|
}
|
||||||
if($table == 'product')
|
if ($table == 'product')
|
||||||
{
|
{
|
||||||
//clean products position
|
//clean products position
|
||||||
$cat = Category::getCategories(1, false, false);
|
$cat = Category::getCategories(1, false, false);
|
||||||
|
|||||||
@@ -53,13 +53,13 @@ class VatNumber extends Module
|
|||||||
return (parent::uninstall() AND Configuration::updateValue('VATNUMBER_MANAGEMENT', 0));
|
return (parent::uninstall() AND Configuration::updateValue('VATNUMBER_MANAGEMENT', 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function enable()
|
public function enable($forceAll = false)
|
||||||
{
|
{
|
||||||
parent::enable();
|
parent::enable();
|
||||||
Configuration::updateValue('VATNUMBER_MANAGEMENT', 1);
|
Configuration::updateValue('VATNUMBER_MANAGEMENT', 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function disable()
|
public function disable($forceAll = false)
|
||||||
{
|
{
|
||||||
parent::disable();
|
parent::disable();
|
||||||
Configuration::updateValue('VATNUMBER_MANAGEMENT', 0);
|
Configuration::updateValue('VATNUMBER_MANAGEMENT', 0);
|
||||||
|
|||||||
Reference in New Issue
Block a user