diff --git a/classes/tax/TaxRulesGroup.php b/classes/tax/TaxRulesGroup.php index 0f5d3e4f0..fda98ba26 100644 --- a/classes/tax/TaxRulesGroup.php +++ b/classes/tax/TaxRulesGroup.php @@ -117,20 +117,22 @@ class TaxRulesGroupCore extends ObjectModel public function getIdTaxRuleGroupFromHistorizedId($id_tax_rule) { - $params = Db::getInstance()->getRow(' - SELECT id_country, id_state, zipcode_from, zipcode_to, id_tax, behavior - FROM '._DB_PREFIX_.'tax_rule - WHERE id_tax_rule='.(int)$id_tax_rule - ); + if ($params = Db::getInstance()->getRow(' + SELECT id_country, id_state, zipcode_from, zipcode_to, id_tax, behavior + FROM '._DB_PREFIX_.'tax_rule + WHERE id_tax_rule='.(int)$id_tax_rule + )) { + return Db::getInstance()->getValue(' + SELECT id_tax_rule + FROM '._DB_PREFIX_.'tax_rule + WHERE + id_tax_rules_group = '.(int)$this->id.' AND + id_country='.(int)$params['id_country'].' AND id_state='.(int)$params['id_state'].' AND id_tax='.(int)$params['id_tax'].' AND + zipcode_from=\''.pSQL($params['zipcode_from']).'\' AND zipcode_to=\''.pSQL($params['zipcode_to']).'\' AND behavior='.(int)$params['behavior'] + ); + } - return Db::getInstance()->getValue(' - SELECT id_tax_rule - FROM '._DB_PREFIX_.'tax_rule - WHERE - id_tax_rules_group = '.(int)$this->id.' AND - id_country='.(int)$params['id_country'].' AND id_state='.(int)$params['id_state'].' AND id_tax='.(int)$params['id_tax'].' AND - zipcode_from=\''.pSQL($params['zipcode_from']).'\' AND zipcode_to=\''.pSQL($params['zipcode_to']).'\' AND behavior='.(int)$params['behavior'] - ); + return false; } public static function getTaxRulesGroups($only_active = true)