// Tax::initializeAddress =>Address::initialize
This commit is contained in:
@@ -1593,7 +1593,7 @@ class AdminProducts extends AdminTab
|
|||||||
$specificPrices = SpecificPrice::getByProductId((int)($obj->id));
|
$specificPrices = SpecificPrice::getByProductId((int)($obj->id));
|
||||||
$specificPricePriorities = SpecificPrice::getPriority((int)($obj->id));
|
$specificPricePriorities = SpecificPrice::getPriority((int)($obj->id));
|
||||||
|
|
||||||
$taxRate = $obj->getTaxesRate(Tax::initializeAddress());
|
$taxRate = $obj->getTaxesRate(Address::initialize());
|
||||||
|
|
||||||
$tmp = array();
|
$tmp = array();
|
||||||
foreach ($shops as $shop)
|
foreach ($shops as $shop)
|
||||||
|
|||||||
@@ -216,7 +216,7 @@ abstract class PaymentModuleCore extends Module
|
|||||||
$tax_calculator = new TaxCalculator();
|
$tax_calculator = new TaxCalculator();
|
||||||
if (!Tax::excludeTaxeOption())
|
if (!Tax::excludeTaxeOption())
|
||||||
{
|
{
|
||||||
$address = Tax::initializeAddress($vat_address->id);
|
$address = Address::initialize($vat_address->id);
|
||||||
$id_tax_rules = (int)Product::getIdTaxRulesGroupByIdProduct((int)$product['id_product']);
|
$id_tax_rules = (int)Product::getIdTaxRulesGroupByIdProduct((int)$product['id_product']);
|
||||||
|
|
||||||
$tax_manager = TaxManagerFactory::getManager($vat_address, $id_tax_rules);
|
$tax_manager = TaxManagerFactory::getManager($vat_address, $id_tax_rules);
|
||||||
|
|||||||
+2
-1
@@ -3308,7 +3308,7 @@ class ProductCore extends ObjectModel
|
|||||||
public function getTaxesRate(Address $address = NULL)
|
public function getTaxesRate(Address $address = NULL)
|
||||||
{
|
{
|
||||||
if (!$address OR !$address->id_country)
|
if (!$address OR !$address->id_country)
|
||||||
$address = Tax::initializeAddress();
|
$address = Address::initialize();
|
||||||
|
|
||||||
$tax_manager = TaxManagerFactory::getManager($address, $this->id_tax_rules_group);
|
$tax_manager = TaxManagerFactory::getManager($address, $this->id_tax_rules_group);
|
||||||
$tax_calculator = $tax_manager->getTaxCalculator();
|
$tax_calculator = $tax_manager->getTaxCalculator();
|
||||||
@@ -3596,3 +3596,4 @@ class ProductCore extends ObjectModel
|
|||||||
return isset($row['reference']);
|
return isset($row['reference']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+3
-30
@@ -199,7 +199,7 @@ class TaxCore extends ObjectModel
|
|||||||
*/
|
*/
|
||||||
public static function getProductEcotaxRate($id_address = NULL)
|
public static function getProductEcotaxRate($id_address = NULL)
|
||||||
{
|
{
|
||||||
$address = Tax::initializeAddress($id_address);
|
$address = Address::initialize($id_address);
|
||||||
|
|
||||||
$tax_manager = TaxManagerFactory::getManager($address, (int)Configuration::get('PS_ECOTAX_TAX_RULES_GROUP_ID'));
|
$tax_manager = TaxManagerFactory::getManager($address, (int)Configuration::get('PS_ECOTAX_TAX_RULES_GROUP_ID'));
|
||||||
$tax_calculator = $tax_manager->getTaxCalculator();
|
$tax_calculator = $tax_manager->getTaxCalculator();
|
||||||
@@ -215,7 +215,7 @@ class TaxCore extends ObjectModel
|
|||||||
*/
|
*/
|
||||||
public static function getCarrierTaxRate($id_carrier, $id_address = NULL)
|
public static function getCarrierTaxRate($id_carrier, $id_address = NULL)
|
||||||
{
|
{
|
||||||
$address = Tax::initializeAddress($id_address);
|
$address = Address::initialize($id_address);
|
||||||
$id_tax_rules = (int)Carrier::getIdTaxRulesGroupByIdCarrier((int)$id_carrier);
|
$id_tax_rules = (int)Carrier::getIdTaxRulesGroupByIdCarrier((int)$id_carrier);
|
||||||
|
|
||||||
$tax_manager = TaxManagerFactory::getManager($address, $id_tax_rules);
|
$tax_manager = TaxManagerFactory::getManager($address, $id_tax_rules);
|
||||||
@@ -224,33 +224,6 @@ class TaxCore extends ObjectModel
|
|||||||
return $tax_calculator->getTotalRate();
|
return $tax_calculator->getTotalRate();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Initiliaze an address corresponding to the id address if any or to the
|
|
||||||
* default shop configuration
|
|
||||||
*
|
|
||||||
* @param int $id_address
|
|
||||||
* @return Address address
|
|
||||||
*/
|
|
||||||
public static function initializeAddress($id_address = NULL)
|
|
||||||
{
|
|
||||||
// set the default address
|
|
||||||
$address = new Address();
|
|
||||||
$address->id_country = (int)Context::getContext()->country->id;
|
|
||||||
$address->id_state = 0;
|
|
||||||
$address->postcode = 0;
|
|
||||||
|
|
||||||
// if an id_address has been specified retrieve the address
|
|
||||||
if ($id_address)
|
|
||||||
{
|
|
||||||
$address = new Address((int)$id_address);
|
|
||||||
|
|
||||||
if (!Validate::isLoadedObject($address))
|
|
||||||
throw new Exception('Invalid address');
|
|
||||||
}
|
|
||||||
|
|
||||||
return $address;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the product tax rate using the tax rules system
|
* Return the product tax rate using the tax rules system
|
||||||
*
|
*
|
||||||
@@ -282,7 +255,7 @@ class TaxCore extends ObjectModel
|
|||||||
*/
|
*/
|
||||||
public static function getProductTaxRate($id_product, $id_address = NULL)
|
public static function getProductTaxRate($id_product, $id_address = NULL)
|
||||||
{
|
{
|
||||||
$address = Tax::initializeAddress($id_address);
|
$address = Address::initialize($id_address);
|
||||||
$id_tax_rules = (int)Product::getIdTaxRulesGroupByIdProduct($id_product);
|
$id_tax_rules = (int)Product::getIdTaxRulesGroupByIdProduct($id_product);
|
||||||
|
|
||||||
$tax_manager = TaxManagerFactory::getManager($address, $id_tax_rules);
|
$tax_manager = TaxManagerFactory::getManager($address, $id_tax_rules);
|
||||||
|
|||||||
Reference in New Issue
Block a user