// Fix admin carriers multishop bug #PSCFV-2380

This commit is contained in:
rMalie
2012-05-18 15:44:46 +00:00
parent c557ea05c6
commit c9e891e0a2
2 changed files with 5 additions and 7 deletions
+3 -5
View File
@@ -2335,10 +2335,9 @@ class AdminControllerCore extends Controller
* Returns an array with selected shops and type (group or boutique shop)
*
* @param string $table
* @param int $id_object
* @return array
*/
protected function getSelectedAssoShop($table, $id_object = false)
protected function getSelectedAssoShop($table)
{
if (!Shop::isFeatureActive() || !Shop::isTableAssociated($table))
return array();
@@ -2362,9 +2361,8 @@ class AdminControllerCore extends Controller
* Update the associations of shops
*
* @param int $id_object
* @param int $new_id_object
*/
protected function updateAssoShop($id_object, $new_id_object = false)
protected function updateAssoShop($id_object)
{
if (!Shop::isFeatureActive())
return;
@@ -2388,7 +2386,7 @@ class AdminControllerCore extends Controller
$insert = array();
foreach ($assos_data as $id_shop)
$insert[] = array(
$this->identifier => $new_id_object ? $new_id_object : $id_object,
$this->identifier => $id_object,
'id_shop' => (int)$id_shop,
);
Db::getInstance()->insert($this->table.'_shop', $insert, false, true, Db::INSERT_IGNORE);
@@ -177,7 +177,7 @@ class AdminCarriersControllerCore extends AdminController
</ul>'
);
$this->_select = 'b.*';
$this->_join = 'LEFT JOIN `'._DB_PREFIX_.'carrier_lang` b ON a.id_carrier = b.id_carrier
$this->_join = 'LEFT JOIN `'._DB_PREFIX_.'carrier_lang` b ON a.id_carrier = b.id_carrier'.Shop::addSqlRestrictionOnLang('b').'
LEFT JOIN `'._DB_PREFIX_.'carrier_tax_rules_group_shop` ctrgs ON (a.`id_carrier` = ctrgs.`id_carrier`
AND ctrgs.id_shop='.(int)$this->context->shop->id.')';
$this->_where = 'AND b.id_lang = '.$this->context->language->id;
@@ -476,7 +476,7 @@ class AdminCarriersControllerCore extends AdminController
$new_carrier->position = $current_carrier->position;
if ($new_carrier->add())
{
$this->updateAssoShop($current_carrier->id, $new_carrier->id);
$this->updateAssoShop($new_carrier->id);
$new_carrier->copyCarrierData((int)$current_carrier->id);
$this->changeGroups($new_carrier->id);
// Call of hooks