Переглянути джерело

Frontend : gestion de supplierTitle dans OrderProduct

master
Guillaume 4 роки тому
джерело
коміт
4fda041425
2 змінених файлів з 12 додано та 7 видалено
  1. +1
    -1
      ShopBundle/Repository/OrderShopRepository.php
  2. +11
    -6
      ShopBundle/Services/OrderUtils.php

+ 1
- 1
ShopBundle/Repository/OrderShopRepository.php Переглянути файл

@@ -62,7 +62,7 @@ class OrderShopRepository extends BaseRepository implements DefaultRepositoryInt
$query->andWhere('e.user = :user')->setParameter('user', $params['user']) ;
}

$query->orderBy('e.createdAt', 'DESC') ;
$query->orderBy('e.id', 'DESC') ;

return $query->getQuery()->getResult() ;
}

+ 11
- 6
ShopBundle/Services/OrderUtils.php Переглянути файл

@@ -151,12 +151,14 @@ class OrderUtils

foreach($orderShop->getOrderProducts() as $orderProduct) {
if ($orderProduct->getProduct()->getId() == $orderProductAdd->getProduct()->getId()
&& $this->priceUtils->getPrice($orderProduct) == $this->priceUtils->getPrice($orderProductAdd)
&& (string) $this->priceUtils->getPrice($orderProduct) == (string) $this->priceUtils->getPrice($orderProductAdd)
&& $this->compareOrderProductReductionCatalog($orderProduct->getOrderProductReductionCatalog(), $orderProductAdd->getOrderProductReductionCatalog())) {

$updated = true;
$orderProduct->setQuantityOrder($orderProduct->getQuantityOrder() + $orderProductAdd->getQuantityOrder());
$this->em->persist($orderProduct);
$updated = true;

break ;
}
}

@@ -178,10 +180,13 @@ class OrderUtils

public function compareOrderProductReductionCatalog($orderProductReductionCatalog1, $orderProductReductionCatalog2)
{
return $orderProductReductionCatalog1 && $orderProductReductionCatalog2
&& $orderProductReductionCatalog1->getUnit() == $orderProductReductionCatalog2->getUnit()
&& $orderProductReductionCatalog1->getValue() == $orderProductReductionCatalog2->getValue()
&& $orderProductReductionCatalog1->getBehaviorTaxRate() == $orderProductReductionCatalog2->getBehaviorTaxRate() ;
return (!$orderProductReductionCatalog1 && !$orderProductReductionCatalog2)

|| ($orderProductReductionCatalog1
&& $orderProductReductionCatalog2
&& $orderProductReductionCatalog1->getUnit() == $orderProductReductionCatalog2->getUnit()
&& (string) $orderProductReductionCatalog1->getValue() == (string) $orderProductReductionCatalog2->getValue()
&& $orderProductReductionCatalog1->getBehaviorTaxRate() == $orderProductReductionCatalog2->getBehaviorTaxRate()) ;
}

public function countQuantities($orderShop)

Завантаження…
Відмінити
Зберегти