Commit 8328b67e authored by Bertrand Gauthier's avatar Bertrand Gauthier
Browse files

Merge branch 'prefix-etab-filter-usage'

parents 42ae0205 5f818375
Loading
Loading
Loading
Loading
Loading
+1 −1
Changes for module/Application/src/Application/Controller/ExportController.php: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -27,7 +27,7 @@ class ExportController extends AbstractController
            'Nom patronymique'                      => function (These $these) { return $these->getDoctorant()->getIndividu()->getNomPatronymique(); },
            'Date de naissance'                     => function (These $these) { return $these->getDoctorant()->getIndividu()->getDateNaissance(); },
            'Mail'                                  => function (These $these) { return $these->getDoctorant()->getIndividu()->getEmail(); },
            'Numéro étudiant'                       => function (These $these) { return $these->getDoctorant()->getSourceCode(); },
            'Numéro étudiant'                       => function (These $these) { return $these->getDoctorant()->getSourceCodeSansPrefix(); },
            //These
            'Identifiant de la thèse'               => function (These $these) { return $these->getSourceCode(); },
            'Titre'                                 => function (These $these) { return $these->getTitre(); },
+15 −14
Changes for module/Application/src/Application/Controller/SubstitutionController.php: 15 added lines, 14 removed lines.
Original line number Diff line number Diff line
@@ -2,19 +2,17 @@

namespace Application\Controller;

use Application\Entity\Db\EcoleDoctorale;
use Application\Entity\Db\Etablissement;
use Application\Entity\Db\Structure;
use Application\Entity\Db\StructureConcreteInterface;
use Application\Entity\Db\TypeStructure;
use Application\Entity\Db\UniteRecherche;
use Application\Filter\EtablissementPrefixFilterAwareTrait;
use Application\Service\EcoleDoctorale\EcoleDoctoraleServiceAwareTrait;
use Application\Service\Etablissement\EtablissementServiceAwareTrait;
use Application\Service\Structure\StructureServiceAwareTrait;
use Application\Service\UniteRecherche\UniteRechercheServiceAwareTrait;
use UnicaenApp\Exception\RuntimeException;
use UnicaenApp\Service\EntityManagerAwareTrait;
use Zend\Validator\Date;
use Zend\View\Model\ViewModel;

class SubstitutionController extends AbstractController
@@ -24,6 +22,9 @@ class SubstitutionController extends AbstractController
    use EcoleDoctoraleServiceAwareTrait;
    use UniteRechercheServiceAwareTrait;
    use StructureServiceAwareTrait;
    use EtablissementPrefixFilterAwareTrait;

    const CODE_SYGAL = 'SyGAL';

    /** Affiche l'index générale */
    public function indexAction() {
@@ -202,7 +203,7 @@ class SubstitutionController extends AbstractController

        $dictionnaire = [];
        foreach ($structures as $structure) {
            $identifiant = explode("::", $structure->getSourceCode())[1];
            $identifiant = $this->getEtablissementPrefixFilter()->removePrefixFrom($structure->getSourceCode());
            $dictionnaire[$identifiant][] = $structure;
        }

@@ -223,8 +224,8 @@ class SubstitutionController extends AbstractController

                /** @var StructureConcreteInterface $structure */
                foreach ($structures as $structure) {
                    $prefix = explode("::",$structure->getSourceCode())[0];
                    if ($prefix === "SyGAL" || $prefix === "COMUE") {
                    $prefix = $this->getEtablissementPrefixFilter()->extractCodeEtablissementFrom($structure->getSourceCode());
                    if ($prefix === self::CODE_SYGAL || $prefix === Etablissement::CODE_COMUE) {
                        $cible = $structure;
                    } else {
                        $sources[] = $structure;
@@ -249,8 +250,8 @@ class SubstitutionController extends AbstractController

        /** @var StructureConcreteInterface $structure */
        foreach ($structures as $structure) {
            $prefix = explode("::", $structure->getSourceCode())[0];
            if ($prefix === "SyGAL" || $prefix === "COMUE") {
            $prefix = $this->getEtablissementPrefixFilter()->extractCodeEtablissementFrom($structure->getSourceCode());
            if ($prefix === self::CODE_SYGAL || $prefix === Etablissement::CODE_COMUE) {
                $cible = $structure;
            } else {
                $sources[] = $structure;
@@ -273,8 +274,8 @@ class SubstitutionController extends AbstractController

        /** @var StructureConcreteInterface $structure */
        foreach ($structures as $structure) {
            $prefix = explode("::",$structure->getSourceCode())[0];
            if ($prefix === "SyGAL" || $prefix === "COMUE") {
            $prefix = $this->getEtablissementPrefixFilter()->extractCodeEtablissementFrom($structure->getSourceCode());
            if ($prefix === self::CODE_SYGAL || $prefix === Etablissement::CODE_COMUE) {
                $cible = $structure;
            } else {
                $sources[] = $structure;
@@ -318,7 +319,7 @@ class SubstitutionController extends AbstractController
            if ($cible === null) {
                $cible = $this->getStructureService()->createStructureConcrete($type);
                $this->structureService->updateFromPostData($cible,$data['cible']);
                $cible->setSourceCode("SyGAL" . "::" . $identifiant);
                $cible->setSourceCode($this->getEtablissementPrefixFilter()->addPrefixEtablissementTo($identifiant));
                $this->getEntityManager()->persist($cible);
                $this->getEntityManager()->flush($cible);
            } else {
@@ -342,7 +343,7 @@ class SubstitutionController extends AbstractController

        if ($cible === null) {
            $cible = $this->getStructureService()->createStructureConcrete($type);
            $cible->setSourceCode("SyGAL" . "::" . $identifiant);
            $cible->setSourceCode($this->getEtablissementPrefixFilter()->addPrefixEtablissementTo($identifiant));
        }

        $vm = new ViewModel();
@@ -370,8 +371,8 @@ class SubstitutionController extends AbstractController

        /** @var StructureConcreteInterface $structure */
        foreach ($structures as $structure) {
            $prefix = explode("::",$structure->getSourceCode())[0];
            if ($prefix === "SyGAL" || $prefix === "COMUE") {
            $prefix = $this->getEtablissementPrefixFilter()->extractCodeEtablissementFrom($structure->getSourceCode());
            if ($prefix === self::CODE_SYGAL || $prefix === Etablissement::CODE_COMUE) {
                $cible = $structure;
            } else {
                $sources[] = $structure;
+5 −7
Changes for module/Application/src/Application/Entity/Db/Doctorant.php: 5 added lines, 7 removed lines.
Original line number Diff line number Diff line
@@ -3,6 +3,7 @@
namespace Application\Entity\Db;

use Application\Entity\Db\Interfaces\DoctorantInterface;
use Application\Filter\EtablissementPrefixFilterAwareTrait;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use LogicException;
@@ -18,6 +19,7 @@ class Doctorant implements DoctorantInterface, HistoriqueAwareInterface, Resourc
{
    use HistoriqueAwareTrait;
    use SourceAwareTrait;
    use EtablissementPrefixFilterAwareTrait;

    /**
     * @var integer
@@ -87,23 +89,19 @@ class Doctorant implements DoctorantInterface, HistoriqueAwareInterface, Resourc
     *
     * @return string
     */
    public function getSourceCode($no_prefix = false)
    public function getSourceCode()
    {
        if ($no_prefix) {
            $res = explode("::", $this->sourceCode);
            return end($res);
        }
        return $this->sourceCode;
    }

    /**
     * Get sourceCode
     * Retourne le source code sans le préfixe établissement.
     *
     * @return string
     */
    public function getSourceCodeSansPrefix()
    {
        return $this->getEtablissement()->removePrefixFrom($this->sourceCode);
        return $this->getEtablissementPrefixFilter()->removePrefixFrom($this->getSourceCode());
    }

    /**
+1 −1
Changes for module/Application/src/Application/Entity/Db/Etablissement.php: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -56,7 +56,7 @@ class Etablissement implements StructureConcreteInterface, HistoriqueAwareInterf
    {
        $filter = new EtablissementPrefixFilter();

        return $filter->addPrefixTo($string, $this);
        return $filter->addPrefixEtablissementTo($string, $this);
    }

    /**
+4 −1
Changes for module/Application/src/Application/Entity/Db/Structure.php: 4 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -2,6 +2,8 @@

namespace Application\Entity\Db;

use Application\Filter\EtablissementPrefixFilterAwareInterface;
use Application\Filter\EtablissementPrefixFilterAwareTrait;
use Doctrine\Common\Collections\Collection;
use UnicaenApp\Entity\HistoriqueAwareInterface;
use UnicaenApp\Entity\HistoriqueAwareTrait;
@@ -18,6 +20,7 @@ class Structure implements HistoriqueAwareInterface, SourceAwareInterface
{
    use SourceAwareTrait;
    use HistoriqueAwareTrait;
    use EtablissementPrefixFilterAwareTrait;

    const PATH = "/var/www/sygal/upload";

@@ -181,7 +184,7 @@ class Structure implements HistoriqueAwareInterface, SourceAwareInterface
    {
        if ($this->code !== null) return $this->code;
        if ($this->sourceCode !== null) {
            $code = explode("::", $this->sourceCode)[1];
            $code = $this->getEtablissementPrefixFilter()->removePrefixFrom($this->sourceCode);
            return $code;
        }

Loading