$filteredValue = ['value' => $context->getRequest()->query->get('q')]; | $filteredValue = ['value' => $context->getRequest()->query->get('q')]; | ||||
$filterManager->applyFilter($repositoryQuery, $field, $filteredValue); | $filterManager->applyFilter($repositoryQuery, $field, $filteredValue); | ||||
$repositoryQuery->select('.' . $autocompleteContext['propertyName']); | $repositoryQuery->select('.' . $autocompleteContext['propertyName']); | ||||
//dump($repositoryQuery->getQueryBuilder()->getQuery()->getDQL()); | |||||
$responses = array(); | $responses = array(); | ||||
foreach ($repositoryQuery->find() as $result) { | foreach ($repositoryQuery->find() as $result) { |
use Lc\SovBundle\Container\User\UserContainer; | use Lc\SovBundle\Container\User\UserContainer; | ||||
use Lc\SovBundle\Controller\User\UserAdminController as SovUserAdminController; | use Lc\SovBundle\Controller\User\UserAdminController as SovUserAdminController; | ||||
use Lc\SovBundle\Definition\ActionDefinition; | use Lc\SovBundle\Definition\ActionDefinition; | ||||
use Lc\SovBundle\Model\User\UserInterface; | |||||
use Lc\SovBundle\Repository\RepositoryQueryInterface; | use Lc\SovBundle\Repository\RepositoryQueryInterface; | ||||
abstract class UserAdminController extends SovUserAdminController | abstract class UserAdminController extends SovUserAdminController | ||||
public function getRepositoryQuery(): RepositoryQueryInterface | public function getRepositoryQuery(): RepositoryQueryInterface | ||||
{ | { | ||||
dump($this->container->get($this->getContainerFqcn())); | |||||
return $this->container->get($this->getContainerFqcn())->getRepositoryQuery(); | return $this->container->get($this->getContainerFqcn())->getRepositoryQuery(); | ||||
} | } | ||||
public function overrideEntitiesActions(?EntityCollection $entities, string $pageName): void | public function overrideEntitiesActions(?EntityCollection $entities, string $pageName): void | ||||
{ | { | ||||
foreach ($entities as $entity) { | foreach ($entities as $entity) { | ||||
foreach ($entity->getActions() as $action){ | |||||
if($action->getName() == ActionDefinition::SWITCH_USER){ | |||||
foreach ($entity->getActions() as $action) { | |||||
if ($action->getName() == ActionDefinition::SWITCH_USER) { | |||||
$sectionDefault = $this->getSectionContainer()->getStore()->setMerchant($this->getMerchantCurrent())->getOneDefault(); | $sectionDefault = $this->getSectionContainer()->getStore()->setMerchant($this->getMerchantCurrent())->getOneDefault(); | ||||
$url = $this->generateUrl($this->getParameter('lc_sov.homepage_route'), array('_switch_user' => $entity->getInstance()->getEmail(), 'section'=> $sectionDefault->getSlug())); | |||||
$url = $this->generateUrl($this->getParameter('lc_sov.homepage_route'), array('_switch_user' => $entity->getInstance()->getEmail(), 'section' => $sectionDefault->getSlug())); | |||||
$action->setLinkUrl($url); | $action->setLinkUrl($url); | ||||
} | } | ||||
} | } | ||||
} | } | ||||
public function getDeleteUserWarningMessageList(UserInterface $user): array | |||||
{ | |||||
$warningMessages = parent::getDeleteUserWarningMessageList($user); | |||||
foreach ($this->getUserMerchantContainer()->getStore()->getByUserOutOfContext($user) as $userMerchant) { | |||||
if ($this->getUserMerchantContainer()->getSolver()->isCreditActive($userMerchant) && $userMerchant->getCredit() != 0) { | |||||
$warningMessages['danger'][] = $this->getTranslatorAdmin()->transFlashMessage('error', 'deleteHasCredit', 'User', array('%merchant%' => $userMerchant->getMerchant())); | |||||
} | |||||
} | |||||
foreach ($this->getReductionCatalogContainer()->getStore()->getByUserOutOfContext($user) as $reductionCatalog) { | |||||
$warningMessages['danger'][] = $this->getTranslatorAdmin()->transFlashMessage( | |||||
'error', | |||||
'deleteHasReductionCatalog', | |||||
'User', | |||||
array( | |||||
'%merchant%' => $reductionCatalog->getMerchant(), | |||||
'%id%' => $reductionCatalog->getId() | |||||
) | |||||
); | |||||
} | |||||
foreach ($this->getReductionCartContainer()->getStore()->getByUserOutOfContext($user) as $reductionCart) { | |||||
$warningMessages['danger'][] = $this->getTranslatorAdmin()->transFlashMessage( | |||||
'error', | |||||
'deleteHasReductionCart', | |||||
'User', | |||||
array( | |||||
'%merchant%' => $reductionCart->getMerchant(), | |||||
'%id%' => $reductionCart->getId() | |||||
) | |||||
); | |||||
} | |||||
foreach ($this->getReductionCreditContainer()->getStore()->getReductionCreditByUserOutOfContext($user) as $reductionCredit) { | |||||
$warningMessages['warning'][] = $this->getTranslatorAdmin()->transFlashMessage( | |||||
'error', | |||||
'deleteHasReductionCredit', | |||||
'User', | |||||
array( | |||||
'%merchant%' => $reductionCredit->getMerchant(), | |||||
'%id%' => $reductionCredit->getId() | |||||
) | |||||
); | |||||
} | |||||
foreach ($this->getReductionCreditContainer()->getStore()->getReductionGiftByUserOutOfContext($user) as $reductionGift) { | |||||
$warningMessages['warning'][] = $this->getTranslatorAdmin()->transFlashMessage( | |||||
'error', | |||||
'deleteHasReductionGift', | |||||
'User', | |||||
array( | |||||
'%merchant%' => $reductionGift->getMerchant(), | |||||
'%id%' => $reductionGift->getId() | |||||
) | |||||
); | |||||
} | |||||
return $warningMessages; | |||||
} | |||||
} | } |
$class = CreditHistoryContainer::getEntityFqcn(); | $class = CreditHistoryContainer::getEntityFqcn(); | ||||
$creditHistory = new $class; | $creditHistory = new $class; | ||||
$creditHistory->setUserMerchant($userMerchant) ; | $creditHistory->setUserMerchant($userMerchant) ; | ||||
$creditHistory->setMerchant($userMerchant->getMerchant()) ; | |||||
return $creditHistory; | return $creditHistory; | ||||
} | } |
protected $comment; | protected $comment; | ||||
/** | /** | ||||
* @ORM\OneToOne(targetEntity="Lc\CaracoleBundle\Model\PointSale\PointSaleInterface", mappedBy="address", cascade={"persist", "remove"}) | |||||
* @ORM\OneToOne(targetEntity="Lc\CaracoleBundle\Model\PointSale\PointSaleInterface", mappedBy="address", cascade={"persist"}) | |||||
*/ | */ | ||||
protected $pointSale; | protected $pointSale; | ||||
/** | /** | ||||
* @ORM\OneToOne(targetEntity="Lc\CaracoleBundle\Model\Merchant\MerchantInterface", mappedBy="address", cascade={"persist", "remove"}) | |||||
* @ORM\OneToOne(targetEntity="Lc\CaracoleBundle\Model\Merchant\MerchantInterface", mappedBy="address", cascade={"persist"}) | |||||
*/ | */ | ||||
protected $merchant; | protected $merchant; | ||||
use Doctrine\ORM\Mapping as ORM; | use Doctrine\ORM\Mapping as ORM; | ||||
use Lc\CaracoleBundle\Doctrine\Extension\PayoffTrait; | use Lc\CaracoleBundle\Doctrine\Extension\PayoffTrait; | ||||
use Lc\CaracoleBundle\Model\Merchant\MerchantInterface; | |||||
use Lc\CaracoleBundle\Model\Order\OrderPaymentInterface; | use Lc\CaracoleBundle\Model\Order\OrderPaymentInterface; | ||||
use Lc\CaracoleBundle\Model\Order\OrderRefundInterface; | use Lc\CaracoleBundle\Model\Order\OrderRefundInterface; | ||||
use Lc\CaracoleBundle\Doctrine\Extension\PayoffInterface; | use Lc\CaracoleBundle\Doctrine\Extension\PayoffInterface; | ||||
/** | /** | ||||
* @ORM\ManyToOne(targetEntity="Lc\CaracoleBundle\Model\User\UserMerchantInterface", inversedBy="creditHistories") | * @ORM\ManyToOne(targetEntity="Lc\CaracoleBundle\Model\User\UserMerchantInterface", inversedBy="creditHistories") | ||||
* @ORM\JoinColumn(nullable=true, ) | |||||
* @ORM\JoinColumn(nullable=true, onDelete="SET NULL") | |||||
*/ | */ | ||||
protected $userMerchant; | protected $userMerchant; | ||||
/** | |||||
* @ORM\ManyToOne(targetEntity="Lc\CaracoleBundle\Model\Merchant\MerchantInterface") | |||||
* @ORM\JoinColumn(nullable=false) | |||||
*/ | |||||
protected $merchant; | |||||
/** | /** | ||||
* @ORM\OneToOne(targetEntity="Lc\CaracoleBundle\Model\Order\OrderPaymentInterface", cascade={"persist"}) | * @ORM\OneToOne(targetEntity="Lc\CaracoleBundle\Model\Order\OrderPaymentInterface", cascade={"persist"}) | ||||
*/ | */ | ||||
return $this; | return $this; | ||||
} | } | ||||
public function getMerchant(): MerchantInterface | |||||
{ | |||||
return $this->merchant; | |||||
} | |||||
public function setMerchant(MerchantInterface $merchant): self | |||||
{ | |||||
$this->merchant = $merchant; | |||||
return $this; | |||||
} | |||||
public function getOrderPayment(): ?OrderPaymentInterface | public function getOrderPayment(): ?OrderPaymentInterface | ||||
{ | { |
protected $orderShops; | protected $orderShops; | ||||
/** | /** | ||||
* @ORM\OneToOne(targetEntity="Lc\CaracoleBundle\Model\Order\OrderRefundInterface", mappedBy="document", cascade={"persist", "remove"}) | |||||
* @ORM\OneToOne(targetEntity="Lc\CaracoleBundle\Model\Order\OrderRefundInterface", mappedBy="document", cascade={"persist"}) | |||||
*/ | */ | ||||
protected $orderRefund; | protected $orderRefund; | ||||
/** | /** | ||||
* @ORM\ManyToOne(targetEntity="Lc\SovBundle\Model\User\UserInterface") | * @ORM\ManyToOne(targetEntity="Lc\SovBundle\Model\User\UserInterface") | ||||
* @ORM\JoinColumn(nullable=true, onDelete="SET NULL") | |||||
*/ | */ | ||||
protected $owner; | protected $owner; | ||||
protected $productCategories; | protected $productCategories; | ||||
/** | /** | ||||
* @ORM\OneToMany(targetEntity="Lc\SovBundle\Model\Site\NewsInterface", mappedBy="section", orphanRemoval=true) | |||||
* @ORM\OneToMany(targetEntity="Lc\SovBundle\Model\Site\NewsInterface", mappedBy="section") | |||||
*/ | */ | ||||
protected $news; | protected $news; | ||||
protected $creditActive = false; | protected $creditActive = false; | ||||
/** | /** | ||||
* @ORM\OneToMany(targetEntity="Lc\CaracoleBundle\Model\Credit\CreditHistoryInterface", mappedBy="userMerchant", cascade={"remove"}) | |||||
* @ORM\OneToMany(targetEntity="Lc\CaracoleBundle\Model\Credit\CreditHistoryInterface", mappedBy="userMerchant") | |||||
*/ | */ | ||||
protected $creditHistories; | protected $creditHistories; | ||||
protected $userMerchants; | protected $userMerchants; | ||||
/** | /** | ||||
* @ORM\ManyToMany(targetEntity="Lc\CaracoleBundle\Model\Reduction\ReductionCreditInterface", mappedBy="users", orphanRemoval=true) | |||||
* @ORM\ManyToMany(targetEntity="Lc\CaracoleBundle\Model\Reduction\ReductionCreditInterface", mappedBy="users") | |||||
*/ | */ | ||||
protected $reductionCredits; | protected $reductionCredits; | ||||
$userMerchant = $this->getOneByUser($user, $query); | $userMerchant = $this->getOneByUser($user, $query); | ||||
return $this->userMerchantSolver->isCreditActive($userMerchant); | return $this->userMerchantSolver->isCreditActive($userMerchant); | ||||
} | } | ||||
public function getByUserOutOfContext(UserInterface $user, $query = null): ?array | |||||
{ | |||||
$query = $this->createQuery($query); | |||||
$query->filterByUser($user); | |||||
return $query->find(); | |||||
} | |||||
} | } |
boxes: | boxes: | ||||
visitor: Visiteur | visitor: Visiteur | ||||
user: Utilisateur | user: Utilisateur | ||||
UserPointSale: | |||||
label_plurial: Liens avec une ambassade | |||||
PointSale: | PointSale: | ||||
label: Point de vente | label: Point de vente | ||||
label_plurial: Points de vente | label_plurial: Points de vente | ||||
orderAmountMin: Montant minimum de commande | orderAmountMin: Montant minimum de commande | ||||
Address: | Address: | ||||
label_plurial: Adresses | |||||
fields: | fields: | ||||
type: Type | type: Type | ||||
typeOptions: | typeOptions: | ||||
countOrder: Commandes | countOrder: Commandes | ||||
totalSpent: Ventes | totalSpent: Ventes | ||||
lastLogin: Dernière connexion | lastLogin: Dernière connexion | ||||
flashes: | |||||
error: | |||||
deleteHasCredit: "L'utilisateur possède du crédit sur <strong>%merchant%</strong>, débiter son compte pour pouvoir le supprimer" | |||||
deleteHasReductionCatalog: "L'utilisateur possède une réduction catalogue sur %merchant%, supprimer ou modifier cette réduction pour pouvoir le supprimer<br /> <strong>Réduction catalogue : #%id% sur %merchant%</strong>" | |||||
deleteHasReductionCart: "L'utilisateur possède une réduction panier sur %merchant%, supprimer ou modifier cette réduction pour pouvoir le supprimer<br /> <strong>Réduction panier : #%id% sur %merchant%</strong>" | |||||
deleteHasReductionCredit: "L'utilisateur possède un avoir sur %merchant%, il ne sera pas supprimé mais non attribué<br /> <strong>Avoir : #%id% sur %merchant%</strong>" | |||||
deleteHasReductionGift: "L'utilisateur possède un bon cadeau sur %merchant%, il ne sera pas supprimé mais non attribué<br /> <strong>Bon cadeau : #%id% sur %merchant%</strong>" | |||||
deleteEntityCascade: "%count% %entity% liés à l'utilisateur seront supprimés" | |||||
CreditHistory: | CreditHistory: | ||||
label: Historique de compte prépayé | label: Historique de compte prépayé | ||||
label_plurial: Historiques de compte prépayé | label_plurial: Historiques de compte prépayé |