Sfoglia il codice sorgente

[Global] Bon cadeau

feature/module_traiteur_v1
Fab 4 anni fa
parent
commit
c93829eb66
2 ha cambiato i file con 7 aggiunte e 4 eliminazioni
  1. +6
    -3
      ShopBundle/Repository/OrderShopRepository.php
  2. +1
    -1
      ShopBundle/Services/Order/OrderUtilsReductionTrait.php

+ 6
- 3
ShopBundle/Repository/OrderShopRepository.php Vedi File

@@ -24,16 +24,19 @@ class OrderShopRepository extends BaseRepository implements DefaultRepositoryInt
return OrderShopInterface::class;
}

public function countValidOrderWithReductionCredit($reductionCredit, $user)
public function countValidOrderWithReductionCredit($reductionCredit, $user=null)
{
$query = $this->findByMerchantQuery();
$query = $this->filterOrderValid($query);
$query->select('count(e.id)');
$query->andWhere('e.user = :user');
if($user) {
$query->andWhere('e.user = :user');
$query->setParameter('user', $user);
}
$query->innerJoin('e.orderReductionCredits', 'orc');
$query->andWhere('orc.reductionCredit = :reductionCredit');
$query->setParameter('reductionCredit', $reductionCredit);
$query->setParameter('user', $user);
return $query->getQuery()->getSingleScalarResult();
}


+ 1
- 1
ShopBundle/Services/Order/OrderUtilsReductionTrait.php Vedi File

@@ -164,7 +164,7 @@ trait OrderUtilsReductionTrait

$reductionGiftsArray = [] ;
foreach($reductionGifts as $reductionGift) {
if(!$this->orderShopRepo->countValidOrderWithReductionCredit($reductionGift, $user)) {
if(!$this->orderShopRepo->countValidOrderWithReductionCredit($reductionGift)) {
$reductionGiftsArray[] = $reductionGift ;
}
}

Loading…
Annulla
Salva