|
|
@@ -5,6 +5,7 @@ namespace Lc\ShopBundle\Repository; |
|
|
|
use Doctrine\ORM\QueryBuilder; |
|
|
|
use Lc\ShopBundle\Context\DefaultRepositoryInterface; |
|
|
|
use Lc\ShopBundle\Context\OrderShopInterface; |
|
|
|
use Lc\ShopBundle\Model\OrderStatus; |
|
|
|
|
|
|
|
/** |
|
|
|
* @method OrderShopInterface|null find($id, $lockMode = null, $lockVersion = null) |
|
|
@@ -20,12 +21,6 @@ class OrderShopRepository extends BaseRepository implements DefaultRepositoryInt |
|
|
|
return OrderShopInterface::class; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//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 $statusAliasAsCart = array('cart', 'waiting-payment-online', 'waiting-payment-credit', 'waiting-payment-on-delivery', 'error-payment-online'); |
|
|
|
|
|
|
|
|
|
|
|
public function countValidOrderWithReductionCredit($reductionCredit, $user) |
|
|
|
{ |
|
|
|
$query = $this->findByMerchantQuery(); |
|
|
@@ -68,10 +63,9 @@ class OrderShopRepository extends BaseRepository implements DefaultRepositoryInt |
|
|
|
|
|
|
|
public function filterOrderValid(?QueryBuilder $query): QueryBuilder |
|
|
|
{ |
|
|
|
|
|
|
|
$query->leftJoin('e.orderStatus', 'os'); |
|
|
|
$query->andWhere('os.alias IN (:alias)'); |
|
|
|
$query->setParameter('alias', $this->statusAliasAsValid); |
|
|
|
$query->setParameter('alias', OrderStatus::$statusAliasAsValid); |
|
|
|
|
|
|
|
return $query; |
|
|
|
} |
|
|
@@ -80,7 +74,7 @@ class OrderShopRepository extends BaseRepository implements DefaultRepositoryInt |
|
|
|
{ |
|
|
|
$query->leftJoin('e.orderStatus', 'os'); |
|
|
|
$query->andWhere('os.alias IN (:alias)'); |
|
|
|
$query->setParameter('alias', $this->statusAliasAsCart); |
|
|
|
$query->setParameter('alias', OrderStatus::$statusAliasAsCart); |
|
|
|
|
|
|
|
return $query; |
|
|
|
} |
|
|
@@ -164,7 +158,7 @@ class OrderShopRepository extends BaseRepository implements DefaultRepositoryInt |
|
|
|
|
|
|
|
$query->leftJoin('complementaryOrderShops.orderStatus', 'complementaryOrderStatus'); |
|
|
|
$query->andWhere('complementaryOrderShops IS NULL OR complementaryOrderStatus.alias IN (:statusAliasValid)'); |
|
|
|
$query->setParameter('statusAliasValid', $this->statusAliasAsValid); |
|
|
|
$query->setParameter('statusAliasValid', OrderStatus::$statusAliasAsValid); |
|
|
|
} |
|
|
|
|
|
|
|
if (isset($params['excludeComplementaryOrderShops'])) { |