|
|
@@ -24,11 +24,11 @@ class ProductPriceSolver |
|
|
|
|
|
|
|
public function getSolver(ProductPropertyInterface $product) |
|
|
|
{ |
|
|
|
if($product instanceof ProductFamilyInterface) { |
|
|
|
if ($product instanceof ProductFamilyInterface) { |
|
|
|
return $this->productFamilySolver; |
|
|
|
} |
|
|
|
|
|
|
|
if($product instanceof ProductInterface) { |
|
|
|
if ($product instanceof ProductInterface) { |
|
|
|
return $this->productSolver; |
|
|
|
} |
|
|
|
} |
|
|
@@ -41,7 +41,8 @@ class ProductPriceSolver |
|
|
|
return $solver->getPriceInherited($product); |
|
|
|
} elseif ($solver->getBehaviorPriceInherited($product) == 'by-reference-unit') { |
|
|
|
if ($solver->getQuantityInherited($product) > 0) { |
|
|
|
return $solver->getPriceByRefUnitInherited($product) * ($solver->getQuantityInherited($product |
|
|
|
return $solver->getPriceByRefUnitInherited($product) * ($solver->getQuantityInherited( |
|
|
|
$product |
|
|
|
) / $solver->getUnitInherited($product)->getCoefficient()); |
|
|
|
} else { |
|
|
|
return 0; |
|
|
@@ -89,21 +90,29 @@ class ProductPriceSolver |
|
|
|
} |
|
|
|
|
|
|
|
//Bridge pour applyReductionCatalog qui ne peut pas être appeler à cause du call |
|
|
|
public function getPriceWithTaxByReduction(ProductPropertyInterface $product, ReductionCatalogInterface $reductionCatalog) |
|
|
|
{ |
|
|
|
public function getPriceWithTaxByReduction( |
|
|
|
ProductPropertyInterface $product, |
|
|
|
ReductionCatalogInterface $reductionCatalog |
|
|
|
) { |
|
|
|
return $this->applyReductionCatalog( |
|
|
|
$product, |
|
|
|
$this->getPrice($product), |
|
|
|
$this->getPriceWithTax($product), |
|
|
|
1, |
|
|
|
$reductionCatalog |
|
|
|
$product, |
|
|
|
$this->getPrice($product), |
|
|
|
$this->getPriceWithTax($product), |
|
|
|
1, |
|
|
|
$reductionCatalog |
|
|
|
); |
|
|
|
} |
|
|
|
|
|
|
|
public function getPriceByRefUnitWithTaxAndReduction(ProductPropertyInterface $product) |
|
|
|
{ |
|
|
|
return ($this->getPriceByRefUnitWithTax($product) * $this->getPriceWithTaxAndReduction($product)) |
|
|
|
/ $this->getPriceWithTax($product); |
|
|
|
$priceWithTax = $this->getPriceWithTax($product); |
|
|
|
|
|
|
|
if ($priceWithTax) { |
|
|
|
return ($this->getPriceByRefUnitWithTax($product) * $this->getPriceWithTaxAndReduction($product)) |
|
|
|
/ $priceWithTax; |
|
|
|
} |
|
|
|
|
|
|
|
return 0; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@@ -115,7 +124,8 @@ class ProductPriceSolver |
|
|
|
return $solver->getBuyingPriceInherited($product); |
|
|
|
} elseif ($solver->getBehaviorPriceInherited($product) == 'by-reference-unit') { |
|
|
|
if ($solver->getQuantityInherited($product) > 0) { |
|
|
|
return $solver->getBuyingPriceByRefUnitInherited($product) * ($solver->getQuantityInherited($product |
|
|
|
return $solver->getBuyingPriceByRefUnitInherited($product) * ($solver->getQuantityInherited( |
|
|
|
$product |
|
|
|
) / $solver->getUnitInherited($product)->getCoefficient()); |
|
|
|
} else { |
|
|
|
return 0; |