Browse Source

Nombre maximum de commandes / semaine

feature/export_comptable
Guillaume 4 years ago
parent
commit
e5cc53a978
2 changed files with 16 additions and 2 deletions
  1. +10
    -1
      ShopBundle/Repository/OrderShopRepository.php
  2. +6
    -1
      ShopBundle/Services/OrderUtils.php

+ 10
- 1
ShopBundle/Repository/OrderShopRepository.php View File

{ {
$query = $this->findByMerchantQuery() ; $query = $this->findByMerchantQuery() ;


if(isset($params['count']) && $params['count']) {
$query->select('count(e.id)') ;
}

if(isset($params['dateStart']) || isset($params['dateEnd'])) { if(isset($params['dateStart']) || isset($params['dateEnd'])) {
$params['dateField'] = isset($params['dateField']) ? $params['dateField'] : 'validationDate' ; $params['dateField'] = isset($params['dateField']) ? $params['dateField'] : 'validationDate' ;
} }
$query->addOrderBy('deliverySlotPointSale.day', 'ASC') ; $query->addOrderBy('deliverySlotPointSale.day', 'ASC') ;
$query->addOrderBy('deliverySlotPointSale.timeStart', 'ASC') ; $query->addOrderBy('deliverySlotPointSale.timeStart', 'ASC') ;


return $query->getQuery()->getResult() ;
if(isset($params['count']) && $params['count']) {
return $query->getQuery()->getSingleScalarResult();
}
else {
return $query->getQuery()->getResult() ;
}
} }
} }

+ 6
- 1
ShopBundle/Services/OrderUtils.php View File

$orderPayment->setAmount($amount) ; $orderPayment->setAmount($amount) ;
$orderPayment->setReference($reference) ; $orderPayment->setReference($reference) ;
$orderPayment->setComment($comment) ; $orderPayment->setComment($comment) ;
$orderPayment->setPaidAt($paidAt) ;
if($paidAt) {
$orderPayment->setPaidAt($paidAt) ;
}
else {
$orderPayment->setPaidAt(new \DateTime('now')) ;
}


$this->em->persist($orderPayment) ; $this->em->persist($orderPayment) ;
$this->em->flush() ; $this->em->flush() ;

Loading…
Cancel
Save