Commit e933d503 by Julien Jorry

Revert operation admin and transfert admin for gestionnaire/contact : revert…

Revert operation admin and transfert admin for gestionnaire/contact : revert 9b772f29
parent d3e25ca3
......@@ -52,30 +52,30 @@ class OperationAdherentAdmin extends OperationAdmin
$em = $this->getConfigurationPool()->getContainer()->get('doctrine')->getManager();
$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 ($this->hasRequest()) {
// if (empty($this->getRequest()->getSession()->get('_groupegere'))) {
// if (!$this->security->isGranted('ROLE_TRESORIER')) {
// $query->andWhere('false = true');
// }
// } else {
// $groupe = $this->getRequest()->getSession()->get('_groupegere');
// $connection = $em->getConnection();
// $adherentTable = $em->getMetadataFactory()->getMetadataFor(Adherent::class)->getTableName();
// $accountTable = $em->getMetadataFactory()->getMetadataFor(AccountAdherent::class)->getTableName();
// $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 p.id FROM ' . $adherentTable . ' p WHERE p.groupe_id = "' . $groupe->getId() . '")
// )');
// $statement->execute();
// $ids = $statement->fetchAll();
// $query
// ->andWhere($query->expr()->in($query->getRootAliases()[0] . '.id', ':ids'))
// ->setParameter('ids', $ids)
// ;
// }
// }
// }
if ($user && ($this->security->isGranted('ROLE_GESTION_GROUPE') || $this->security->isGranted('ROLE_CONTACT') || $this->security->isGranted('ROLE_TRESORIER'))) {
if ($this->hasRequest()) {
if (empty($this->getRequest()->getSession()->get('_groupegere'))) {
if (!$this->security->isGranted('ROLE_TRESORIER')) {
$query->andWhere('false = true');
}
} else {
$groupe = $this->getRequest()->getSession()->get('_groupegere');
$connection = $em->getConnection();
$adherentTable = $em->getMetadataFactory()->getMetadataFor(Adherent::class)->getTableName();
$accountTable = $em->getMetadataFactory()->getMetadataFor(AccountAdherent::class)->getTableName();
$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 p.id FROM ' . $adherentTable . ' p WHERE p.groupe_id = "' . $groupe->getId() . '")
)');
$statement->execute();
$ids = $statement->fetchAll();
$query
->andWhere($query->expr()->in($query->getRootAliases()[0] . '.id', ':ids'))
->setParameter('ids', $ids)
;
}
}
}
return $query;
}
......
......@@ -52,30 +52,30 @@ class OperationComptoirAdmin extends OperationAdmin
$em = $this->getConfigurationPool()->getContainer()->get('doctrine')->getManager();
$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 ($this->hasRequest()) {
// if (empty($this->getRequest()->getSession()->get('_groupegere'))) {
// if (!$this->security->isGranted('ROLE_TRESORIER')) {
// $query->andWhere('false = true');
// }
// } else {
// $groupe = $this->getRequest()->getSession()->get('_groupegere');
// $connection = $em->getConnection();
// $comptoirTable = $em->getMetadataFactory()->getMetadataFor(Comptoir::class)->getTableName();
// $accountTable = $em->getMetadataFactory()->getMetadataFor(AccountComptoir::class)->getTableName();
// $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 p.id FROM ' . $comptoirTable . ' p WHERE p.groupe_id = "' . $groupe->getId() . '")
// )');
// $statement->execute();
// $ids = $statement->fetchAll();
// $query
// ->andWhere($query->expr()->in($query->getRootAliases()[0] . '.id', ':ids'))
// ->setParameter('ids', $ids)
// ;
// }
// }
// }
if ($user && ($this->security->isGranted('ROLE_GESTION_GROUPE') || $this->security->isGranted('ROLE_CONTACT') || $this->security->isGranted('ROLE_TRESORIER'))) {
if ($this->hasRequest()) {
if (empty($this->getRequest()->getSession()->get('_groupegere'))) {
if (!$this->security->isGranted('ROLE_TRESORIER')) {
$query->andWhere('false = true');
}
} else {
$groupe = $this->getRequest()->getSession()->get('_groupegere');
$connection = $em->getConnection();
$comptoirTable = $em->getMetadataFactory()->getMetadataFor(Comptoir::class)->getTableName();
$accountTable = $em->getMetadataFactory()->getMetadataFor(AccountComptoir::class)->getTableName();
$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 p.id FROM ' . $comptoirTable . ' p WHERE p.groupe_id = "' . $groupe->getId() . '")
)');
$statement->execute();
$ids = $statement->fetchAll();
$query
->andWhere($query->expr()->in($query->getRootAliases()[0] . '.id', ':ids'))
->setParameter('ids', $ids)
;
}
}
}
return $query;
}
......
......@@ -52,30 +52,30 @@ class OperationPrestataireAdmin extends OperationAdmin
$em = $this->getConfigurationPool()->getContainer()->get('doctrine')->getManager();
$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 ($this->hasRequest()) {
// if (empty($this->getRequest()->getSession()->get('_groupegere'))) {
// if (!$this->security->isGranted('ROLE_TRESORIER')) {
// $query->andWhere('false = true');
// }
// } else {
// $groupe = $this->getRequest()->getSession()->get('_groupegere');
// $connection = $em->getConnection();
// $prestatable = $em->getMetadataFactory()->getMetadataFor(Prestataire::class)->getTableName();
// $accountTable = $em->getMetadataFactory()->getMetadataFor(AccountPrestataire::class)->getTableName();
// $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 p.id FROM ' . $prestatable . ' p WHERE p.groupe_id = "' . $groupe->getId() . '")
// )');
// $statement->execute();
// $ids = $statement->fetchAll();
// $query
// ->andWhere($query->expr()->in($query->getRootAliases()[0] . '.id', ':ids'))
// ->setParameter('ids', $ids)
// ;
// }
// }
// }
if ($user && ($this->security->isGranted('ROLE_GESTION_GROUPE') || $this->security->isGranted('ROLE_CONTACT') || $this->security->isGranted('ROLE_TRESORIER'))) {
if ($this->hasRequest()) {
if (empty($this->getRequest()->getSession()->get('_groupegere'))) {
if (!$this->security->isGranted('ROLE_TRESORIER')) {
$query->andWhere('false = true');
}
} else {
$groupe = $this->getRequest()->getSession()->get('_groupegere');
$connection = $em->getConnection();
$prestatable = $em->getMetadataFactory()->getMetadataFor(Prestataire::class)->getTableName();
$accountTable = $em->getMetadataFactory()->getMetadataFor(AccountPrestataire::class)->getTableName();
$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 p.id FROM ' . $prestatable . ' p WHERE p.groupe_id = "' . $groupe->getId() . '")
)');
$statement->execute();
$ids = $statement->fetchAll();
$query
->andWhere($query->expr()->in($query->getRootAliases()[0] . '.id', ':ids'))
->setParameter('ids', $ids)
;
}
}
}
return $query;
}
......
......@@ -58,26 +58,25 @@ class TransfertAdmin extends FluxAdmin
$em = $this->getConfigurationPool()->getContainer()->get('doctrine')->getManager();
$fluxtable = $em->getMetadataFactory()->getMetadataFor(Flux::class)->getTableName();
if ($this->hasRequest()) {
// 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 (!$this->security->isGranted('ROLE_TRESORIER')) {
// $query->andWhere('false = true');
// }
// } else {
// $groupe = $this->getRequest()->getSession()->get('_groupegere');
// $connection = $em->getConnection();
// $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->bindValue(':groupe_id', $groupe->getId());
// $statement->execute();
// $ids = $statement->fetchAll();
// $query
// ->andWhere($query->expr()->in($query->getRootAliases()[0] . '.id', ':ids'))
// ->setParameter('ids', $ids)
// ;
// }
// } else
if ($this->security->isGranted('ROLE_COMPTOIR')) {
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 (!$this->security->isGranted('ROLE_TRESORIER')) {
$query->andWhere('false = true');
}
} else {
$groupe = $this->getRequest()->getSession()->get('_groupegere');
$connection = $em->getConnection();
$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->bindValue(':groupe_id', $groupe->getId());
$statement->execute();
$ids = $statement->fetchAll();
$query
->andWhere($query->expr()->in($query->getRootAliases()[0] . '.id', ':ids'))
->setParameter('ids', $ids)
;
}
} else if ($this->security->isGranted('ROLE_COMPTOIR')) {
if (empty($this->getRequest()->getSession()->get('_comptoirgere'))) {
$query->andWhere('false = true');
} 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