Ver código fonte

[Boutique] Abonnements : correctif problème points de vente à accès restreint affichés

feature/souke
Guillaume Bourgeois 11 meses atrás
pai
commit
fc013849a8
3 arquivos alterados com 19 adições e 2 exclusões
  1. +8
    -0
      common/logic/PointSale/PointSale/Repository/PointSaleRepository.php
  2. +9
    -0
      common/logic/PointSale/PointSale/Repository/PointSaleRepositoryQuery.php
  3. +2
    -2
      producer/controllers/SubscriptionController.php

+ 8
- 0
common/logic/PointSale/PointSale/Repository/PointSaleRepository.php Ver arquivo

@@ -98,6 +98,14 @@ class PointSaleRepository extends AbstractRepository
->find();
}

public function findPointSalesByUserAccess(User $user)
{
return $this->createDefaultQuery()
->filterIsOnline()
->filterByUserAccess($user)
->find();
}

public function queryPointSalesPublic(Producer $producer)
{
return $this->createDefaultQuery()

+ 9
- 0
common/logic/PointSale/PointSale/Repository/PointSaleRepositoryQuery.php Ver arquivo

@@ -6,6 +6,7 @@ use common\logic\AbstractRepositoryQuery;
use common\logic\PointSale\PointSale\Model\PointSale;
use common\logic\PointSale\PointSale\Service\PointSaleDefinition;
use common\logic\StatusInterface;
use common\logic\User\User\Model\User;
use yii\db\ActiveQuery;

class PointSaleRepositoryQuery extends AbstractRepositoryQuery
@@ -44,4 +45,12 @@ class PointSaleRepositoryQuery extends AbstractRepositoryQuery

return $this;
}

public function filterByUserAccess(User $user): self
{
$this->andWhere('status = 1 AND (restricted_access = 0 OR (restricted_access = 1 AND (SELECT COUNT(*) FROM user_point_sale WHERE point_sale.id = user_point_sale.id_point_sale AND user_point_sale.id_user = :id_user) > 0))');
$this->addParams([':id_user' => $user->id]);

return $this;
}
}

+ 2
- 2
producer/controllers/SubscriptionController.php Ver arquivo

@@ -245,7 +245,7 @@ class SubscriptionController extends ProducerBaseController
$params = [];
$productModule = $this->getProductModule();
$subscriptionModule = $this->getSubscriptionModule();
$user = GlobalParam::getCurrentUser();
$user = $this->getUserCurrent();
$userProducer = $this->getUserProducerModule()->findOneUserProducer($this->getUserCurrent());
$pointSale = null;

@@ -304,7 +304,7 @@ class SubscriptionController extends ProducerBaseController

$params['products'] = $productsArray;
$pointsSaleArray = $this->getPointSaleModule()->findPointSales();
$pointsSaleArray = $this->getPointSaleModule()->findPointSalesByUserAccess($user);
foreach ($pointsSaleArray as &$pointSale) {
$pointSale = array_merge($pointSale->getAttributes(), [
'userPointSale' => ($pointSale->userPointSale ? $pointSale->userPointSale[0] : '')

Carregando…
Cancelar
Salvar