Commit 997400ca authored by Laurent Lecluse's avatar Laurent Lecluse
Browse files

Ajout du filtre Etudiant pour les types d'intervenants

parent e60ad8f0
Loading
Loading
Loading
Loading
+0 −95
Changes for module/Application/src/Service/TypeIntervenantService.php: 0 added lines, 95 removed lines.
Original line number Diff line number Diff line
<?php

namespace Application\Service;

use Intervenant\Entity\Db\TypeIntervenant;
use Doctrine\ORM\QueryBuilder;

/**
 * Description of TypeIntervenantService
 *
 * @author Laurent LÉCLUSE <laurent.lecluse at unicaen.fr>
 */
class TypeIntervenantService extends AbstractEntityService
{

    /**
     * retourne la classe des entités
     *
     * @return string
     * @throws RuntimeException
     */
    public function getEntityClass()
    {
        return TypeIntervenant::class;
    }



    /**
     * Retourne le type d'intervenant Permanent
     *
     * @return TypeIntervenant
     */
    public function getPermanent()
    {
        return $this->getRepo()->findOneBy(['code' => TypeIntervenant::CODE_PERMANENT]);
    }



    /**
     * Retourne le type d'intervenant Extérieur
     *
     * @return TypeIntervenant
     */
    public function getExterieur()
    {
        return $this->getRepo()->findOneBy(['code' => TypeIntervenant::CODE_EXTERIEUR]);
    }



    /**
     * Retourne l'alias d'entité courante
     *
     * @return string
     */
    public function getAlias()
    {
        return 'type_int';
    }



    /**
     *
     * @param QueryBuilder|null $qb
     * @param string|null       $alias
     *
     * @return QueryBuilder
     */
    public function orderBy(QueryBuilder $qb = null, $alias = null)
    {
        [$qb, $alias] = $this->initQuery($qb, $alias);
        $qb->addOrderBy("$alias.code", 'DESC');

        return $qb;
    }



    /**
     *
     * @param string $code
     *
     * @return TypeIntervenant
     */
    public function getByCode($code)
    {
        if (null == $code) return null;

        return $this->getRepo()->findOneBy(['code' => $code]);
    }

}
 No newline at end of file
+1 −0
Changes for module/Intervenant/src/Entity/Db/TypeIntervenant.php: 1 added line, 0 removed lines.
Original line number Diff line number Diff line
@@ -10,6 +10,7 @@ class TypeIntervenant
{
    const CODE_PERMANENT = 'P';
    const CODE_EXTERIEUR = 'E';
    const CODE_ETUDIANT = 'S';

    protected int    $id;

+10 −0
Changes for module/Intervenant/src/Service/TypeIntervenantService.php: 10 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -48,6 +48,16 @@ class TypeIntervenantService extends AbstractEntityService



    /**
     * Retourne le type d'intervenant Extérieur
     */
    public function getEtudiant(): TypeIntervenant
    {
        return $this->getRepo()->findOneBy(['code' => TypeIntervenant::CODE_ETUDIANT]);
    }



    public function getAlias(): string
    {
        return 'type_int';
+1 −0
Changes for module/Paiement/src/Form/Paiement/MiseEnPaiementRechercheForm.php: 1 added line, 0 removed lines.
Original line number Diff line number Diff line
@@ -67,6 +67,7 @@ class MiseEnPaiementRechercheForm extends AbstractForm
                    ''                                                          => "Peu importe",
                    $this->getServiceTypeIntervenant()->getPermanent()->getId() => "Permanent",
                    $this->getServiceTypeIntervenant()->getExterieur()->getId() => "Vacataire",
                    $this->getServiceTypeIntervenant()->getEtudiant()->getId()  => "Étudiant",
                ],
            ],
            'attributes' => [