Explorar el Código

Correctif reductionCatalog

packProduct
Fabien Normand hace 3 años
padre
commit
cfc6befc38
Se han modificado 6 ficheros con 13 adiciones y 8 borrados
  1. +1
    -1
      Builder/Order/OrderShopBuilder.php
  2. +2
    -1
      Model/Order/OrderProductReductionCatalogModel.php
  3. +2
    -1
      Model/Order/OrderProductRefundModel.php
  4. +2
    -1
      Model/Order/OrderReductionCreditModel.php
  5. +1
    -0
      Repository/Product/ProductFamilyStore.php
  6. +5
    -4
      Solver/Price/PriceSolverTrait.php

+ 1
- 1
Builder/Order/OrderShopBuilder.php Ver fichero

@@ -241,7 +241,7 @@ class OrderShopBuilder
if ($orderProductAdd->getQuantityOrder() > 0) {
$updated = false;
$this->orderProductBuilder->init($orderProductAdd);
$productFamily = $this->productFamilyStore->getOneBySlug(
$productFamily = $this->productFamilyStore->setSection($orderShop->getSection())->getOneBySlug(
$orderProductAdd->getProduct()->getProductFamily()->getSlug()
);


+ 2
- 1
Model/Order/OrderProductReductionCatalogModel.php Ver fichero

@@ -4,11 +4,12 @@ namespace Lc\CaracoleBundle\Model\Order;

use Doctrine\ORM\Mapping as ORM;
use Lc\CaracoleBundle\Doctrine\Extension\ReductionTrait;
use Lc\SovBundle\Doctrine\EntityInterface;

/**
* @ORM\MappedSuperclass()
*/
abstract class OrderProductReductionCatalogModel
abstract class OrderProductReductionCatalogModel implements EntityInterface
{
use ReductionTrait;


+ 2
- 1
Model/Order/OrderProductRefundModel.php Ver fichero

@@ -3,12 +3,13 @@
namespace Lc\CaracoleBundle\Model\Order;

use Doctrine\ORM\Mapping as ORM;
use Lc\SovBundle\Doctrine\EntityInterface;


/**
* @ORM\MappedSuperclass()
*/
abstract class OrderProductRefundModel
abstract class OrderProductRefundModel implements EntityInterface
{
/**
* @ORM\Column(type="integer")

+ 2
- 1
Model/Order/OrderReductionCreditModel.php Ver fichero

@@ -6,11 +6,12 @@ use Doctrine\ORM\Mapping as ORM;
use Lc\CaracoleBundle\Doctrine\Extension\ReductionInterface;
use Lc\CaracoleBundle\Doctrine\Extension\ReductionTrait;
use Lc\CaracoleBundle\Model\Reduction\ReductionCreditInterface;
use Lc\SovBundle\Doctrine\EntityInterface;

/**
* @ORM\MappedSuperclass()
*/
abstract class OrderReductionCreditModel implements ReductionInterface
abstract class OrderReductionCreditModel implements ReductionInterface, EntityInterface
{
use ReductionTrait;


+ 1
- 0
Repository/Product/ProductFamilyStore.php Ver fichero

@@ -143,6 +143,7 @@ class ProductFamilyStore extends AbstractStore
return [];
}


// findByTerms
public function getByTerms(
$terms,

+ 5
- 4
Solver/Price/PriceSolverTrait.php Ver fichero

@@ -53,6 +53,7 @@ trait PriceSolverTrait
$withTax = true,
$round = true
): ?float {

if ($reductionCatalog) {
$reductionCatalogValue = $reductionCatalog->getValue();
$reductionCatalogUnit = $reductionCatalog->getUnit();
@@ -82,20 +83,20 @@ trait PriceSolverTrait
}
}

if (isset($reductionCatalogValue) && isset($reductionCatalogUnit) && isset($reductionCatalogBehaviorTaxRate)) {
if (isset($reductionCatalogValue) && isset($reductionCatalogUnit)) {
if ($reductionCatalogUnit == 'percent') {
$priceWithTax = $this->applyReductionPercent(
$priceWithTax,
$reductionCatalogValue
);
} elseif ($reductionCatalogUnit == 'amount') {
} elseif ($reductionCatalogUnit == 'amount' && isset($reductionCatalogBehaviorTaxRate)) {
if ($reductionCatalogBehaviorTaxRate == 'tax-excluded') {
$priceWithTax = $this->applyTax(
$this->applyReductionAmount(
$price,
$reductionCatalogValue * $quantity
),
$entity->getTaxRateInherited()->getValue()
$this->productFamilySolver->getTaxRateInherited($entity)->getValue()
);
} elseif ($reductionCatalogBehaviorTaxRate == 'tax-included') {
$priceWithTax = $this->applyReductionAmount(
@@ -109,7 +110,7 @@ trait PriceSolverTrait
if ($withTax) {
$priceReturn = $priceWithTax;
} else {
$priceReturn = $this->applyPercentNegative($priceWithTax, $entity->getTaxRateInherited()->getValue());
$priceReturn = $this->applyPercentNegative($priceWithTax, $this->productFamilySolver->getTaxRateInherited($entity)->getValue());
}
if ($round) {
return $this->round($priceReturn);

Cargando…
Cancelar
Guardar