[-] BO: FIX #PSCFV-5088 - cant add a tax rule to a group if one have already defined as unique
This commit is contained in:
1 parent
4aa0a69953
commit
ee62ed8d27
2 files changed
+13
-1
No files matched your search
@@ -89,7 +89,9 @@ class TaxRuleCore extends ObjectModel
|
|||||||
t.`rate`,
|
t.`rate`,
|
||||||
g.`zipcode_from`, g.`zipcode_to`,
|
g.`zipcode_from`, g.`zipcode_to`,
|
||||||
g.`description`,
|
g.`description`,
|
||||||
g.`behavior`
|
g.`behavior`,
|
||||||
|
g.`id_country`,
|
||||||
|
g.`id_state`
|
||||||
FROM `'._DB_PREFIX_.'tax_rule` g
|
FROM `'._DB_PREFIX_.'tax_rule` g
|
||||||
LEFT JOIN `'._DB_PREFIX_.'country_lang` c ON (g.`id_country` = c.`id_country` AND `id_lang` = '.(int)$id_lang.')
|
LEFT JOIN `'._DB_PREFIX_.'country_lang` c ON (g.`id_country` = c.`id_country` AND `id_lang` = '.(int)$id_lang.')
|
||||||
LEFT JOIN `'._DB_PREFIX_.'state` s ON (g.`id_state` = s.`id_state`)
|
LEFT JOIN `'._DB_PREFIX_.'state` s ON (g.`id_state` = s.`id_state`)
|
||||||
|
|||||||
@@ -113,6 +113,16 @@ class TaxRulesGroupCore extends ObjectModel
|
|||||||
WHERE `name` = \''.pSQL($name).'\''
|
WHERE `name` = \''.pSQL($name).'\''
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function hasUniqueTaxRuleForCountry($id_country, $id_state)
|
||||||
|
{
|
||||||
|
$rules = TaxRule::getTaxRulesByGroupId((int)Context::getContext()->language->id, (int)$this->id);
|
||||||
|
foreach ($rules as $rule)
|
||||||
|
if ($rule['id_country'] == $id_country && $id_state == $rule['id_state'] && !$rule['behavior'])
|
||||||
|
return true;
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @deprecated since 1.5
|
* @deprecated since 1.5
|
||||||
|
|||||||
Reference in new issue
Block a user