瀏覽代碼

[Global] Bon cadeau

feature/module_traiteur_v1
Fab 4 年之前
父節點
當前提交
c93829eb66
共有 2 個文件被更改,包括 7 次插入4 次删除
  1. +6
    -3
      ShopBundle/Repository/OrderShopRepository.php
  2. +1
    -1
      ShopBundle/Services/Order/OrderUtilsReductionTrait.php

+ 6
- 3
ShopBundle/Repository/OrderShopRepository.php 查看文件

@@ -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 查看文件

@@ -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…
取消
儲存