[+] Core : products and carriers tax rules are associated to shop
This commit is contained in:
@@ -175,7 +175,9 @@ 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
|
||||
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;
|
||||
|
||||
return parent::renderList();
|
||||
@@ -440,7 +442,6 @@ class AdminCarriersControllerCore extends AdminController
|
||||
return;
|
||||
|
||||
$this->getFieldsValues($obj);
|
||||
|
||||
return parent::renderForm();
|
||||
}
|
||||
|
||||
@@ -484,6 +485,7 @@ class AdminCarriersControllerCore extends AdminController
|
||||
|
||||
$this->postImage($new_carrier->id);
|
||||
$this->changeZones($new_carrier->id);
|
||||
$new_carrier->setTaxRulesGroup((int)Tools::getValue('id_tax_rules_group'), true);
|
||||
Tools::redirectAdmin(self::$currentIndex.'&id_'.$this->table.'='.$current_carrier->id.'&conf=4&token='.$this->token);
|
||||
}
|
||||
else
|
||||
@@ -506,6 +508,7 @@ class AdminCarriersControllerCore extends AdminController
|
||||
{
|
||||
if (($_POST['id_'.$this->table] = $carrier->id /* voluntary */) && $this->postImage($carrier->id) && $this->_redirect)
|
||||
{
|
||||
$carrier->setTaxRulesGroup((int)Tools::getValue('id_tax_rules_group'), true);
|
||||
$this->changeZones($carrier->id);
|
||||
$this->changeGroups($carrier->id);
|
||||
$this->updateAssoShop($carrier->id);
|
||||
@@ -565,7 +568,6 @@ class AdminCarriersControllerCore extends AdminController
|
||||
|
||||
if ($this->getFieldValue($obj, 'need_range'))
|
||||
$this->fields_value['need_range'] = 1;
|
||||
|
||||
// Added values of object Zone
|
||||
$carrier_zones = $obj->getZones();
|
||||
$carrier_zones_ids = array();
|
||||
@@ -588,6 +590,8 @@ class AdminCarriersControllerCore extends AdminController
|
||||
|
||||
foreach ($groups as $group)
|
||||
$this->fields_value['groupBox_'.$group['id_group']] = Tools::getValue('groupBox_'.$group['id_group'], (in_array($group['id_group'], $carrier_groups_ids) || empty($carrier_groups_ids) && !$obj->id));
|
||||
|
||||
$this->fields_value['id_tax_rules_group'] = $this->object->getIdTaxRulesGroup($this->context);
|
||||
}
|
||||
|
||||
protected function beforeDelete($object)
|
||||
@@ -636,7 +640,6 @@ class AdminCarriersControllerCore extends AdminController
|
||||
if ($list['name'] == '0')
|
||||
$this->_list[$key]['name'] = Configuration::get('PS_SHOP_NAME');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -190,7 +190,9 @@ class AdminProductsControllerCore extends AdminController
|
||||
LEFT JOIN `'._DB_PREFIX_.'category_lang` cl ON (a.`id_category_default` = cl.`id_category` AND b.`id_lang` = cl.`id_lang`)
|
||||
LEFT JOIN `'._DB_PREFIX_.'image` i ON (i.`id_product` = a.`id_product` AND i.`cover` = 1)
|
||||
LEFT JOIN `'._DB_PREFIX_.'category_product` cp ON (cp.`id_product` = a.`id_product`)
|
||||
LEFT JOIN `'._DB_PREFIX_.'tax_rule` tr ON (a.`id_tax_rules_group` = tr.`id_tax_rules_group`
|
||||
LEFT JOIN `'._DB_PREFIX_.'product_tax_rules_group_shop` ptrgs ON (a.`id_product` = ptrgs.`id_product`
|
||||
AND ptrgs.id_shop='.(int)$this->context->shop->id.')
|
||||
LEFT JOIN `'._DB_PREFIX_.'tax_rule` tr ON (ptrgs.`id_tax_rules_group` = tr.`id_tax_rules_group`
|
||||
AND tr.`id_country` = '.(int)$this->context->country->id.' AND tr.`id_state` = 0)
|
||||
LEFT JOIN `'._DB_PREFIX_.'tax` t ON (t.`id_tax` = tr.`id_tax`)';
|
||||
|
||||
@@ -427,6 +429,7 @@ class AdminProductsControllerCore extends AdminController
|
||||
&& Product::duplicateCustomizationFields($id_product_old, $product->id)
|
||||
&& Product::duplicateTags($id_product_old, $product->id)
|
||||
&& Product::duplicateDownload($id_product_old, $product->id)
|
||||
&& Product::duplicateTaxRulesGroup((int)$id_product_old, (int)$product->id)
|
||||
&& $product->duplicateShops($id_product_old))
|
||||
{
|
||||
if ($product->hasAttributes())
|
||||
@@ -1412,6 +1415,7 @@ class AdminProductsControllerCore extends AdminController
|
||||
if (!$this->updatePackItems($this->object))
|
||||
$this->errors[] = Tools::displayError('An error occurred while adding products to the pack.');
|
||||
$this->updateDownloadProduct($this->object);
|
||||
$this->object->setTaxRulesGroup((int)Tools::getValue('id_tax_rules_group'), true);
|
||||
|
||||
if (!count($this->errors))
|
||||
{
|
||||
@@ -1506,7 +1510,7 @@ class AdminProductsControllerCore extends AdminController
|
||||
$this->processProductAttribute($token);
|
||||
$this->processPriceAddition($token);
|
||||
$this->processSpecificPricePriorities($token);
|
||||
|
||||
$this->object->setTaxRulesGroup((int)Tools::getValue('id_tax_rules_group'));
|
||||
if (!$this->updatePackItems($object))
|
||||
$this->errors[] = Tools::displayError('An error occurred while adding products to the pack.');
|
||||
elseif (!$object->updateCategories(Tools::getValue('categoryBox'), true))
|
||||
|
||||
Reference in New Issue
Block a user