insert 19.6 tva
This commit is contained in:
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
namespace Thelia\Model;
|
namespace Thelia\Model;
|
||||||
|
|
||||||
|
use Propel\Runtime\ActiveQuery\Criteria;
|
||||||
use Thelia\Model\Base\TaxRuleQuery as BaseTaxRuleQuery;
|
use Thelia\Model\Base\TaxRuleQuery as BaseTaxRuleQuery;
|
||||||
|
|
||||||
|
|
||||||
@@ -15,6 +16,16 @@ use Thelia\Model\Base\TaxRuleQuery as BaseTaxRuleQuery;
|
|||||||
* long as it does not already exist in the output directory.
|
* long as it does not already exist in the output directory.
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
class TaxRuleQuery extends BaseTaxRuleQuery {
|
class TaxRuleQuery extends BaseTaxRuleQuery
|
||||||
|
{
|
||||||
|
public function getTaxCalculatorCollection(Product $product, Country $country)
|
||||||
|
{
|
||||||
|
$search = TaxRuleCountryQuery::create()
|
||||||
|
->filterByCountry($country, Criteria::EQUAL)
|
||||||
|
->filterByTaxRuleId($product->getTaxRuleId())
|
||||||
|
->orderByPosition()
|
||||||
|
->find();
|
||||||
|
|
||||||
|
return $search;
|
||||||
|
}
|
||||||
} // TaxRuleQuery
|
} // TaxRuleQuery
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ namespace Thelia\TaxEngine;
|
|||||||
use Thelia\Exception\TaxEngineException;
|
use Thelia\Exception\TaxEngineException;
|
||||||
use Thelia\Model\Country;
|
use Thelia\Model\Country;
|
||||||
use Thelia\Model\Product;
|
use Thelia\Model\Product;
|
||||||
|
use Thelia\Model\TaxRuleQuery;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class Calculator
|
* Class Calculator
|
||||||
@@ -33,6 +34,8 @@ use Thelia\Model\Product;
|
|||||||
*/
|
*/
|
||||||
class Calculator
|
class Calculator
|
||||||
{
|
{
|
||||||
|
protected $taxRuleQuery = null;
|
||||||
|
|
||||||
protected $taxRulesCollection = null;
|
protected $taxRulesCollection = null;
|
||||||
|
|
||||||
protected $product = null;
|
protected $product = null;
|
||||||
@@ -40,6 +43,8 @@ class Calculator
|
|||||||
|
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
|
$this->taxRuleQuery = new TaxRuleQuery();
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -55,11 +60,13 @@ class Calculator
|
|||||||
$this->product = $product;
|
$this->product = $product;
|
||||||
$this->country = $country;
|
$this->country = $country;
|
||||||
|
|
||||||
|
$this->taxRulesCollection = $this->taxRuleQuery->getTaxCalculatorCollection($product, $country);
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getTaxAmount()
|
public function getTaxAmount()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1109,3 +1109,25 @@ INSERT INTO `country_i18n` (`id`, `locale`, `title`, `description`, `chapo`, `po
|
|||||||
(268, 'en_UK', 'USA - Alabama', '', '', ''),
|
(268, 'en_UK', 'USA - Alabama', '', '', ''),
|
||||||
(268, 'es_ES', 'USA - Alabama', '', '', ''),
|
(268, 'es_ES', 'USA - Alabama', '', '', ''),
|
||||||
(268, 'fr_FR', 'USA - Alabama', '', '', '');
|
(268, 'fr_FR', 'USA - Alabama', '', '', '');
|
||||||
|
|
||||||
|
INSERT INTO `tax` (`id`, `rate`, `created_at`, `updated_at`)
|
||||||
|
VALUES
|
||||||
|
(1, '19.6', NOW(), NOW());
|
||||||
|
|
||||||
|
INSERT INTO `tax_i18n` (`id`, `locale`, `title`)
|
||||||
|
VALUES
|
||||||
|
(1, 'fr_FR', 'TVA française à 19.6%'),
|
||||||
|
(1, 'en_UK', 'french 19.6% tax');
|
||||||
|
|
||||||
|
INSERT INTO `tax_rule` (`id`, `created_at`, `updated_at`)
|
||||||
|
VALUES
|
||||||
|
(1, NOW(), NOW());
|
||||||
|
|
||||||
|
INSERT INTO `tax_rule_i18n` (`id`, `locale`, `title`)
|
||||||
|
VALUES
|
||||||
|
(1, 'fr_FR', 'TVA française à 19.6%'),
|
||||||
|
(1, 'en_UK', 'french 19.6% tax');
|
||||||
|
|
||||||
|
INSERT INTO `tax_rule_country` (`tax_rule_id`, `country_id`, `tax_id`, `position`, `created_at`, `updated_at`)
|
||||||
|
VALUES
|
||||||
|
(1, 64, 1, 1, NOW(), NOW());
|
||||||
Reference in New Issue
Block a user