Commit dcf61a7c authored by Jean-Philippe Metivier's avatar Jean-Philippe Metivier
Browse files

Gros progress sur les auto et sup

parent 00f18991
Loading
Loading
Loading
Loading
−1
Changes for module/Application/src/Application/Controller/AgentHierarchieController.php: 0 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -10,7 +10,6 @@ use Application\Service\AgentAutorite\AgentAutoriteServiceAwareTrait;
use Application\Service\AgentSuperieur\AgentSuperieurServiceAwareTrait;
use Laminas\Mvc\Controller\AbstractActionController;
use Laminas\View\Model\ViewModel;
use RuntimeException;

class AgentHierarchieController extends AbstractActionController
{
+17
Changes for module/Application/src/Application/Entity/Db/AgentAutorite.php: 17 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -2,6 +2,7 @@

namespace Application\Entity\Db;

use Doctrine\ORM\QueryBuilder;
use UnicaenUtilisateur\Entity\Db\HistoriqueAwareInterface;
use UnicaenUtilisateur\Entity\Db\HistoriqueAwareTrait;

@@ -38,4 +39,20 @@ class AgentAutorite implements HistoriqueAwareInterface
        $this->autorite = $autorite;
    }

    /** decorators ************************************/

    static public function decorateWithAgentAutorite(QueryBuilder $qb, string $entityname = 'agent', bool $histo = false) : QueryBuilder
    {
        $qb = $qb
            //Chaine hierarchique
            ->leftJoin($entityname . '.autorites', 'autorite')->addSelect('autorite')
            ->leftJoin('autorite.autorite', 'aautorite')->addSelect('aautorite')
        ;
        if ($histo === false) {
            $qb = $qb->andWhere('autorite.histoDestruction IS NULL');
        }

        return $qb;
    }

}
 No newline at end of file
+17
Changes for module/Application/src/Application/Entity/Db/AgentSuperieur.php: 17 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -2,6 +2,7 @@

namespace Application\Entity\Db;

use Doctrine\ORM\QueryBuilder;
use UnicaenUtilisateur\Entity\Db\HistoriqueAwareInterface;
use UnicaenUtilisateur\Entity\Db\HistoriqueAwareTrait;

@@ -37,4 +38,20 @@ class AgentSuperieur implements HistoriqueAwareInterface
    {
        $this->superieur = $superieur;
    }

    /** decorators ************************************/

    static public function decorateWithAgentSuperieur(QueryBuilder $qb, string $entityname = 'agent', bool $histo = false) : QueryBuilder
    {
        $qb = $qb
            //Chaine hierarchique
            ->leftJoin($entityname .'.superieurs', 'superieur')->addSelect('superieur')
            ->leftJoin('superieur.superieur', 'asuperieur')->addSelect('asuperieur')
        ;
        if ($histo === false) {
            $qb = $qb->andWhere('superieur.histoDestruction IS NULL');
        }

        return $qb;
    }
}
 No newline at end of file
+5
Changes for module/Application/src/Application/Service/Agent/AgentService.php: 5 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -4,7 +4,9 @@ namespace Application\Service\Agent;

use Application\Entity\Db\Agent;
use Application\Entity\Db\AgentAffectation;
use Application\Entity\Db\AgentAutorite;
use Application\Entity\Db\AgentStatut;
use Application\Entity\Db\AgentSuperieur;
use Application\Entity\Db\Complement;
use Application\Entity\Db\Traits\HasPeriodeTrait;
use Application\Provider\Parametre\GlobalParametres;
@@ -268,6 +270,9 @@ class AgentService {
            ->orderBy('agent.nomUsuel, agent.prenom', 'ASC')
        ;

        $qb = AgentSuperieur::decorateWithAgentSuperieur($qb);
        $qb = AgentAutorite::decorateWithAgentAutorite($qb);

        if (!empty($structures)) {
            $qb = $qb->andWhere('affectation.structure IN (:structures)')
                ->setParameter('structures', $structures);
−13
Changes for module/EntretienProfessionnel/config/merged/entretien.config.php: 0 added lines, 13 removed lines.
Original line number Diff line number Diff line
@@ -107,7 +107,6 @@ return [
                    'action' => [
                        'creer',
                        'modifier',
                        'find-responsable-pour-entretien',
                    ],
                    'privileges' => EntretienproPrivileges::ENTRETIENPRO_AJOUTER,
                    'assertion' => EntretienProfessionnelAssertion::class,
@@ -189,18 +188,6 @@ return [
                            ],
                        ],
                    ],
                    'find-responsable-pour-entretien' => [
                        'type'  => Segment::class,
                        'may_terminate' => true,
                        'options' => [
                            'route'    => '/find-responsable-pour-entretien/:campagne/:agent',
                            'defaults' => [
                                /** @see EntretienProfessionnelController::findResponsablePourEntretienAction() */
                                'controller' => EntretienProfessionnelController::class,
                                'action'     => 'find-responsable-pour-entretien',
                            ],
                        ],
                    ],
                    'accepter-entretien' => [
                        'type'  => Segment::class,
                        'may_terminate' => true,
Loading