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

modification et utilisation du formatter NomComplet pour les doctorants de la PDC

parent 733c16fa
Loading
Loading
Loading
Loading
+2 −2
Changes for module/Application/src/Application/Entity/Db/Individu.php: 2 added lines, 2 removed lines.
Original line number Diff line number Diff line
@@ -383,9 +383,9 @@ class Individu implements HistoriqueAwareInterface, SourceAwareInterface
     * @return string
     * @deprecated Utiliser la class NomCompletFormatter.
     */
    public function getNomComplet($avecCivilite = false, $avecNomPatro = false, $prenoms = false, $prenomfirst = false, $court = false)
    public function getNomComplet($avecCivilite = false, $avecNomPatro = false, $prenoms = false, $prenomfirst = false, $court = false, $patroPlutotQueUsuel=false)
    {
        $f = new NomCompletFormatter(true, $avecCivilite, $avecNomPatro, $prenomfirst, $prenoms, $court);
        $f = new NomCompletFormatter(true, $avecCivilite, $avecNomPatro, $prenomfirst, $prenoms, $court, $patroPlutotQueUsuel);

        return $f->filter($this);
    }
+12 −2
Changes for module/Application/src/Application/Filter/NomCompletFormatter.php: 12 added lines, 2 removed lines.
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@ class NomCompletFormatter extends AbstractFilter
    protected $prenomDabord   = false;
    protected $tousLesPrenoms = false;
    protected $court = false;
    protected $patroPlutotQueUsuel = false;

    /**
     * Constructeur.
@@ -31,7 +32,7 @@ class NomCompletFormatter extends AbstractFilter
     * @param bool $prenomDabord
     * @param bool $tousLesPrenoms
     */
    public function __construct($nomEnMajuscule = true, $avecCivilite = false, $avecNomPatro = false, $prenomDabord = false, $tousLesPrenoms = false, $court = false)
    public function __construct($nomEnMajuscule = true, $avecCivilite = false, $avecNomPatro = false, $prenomDabord = false, $tousLesPrenoms = false, $court = false, $patroPlutotQueUsuel=false)
    {
        $this->nomEnMajuscule       = $nomEnMajuscule;
        $this->avecCivilite         = $avecCivilite;
@@ -39,7 +40,7 @@ class NomCompletFormatter extends AbstractFilter
        $this->prenomDabord         = $prenomDabord;
        $this->tousLesPrenoms       = $tousLesPrenoms;
        $this->court                = $court;

        $this->patroPlutotQueUsuel  = $patroPlutotQueUsuel;
    }

    /**
@@ -113,13 +114,21 @@ class NomCompletFormatter extends AbstractFilter
        $nomPatro = ucfirst($this->nomEnMajuscule ? mb_strtoupper($nomPatro) : $nomPatro);
        $civilite = $this->avecCivilite ? $civilite : null;

        if ($this->patroPlutotQueUsuel && $nomPatro != '') {
            $parts = [
                $civilite,
                $this->prenomDabord ? "$prenom $nomPatro" : "$nomPatro $prenom",
            ];
        } else {
            $parts = [
                $civilite,
                $this->prenomDabord ? "$prenom $nomUsuel" : "$nomUsuel $prenom",
            ];
        }

        $result = implode(' ', array_filter($parts));

        if (! $this->patroPlutotQueUsuel) {
            if ($this->avecNomPatro && $nomPatro !== $nomUsuel) {
                if ($this->court) {
                    $result .= "-$nomPatro";
@@ -127,6 +136,7 @@ class NomCompletFormatter extends AbstractFilter
                    $result .= ", née $nomPatro";
                }
            }
        }

	    return $result;
    }
+2 −6
Changes for module/Application/src/Application/Service/These/TheseService.php: 2 added lines, 6 removed lines.
Original line number Diff line number Diff line
@@ -12,6 +12,7 @@ use Application\Entity\Db\Role;
use Application\Entity\Db\Structure;
use Application\Entity\Db\These;
use Application\Entity\Db\VersionFichier;
use Application\Filter\NomCompletFormatter;
use Application\Notification\ValidationRdvBuNotification;
use Application\Service\BaseService;
use Application\Service\Etablissement\EtablissementServiceAwareTrait;
@@ -278,13 +279,8 @@ class TheseService extends BaseService
        $pdcData->setTitre($these->getTitre());
        $pdcData->setSpecialite($these->getLibelleDiscipline());
        if ($these->getEtablissement()) $pdcData->setEtablissement($these->getEtablissement()->getLibelle());
//        if ($these->getDoctorant()) $pdcData->setDoctorant($these->getDoctorant()->getIndividu()->getNomComplet(false, false, false, true, true));
        if ($these->getDoctorant()) {
            $nom = $these->getDoctorant()->getIndividu()->getNomPatronymique();
            if ($nom === null) $nom = $these->getDoctorant()->getIndividu()->getNomUsuel();
            $nom = strtoupper($nom);
            $prenom = $these->getDoctorant()->getIndividu()->getPrenom1();
            $pdcData->setDoctorant($prenom . " " . $nom);
            $pdcData->setDoctorant($these->getDoctorant()->getIndividu()->getNomComplet(false, false, false, true, true, true));
        }
        if ($these->getDateSoutenance()) $pdcData->setDate($these->getDateSoutenance()->format("d/m/Y"));