|
|
@@ -11,6 +11,7 @@ use Lc\CaracoleBundle\Model\Reduction\ReductionCreditInterface; |
|
|
|
use Lc\CaracoleBundle\Model\Reduction\ReductionCreditModel; |
|
|
|
use Lc\CaracoleBundle\Model\User\VisitorInterface; |
|
|
|
use Lc\CaracoleBundle\Repository\Merchant\MerchantStore; |
|
|
|
use Lc\CaracoleBundle\Repository\MerchantStoreTrait; |
|
|
|
use Lc\CaracoleBundle\Repository\Reduction\ReductionCartStore; |
|
|
|
use Lc\CaracoleBundle\Repository\Reduction\ReductionCreditStore; |
|
|
|
use Lc\CaracoleBundle\Repository\Section\SectionStore; |
|
|
@@ -29,6 +30,7 @@ use Symfony\Component\Routing\Generator\UrlGeneratorInterface; |
|
|
|
class OrderShopStore extends AbstractStore |
|
|
|
{ |
|
|
|
use SectionStoreTrait; |
|
|
|
use MerchantStoreTrait; |
|
|
|
|
|
|
|
protected OrderShopRepositoryQuery $query; |
|
|
|
protected EntityManagerInterface $entityManager; |
|
|
@@ -86,10 +88,14 @@ class OrderShopStore extends AbstractStore |
|
|
|
|
|
|
|
public function filtersDefault(RepositoryQueryInterface $query): RepositoryQueryInterface |
|
|
|
{ |
|
|
|
if($this->section) { |
|
|
|
if(isset($this->section) && $this->section) { |
|
|
|
$query->filterBySection($this->section); |
|
|
|
} |
|
|
|
|
|
|
|
if(isset($this->merchant) && $this->merchant) { |
|
|
|
$query->filterByMerchant($this->merchant); |
|
|
|
} |
|
|
|
|
|
|
|
return $query; |
|
|
|
} |
|
|
|
|
|
|
@@ -445,7 +451,8 @@ class OrderShopStore extends AbstractStore |
|
|
|
|
|
|
|
$reductionCreditsArray = []; |
|
|
|
foreach ($reductionCredits as $reductionCredit) { |
|
|
|
if (!$this->countValidWithReductionCredit($reductionCredit, $user)) { |
|
|
|
if (!$this->countValidWithReductionCredit($reductionCredit, $user) |
|
|
|
&& (!$this->merchant || $reductionCredit->getSection()->getMerchant() == $this->merchant)) { |
|
|
|
$reductionCreditsArray[] = $reductionCredit; |
|
|
|
} |
|
|
|
} |
|
|
@@ -514,8 +521,10 @@ class OrderShopStore extends AbstractStore |
|
|
|
if ($this->reductionCartSolver->matchWithUser($reductionCart, $user) |
|
|
|
&& $this->reductionCartSolver->matchWithGroupUser($reductionCart, $user) |
|
|
|
&& $this->getReductionCartRemainingQuantityByUser($reductionCart, $user) |
|
|
|
&& ($reductionCart->getUsers()->count() > 0 || $reductionCart->getGroupUsers()->count() > 0)) { |
|
|
|
$reductionCartsArray[] = $reductionCart; |
|
|
|
&& ($reductionCart->getUsers()->count() > 0 || $reductionCart->getGroupUsers()->count() > 0) |
|
|
|
&& (!$this->merchant || $reductionCart->getSection()->getMerchant() == $this->merchant)) { |
|
|
|
|
|
|
|
$reductionCartsArray[] = $reductionCart; |
|
|
|
} |
|
|
|
} |
|
|
|
|