|
|
|
|
|
|
|
|
use Lc\CaracoleBundle\Model\Reduction\ReductionCreditModel; |
|
|
use Lc\CaracoleBundle\Model\Reduction\ReductionCreditModel; |
|
|
use Lc\CaracoleBundle\Model\User\VisitorInterface; |
|
|
use Lc\CaracoleBundle\Model\User\VisitorInterface; |
|
|
use Lc\CaracoleBundle\Repository\Merchant\MerchantStore; |
|
|
use Lc\CaracoleBundle\Repository\Merchant\MerchantStore; |
|
|
|
|
|
use Lc\CaracoleBundle\Repository\MerchantStoreTrait; |
|
|
use Lc\CaracoleBundle\Repository\Reduction\ReductionCartStore; |
|
|
use Lc\CaracoleBundle\Repository\Reduction\ReductionCartStore; |
|
|
use Lc\CaracoleBundle\Repository\Reduction\ReductionCreditStore; |
|
|
use Lc\CaracoleBundle\Repository\Reduction\ReductionCreditStore; |
|
|
use Lc\CaracoleBundle\Repository\Section\SectionStore; |
|
|
use Lc\CaracoleBundle\Repository\Section\SectionStore; |
|
|
|
|
|
|
|
|
class OrderShopStore extends AbstractStore |
|
|
class OrderShopStore extends AbstractStore |
|
|
{ |
|
|
{ |
|
|
use SectionStoreTrait; |
|
|
use SectionStoreTrait; |
|
|
|
|
|
use MerchantStoreTrait; |
|
|
|
|
|
|
|
|
protected OrderShopRepositoryQuery $query; |
|
|
protected OrderShopRepositoryQuery $query; |
|
|
protected EntityManagerInterface $entityManager; |
|
|
protected EntityManagerInterface $entityManager; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public function filtersDefault(RepositoryQueryInterface $query): RepositoryQueryInterface |
|
|
public function filtersDefault(RepositoryQueryInterface $query): RepositoryQueryInterface |
|
|
{ |
|
|
{ |
|
|
if($this->section) { |
|
|
|
|
|
|
|
|
if(isset($this->section) && $this->section) { |
|
|
$query->filterBySection($this->section); |
|
|
$query->filterBySection($this->section); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if(isset($this->merchant) && $this->merchant) { |
|
|
|
|
|
$query->filterByMerchant($this->merchant); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
return $query; |
|
|
return $query; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$reductionCreditsArray = []; |
|
|
$reductionCreditsArray = []; |
|
|
foreach ($reductionCredits as $reductionCredit) { |
|
|
foreach ($reductionCredits as $reductionCredit) { |
|
|
if (!$this->countValidWithReductionCredit($reductionCredit, $user)) { |
|
|
|
|
|
|
|
|
if (!$this->countValidWithReductionCredit($reductionCredit, $user) |
|
|
|
|
|
&& (!$this->merchant || $reductionCredit->getSection()->getMerchant() == $this->merchant)) { |
|
|
$reductionCreditsArray[] = $reductionCredit; |
|
|
$reductionCreditsArray[] = $reductionCredit; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if ($this->reductionCartSolver->matchWithUser($reductionCart, $user) |
|
|
if ($this->reductionCartSolver->matchWithUser($reductionCart, $user) |
|
|
&& $this->reductionCartSolver->matchWithGroupUser($reductionCart, $user) |
|
|
&& $this->reductionCartSolver->matchWithGroupUser($reductionCart, $user) |
|
|
&& $this->getReductionCartRemainingQuantityByUser($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; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|