From fd1a34604ebe1725b89f203e4287e58a10f2447b Mon Sep 17 00:00:00 2001 From: Benjamin Perche Date: Fri, 27 Jun 2014 10:03:14 +0200 Subject: [PATCH 1/2] =?UTF-8?q?Add=20load=20requirements=20in=20getTypeIns?= =?UTF-8?q?tance=20=09modifi=C3=A9:=20=20=20=20=20=20=20=20=20core/lib/The?= =?UTF-8?q?lia/Model/Tax.php?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- core/lib/Thelia/Model/Tax.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/core/lib/Thelia/Model/Tax.php b/core/lib/Thelia/Model/Tax.php index 654d3a31f..a1a73bad7 100644 --- a/core/lib/Thelia/Model/Tax.php +++ b/core/lib/Thelia/Model/Tax.php @@ -59,12 +59,14 @@ class Tax extends BaseTax if (!class_exists($class)) { throw new TaxEngineException('Recorded type `' . $class . '` does not exists', TaxEngineException::BAD_RECORDED_TYPE); } - + /** @var \Thelia\TaxEngine\BaseTaxType $instance */ $instance = new $class; if (!$instance instanceof BaseTaxType) { throw new TaxEngineException('Recorded type `' . $class . '` does not extends BaseTaxType', TaxEngineException::BAD_RECORDED_TYPE); } + + $instance->loadRequirements($this->getRequirements()); return $instance; } From 65ba28a251fd7c944a7cd08f7842b7ca638acf49 Mon Sep 17 00:00:00 2001 From: Benjamin Perche Date: Fri, 27 Jun 2014 14:20:00 +0200 Subject: [PATCH 2/2] =?UTF-8?q?Remove=20useless=20usage=20of=20loadRequire?= =?UTF-8?q?ments=20=09modifi=C3=A9:=20=20=20=20=20=20=20=20=20core/lib/The?= =?UTF-8?q?lia/TaxEngine/Calculator.php?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- core/lib/Thelia/TaxEngine/Calculator.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/core/lib/Thelia/TaxEngine/Calculator.php b/core/lib/Thelia/TaxEngine/Calculator.php index 77a7b41a3..7c042b6e8 100644 --- a/core/lib/Thelia/TaxEngine/Calculator.php +++ b/core/lib/Thelia/TaxEngine/Calculator.php @@ -154,7 +154,6 @@ class Calculator $position = (int) $taxRule->getTaxRuleCountryPosition(); $taxType = $taxRule->getTypeInstance(); - $taxType->loadRequirements( $taxRule->getRequirements() ); if ($currentPosition !== $position) { $taxedPrice += $currentTax; @@ -209,7 +208,6 @@ class Calculator $position = (int) $taxRule->getTaxRuleCountryPosition(); $taxType = $taxRule->getTypeInstance(); - $taxType->loadRequirements( $taxRule->getRequirements() ); if ($currentPosition !== $position) { $untaxedPrice -= $currentFixTax;