Browse Source

Prix : correctif bug réduction catalogue sur OrderProduct (quantités > 1)

feature/export_comptable
Guillaume 4 years ago
parent
commit
49168c738f
2 changed files with 8 additions and 4 deletions
  1. +4
    -1
      ShopBundle/Services/Price/OrderProductPriceUtils.php
  2. +4
    -3
      ShopBundle/Services/Price/PriceUtilsTrait.php

+ 4
- 1
ShopBundle/Services/Price/OrderProductPriceUtils.php View File

@@ -56,6 +56,7 @@ class OrderProductPriceUtils
$orderProduct,
$this->getPrice($orderProduct),
$this->getPriceWithTax($orderProduct),
1,
null,
false
);
@@ -95,6 +96,7 @@ class OrderProductPriceUtils
$orderProduct,
$this->getTotal($orderProduct),
$this->getTotalWithTax($orderProduct),
$orderProduct->getQuantityOrder(),
null,
false
);
@@ -113,7 +115,8 @@ class OrderProductPriceUtils
return $this->applyReductionCatalog(
$orderProduct,
$this->getTotal($orderProduct),
$this->getTotalWithTax($orderProduct)
$this->getTotalWithTax($orderProduct),
$orderProduct->getQuantityOrder()
);
}


+ 4
- 3
ShopBundle/Services/Price/PriceUtilsTrait.php View File

@@ -42,8 +42,9 @@ trait PriceUtilsTrait
return round((($price * $percent)) / 100, 2);
}

public function applyReductionCatalog($entity, $price, $priceWithTax, $reductionCatalog = null, $withTax = true): ?float
public function applyReductionCatalog($entity, $price, $priceWithTax, $quantity = 1, $reductionCatalog = null, $withTax = true): ?float
{

if ($reductionCatalog) {
$reductionCatalogValue = $reductionCatalog->getValue();
$reductionCatalogUnit = $reductionCatalog->getUnit();
@@ -80,14 +81,14 @@ trait PriceUtilsTrait
$priceWithTax = $this->applyTax(
$this->applyReductionAmount(
$price,
$reductionCatalogValue
$reductionCatalogValue * $quantity
),
$entity->getTaxRateInherited()->getValue()
);
} elseif ($reductionCatalogBehaviorTaxRate == 'tax-included') {
$priceWithTax = $this->applyReductionAmount(
$priceWithTax,
$reductionCatalogValue
$reductionCatalogValue * $quantity
);
}
}

Loading…
Cancel
Save