Browse Source

[Global] Bon cadeau

feature/module_traiteur_v1
Fab 4 years ago
parent
commit
c6550a5841
1 changed files with 20 additions and 3 deletions
  1. +20
    -3
      ShopBundle/Services/Order/OrderUtilsReductionTrait.php

+ 20
- 3
ShopBundle/Services/Order/OrderUtilsReductionTrait.php View File

use Lc\ShopBundle\Context\OrderShopInterface; use Lc\ShopBundle\Context\OrderShopInterface;
use Lc\ShopBundle\Context\ReductionCartInterface; use Lc\ShopBundle\Context\ReductionCartInterface;
use Lc\ShopBundle\Context\ReductionCreditInterface; use Lc\ShopBundle\Context\ReductionCreditInterface;
use Lc\ShopBundle\Model\ReductionCredit;
use function Matrix\trace;


trait OrderUtilsReductionTrait trait OrderUtilsReductionTrait
{ {
} }


// n'a pas été utilisé // n'a pas été utilisé
if ($this->orderShopRepo->countValidOrderWithReductionCredit($reductionCredit, $user) > 0) {
$this->utils->addFlash('error', 'error.reductionCredit.alreadyUse');
return false;
if($reductionCredit->getType()== ReductionCredit::TYPE_CREDIT){
if ($this->orderShopRepo->countValidOrderWithReductionCredit($reductionCredit, $user) > 0) {
$this->utils->addFlash('error', 'error.reductionCredit.alreadyUse');
return false;
}
}else{
if ($this->orderShopRepo->countValidOrderWithReductionCredit($reductionCredit) > 0) {
$this->utils->addFlash('error', 'error.reductionCredit.alreadyUse');
return false;
}

} }


return true; return true;
return $reductionGiftsArray ; return $reductionGiftsArray ;
} }


public function isReductionGiftUsed($reductionGift){
if(!$this->orderShopRepo->countValidOrderWithReductionCredit($reductionGift)) {
return true;
}else{
return false;
}
}
public function isReductionCreditAddedToOrder($orderShop, $reductionCredit) public function isReductionCreditAddedToOrder($orderShop, $reductionCredit)
{ {
foreach($orderShop->getOrderReductionCredits() as $orderReductionCredit) { foreach($orderShop->getOrderReductionCredits() as $orderReductionCredit) {

Loading…
Cancel
Save