Bläddra i källkod

Reduction Cart : gestion des quantités disponibles

feature/export_comptable
Guillaume 4 år sedan
förälder
incheckning
31e74facbd
4 ändrade filer med 7 tillägg och 5 borttagningar
  1. +1
    -1
      ShopBundle/Controller/Backend/OrderController.php
  2. +1
    -1
      ShopBundle/Model/AbstractEntity.php
  3. +2
    -2
      ShopBundle/Repository/OrderShopRepository.php
  4. +3
    -1
      ShopBundle/Repository/ReductionCartRepository.php

+ 1
- 1
ShopBundle/Controller/Backend/OrderController.php Visa fil

@@ -290,7 +290,7 @@ class OrderController extends AdminController
if ($formOrderReductionCart->isSubmitted() && $formOrderReductionCart->isValid()) {
$reductionCart = $formOrderReductionCart->get('reductionCart')->getData();
$orderShop->reductionError = array();
if ($this->orderUtils->isReductionCartAllowToBeAddToOrder($orderShop, $reductionCart)) {
if ($this->orderUtils->isReductionCartAllowAddToOrder($orderShop, $reductionCart)) {
$orderReductionCart = $this->orderUtils->createOrderReductionCart($orderShop, $reductionCart);
$this->em->persist($orderReductionCart);
$this->em->flush();

+ 1
- 1
ShopBundle/Model/AbstractEntity.php Visa fil

@@ -40,7 +40,7 @@ abstract class AbstractEntity
protected $updatedBy;


public function addError($message, $domain = 'lcshop', $params){
public function addError($message, $domain = 'lcshop', $params = []){
$this->errors[] = array(
'message'=> $message,
'domain'=> $domain,

+ 2
- 2
ShopBundle/Repository/OrderShopRepository.php Visa fil

@@ -43,7 +43,7 @@ class OrderShopRepository extends BaseRepository implements DefaultRepositoryInt
$query = $this->findByMerchantQuery();
$query = $this->filterOrderValid($query);
$query->select('count(e.id)');
$query->join('e.orderReductionCart', 'orc');
$query->join('e.orderReductionCarts', 'orc');
$query->andWhere('orc.reductionCart = :reductionCart');
$query->setParameter('reductionCart', $reductionCart);
return $query->getQuery()->getSingleScalarResult();
@@ -55,7 +55,7 @@ class OrderShopRepository extends BaseRepository implements DefaultRepositoryInt
$query = $this->filterOrderValid($query);
$query->select('count(e.id)');
$query->andWhere('e.user = :user');
$query->join('e.orderReductionCart', 'orc');
$query->join('e.orderReductionCarts', 'orc');
$query->andWhere('orc.reductionCart = :reductionCart');
$query->setParameter('reductionCart', $reductionCart);
$query->setParameter('user', $user);

+ 3
- 1
ShopBundle/Repository/ReductionCartRepository.php Visa fil

@@ -69,7 +69,9 @@ class ReductionCartRepository extends BaseRepository implements DefaultRepositor
$reductionCartsArray = [] ;
foreach($reductionCarts as $reductionCart) {
if($this->orderUtils->isReductionCartMatchWithUser($reductionCart, $user)
&& $this->orderUtils->isReductionCartMatchWithGroupUser($reductionCart, $user)) {
&& $this->orderUtils->isReductionCartMatchWithGroupUser($reductionCart, $user)
&& $this->orderUtils->countReductionCartAvailableForUser($reductionCart, $user)) {

$reductionCartsArray[] = $reductionCart ;
}
}

Laddar…
Avbryt
Spara