Skip to content
Snippets Groups Projects
Commit 4174a5a9 authored by Jean-Philippe Metivier's avatar Jean-Philippe Metivier
Browse files

Virage des trucs de agent/index

parent 272de5e9
No related branches found
No related tags found
No related merge requests found
......@@ -73,16 +73,16 @@ class AgentController extends AbstractActionController
public function indexAction()
{
$fromQueries = $this->params()->fromQuery();
$filtres = [];
$clefs = ['titulaire', 'cdi', 'cdd', 'administratif', 'chercheur', 'enseignant', 'vacataire'];
foreach ($clefs as $clef) {
if (empty($fromQueries) or $fromQueries[$clef] === 'on') $filtres[$clef] = true;
}
$agents = $this->getAgentService()->getAgents($filtres);
// $filtres = [];
// $clefs = ['titulaire', 'cdi', 'cdd', 'administratif', 'chercheur', 'enseignant', 'vacataire'];
// foreach ($clefs as $clef) {
// if (empty($fromQueries) or $fromQueries[$clef] === 'on') $filtres[$clef] = true;
// }
// $agents = $this->getAgentService()->getAgents($filtres);
$agents = $this->getAgentService()->getAgents();
return new ViewModel([
'agents' => $agents,
'filtres' => $filtres,
// 'filtres' => $filtres,
]);
}
......
......@@ -109,20 +109,21 @@ class AgentService {
$qb = $this->getEntityManager()->getRepository(Agent::class)->createQueryBuilder('agent')
->andWhere('agent.delete IS NULL')
->addSelect('affectation')->join('agent.affectations', 'affectation')
->addSelect('statut')->leftJoin('agent.statuts', 'statut')
->addSelect('utilisateur')->leftjoin('agent.utilisateur', 'utilisateur')
// ->addSelect('statut')->leftJoin('agent.statuts', 'statut')
->andWhere('affectation.dateDebut <= :NOW')
->andWhere('affectation.dateFin >= :NOW OR affectation.dateFin IS NULL')
->setParameter('NOW', $this->getDateTime())
;
$tmp = ['statut IS NULL'];
foreach ($temoins as $temoin => $value) {
if ($value) $tmp[] = 'statut.'. $temoin .' = :TRUE';
}
if (!empty($tmp)) {
$qb = $qb->andWhere(implode(" OR ",$tmp))
->setParameter('TRUE', 'O');
}
// $tmp = ['statut IS NULL'];
// foreach ($temoins as $temoin => $value) {
// if ($value) $tmp[] = 'statut.'. $temoin .' = :TRUE';
// }
// if (!empty($tmp)) {
// $qb = $qb->andWhere(implode(" OR ",$tmp))
// ->setParameter('TRUE', 'O');
// }
if ($order !== null) {
$qb = $qb->orderBy('agent.' . $order);
......
......@@ -34,7 +34,7 @@ $this->headTitle("Index des agents")
<div class="main">
<?php echo $this->partial('partial/filtre_statut', ['url' => $this->url('agent'), 'filtres' => $filtres]); ?>
<!-- --><?php //echo $this->partial('partial/filtre_statut', ['url' => $this->url('agent'), 'filtres' => $filtres]); ?>
<?php if (count($agents) > 0) : ?>
<table id="agents" class="datatable table table-condensed">
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment