|
|
@@ -6,6 +6,7 @@ use App\Builder\Distribution\DistributionBuilder; |
|
|
|
use Doctrine\ORM\EntityManagerInterface; |
|
|
|
use Lc\CaracoleBundle\Builder\Credit\CreditHistoryBuilder; |
|
|
|
use Lc\CaracoleBundle\Builder\File\DocumentBuilder; |
|
|
|
use Lc\CaracoleBundle\Event\Order\CartChangeEvent; |
|
|
|
use Lc\CaracoleBundle\Event\Order\OrderShopChangeStatusEvent; |
|
|
|
use Lc\CaracoleBundle\Factory\Credit\CreditHistoryFactory; |
|
|
|
use Lc\CaracoleBundle\Factory\File\DocumentFactory; |
|
|
@@ -77,27 +78,26 @@ class OrderShopBuilder |
|
|
|
protected FlashBagTranslator $flashBagTranslator; |
|
|
|
|
|
|
|
public function __construct( |
|
|
|
EntityManagerInterface $entityManager, |
|
|
|
OrderShopStore $orderShopStore, |
|
|
|
OrderShopSolver $orderShopSolver, |
|
|
|
OrderStatusStore $orderStatusStore, |
|
|
|
OrderProductStore $orderProductStore, |
|
|
|
ProductFamilyStore $productFamilyStore, |
|
|
|
OrderProductBuilder $orderProductBuilder, |
|
|
|
DocumentBuilder $documentBuilder, |
|
|
|
PriceSolver $priceSolver, |
|
|
|
EventDispatcherInterface $eventDispatcher, |
|
|
|
FlashBagInterface $flashBag, |
|
|
|
OpeningResolver $openingResolver, |
|
|
|
ProductSolver $productSolver, |
|
|
|
OrderShopResolver $orderShopResolver, |
|
|
|
OrderProductReductionCatalogSolver $orderProductReductionCatalogSolver, |
|
|
|
DistributionBuilder $distributionBuilder, |
|
|
|
MerchantResolver $merchantResolver, |
|
|
|
CreditHistoryBuilder $creditHistoryBuilder, |
|
|
|
FlashBagTranslator $flashBagTranslator |
|
|
|
) |
|
|
|
{ |
|
|
|
EntityManagerInterface $entityManager, |
|
|
|
OrderShopStore $orderShopStore, |
|
|
|
OrderShopSolver $orderShopSolver, |
|
|
|
OrderStatusStore $orderStatusStore, |
|
|
|
OrderProductStore $orderProductStore, |
|
|
|
ProductFamilyStore $productFamilyStore, |
|
|
|
OrderProductBuilder $orderProductBuilder, |
|
|
|
DocumentBuilder $documentBuilder, |
|
|
|
PriceSolver $priceSolver, |
|
|
|
EventDispatcherInterface $eventDispatcher, |
|
|
|
FlashBagInterface $flashBag, |
|
|
|
OpeningResolver $openingResolver, |
|
|
|
ProductSolver $productSolver, |
|
|
|
OrderShopResolver $orderShopResolver, |
|
|
|
OrderProductReductionCatalogSolver $orderProductReductionCatalogSolver, |
|
|
|
DistributionBuilder $distributionBuilder, |
|
|
|
MerchantResolver $merchantResolver, |
|
|
|
CreditHistoryBuilder $creditHistoryBuilder, |
|
|
|
FlashBagTranslator $flashBagTranslator |
|
|
|
) { |
|
|
|
$this->entityManager = $entityManager; |
|
|
|
$this->orderShopStore = $orderShopStore; |
|
|
|
$this->orderShopSolver = $orderShopSolver; |
|
|
@@ -120,11 +120,10 @@ class OrderShopBuilder |
|
|
|
} |
|
|
|
|
|
|
|
public function create( |
|
|
|
SectionInterface $section, |
|
|
|
UserInterface $user = null, |
|
|
|
VisitorInterface $visitor = null |
|
|
|
): OrderShopInterface |
|
|
|
{ |
|
|
|
SectionInterface $section, |
|
|
|
UserInterface $user = null, |
|
|
|
VisitorInterface $visitor = null |
|
|
|
): OrderShopInterface { |
|
|
|
$orderShopFactory = new OrderShopFactory(); |
|
|
|
$orderShop = $orderShopFactory->create($section, $user, $visitor); |
|
|
|
|
|
|
@@ -140,21 +139,18 @@ class OrderShopBuilder |
|
|
|
protected array $cacheCartCurrentBySection = []; |
|
|
|
|
|
|
|
public function createIfNotExist( |
|
|
|
SectionInterface $section, |
|
|
|
UserInterface $user = null, |
|
|
|
VisitorInterface $visitor = null, |
|
|
|
bool $cache = false |
|
|
|
): OrderShopInterface |
|
|
|
{ |
|
|
|
|
|
|
|
SectionInterface $section, |
|
|
|
UserInterface $user = null, |
|
|
|
VisitorInterface $visitor = null, |
|
|
|
bool $cache = false |
|
|
|
): OrderShopInterface { |
|
|
|
$cart = null; |
|
|
|
|
|
|
|
// cache |
|
|
|
$cacheIdCartCurrent = 'cart_current_' . $section->getId(); |
|
|
|
if ($cache |
|
|
|
&& isset($this->cacheCartCurrentBySection[$cacheIdCartCurrent]) |
|
|
|
&& $this->cacheCartCurrentBySection[$cacheIdCartCurrent]) { |
|
|
|
|
|
|
|
&& isset($this->cacheCartCurrentBySection[$cacheIdCartCurrent]) |
|
|
|
&& $this->cacheCartCurrentBySection[$cacheIdCartCurrent]) { |
|
|
|
return $this->cacheCartCurrentBySection[$cacheIdCartCurrent]; |
|
|
|
} |
|
|
|
|
|
|
@@ -169,7 +165,6 @@ class OrderShopBuilder |
|
|
|
if ($cartUser) { |
|
|
|
$cart = $cartUser; |
|
|
|
} elseif ($cartVisitor) { |
|
|
|
|
|
|
|
if ($user && $cartVisitor && !$cartVisitor->getUser()) { |
|
|
|
$cartVisitor->setUser($user); |
|
|
|
$this->entityManager->update($cartVisitor); |
|
|
@@ -194,16 +189,15 @@ class OrderShopBuilder |
|
|
|
} |
|
|
|
|
|
|
|
public function setOrderStatus( |
|
|
|
OrderShopInterface $orderShop, |
|
|
|
string $alias, |
|
|
|
bool $forceByAdmin = false |
|
|
|
): OrderShopInterface |
|
|
|
{ |
|
|
|
OrderShopInterface $orderShop, |
|
|
|
string $alias, |
|
|
|
bool $forceByAdmin = false |
|
|
|
): OrderShopInterface { |
|
|
|
$orderStatus = $this->orderStatusStore->getOneByAlias($alias); |
|
|
|
|
|
|
|
if ($orderStatus) { |
|
|
|
if ($orderShop->getOrderStatus() === null |
|
|
|
|| $orderShop->getOrderStatus()->getNextStatusAllowed()->contains($orderStatus)) { |
|
|
|
|| $orderShop->getOrderStatus()->getNextStatusAllowed()->contains($orderStatus)) { |
|
|
|
$this->applyChangeOrderStatus($orderShop, $orderStatus, $forceByAdmin); |
|
|
|
} |
|
|
|
} else { |
|
|
@@ -214,14 +208,13 @@ class OrderShopBuilder |
|
|
|
} |
|
|
|
|
|
|
|
public function applyChangeOrderStatus( |
|
|
|
OrderShopInterface $orderShop, |
|
|
|
OrderStatusInterface $orderStatus, |
|
|
|
bool $forceByAdmin = false |
|
|
|
): void |
|
|
|
{ |
|
|
|
OrderShopInterface $orderShop, |
|
|
|
OrderStatusInterface $orderStatus, |
|
|
|
bool $forceByAdmin = false |
|
|
|
): void { |
|
|
|
$this->eventDispatcher->dispatch( |
|
|
|
new OrderShopChangeStatusEvent($orderShop, $orderStatus, $forceByAdmin), |
|
|
|
OrderShopChangeStatusEvent::PRE_CHANGE_STATUS |
|
|
|
new OrderShopChangeStatusEvent($orderShop, $orderStatus, $forceByAdmin), |
|
|
|
OrderShopChangeStatusEvent::PRE_CHANGE_STATUS |
|
|
|
); |
|
|
|
|
|
|
|
$orderShop->setOrderStatusProtected($orderStatus); |
|
|
@@ -232,17 +225,16 @@ class OrderShopBuilder |
|
|
|
$orderShop->addOrderStatusHistory($orderStatusHistory); |
|
|
|
|
|
|
|
$this->eventDispatcher->dispatch( |
|
|
|
new OrderShopChangeStatusEvent($orderShop, $orderStatus, $forceByAdmin), |
|
|
|
OrderShopChangeStatusEvent::POST_CHANGE_STATUS |
|
|
|
new OrderShopChangeStatusEvent($orderShop, $orderStatus, $forceByAdmin), |
|
|
|
OrderShopChangeStatusEvent::POST_CHANGE_STATUS |
|
|
|
); |
|
|
|
} |
|
|
|
|
|
|
|
public function addOrderProduct( |
|
|
|
OrderShopInterface $orderShop, |
|
|
|
OrderProductInterface $orderProductAdd, |
|
|
|
bool $persist = true |
|
|
|
): bool |
|
|
|
{ |
|
|
|
OrderShopInterface $orderShop, |
|
|
|
OrderProductInterface $orderProductAdd, |
|
|
|
bool $persist = true |
|
|
|
): bool { |
|
|
|
$return = false; |
|
|
|
|
|
|
|
if ($this->orderShopSolver->isOrderProductAvailableAddCart($orderProductAdd, $orderShop)) { |
|
|
@@ -250,7 +242,7 @@ class OrderShopBuilder |
|
|
|
$updated = false; |
|
|
|
$this->orderProductBuilder->init($orderProductAdd); |
|
|
|
$productFamily = $this->productFamilyStore->setSection($orderShop->getSection())->getOneBySlug( |
|
|
|
$orderProductAdd->getProduct()->getProductFamily()->getSlug() |
|
|
|
$orderProductAdd->getProduct()->getProductFamily()->getSlug() |
|
|
|
); |
|
|
|
|
|
|
|
if ($productFamily) { |
|
|
@@ -259,10 +251,10 @@ class OrderShopBuilder |
|
|
|
if ($reductionCatalog && $reductionCatalog->getStatus()) { |
|
|
|
$orderProductReductionCatalogFactory = new OrderProductReductionCatalogFactory(); |
|
|
|
$orderProductReductionCatalog = $orderProductReductionCatalogFactory->create( |
|
|
|
$reductionCatalog->getTitle(), |
|
|
|
$reductionCatalog->getValue(), |
|
|
|
$reductionCatalog->getUnit(), |
|
|
|
$reductionCatalog->getBehaviorTaxRate() |
|
|
|
$reductionCatalog->getTitle(), |
|
|
|
$reductionCatalog->getValue(), |
|
|
|
$reductionCatalog->getUnit(), |
|
|
|
$reductionCatalog->getBehaviorTaxRate() |
|
|
|
); |
|
|
|
|
|
|
|
$orderProductAdd->setOrderProductReductionCatalog($orderProductReductionCatalog); |
|
|
@@ -271,15 +263,15 @@ class OrderShopBuilder |
|
|
|
|
|
|
|
foreach ($orderShop->getOrderProducts() as $orderProduct) { |
|
|
|
if ($orderProduct->getProduct()->getId() == $orderProductAdd->getProduct()->getId() |
|
|
|
&& $orderProduct->getRedelivery() == $orderProductAdd->getRedelivery() |
|
|
|
&& (string)$this->priceSolver->getPrice($orderProduct) |
|
|
|
== (string)$this->priceSolver->getPrice($orderProductAdd) |
|
|
|
&& $this->orderProductReductionCatalogSolver->compare( |
|
|
|
$orderProduct->getOrderProductReductionCatalog(), |
|
|
|
$orderProductAdd->getOrderProductReductionCatalog() |
|
|
|
)) { |
|
|
|
&& $orderProduct->getRedelivery() == $orderProductAdd->getRedelivery() |
|
|
|
&& (string)$this->priceSolver->getPrice($orderProduct) |
|
|
|
== (string)$this->priceSolver->getPrice($orderProductAdd) |
|
|
|
&& $this->orderProductReductionCatalogSolver->compare( |
|
|
|
$orderProduct->getOrderProductReductionCatalog(), |
|
|
|
$orderProductAdd->getOrderProductReductionCatalog() |
|
|
|
)) { |
|
|
|
$orderProduct->setQuantityOrder( |
|
|
|
$orderProduct->getQuantityOrder() + $orderProductAdd->getQuantityOrder() |
|
|
|
$orderProduct->getQuantityOrder() + $orderProductAdd->getQuantityOrder() |
|
|
|
); |
|
|
|
|
|
|
|
if ($persist) { |
|
|
@@ -300,7 +292,7 @@ class OrderShopBuilder |
|
|
|
if (isset($orderProductReductionCatalog)) { |
|
|
|
$this->entityManager->create($orderProductReductionCatalog); |
|
|
|
} |
|
|
|
//TODO est-ce un update ou un create ??? |
|
|
|
// @TODO : update ou create ? |
|
|
|
$this->entityManager->persist($orderProductAdd); |
|
|
|
$this->entityManager->update($orderShop); |
|
|
|
} |
|
|
@@ -310,10 +302,8 @@ class OrderShopBuilder |
|
|
|
|
|
|
|
if ($persist) { |
|
|
|
$this->entityManager->flush(); |
|
|
|
$this->eventDispatcher->dispatch(new CartChangeEvent($orderShop), CartChangeEvent::POST_UPDATE); |
|
|
|
} |
|
|
|
|
|
|
|
// @TODO : dispatch event cart change |
|
|
|
//$this->eventCartChange($orderShop); |
|
|
|
} |
|
|
|
} else { |
|
|
|
// @TODO : retourner le message d'erreur et faire le addFlash dans le contrôleur |
|
|
@@ -337,23 +327,27 @@ class OrderShopBuilder |
|
|
|
} |
|
|
|
} |
|
|
|
$this->utils->addFlash('error', $textError);*/ |
|
|
|
|
|
|
|
$return = false; |
|
|
|
} |
|
|
|
|
|
|
|
return $return; |
|
|
|
} |
|
|
|
|
|
|
|
public function merge( |
|
|
|
OrderShopInterface $orderShop1, |
|
|
|
OrderShopInterface $orderShop2, |
|
|
|
$persist = true |
|
|
|
): OrderShopInterface |
|
|
|
{ |
|
|
|
OrderShopInterface $orderShop1, |
|
|
|
OrderShopInterface $orderShop2, |
|
|
|
$persist = true |
|
|
|
): OrderShopInterface { |
|
|
|
//TODO essayer de comprendre prk on doit faire un refresh ici ??? |
|
|
|
$this->entityManager->refresh($orderShop1); |
|
|
|
$this->entityManager->refresh($orderShop2); |
|
|
|
if ($orderShop1 && $orderShop2) { |
|
|
|
foreach ($orderShop2->getOrderProducts() as $orderProduct) { |
|
|
|
$orderProductAlreadyInCart = $this->orderShopSolver->hasOrderProductAlreadyInCart($orderShop1, $orderProduct); |
|
|
|
$orderProductAlreadyInCart = $this->orderShopSolver->hasOrderProductAlreadyInCart( |
|
|
|
$orderShop1, |
|
|
|
$orderProduct |
|
|
|
); |
|
|
|
|
|
|
|
if ($orderProductAlreadyInCart) { |
|
|
|
if ($orderProduct->getQuantityOrder() > $orderProductAlreadyInCart->getQuantityOrder()) { |
|
|
@@ -387,9 +381,13 @@ class OrderShopBuilder |
|
|
|
$orderShop->addOrderPayment($orderPayment); |
|
|
|
|
|
|
|
if ($meanPayment == OrderPaymentModel::MEAN_PAYMENT_CREDIT) { |
|
|
|
$this->creditHistoryBuilder->create(CreditHistoryModel::TYPE_DEBIT, $this->merchantResolver->getUserMerchant(), [ |
|
|
|
'orderPayment' => $orderPayment |
|
|
|
]); |
|
|
|
$this->creditHistoryBuilder->create( |
|
|
|
CreditHistoryModel::TYPE_DEBIT, |
|
|
|
$this->merchantResolver->getUserMerchant(), |
|
|
|
[ |
|
|
|
'orderPayment' => $orderPayment |
|
|
|
] |
|
|
|
); |
|
|
|
} |
|
|
|
|
|
|
|
if ($this->orderShopResolver->isPaid($orderShop)) { |
|
|
@@ -415,17 +413,17 @@ class OrderShopBuilder |
|
|
|
$orderShop->setStatTotal($this->priceSolver->getTotal($orderShop)); |
|
|
|
$orderShop->setStatTotalWithTax($this->priceSolver->getTotalWithTax($orderShop)); |
|
|
|
$orderShop->setStatTotalOrderProductsWithReductions( |
|
|
|
$this->priceSolver->getTotalOrderProductsWithReductions($orderShop) |
|
|
|
$this->priceSolver->getTotalOrderProductsWithReductions($orderShop) |
|
|
|
); |
|
|
|
$orderShop->setStatTotalOrderProductsWithTaxAndReductions( |
|
|
|
$this->priceSolver->getTotalOrderProductsWithTaxAndReductions($orderShop) |
|
|
|
$this->priceSolver->getTotalOrderProductsWithTaxAndReductions($orderShop) |
|
|
|
); |
|
|
|
$orderShop->setStatMarginOrderProductsWithReductions( |
|
|
|
$this->priceSolver->getMarginOrderProductsWithReductions($orderShop) |
|
|
|
$this->priceSolver->getMarginOrderProductsWithReductions($orderShop) |
|
|
|
); |
|
|
|
$orderShop->setStatDeliveryPriceWithReduction($this->priceSolver->getDeliveryPriceWithReduction($orderShop)); |
|
|
|
$orderShop->setStatDeliveryPriceWithTaxAndReduction( |
|
|
|
$this->priceSolver->getDeliveryPriceWithTaxAndReduction($orderShop) |
|
|
|
$this->priceSolver->getDeliveryPriceWithTaxAndReduction($orderShop) |
|
|
|
); |
|
|
|
|
|
|
|
$this->entityManager->persist($orderShop); |
|
|
@@ -438,8 +436,8 @@ class OrderShopBuilder |
|
|
|
public function initDistribution(OrderShopInterface $orderShop): void |
|
|
|
{ |
|
|
|
$distribution = $this->distributionBuilder->guessDistributionByDeliveryDate( |
|
|
|
$orderShop->getDeliveryDate(), |
|
|
|
$orderShop->getSection() |
|
|
|
$orderShop->getDeliveryDate(), |
|
|
|
$orderShop->getSection() |
|
|
|
); |
|
|
|
$orderShop->setDistribution($distribution); |
|
|
|
} |
|
|
@@ -456,17 +454,16 @@ class OrderShopBuilder |
|
|
|
} |
|
|
|
|
|
|
|
public function addReductionCart( |
|
|
|
OrderShopInterface $orderShop, |
|
|
|
ReductionCartInterface $reductionCart |
|
|
|
): ?OrderReductionCartInterface |
|
|
|
{ |
|
|
|
OrderShopInterface $orderShop, |
|
|
|
ReductionCartInterface $reductionCart |
|
|
|
): ?OrderReductionCartInterface { |
|
|
|
$orderReductionCartFactory = new OrderReductionCartFactory(); |
|
|
|
$orderReductionCart = $orderReductionCartFactory->create($orderShop, $reductionCart); |
|
|
|
|
|
|
|
$orderShop->addOrderReductionCart($orderReductionCart); |
|
|
|
|
|
|
|
if ($this->orderShopResolver->isPositiveAmount($orderShop) |
|
|
|
&& $this->orderShopResolver->isPositiveAmountRemainingToBePaid($orderShop)) { |
|
|
|
&& $this->orderShopResolver->isPositiveAmountRemainingToBePaid($orderShop)) { |
|
|
|
$this->entityManager->create($orderReductionCart); |
|
|
|
$this->entityManager->flush(); |
|
|
|
|
|
|
@@ -480,18 +477,16 @@ class OrderShopBuilder |
|
|
|
|
|
|
|
// createOrderReductionCredit |
|
|
|
public function addReductionCredit( |
|
|
|
OrderShopInterface $orderShop, |
|
|
|
ReductionCreditInterface $reductionCredit |
|
|
|
): ?OrderReductionCreditInterface |
|
|
|
{ |
|
|
|
OrderShopInterface $orderShop, |
|
|
|
ReductionCreditInterface $reductionCredit |
|
|
|
): ?OrderReductionCreditInterface { |
|
|
|
$orderReductionCreditFactory = new OrderReductionCreditFactory(); |
|
|
|
$orderReductionCredit = $orderReductionCreditFactory->create($orderShop, $reductionCredit); |
|
|
|
|
|
|
|
$orderShop->addOrderReductionCredit($orderReductionCredit); |
|
|
|
|
|
|
|
if ($this->orderShopResolver->isPositiveAmount($orderShop) |
|
|
|
&& $this->orderShopResolver->isPositiveAmountRemainingToBePaid($orderShop)) { |
|
|
|
|
|
|
|
&& $this->orderShopResolver->isPositiveAmountRemainingToBePaid($orderShop)) { |
|
|
|
$this->entityManager->create($orderReductionCredit); |
|
|
|
$this->entityManager->flush(); |
|
|
|
|
|
|
@@ -511,16 +506,16 @@ class OrderShopBuilder |
|
|
|
} |
|
|
|
|
|
|
|
public function applyDeductAvailabilityProduct( |
|
|
|
OrderShopInterface $orderShop, |
|
|
|
OrderProductInterface $orderProduct |
|
|
|
): void |
|
|
|
{ |
|
|
|
OrderShopInterface $orderShop, |
|
|
|
OrderProductInterface $orderProduct |
|
|
|
): void { |
|
|
|
switch ($orderProduct->getProduct()->getProductFamily()->getBehaviorCountStock()) { |
|
|
|
case ProductFamilyModel::BEHAVIOR_COUNT_STOCK_BY_MEASURE : |
|
|
|
|
|
|
|
//Disponibilité par unité de référence |
|
|
|
$oldAvailability = $this->productSolver->getAvailableQuantityInherited($orderProduct->getProduct()); |
|
|
|
$newAvailability = $oldAvailability - ($orderProduct->getQuantityOrder() * ($orderProduct->getQuantityProduct() / $orderProduct->getUnit()->getCoefficient())); |
|
|
|
$newAvailability = $oldAvailability - ($orderProduct->getQuantityOrder( |
|
|
|
) * ($orderProduct->getQuantityProduct() / $orderProduct->getUnit()->getCoefficient())); |
|
|
|
|
|
|
|
$productFamily = $orderProduct->getProduct()->getProductFamily(); |
|
|
|
$productFamily->setAvailableQuantity($newAvailability); |
|
|
@@ -559,17 +554,22 @@ class OrderShopBuilder |
|
|
|
|
|
|
|
public function updatePriceByProductFamily(ProductFamilyInterface $productFamily) |
|
|
|
{ |
|
|
|
$debug = ''; |
|
|
|
|
|
|
|
foreach ($this->merchantResolver->getCurrent()->getSections() as $section) { |
|
|
|
// @TODO : faire la vérification isOpenSale depuis la méthode appelante |
|
|
|
if (!$this->openingResolver->isOpenSale($section)) { |
|
|
|
$countOrderProductUpdated = 0; |
|
|
|
|
|
|
|
foreach ($productFamily->getProducts() as $product) { |
|
|
|
$orderProducts = $this->orderProductStore->resetContext()->setSection($section)->getInCartsByProduct($product); |
|
|
|
$orderProducts = $this->orderProductStore->resetContext()->setSection( |
|
|
|
$section |
|
|
|
)->getInCartsByProduct($product); |
|
|
|
|
|
|
|
foreach ($orderProducts as $orderProduct) { |
|
|
|
$quantityOrder = $orderProduct->getQuantityOrder(); |
|
|
|
$orderShop = $orderProduct->getOrderShop(); |
|
|
|
|
|
|
|
$orderShop->removeOrderProduct($orderProduct); |
|
|
|
$this->entityManager->delete($orderProduct); |
|
|
|
$this->entityManager->flush(); |
|
|
@@ -583,12 +583,12 @@ class OrderShopBuilder |
|
|
|
} |
|
|
|
} |
|
|
|
if ($countOrderProductUpdated) { |
|
|
|
// @TODO : faire le add flash dans le controller |
|
|
|
$this->flashBagTranslator->add( |
|
|
|
'success', |
|
|
|
'orderProductUpdated', |
|
|
|
'OrderShop', |
|
|
|
array('%count%' => $countOrderProductUpdated) |
|
|
|
'success', |
|
|
|
'orderProductUpdated', |
|
|
|
'OrderShop', |
|
|
|
//array('%count%' => $countOrderProductUpdated) |
|
|
|
['%count' => $debug] |
|
|
|
); |
|
|
|
|
|
|
|
$this->entityManager->flush(); |
|
|
@@ -604,17 +604,17 @@ class OrderShopBuilder |
|
|
|
$orderShop->setStatTotal($this->priceSolver->getTotal($orderShop)); |
|
|
|
$orderShop->setStatTotalWithTax($this->priceSolver->getTotalWithTax($orderShop)); |
|
|
|
$orderShop->setStatTotalOrderProductsWithReductions( |
|
|
|
$this->priceSolver->getTotalOrderProductsWithReductions($orderShop) |
|
|
|
$this->priceSolver->getTotalOrderProductsWithReductions($orderShop) |
|
|
|
); |
|
|
|
$orderShop->setStatTotalOrderProductsWithTaxAndReductions( |
|
|
|
$this->priceSolver->getTotalOrderProductsWithTaxAndReductions($orderShop) |
|
|
|
$this->priceSolver->getTotalOrderProductsWithTaxAndReductions($orderShop) |
|
|
|
); |
|
|
|
$orderShop->setStatMarginOrderProductsWithReductions( |
|
|
|
$this->priceSolver->getMarginOrderProductsWithReductions($orderShop) |
|
|
|
$this->priceSolver->getMarginOrderProductsWithReductions($orderShop) |
|
|
|
); |
|
|
|
$orderShop->setStatDeliveryPriceWithReduction($this->priceSolver->getDeliveryPriceWithReduction($orderShop)); |
|
|
|
$orderShop->setStatDeliveryPriceWithTaxAndReduction( |
|
|
|
$this->priceSolver->getDeliveryPriceWithTaxAndReduction($orderShop) |
|
|
|
$this->priceSolver->getDeliveryPriceWithTaxAndReduction($orderShop) |
|
|
|
); |
|
|
|
|
|
|
|
$this->entityManager->update($orderShop); |
|
|
@@ -665,10 +665,10 @@ class OrderShopBuilder |
|
|
|
public function getProductsSalesStatistic(SectionInterface $section, $entity, $nbWeek = 2) |
|
|
|
{ |
|
|
|
$productsSalesStatistic = new ProductsSalesStatistic( |
|
|
|
$this->entityManager, |
|
|
|
$entity, |
|
|
|
$nbWeek, |
|
|
|
$this->productSolver |
|
|
|
$this->entityManager, |
|
|
|
$entity, |
|
|
|
$nbWeek, |
|
|
|
$this->productSolver |
|
|
|
); |
|
|
|
|
|
|
|
$productsSalesStatistic->init($section, $this->distributionBuilder, $this->openingResolver); |