Commit 9b772f29 by Julien Jorry

Fix gestionnaire groupe local can see every presta and adherent from mlc…

Fix gestionnaire groupe local can see every presta and adherent from mlc including operation (can be revert if needed)
parent 462de980
...@@ -73,18 +73,18 @@ class AdherentAdmin extends AbstractAdmin ...@@ -73,18 +73,18 @@ class AdherentAdmin extends AbstractAdmin
->innerJoin($query->getRootAliases()[0] . '.user', 'u') ->innerJoin($query->getRootAliases()[0] . '.user', 'u')
->addSelect('u') ->addSelect('u')
; ;
if ($this->hasRequest()) { // if ($this->hasRequest()) {
if (empty($this->getRequest()->getSession()->get('_groupegere'))) { // if (empty($this->getRequest()->getSession()->get('_groupegere'))) {
if ($this->security->isGranted('ROLE_GESTION_GROUPE') || $this->security->isGranted('ROLE_CONTACT')) { // if ($this->security->isGranted('ROLE_GESTION_GROUPE') || $this->security->isGranted('ROLE_CONTACT')) {
$query->andWhere('false = true'); // $query->andWhere('false = true');
} // }
} else { // } else {
$query // $query
->andWhere($query->getRootAliases()[0] . '.groupe = :groupe') // ->andWhere($query->getRootAliases()[0] . '.groupe = :groupe')
->setParameter('groupe', $this->getRequest()->getSession()->get('_groupegere')) // ->setParameter('groupe', $this->getRequest()->getSession()->get('_groupegere'))
; // ;
} // }
} // }
return $query; return $query;
} }
......
...@@ -51,18 +51,18 @@ class ComptoirAdmin extends AbstractAdmin ...@@ -51,18 +51,18 @@ class ComptoirAdmin extends AbstractAdmin
{ {
$query = parent::createQuery($context); $query = parent::createQuery($context);
$user = $this->security->getUser(); $user = $this->security->getUser();
if ($this->hasRequest()) { // if ($this->hasRequest()) {
if (empty($this->getRequest()->getSession()->get('_groupegere'))) { // if (empty($this->getRequest()->getSession()->get('_groupegere'))) {
if ($this->security->isGranted('ROLE_GESTION_GROUPE') || $this->security->isGranted('ROLE_CONTACT')) { // if ($this->security->isGranted('ROLE_GESTION_GROUPE') || $this->security->isGranted('ROLE_CONTACT')) {
$query->andWhere('false = true'); // $query->andWhere('false = true');
} // }
} else { // } else {
$query // $query
->andWhere($query->getRootAliases()[0] . '.groupe = :groupe') // ->andWhere($query->getRootAliases()[0] . '.groupe = :groupe')
->setParameter('groupe', $this->getRequest()->getSession()->get('_groupegere')) // ->setParameter('groupe', $this->getRequest()->getSession()->get('_groupegere'))
; // ;
} // }
} // }
return $query; return $query;
} }
...@@ -92,24 +92,24 @@ class ComptoirAdmin extends AbstractAdmin ...@@ -92,24 +92,24 @@ class ComptoirAdmin extends AbstractAdmin
} }
$formMapper $formMapper
->with('Comptoir', ['class' => 'col-md-6']); ->with('Comptoir', ['class' => 'col-md-6']);
if ($user && ($this->security->isGranted('ROLE_GESTION_GROUPE') || $this->security->isGranted('ROLE_CONTACT')) && !empty($this->getRequest()->getSession()->get('_groupegere'))) { // if ($user && ($this->security->isGranted('ROLE_GESTION_GROUPE') || $this->security->isGranted('ROLE_CONTACT')) && !empty($this->getRequest()->getSession()->get('_groupegere'))) {
$formMapper->add('groupe', null, [ // $formMapper->add('groupe', null, [
'label' => 'Groupe local', // 'label' => 'Groupe local',
'required' => true, // 'required' => true,
'query_builder' => function (EntityRepository $repo) use ($user) { // 'query_builder' => function (EntityRepository $repo) use ($user) {
return $repo->createQueryBuilder('g') // return $repo->createQueryBuilder('g')
->select('g') // ->select('g')
->join('g.gestionnaires', 'c') // ->join('g.gestionnaires', 'c')
->where('c.id = :user') // ->where('c.id = :user')
->setParameter('user', $user->getId()); // ->setParameter('user', $user->getId());
}, // },
]); // ]);
} else { // } else {
$formMapper->add('groupe', null, [ $formMapper->add('groupe', null, [
'label' => 'Groupe local', 'label' => 'Groupe local',
'required' => true, 'required' => true,
]); ]);
} // }
$formMapper $formMapper
->add('name', null, [ ->add('name', null, [
'label' => 'Nom', 'label' => 'Nom',
......
...@@ -43,29 +43,29 @@ class CotisationAdherentAdmin extends CotisationAdmin ...@@ -43,29 +43,29 @@ class CotisationAdherentAdmin extends CotisationAdmin
->andWhere($query->getRootAliases()[0] . ".type='cotisation_adherent'") ->andWhere($query->getRootAliases()[0] . ".type='cotisation_adherent'")
// ->andWhere('u.adherent IS NOT NULL') // ->andWhere('u.adherent IS NOT NULL')
; ;
if ($this->hasRequest()) { // if ($this->hasRequest()) {
if (empty($this->getRequest()->getSession()->get('_groupegere'))) { // if (empty($this->getRequest()->getSession()->get('_groupegere'))) {
if ($this->security->isGranted('ROLE_GESTION_GROUPE') || $this->security->isGranted('ROLE_CONTACT') || $this->security->isGranted('ROLE_TRESORIER')) { // if ($this->security->isGranted('ROLE_GESTION_GROUPE') || $this->security->isGranted('ROLE_CONTACT') || $this->security->isGranted('ROLE_TRESORIER')) {
if (!$this->security->isGranted('ROLE_TRESORIER')) { // if (!$this->security->isGranted('ROLE_TRESORIER')) {
$query->andWhere('false = true'); // $query->andWhere('false = true');
} // }
} // }
} else { // } else {
$groupe = $this->getRequest()->getSession()->get('_groupegere'); // $groupe = $this->getRequest()->getSession()->get('_groupegere');
$em = $this->getConfigurationPool()->getContainer()->get('doctrine')->getManager(); // $em = $this->getConfigurationPool()->getContainer()->get('doctrine')->getManager();
$adhTable = $em->getMetadataFactory()->getMetadataFor(Adherent::class)->getTableName(); // $adhTable = $em->getMetadataFactory()->getMetadataFor(Adherent::class)->getTableName();
$fluxTable = $em->getMetadataFactory()->getMetadataFor(Flux::class)->getTableName(); // $fluxTable = $em->getMetadataFactory()->getMetadataFor(Flux::class)->getTableName();
$connection = $em->getConnection(); // $connection = $em->getConnection();
$statement = $connection->prepare("SELECT f.id FROM $fluxTable f INNER JOIN $adhTable a ON (a.id = f.adherent_id OR a.id = f.adherent_dest_id) WHERE a.groupe_id = :groupe_id"); // $statement = $connection->prepare("SELECT f.id FROM $fluxTable f INNER JOIN $adhTable a ON (a.id = f.adherent_id OR a.id = f.adherent_dest_id) WHERE a.groupe_id = :groupe_id");
$statement->bindValue(':groupe_id', $groupe->getId()); // $statement->bindValue(':groupe_id', $groupe->getId());
$statement->execute(); // $statement->execute();
$ids = $statement->fetchAll(); // $ids = $statement->fetchAll();
$query // $query
->andWhere($query->expr()->in($query->getRootAliases()[0] . '.id', ':ids')) // ->andWhere($query->expr()->in($query->getRootAliases()[0] . '.id', ':ids'))
->setParameter('ids', $ids) // ->setParameter('ids', $ids)
; // ;
} // }
} // }
return $query; return $query;
} }
......
...@@ -52,20 +52,20 @@ class GroupeprestataireAdmin extends AbstractAdmin ...@@ -52,20 +52,20 @@ class GroupeprestataireAdmin extends AbstractAdmin
{ {
$user = $this->security->getUser(); $user = $this->security->getUser();
$query = parent::createQuery($context); $query = parent::createQuery($context);
if ($this->hasRequest()) { // if ($this->hasRequest()) {
if (empty($this->getRequest()->getSession()->get('_groupegere'))) { // if (empty($this->getRequest()->getSession()->get('_groupegere'))) {
if ($this->security->isGranted('ROLE_GESTION_GROUPE') || $this->security->isGranted('ROLE_CONTACT') || $this->security->isGranted('ROLE_TRESORIER')) { // if ($this->security->isGranted('ROLE_GESTION_GROUPE') || $this->security->isGranted('ROLE_CONTACT') || $this->security->isGranted('ROLE_TRESORIER')) {
if (!$this->security->isGranted('ROLE_TRESORIER')) { // if (!$this->security->isGranted('ROLE_TRESORIER')) {
$query->andWhere('false = true'); // $query->andWhere('false = true');
} // }
} // }
} else { // } else {
$query // $query
->andWhere($query->getRootAliases()[0] . '.groupe = :groupe') // ->andWhere($query->getRootAliases()[0] . '.groupe = :groupe')
->setParameter('groupe', $this->getRequest()->getSession()->get('_groupegere')) // ->setParameter('groupe', $this->getRequest()->getSession()->get('_groupegere'))
; // ;
} // }
} // }
return $query; return $query;
} }
...@@ -92,11 +92,11 @@ class GroupeprestataireAdmin extends AbstractAdmin ...@@ -92,11 +92,11 @@ class GroupeprestataireAdmin extends AbstractAdmin
'required' => true, 'required' => true,
]) ])
; ;
if ($user && ($this->security->isGranted('ROLE_GESTION_GROUPE') || $this->security->isGranted('ROLE_CONTACT') || $this->security->isGranted('ROLE_TRESORIER')) && !empty($this->getRequest()->getSession()->get('_groupegere'))) { // if ($user && ($this->security->isGranted('ROLE_GESTION_GROUPE') || $this->security->isGranted('ROLE_CONTACT') || $this->security->isGranted('ROLE_TRESORIER')) && !empty($this->getRequest()->getSession()->get('_groupegere'))) {
$prestataires = $this->getConfigurationPool()->getContainer()->get('doctrine')->getRepository(Prestataire::class)->findByGroupeLocal($this->getRequest()->getSession()->get('_groupegere')); // $prestataires = $this->getConfigurationPool()->getContainer()->get('doctrine')->getRepository(Prestataire::class)->findByGroupeLocal($this->getRequest()->getSession()->get('_groupegere'));
} else { // } else {
$prestataires = $this->getConfigurationPool()->getContainer()->get('doctrine')->getRepository(Prestataire::class)->findBy(['enabled' => true, 'mlc' => false], ['raison' => 'ASC']); $prestataires = $this->getConfigurationPool()->getContainer()->get('doctrine')->getRepository(Prestataire::class)->findBy(['enabled' => true, 'mlc' => false], ['raison' => 'ASC']);
} // }
if ($user && ($this->security->isGranted('ROLE_SUPER_ADMIN') || $this->security->isGranted('ROLE_ADMIN_SIEGE'))) { if ($user && ($this->security->isGranted('ROLE_SUPER_ADMIN') || $this->security->isGranted('ROLE_ADMIN_SIEGE'))) {
$formMapper $formMapper
->add('groupe', null, [ ->add('groupe', null, [
......
...@@ -52,30 +52,30 @@ class OperationAdherentAdmin extends OperationAdmin ...@@ -52,30 +52,30 @@ class OperationAdherentAdmin extends OperationAdmin
$em = $this->getConfigurationPool()->getContainer()->get('doctrine')->getManager(); $em = $this->getConfigurationPool()->getContainer()->get('doctrine')->getManager();
$operationAdherenttable = $em->getMetadataFactory()->getMetadataFor(OperationAdherent::class)->getTableName(); $operationAdherenttable = $em->getMetadataFactory()->getMetadataFor(OperationAdherent::class)->getTableName();
if ($user && ($this->security->isGranted('ROLE_GESTION_GROUPE') || $this->security->isGranted('ROLE_CONTACT') || $this->security->isGranted('ROLE_TRESORIER'))) { // if ($user && ($this->security->isGranted('ROLE_GESTION_GROUPE') || $this->security->isGranted('ROLE_CONTACT') || $this->security->isGranted('ROLE_TRESORIER'))) {
if ($this->hasRequest()) { // if ($this->hasRequest()) {
if (empty($this->getRequest()->getSession()->get('_groupegere'))) { // if (empty($this->getRequest()->getSession()->get('_groupegere'))) {
if (!$this->security->isGranted('ROLE_TRESORIER')) { // if (!$this->security->isGranted('ROLE_TRESORIER')) {
$query->andWhere('false = true'); // $query->andWhere('false = true');
} // }
} else { // } else {
$groupe = $this->getRequest()->getSession()->get('_groupegere'); // $groupe = $this->getRequest()->getSession()->get('_groupegere');
$connection = $em->getConnection(); // $connection = $em->getConnection();
$adherentTable = $em->getMetadataFactory()->getMetadataFor(Adherent::class)->getTableName(); // $adherentTable = $em->getMetadataFactory()->getMetadataFor(Adherent::class)->getTableName();
$accountTable = $em->getMetadataFactory()->getMetadataFor(AccountAdherent::class)->getTableName(); // $accountTable = $em->getMetadataFactory()->getMetadataFor(AccountAdherent::class)->getTableName();
$statement = $connection->prepare('SELECT f.id FROM ' . $operationAdherenttable . ' f WHERE f.account_id IN // $statement = $connection->prepare('SELECT f.id FROM ' . $operationAdherenttable . ' f WHERE f.account_id IN
(SELECT a.id FROM ' . $accountTable . ' a WHERE a.adherent_id IN // (SELECT a.id FROM ' . $accountTable . ' a WHERE a.adherent_id IN
(SELECT p.id FROM ' . $adherentTable . ' p WHERE p.groupe_id = "' . $groupe->getId() . '") // (SELECT p.id FROM ' . $adherentTable . ' p WHERE p.groupe_id = "' . $groupe->getId() . '")
)'); // )');
$statement->execute(); // $statement->execute();
$ids = $statement->fetchAll(); // $ids = $statement->fetchAll();
$query // $query
->andWhere($query->expr()->in($query->getRootAliases()[0] . '.id', ':ids')) // ->andWhere($query->expr()->in($query->getRootAliases()[0] . '.id', ':ids'))
->setParameter('ids', $ids) // ->setParameter('ids', $ids)
; // ;
} // }
} // }
} // }
return $query; return $query;
} }
......
...@@ -46,16 +46,16 @@ class OperationAdmin extends AbstractAdmin ...@@ -46,16 +46,16 @@ class OperationAdmin extends AbstractAdmin
$collection->clearExcept(['list', 'export']); $collection->clearExcept(['list', 'export']);
} }
protected function configureExportFields(): array public function getExportFields()
{ {
return [ return [
$this->trans('Date') => 'createdAt', 'Date' => 'createdAt',
$this->trans('Montant') => 'montant', 'Montant' => 'montant',
$this->trans('Compte') => 'currency', 'Compte' => 'currency',
$this->trans('Type') => 'flux.type', 'Type' => 'flux.type',
$this->trans('Moyen') => 'flux.moyen', 'Moyen' => 'flux.moyen',
$this->trans('Operateur') => 'flux.operateur', 'Operateur' => 'flux.operateur',
$this->trans('Importé') => 'historical', 'Importé' => 'historical'
]; ];
} }
......
...@@ -52,30 +52,30 @@ class OperationComptoirAdmin extends OperationAdmin ...@@ -52,30 +52,30 @@ class OperationComptoirAdmin extends OperationAdmin
$em = $this->getConfigurationPool()->getContainer()->get('doctrine')->getManager(); $em = $this->getConfigurationPool()->getContainer()->get('doctrine')->getManager();
$operationComptoirtable = $em->getMetadataFactory()->getMetadataFor(OperationComptoir::class)->getTableName(); $operationComptoirtable = $em->getMetadataFactory()->getMetadataFor(OperationComptoir::class)->getTableName();
if ($user && ($this->security->isGranted('ROLE_GESTION_GROUPE') || $this->security->isGranted('ROLE_CONTACT') || $this->security->isGranted('ROLE_TRESORIER'))) { // if ($user && ($this->security->isGranted('ROLE_GESTION_GROUPE') || $this->security->isGranted('ROLE_CONTACT') || $this->security->isGranted('ROLE_TRESORIER'))) {
if ($this->hasRequest()) { // if ($this->hasRequest()) {
if (empty($this->getRequest()->getSession()->get('_groupegere'))) { // if (empty($this->getRequest()->getSession()->get('_groupegere'))) {
if (!$this->security->isGranted('ROLE_TRESORIER')) { // if (!$this->security->isGranted('ROLE_TRESORIER')) {
$query->andWhere('false = true'); // $query->andWhere('false = true');
} // }
} else { // } else {
$groupe = $this->getRequest()->getSession()->get('_groupegere'); // $groupe = $this->getRequest()->getSession()->get('_groupegere');
$connection = $em->getConnection(); // $connection = $em->getConnection();
$comptoirTable = $em->getMetadataFactory()->getMetadataFor(Comptoir::class)->getTableName(); // $comptoirTable = $em->getMetadataFactory()->getMetadataFor(Comptoir::class)->getTableName();
$accountTable = $em->getMetadataFactory()->getMetadataFor(AccountComptoir::class)->getTableName(); // $accountTable = $em->getMetadataFactory()->getMetadataFor(AccountComptoir::class)->getTableName();
$statement = $connection->prepare('SELECT f.id FROM ' . $operationComptoirtable . ' f WHERE f.account_id IN // $statement = $connection->prepare('SELECT f.id FROM ' . $operationComptoirtable . ' f WHERE f.account_id IN
(SELECT a.id FROM ' . $accountTable . ' a WHERE a.comptoir_id IN // (SELECT a.id FROM ' . $accountTable . ' a WHERE a.comptoir_id IN
(SELECT p.id FROM ' . $comptoirTable . ' p WHERE p.groupe_id = "' . $groupe->getId() . '") // (SELECT p.id FROM ' . $comptoirTable . ' p WHERE p.groupe_id = "' . $groupe->getId() . '")
)'); // )');
$statement->execute(); // $statement->execute();
$ids = $statement->fetchAll(); // $ids = $statement->fetchAll();
$query // $query
->andWhere($query->expr()->in($query->getRootAliases()[0] . '.id', ':ids')) // ->andWhere($query->expr()->in($query->getRootAliases()[0] . '.id', ':ids'))
->setParameter('ids', $ids) // ->setParameter('ids', $ids)
; // ;
} // }
} // }
} // }
return $query; return $query;
} }
......
...@@ -52,30 +52,30 @@ class OperationPrestataireAdmin extends OperationAdmin ...@@ -52,30 +52,30 @@ class OperationPrestataireAdmin extends OperationAdmin
$em = $this->getConfigurationPool()->getContainer()->get('doctrine')->getManager(); $em = $this->getConfigurationPool()->getContainer()->get('doctrine')->getManager();
$operationPrestatable = $em->getMetadataFactory()->getMetadataFor(OperationPrestataire::class)->getTableName(); $operationPrestatable = $em->getMetadataFactory()->getMetadataFor(OperationPrestataire::class)->getTableName();
if ($user && ($this->security->isGranted('ROLE_GESTION_GROUPE') || $this->security->isGranted('ROLE_CONTACT') || $this->security->isGranted('ROLE_TRESORIER'))) { // if ($user && ($this->security->isGranted('ROLE_GESTION_GROUPE') || $this->security->isGranted('ROLE_CONTACT') || $this->security->isGranted('ROLE_TRESORIER'))) {
if ($this->hasRequest()) { // if ($this->hasRequest()) {
if (empty($this->getRequest()->getSession()->get('_groupegere'))) { // if (empty($this->getRequest()->getSession()->get('_groupegere'))) {
if (!$this->security->isGranted('ROLE_TRESORIER')) { // if (!$this->security->isGranted('ROLE_TRESORIER')) {
$query->andWhere('false = true'); // $query->andWhere('false = true');
} // }
} else { // } else {
$groupe = $this->getRequest()->getSession()->get('_groupegere'); // $groupe = $this->getRequest()->getSession()->get('_groupegere');
$connection = $em->getConnection(); // $connection = $em->getConnection();
$prestatable = $em->getMetadataFactory()->getMetadataFor(Prestataire::class)->getTableName(); // $prestatable = $em->getMetadataFactory()->getMetadataFor(Prestataire::class)->getTableName();
$accountTable = $em->getMetadataFactory()->getMetadataFor(AccountPrestataire::class)->getTableName(); // $accountTable = $em->getMetadataFactory()->getMetadataFor(AccountPrestataire::class)->getTableName();
$statement = $connection->prepare('SELECT f.id FROM ' . $operationPrestatable . ' f WHERE f.account_id IN // $statement = $connection->prepare('SELECT f.id FROM ' . $operationPrestatable . ' f WHERE f.account_id IN
(SELECT a.id FROM ' . $accountTable . ' a WHERE a.prestataire_id IN // (SELECT a.id FROM ' . $accountTable . ' a WHERE a.prestataire_id IN
(SELECT p.id FROM ' . $prestatable . ' p WHERE p.groupe_id = "' . $groupe->getId() . '") // (SELECT p.id FROM ' . $prestatable . ' p WHERE p.groupe_id = "' . $groupe->getId() . '")
)'); // )');
$statement->execute(); // $statement->execute();
$ids = $statement->fetchAll(); // $ids = $statement->fetchAll();
$query // $query
->andWhere($query->expr()->in($query->getRootAliases()[0] . '.id', ':ids')) // ->andWhere($query->expr()->in($query->getRootAliases()[0] . '.id', ':ids'))
->setParameter('ids', $ids) // ->setParameter('ids', $ids)
; // ;
} // }
} // }
} // }
return $query; return $query;
} }
......
...@@ -101,20 +101,20 @@ class PrestataireAdmin extends AbstractAdmin ...@@ -101,20 +101,20 @@ class PrestataireAdmin extends AbstractAdmin
$user = $this->security->getUser(); $user = $this->security->getUser();
$query = parent::createQuery($context); $query = parent::createQuery($context);
if ($user && ($this->security->isGranted('ROLE_GESTION_GROUPE') || $this->security->isGranted('ROLE_CONTACT') || $this->security->isGranted('ROLE_TRESORIER'))) { // if ($user && ($this->security->isGranted('ROLE_GESTION_GROUPE') || $this->security->isGranted('ROLE_CONTACT') || $this->security->isGranted('ROLE_TRESORIER'))) {
if ($this->hasRequest()) { // if ($this->hasRequest()) {
if (empty($this->getRequest()->getSession()->get('_groupegere'))) { // if (empty($this->getRequest()->getSession()->get('_groupegere'))) {
if (!$this->security->isGranted('ROLE_TRESORIER')) { // if (!$this->security->isGranted('ROLE_TRESORIER')) {
$query->andWhere('false = true'); // $query->andWhere('false = true');
} // }
} else { // } else {
$query // $query
->andWhere($query->getRootAliases()[0] . '.groupe = :group') // ->andWhere($query->getRootAliases()[0] . '.groupe = :group')
->setParameter('group', $this->getRequest()->getSession()->get('_groupegere')) // ->setParameter('group', $this->getRequest()->getSession()->get('_groupegere'))
; // ;
} // }
} // }
} // }
return $query; return $query;
} }
......
...@@ -58,25 +58,26 @@ class TransfertAdmin extends FluxAdmin ...@@ -58,25 +58,26 @@ class TransfertAdmin extends FluxAdmin
$em = $this->getConfigurationPool()->getContainer()->get('doctrine')->getManager(); $em = $this->getConfigurationPool()->getContainer()->get('doctrine')->getManager();
$fluxtable = $em->getMetadataFactory()->getMetadataFor(Flux::class)->getTableName(); $fluxtable = $em->getMetadataFactory()->getMetadataFor(Flux::class)->getTableName();
if ($this->hasRequest()) { if ($this->hasRequest()) {
if ($this->security->isGranted('ROLE_GESTION_GROUPE') || $this->security->isGranted('ROLE_CONTACT') || $this->security->isGranted('ROLE_TRESORIER')) { // if ($this->security->isGranted('ROLE_GESTION_GROUPE') || $this->security->isGranted('ROLE_CONTACT') || $this->security->isGranted('ROLE_TRESORIER')) {
if (empty($this->getRequest()->getSession()->get('_groupegere'))) { // if (empty($this->getRequest()->getSession()->get('_groupegere'))) {
if (!$this->security->isGranted('ROLE_TRESORIER')) { // if (!$this->security->isGranted('ROLE_TRESORIER')) {
$query->andWhere('false = true'); // $query->andWhere('false = true');
} // }
} else { // } else {
$groupe = $this->getRequest()->getSession()->get('_groupegere'); // $groupe = $this->getRequest()->getSession()->get('_groupegere');
$connection = $em->getConnection(); // $connection = $em->getConnection();
$prestatable = $em->getMetadataFactory()->getMetadataFor(Prestataire::class)->getTableName(); // $prestatable = $em->getMetadataFactory()->getMetadataFor(Prestataire::class)->getTableName();
$statement = $connection->prepare('SELECT f.id FROM ' . $fluxtable . ' f WHERE f.groupe_id = :groupe_id OR (f.prestataire_id IN (SELECT p.id FROM ' . $prestatable . ' p WHERE p.groupe_id = :groupe_id)) OR (f.prestataire_dest_id IN (SELECT p.id FROM ' . $prestatable . ' p WHERE p.groupe_id = :groupe_id))'); // $statement = $connection->prepare('SELECT f.id FROM ' . $fluxtable . ' f WHERE f.groupe_id = :groupe_id OR (f.prestataire_id IN (SELECT p.id FROM ' . $prestatable . ' p WHERE p.groupe_id = :groupe_id)) OR (f.prestataire_dest_id IN (SELECT p.id FROM ' . $prestatable . ' p WHERE p.groupe_id = :groupe_id))');
$statement->bindValue(':groupe_id', $groupe->getId()); // $statement->bindValue(':groupe_id', $groupe->getId());
$statement->execute(); // $statement->execute();
$ids = $statement->fetchAll(); // $ids = $statement->fetchAll();
$query // $query
->andWhere($query->expr()->in($query->getRootAliases()[0] . '.id', ':ids')) // ->andWhere($query->expr()->in($query->getRootAliases()[0] . '.id', ':ids'))
->setParameter('ids', $ids) // ->setParameter('ids', $ids)
; // ;
} // }
} elseif ($this->security->isGranted('ROLE_COMPTOIR')) { // } else
if ($this->security->isGranted('ROLE_COMPTOIR')) {
if (empty($this->getRequest()->getSession()->get('_comptoirgere'))) { if (empty($this->getRequest()->getSession()->get('_comptoirgere'))) {
$query->andWhere('false = true'); $query->andWhere('false = true');
} else { } else {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment