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

Revoquer remonter SI

parent 6c2b6c71
No related branches found
No related tags found
No related merge requests found
...@@ -35,6 +35,8 @@ return [ ...@@ -35,6 +35,8 @@ return [
'ajouter', 'ajouter',
'modifier', 'modifier',
'supprimer', 'supprimer',
'historiser',
'restaurer',
], ],
'privilege' => [ 'privilege' => [
AgentPrivileges::getResourceId(AgentPrivileges::AGENT_MODIFIER), AgentPrivileges::getResourceId(AgentPrivileges::AGENT_MODIFIER),
...@@ -99,6 +101,28 @@ return [ ...@@ -99,6 +101,28 @@ return [
], ],
], ],
], ],
'historiser' => [
'type' => Segment::class,
'options' => [
'route' => '/historiser/:agent-validateur',
'defaults' => [
/** @see ValidateurController::historiserAction() */
'controller' => ValidateurController::class,
'action' => 'historiser',
],
],
],
'restaurer' => [
'type' => Segment::class,
'options' => [
'route' => '/restaurer/:agent-validateur',
'defaults' => [
/** @see ValidateurController::restaurerAction() */
'controller' => ValidateurController::class,
'action' => 'restaurer',
],
],
],
], ],
], ],
], ],
......
...@@ -63,7 +63,7 @@ class AgentController extends AbstractActionController ...@@ -63,7 +63,7 @@ class AgentController extends AbstractActionController
$agentAffectations = $this->getAgentAffectationService()->getAgentAffectationsByAgent($agent); $agentAffectations = $this->getAgentAffectationService()->getAgentAffectationsByAgent($agent);
$agentGrades = $this->getAgentGradeService()->getAgentGradesByAgent($agent); $agentGrades = $this->getAgentGradeService()->getAgentGradesByAgent($agent);
$agentStatuts = $this->getAgentStatutService()->getAgentStatutsByAgent($agent); $agentStatuts = $this->getAgentStatutService()->getAgentStatutsByAgent($agent);
$validateurs = $this->getAgentValidateurService()->getAgentsValidateursByAgent($agent); $validateurs = $this->getAgentValidateurService()->getAgentsValidateursByAgent($agent, true);
$formations = $this->getInscriptionService()->getInscriptionsByAgent($agent); $formations = $this->getInscriptionService()->getInscriptionsByAgent($agent);
$inscriptions = $this->getInscriptionService()->getInscriptionsByAgent($agent); $inscriptions = $this->getInscriptionService()->getInscriptionsByAgent($agent);
......
...@@ -6,6 +6,7 @@ use Agent\Entity\Db\AgentValidateur; ...@@ -6,6 +6,7 @@ use Agent\Entity\Db\AgentValidateur;
use Agent\Form\Validateur\ValidateurFormAwareTrait; use Agent\Form\Validateur\ValidateurFormAwareTrait;
use Agent\Service\Agent\AgentServiceAwareTrait; use Agent\Service\Agent\AgentServiceAwareTrait;
use Agent\Service\AgentValidateur\AgentValidateurServiceAwareTrait; use Agent\Service\AgentValidateur\AgentValidateurServiceAwareTrait;
use Laminas\Http\Response;
use Laminas\Mvc\Controller\AbstractActionController; use Laminas\Mvc\Controller\AbstractActionController;
use Laminas\View\Model\ViewModel; use Laminas\View\Model\ViewModel;
...@@ -100,4 +101,23 @@ class ValidateurController extends AbstractActionController ...@@ -100,4 +101,23 @@ class ValidateurController extends AbstractActionController
return $vm; return $vm;
} }
public function historiserAction(): Response
{
$validateur = $this->getAgentValidateurService()->getRequestedAgentValidateur($this);
$this->getAgentValidateurService()->historise($validateur);
$retour = $this->params()->fromQuery('retour');
if ($retour) return $this->redirect()->toUrl($retour);
return $this->redirect()->toRoute('agent/afficher', ["agent" => $validateur->getAgent()->getId()], [], true);
}
public function restaurerAction(): Response
{
$validateur = $this->getAgentValidateurService()->getRequestedAgentValidateur($this);
$this->getAgentValidateurService()->restore($validateur);
$retour = $this->params()->fromQuery('retour');
if ($retour) return $this->redirect()->toUrl($retour);
return $this->redirect()->toRoute('agent/afficher', ["agent" => $validateur->getAgent()->getId()], [], true);
}
} }
\ No newline at end of file
...@@ -67,7 +67,7 @@ class AgentValidateurService ...@@ -67,7 +67,7 @@ class AgentValidateurService
return $qb; return $qb;
} }
public function getAgentValidateur(?int $id) : ?AgentValidateur public function getAgentValidateur(?string $id) : ?AgentValidateur
{ {
$qb = $this->createQueryBuilder() $qb = $this->createQueryBuilder()
->andWhere('AgentValidateur.id = :id')->setParameter('id', $id); ->andWhere('AgentValidateur.id = :id')->setParameter('id', $id);
...@@ -103,6 +103,7 @@ class AgentValidateurService ...@@ -103,6 +103,7 @@ class AgentValidateurService
$qb = $this->createQueryBuilder() $qb = $this->createQueryBuilder()
->andWhere('AgentValidateur.agent = :agent')->setParameter('agent', $agent) ->andWhere('AgentValidateur.agent = :agent')->setParameter('agent', $agent)
->andWhere('agent.deleted_on IS NULL') ->andWhere('agent.deleted_on IS NULL')
->andWhere('AgentValidateur.deletedOn IS NULL')
->orderBy('AgentValidateur.' . $champ, $ordre); ->orderBy('AgentValidateur.' . $champ, $ordre);
if ($histo === false) $qb = $qb->andWhere('AgentValidateur.histoDestruction IS NULL'); if ($histo === false) $qb = $qb->andWhere('AgentValidateur.histoDestruction IS NULL');
...@@ -115,6 +116,7 @@ class AgentValidateurService ...@@ -115,6 +116,7 @@ class AgentValidateurService
{ {
$qb = $this->createQueryBuilder() $qb = $this->createQueryBuilder()
->andWhere('AgentValidateur.validateur = :validateur')->setParameter('validateur', $validateur) ->andWhere('AgentValidateur.validateur = :validateur')->setParameter('validateur', $validateur)
->andWhere('AgentValidateur.deletedOn IS NULL')
->orderBy('AgentValidateur.' . $champ, $ordre); ->orderBy('AgentValidateur.' . $champ, $ordre);
if ($histo === false) $qb = $qb->andWhere('AgentValidateur.histoDestruction IS NULL'); if ($histo === false) $qb = $qb->andWhere('AgentValidateur.histoDestruction IS NULL');
...@@ -213,6 +215,7 @@ class AgentValidateurService ...@@ -213,6 +215,7 @@ class AgentValidateurService
$qb = $this->getObjectManager()->getRepository(AgentValidateur::class)->createQueryBuilder('avalidateur') $qb = $this->getObjectManager()->getRepository(AgentValidateur::class)->createQueryBuilder('avalidateur')
->join('avalidateur.validateur', 'agent') ->join('avalidateur.validateur', 'agent')
->join('agent.utilisateur', 'utilisateur') ->join('agent.utilisateur', 'utilisateur')
->andWhere('avalidateur.deletedOn IS NULL')
->orderBy('agent.nomUsuel, agent.prenom', 'ASC') ->orderBy('agent.nomUsuel, agent.prenom', 'ASC')
; ;
$result = $qb->getQuery()->getResult(); $result = $qb->getQuery()->getResult();
...@@ -239,6 +242,7 @@ class AgentValidateurService ...@@ -239,6 +242,7 @@ class AgentValidateurService
->andWhere('avalidateur.histoDestruction IS NULL') ->andWhere('avalidateur.histoDestruction IS NULL')
->andWhere('avalidateur.dateDebut <= :now') ->andWhere('avalidateur.dateDebut <= :now')
->andWhere('avalidateur.dateFin IS NULL OR avalidateur.dateFin >= :now') ->andWhere('avalidateur.dateFin IS NULL OR avalidateur.dateFin >= :now')
->andWhere('avalidateur.deletedOn IS NULL')
->setParameter('user', $user) ->setParameter('user', $user)
->setParameter('now', new DateTime()) ->setParameter('now', new DateTime())
; ;
...@@ -252,6 +256,7 @@ class AgentValidateurService ...@@ -252,6 +256,7 @@ class AgentValidateurService
->andWhere('avalidateur.histoDestruction IS NULL') ->andWhere('avalidateur.histoDestruction IS NULL')
->andWhere('avalidateur.dateDebut <= :now') ->andWhere('avalidateur.dateDebut <= :now')
->andWhere('avalidateur.dateFin IS NULL OR avalidateur.dateFin >= :now') ->andWhere('avalidateur.dateFin IS NULL OR avalidateur.dateFin >= :now')
->andWhere('avalidateur.deletedOn IS NULL')
->setParameter('now', new DateTime()) ->setParameter('now', new DateTime())
->andWhere('avalidateur.agent = :agent')->setParameter('agent', $agent) ->andWhere('avalidateur.agent = :agent')->setParameter('agent', $agent)
->andWhere('avalidateur.validateur = :validateur')->setParameter('validateur', $validateur) ->andWhere('avalidateur.validateur = :validateur')->setParameter('validateur', $validateur)
......
...@@ -55,7 +55,7 @@ $canModifier = $this->isAllowed(AgentPrivileges::getResourceId(AgentPrivileges:: ...@@ -55,7 +55,7 @@ $canModifier = $this->isAllowed(AgentPrivileges::getResourceId(AgentPrivileges::
?> ?>
<?php if ($structure) : ?> <?php if ($structure) : ?>
<?php echo $structure->getLibelleLong(); ?> <?php echo $structure->getLibelleLong(); ?>
<?php if ($niveau2 AND $niveau2 !== $structure) : ?> <?php if ($niveau2 and $niveau2 !== $structure) : ?>
<br/> Rattaché&middot;e à <?php echo $niveau2->getLibelleLong(); ?> <br/> Rattaché&middot;e à <?php echo $niveau2->getLibelleLong(); ?>
<?php endif; ?> <?php endif; ?>
<?php endif; ?> <?php endif; ?>
...@@ -137,10 +137,13 @@ $canModifier = $this->isAllowed(AgentPrivileges::getResourceId(AgentPrivileges:: ...@@ -137,10 +137,13 @@ $canModifier = $this->isAllowed(AgentPrivileges::getResourceId(AgentPrivileges::
<?php else: ?> <?php else: ?>
<ul> <ul>
<?php foreach ($validateurs as $validateur) : ?> <?php foreach ($validateurs as $validateur) : ?>
<?php if (!$validateur->estHistorise() or $canModifier) : ?>
<li <li
title="Sur la période du <?php echo $validateur->getDateDebut()->format('d/m/Y'); ?> au <?php echo $validateur->getDateFin() ? $validateur->getDateFin()->format('d/m/y') : " ---"; ?>"> title="Sur la période du <?php echo $validateur->getDateDebut()->format('d/m/Y'); ?> au <?php echo $validateur->getDateFin() ? $validateur->getDateFin()->format('d/m/y') : " ---"; ?>">
<?php echo $validateur->getValidateur()->getDenomination(); ?> <span class="badge"> <?php echo $validateur->getSourceId(); ?> </span> <span class="<?php if ($validateur->estHistorise()) echo "historise"; ?>"><?php echo $validateur->getValidateur()->getDenomination(); ?></span>
<?php if ($validateur->getSourceId() === 'MES FORMATIONS' AND $canModifier) : ?> <span
class="badge"> <?php echo $validateur->getSourceId(); ?> </span>
<?php if ($validateur->getSourceId() === 'MES FORMATIONS' and $canModifier) : ?>
<?php /** @see \Agent\Controller\ValidateurController::modifierAction() */ ?> <?php /** @see \Agent\Controller\ValidateurController::modifierAction() */ ?>
<a href="<?php echo $this->url('agent/validateur/modifier', ['agent-validateur' => $validateur->getId()], [], true); ?>" <a href="<?php echo $this->url('agent/validateur/modifier', ['agent-validateur' => $validateur->getId()], [], true); ?>"
class="ajax-modal action primary" data-event="modification"> class="ajax-modal action primary" data-event="modification">
...@@ -153,9 +156,24 @@ $canModifier = $this->isAllowed(AgentPrivileges::getResourceId(AgentPrivileges:: ...@@ -153,9 +156,24 @@ $canModifier = $this->isAllowed(AgentPrivileges::getResourceId(AgentPrivileges::
<span class="icon icon-unchecked"></span> <span class="icon icon-unchecked"></span>
Supprimer Supprimer
</a> </a>
<?php else : ?>
<?php if ($validateur->estHistorise()) : ?>
<?php /** @see \Agent\Controller\ValidateurController::restaurerAction() */ ?>
<a href="<?php echo $this->url('agent/validateur/restaurer', ['agent-validateur' => $validateur->getId()], [], true); ?>"
class="action warning" >
<span class="icon icon-restaurer"></span>
Ré-établir
</a>
<?php else : ?>
<a href="<?php echo $this->url('agent/validateur/historiser', ['agent-validateur' => $validateur->getId()], [], true); ?>"
class="action warning">
<span class="icon icon-historiser"></span>
Révoquer
</a>
<?php endif; ?>
<?php endif; ?> <?php endif; ?>
</li> </li>
<?php endif; ?>
<?php endforeach; ?> <?php endforeach; ?>
</ul> </ul>
<?php endif; ?> <?php endif; ?>
...@@ -171,13 +189,15 @@ $canModifier = $this->isAllowed(AgentPrivileges::getResourceId(AgentPrivileges:: ...@@ -171,13 +189,15 @@ $canModifier = $this->isAllowed(AgentPrivileges::getResourceId(AgentPrivileges::
</a> </a>
</li> </li>
<li class="nav-item"> <li class="nav-item">
<a href="#inscriptions-internes" class="nav-link" aria-controls="inscriptions-internes" role="tab" data-toggle="tabz"> <a href="#inscriptions-internes" class="nav-link" aria-controls="inscriptions-internes" role="tab"
data-toggle="tabz">
Inscriptions en cours <br> Inscriptions en cours <br>
Plan de formation Plan de formation
</a> </a>
</li> </li>
<li class="nav-item"> <li class="nav-item">
<a href="#inscriptions-externes" class="nav-link" aria-controls="inscriptions-externes" role="tab" data-toggle="tabz"> <a href="#inscriptions-externes" class="nav-link" aria-controls="inscriptions-externes" role="tab"
data-toggle="tabz">
Inscriptions en cours <br> Inscriptions en cours <br>
Stage externe Stage externe
</a> </a>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment