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

filtrage sur le type des individu

parent 2606c45a
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -98,7 +98,7 @@ class CoEncadrantController extends AbstractActionController {

        $form = $this->getRechercherCoEncadrantForm();
        $form->setAttribute('action', $this->url()->fromRoute('co-encadrant/ajouter-co-encadrant', [], [], true));
        $form->setUrlCoEncadrant($this->url()->fromRoute('utilisateur/rechercher-individu', [], [], true));
        $form->setUrlCoEncadrant($this->url()->fromRoute('utilisateur/rechercher-individu', [], ["query" => ['type' => Individu::TYPE_ACTEUR]], true));

        $request = $this->getRequest();
        if ($request->isPost()) {
+1 −0
Original line number Diff line number Diff line
@@ -161,6 +161,7 @@ class UtilisateurController extends \UnicaenAuth\Controller\UtilisateurControlle
     */
    public function rechercherIndividuAction($type = null)
    {
        $type = $this->params()->fromQuery('type');
        if (($term = $this->params()->fromQuery('term'))) {
            $rows = $this->individuService->getRepository()->findByText($term, $type);
            $result = [];
+28 −0
Original line number Diff line number Diff line
@@ -21,6 +21,9 @@ class Individu implements HistoriqueAwareInterface, SourceAwareInterface
    const CIVILITE_M = 'M.';
    const CIVILITE_MME = 'Mme';

    const TYPE_ACTEUR = 'acteur';
    const TYPE_DOCTORANT = 'doctorant';

    /**
     * Identifiant qui correspond en fait au :
     * - supannEmpId (pour les acteurs) ou au
@@ -108,6 +111,11 @@ class Individu implements HistoriqueAwareInterface, SourceAwareInterface
     */
    private $utilisateurs;

    /**
     * @var string
     */
    private $type;

    /**
     * Individu constructor.
     */
@@ -550,4 +558,24 @@ class Individu implements HistoriqueAwareInterface, SourceAwareInterface
    {
        return $this->utilisateurs->toArray();
    }

    /**
     * @return string
     */
    public function getType(): string
    {
        return $this->type;
    }

    /**
     * @param string $type
     * @return Individu
     */
    public function setType(string $type): Individu
    {
        $this->type = $type;
        return $this;
    }


}
 No newline at end of file
+1 −0
Original line number Diff line number Diff line
@@ -9,6 +9,7 @@
        </id>

        <field name="supannId" column="SUPANN_ID" nullable="true"/>
        <field name="type" column="TYPE" nullable="false"/>
        <field name="civilite" column="CIVILITE" nullable="true"/>
        <field name="dateNaissance" type="datetime" column="DATE_NAISSANCE"/>
        <field name="nationalite" column="NATIONALITE" nullable="true"/>
+1 −1
Original line number Diff line number Diff line
@@ -72,7 +72,7 @@ class IndividuRepository extends DefaultEntityRepository
            "WHERE i.HISTO_DESTRUCTION IS NULL AND rownum <= %d";
        if ($type !== null) {
            $sqlTemplate .= " AND i.type = '%s'";
            $sql = sprintf($sqlTemplate, $type, (int)$limit);
            $sql = sprintf($sqlTemplate, (int)$limit, $type);
            $tmp = null;
        } else {
            $sql = sprintf($sqlTemplate, (int)$limit);