Procházet zdrojové kódy

Processus commande

feature/export_comptable
Guillaume před 4 roky
rodič
revize
a4205abfe8
1 změnil soubory, kde provedl 23 přidání a 24 odebrání
  1. +23
    -24
      ShopBundle/Repository/OrderShopRepository.php

+ 23
- 24
ShopBundle/Repository/OrderShopRepository.php Zobrazit soubor

@@ -22,7 +22,7 @@ class OrderShopRepository extends BaseRepository implements DefaultRepositoryInt

//TODO : AJOUTER un champ valid ds orderSTATUS
protected $statusAliasAsValid = array('paid-online', 'paid-by-credit', 'waiting-delivery', 'waiting-delivery-with-payment', 'delivered-without-payment', 'done');
protected $statusAliasAsCard = array('cart', 'wainting-payment-online', 'wainting-payment-credit', 'wainting-payment-on-delivery', 'error-payment-online');
protected $statusAliasAsCart = array('cart', 'waiting-payment-online', 'waiting-payment-credit', 'waiting-payment-on-delivery', 'error-payment-online');


public function findValidOrderWithReductionCredit($reductionCredit, $user){
@@ -50,7 +50,7 @@ class OrderShopRepository extends BaseRepository implements DefaultRepositoryInt
{
$query->leftJoin('e.orderStatus', 'os');
$query->andWhere('os.alias IN (:alias)');
$query->setParameter('alias', $this->statusAliasAsCard);
$query->setParameter('alias', $this->statusAliasAsCart);

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

$this->filterOrderCart($query, true);
$query = $this->filterOrderCart($query);

$query->leftJoin('e.orderReductionCarts', 'orderReductionCarts')
->addSelect('orderReductionCarts');
@@ -85,16 +85,23 @@ class OrderShopRepository extends BaseRepository implements DefaultRepositoryInt
{
$query = $this->findByMerchantQuery() ;

if(isset($params['dateStart'])) {
$query->andWhere('e.createdAt >= :dateStart')->setParameter('dateStart', $params['dateStart']) ;
if(isset($params['dateStart']) || isset($params['dateEnd'])) {
$params['dateField'] = isset($params['dateField']) ? $params['dateField'] : 'validationDate' ;
}

if(isset($params['dateStart'])) {
$query->andWhere('e.'.$params['dateField'].' >= :dateStart')->setParameter('dateStart', $params['dateStart']) ;
}
if(isset($params['dateEnd'])) {
$query->andWhere('e.createdAt <= :dateEnd')->setParameter('dateEnd', $params['dateEnd']) ;
$query->andWhere('e.'.$params['dateField'].' <= :dateEnd')->setParameter('dateEnd', $params['dateEnd']) ;
}

if(isset($params['isCart'])) {
$query = $this->filterOrderCart($query) ;
}

if(!isset($params['isCart'])) {
$this->filterOrderCart($query) ;
if(isset($params['isValid'])) {
$query = $this->filterOrderValid($query) ;
}

if(isset($params['user'])) {
@@ -103,19 +110,6 @@ class OrderShopRepository extends BaseRepository implements DefaultRepositoryInt

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

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

public function findAllByDateStartEnd($dateStart, $dateEnd)
{
$query = $this->findByMerchantQuery()
->andWhere('e.createdAt >= :dateStart')
->setParameter('dateStart', $dateStart)
->andWhere('e.createdAt <= :dateEnd')
->setParameter('dateEnd', $dateEnd);

$this->filterOrderCart($query) ;

$query->leftJoin('e.deliveryAvailabilityZone', 'deliveryAvailabilityZone') ;
$query->leftJoin('deliveryAvailabilityZone.deliverySlot', 'deliverySlotZone') ;
$query->addOrderBy('deliverySlotZone.day', 'ASC') ;
@@ -129,7 +123,12 @@ class OrderShopRepository extends BaseRepository implements DefaultRepositoryInt
return $query->getQuery()->getResult() ;
}



//getValidOrders()
public function findAllByDateStartEnd($dateStart, $dateEnd)
{
return $this->findAllBy([
'dateStart' => $dateStart,
'dateEnd' => $dateEnd,
'isValid' => true
]) ;
}
}

Načítá se…
Zrušit
Uložit