Browse Source

[Backend] Bons cadeau : adaptations

feature/module_traiteur_v1
Guillaume 4 years ago
parent
commit
6db64c1e7a
2 changed files with 20 additions and 8 deletions
  1. +18
    -6
      ShopBundle/Repository/OrderShopRepository.php
  2. +2
    -2
      ShopBundle/Services/Order/OrderUtils.php

+ 18
- 6
ShopBundle/Repository/OrderShopRepository.php View File

} }


$setParameterHorsTournee = false ; $setParameterHorsTournee = false ;
$setParameterGiftVoucher = false ;


if (isset($params['isCircuit'])) {
if(isset($params['isCircuit'])) {
$query->leftJoin('e.deliveryPointSale', 'pointSale'); $query->leftJoin('e.deliveryPointSale', 'pointSale');
$query->andWhere('e.deliveryPointSale IS NULL OR (pointSale.isDepository = 0 AND (pointSale.devAlias IS NULL OR pointSale.devAlias != :devAliasHorsTournee))');
$query->andWhere('e.deliveryPointSale IS NULL OR (pointSale.isDepository = 0 AND (pointSale.devAlias IS NULL OR (pointSale.devAlias != :devAliasHorsTournee AND pointSale.devAlias != :devAliasGiftVoucher)))');
$setParameterHorsTournee = true ; $setParameterHorsTournee = true ;
$setParameterGiftVoucher = true ;
} }


if (isset($params['isDepository'])) {
if(isset($params['isDepository'])) {
$query->innerJoin('e.deliveryPointSale', 'pointSale'); $query->innerJoin('e.deliveryPointSale', 'pointSale');
$query->andWhere('pointSale IS NOT NULL AND pointSale.isDepository = 1 AND (pointSale.devAlias IS NULL OR pointSale.devAlias != :devAliasHorsTournee)');
$query->andWhere('pointSale IS NOT NULL AND pointSale.isDepository = 1 AND (pointSale.devAlias IS NULL OR (pointSale.devAlias != :devAliasHorsTournee AND pointSale.devAlias != :devAliasGiftVoucher))');
$setParameterHorsTournee = true ; $setParameterHorsTournee = true ;
$setParameterGiftVoucher = true ;
} }


if (isset($params['isOffCircuit'])) {
if(isset($params['isOffCircuit'])) {
$query->innerJoin('e.deliveryPointSale', 'pointSale'); $query->innerJoin('e.deliveryPointSale', 'pointSale');
$query->andWhere('pointSale IS NOT NULL AND pointSale.devAlias = :devAliasHorsTournee'); $query->andWhere('pointSale IS NOT NULL AND pointSale.devAlias = :devAliasHorsTournee');
$setParameterHorsTournee = true ; $setParameterHorsTournee = true ;
} }


if(isset($params['isGiftVoucher'])) {
$query->innerJoin('e.deliveryPointSale', 'pointSale');
$query->andWhere('pointSale IS NOT NULL AND pointSale.devAlias = :devAliasGiftVoucher');
$setParameterGiftVoucher = true ;
}

if($setParameterHorsTournee) { if($setParameterHorsTournee) {
$query->setParameter('devAliasHorsTournee', 'horstournee') ; $query->setParameter('devAliasHorsTournee', 'horstournee') ;
} }


if($setParameterGiftVoucher) {
$query->setParameter('devAliasGiftVoucher', 'giftvoucher') ;
}

if (isset($params['deliveryAvailability'])) { if (isset($params['deliveryAvailability'])) {
$deliveryAvailability = $params['deliveryAvailability'] ; $deliveryAvailability = $params['deliveryAvailability'] ;


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



if (isset($params['groupBy'])) { if (isset($params['groupBy'])) {
$query->groupBy( $params['groupBy']); $query->groupBy( $params['groupBy']);
} }

+ 2
- 2
ShopBundle/Services/Order/OrderUtils.php View File

$this->em->flush(); $this->em->flush();
} }


$this->eventOrderShopChangeQuantity($orderShop) ;
$this->eventCartChange($orderShop) ;
} }
} }
else { else {
return $this->priceUtils->getTotalWithTax($orderShop) >= 0 ; return $this->priceUtils->getTotalWithTax($orderShop) >= 0 ;
} }


public function eventOrderShopChangeQuantity(OrderShopInterface $orderShop)
public function eventCartChange(OrderShopInterface $orderShop)
{ {


} }

Loading…
Cancel
Save