diff --git a/CHANGELOG.md b/CHANGELOG.md index 7f02f9bbf104438a3bdba34e56e7194794b1ecac..cf777630603a015a4cd18defe6ef5c92ef479ca5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ Journal des modifications 6.0.7 ----- - [FORMATION] Affichage des missions d'enseignement à coté des inscriptions dans les sessions de formation +- [FORMATION] Possibilité de renseigner la nécessité de mission d'enseignement sur un module et filtrage des formations en conséquent - [SOUTENANCE] Nouveaux templates pour remplacer l'ancien système de notification : CONNEXION_RAPPORTEUR, DEMANDE_RAPPORT_SOUTENANCE 6.0.6 diff --git a/doc/release-notes/v6.0.7.md b/doc/release-notes/v6.0.7.md index 9c7465f4fb61c8378650006c198a55883babcde1..dd705e8db106e96530baadb230f97444869b12a9 100644 --- a/doc/release-notes/v6.0.7.md +++ b/doc/release-notes/v6.0.7.md @@ -27,4 +27,7 @@ INSERT INTO unicaen_renderer_macro (code, description, variable_name, methode_na -- Nouveaux templates -- TODO ajouter une fois stable : CONNEXION_RAPPORTEUR -- TODO ajouter une fois stable : DEMANDE_RAPPORT_SOUTENANCE + + +alter table formation_module add require_missionenseignement boolean default false not null; ``` \ No newline at end of file diff --git a/module/Doctorant/src/Doctorant/Entity/Db/Doctorant.php b/module/Doctorant/src/Doctorant/Entity/Db/Doctorant.php index 55b4678f8117dc541b136072f23446c5527a251f..6522917ed0e0f0e717c5c3d795705bcdecd2df3d 100644 --- a/module/Doctorant/src/Doctorant/Entity/Db/Doctorant.php +++ b/module/Doctorant/src/Doctorant/Entity/Db/Doctorant.php @@ -53,7 +53,6 @@ class Doctorant implements HistoriqueAwareInterface, ResourceInterface, Individu private Collection $missionsEnseignements; - /** * Retourne l'éventuel établissement lié *ou son substitut le cas échéant*. * @@ -61,8 +60,8 @@ class Doctorant implements HistoriqueAwareInterface, ResourceInterface, Individu * '.etablissement' puis 'etablissement.structure' puis 'structure.structureSubstituante' puis 'structureSubstituante.etablissement'. * * @param bool $returnSubstitIfExists À true, retourne l'établissement substituant s'il y en a un ; sinon l'établissement d'origine. - * @see Etablissement::getEtablissementSubstituant() * @return Etablissement|null + * @see Etablissement::getEtablissementSubstituant() */ public function getEtablissement(bool $returnSubstitIfExists = true): ?Etablissement { @@ -385,19 +384,12 @@ class Doctorant implements HistoriqueAwareInterface, ResourceInterface, Individu return 'Doctorant'; } - /** - * @return string - */ - public function getIne() + public function getIne(): string { return $this->ine; } - /** - * @param string $ine - * @return self - */ - public function setIne($ine) + public function setIne(string $ine): Doctorant { $this->ine = $ine; return $this; @@ -409,4 +401,12 @@ class Doctorant implements HistoriqueAwareInterface, ResourceInterface, Individu return $this->missionsEnseignements->toArray(); } + public function hasMissionEnseignementFor(int $annee): bool + { + foreach ($this->getMissionsEnseignements() as $missionEnseignement) { + if ($missionEnseignement->getAnneeUniversitaire() === $annee) return true; + } + return false; + } + } diff --git a/module/Formation/src/Formation/Entity/Db/Mapping/Formation.Entity.Db.Module.dcm.xml b/module/Formation/src/Formation/Entity/Db/Mapping/Formation.Entity.Db.Module.dcm.xml index 0e67637c9f22867a57be05d6ee02e088f76b0b9b..35018dd1f291f10fc7d84e7f8c3381db60f80492 100644 --- a/module/Formation/src/Formation/Entity/Db/Mapping/Formation.Entity.Db.Module.dcm.xml +++ b/module/Formation/src/Formation/Entity/Db/Mapping/Formation.Entity.Db.Module.dcm.xml @@ -11,6 +11,7 @@ <field name="libelle" type="string" length="1024" column="LIBELLE" nullable="false"/> <field name="description" type="string" length="9999" column="DESCRIPTION" nullable="true"/> <field name="lien" type="string" length="9999" column="LIEN" nullable="true"/> + <field name="requireMissionEnseignement" type="boolean" column="require_missionenseignement"/> <one-to-many field="formations" target-entity="Formation\Entity\Db\Formation" mapped-by="module"/> diff --git a/module/Formation/src/Formation/Entity/Db/Module.php b/module/Formation/src/Formation/Entity/Db/Module.php index dc83145176dc21868c63387e287a0370155506dd..2200b3ada867c722fdf0cc824d0bd790ffc7062d 100644 --- a/module/Formation/src/Formation/Entity/Db/Module.php +++ b/module/Formation/src/Formation/Entity/Db/Module.php @@ -15,6 +15,7 @@ class Module implements HistoriqueAwareInterface private ?string $description = null; private ?string $lien = null; private Collection $formations; + private bool $requireMissionEnseignement = false; /** * @return int @@ -86,11 +87,20 @@ class Module implements HistoriqueAwareInterface return $this->formations; } - /** - * @return string - */ public function getCode() : string { return 'M'.$this->getId(); } + + public function isRequireMissionEnseignement(): bool + { + return $this->requireMissionEnseignement; + } + + public function setRequireMissionEnseignement(bool $requireMissionEnseignement): void + { + $this->requireMissionEnseignement = $requireMissionEnseignement; + } + + } \ No newline at end of file diff --git a/module/Formation/src/Formation/Entity/Db/Repository/SessionRepository.php b/module/Formation/src/Formation/Entity/Db/Repository/SessionRepository.php index e63d614b212b3f0e2e64231c6b72992d9b069a82..2091e1efbe8dab539883b4a0a6276f05c8a35c8f 100644 --- a/module/Formation/src/Formation/Entity/Db/Repository/SessionRepository.php +++ b/module/Formation/src/Formation/Entity/Db/Repository/SessionRepository.php @@ -4,6 +4,7 @@ namespace Formation\Entity\Db\Repository; use Application\Entity\Db\Repository\DefaultEntityRepository; use Application\QueryBuilder\DefaultQueryBuilder; +use DateTime; use Doctorant\Entity\Db\Doctorant; use Formation\Entity\Db\Etat; use Formation\Entity\Db\Formation; @@ -22,6 +23,7 @@ class SessionRepository extends DefaultEntityRepository $qb = parent::createQueryBuilder($alias, $indexBy) ->join($alias . '.responsable', 'resp')->addSelect('resp') ->join($alias . '.formation', "formation")->addSelect("formation") + ->join('formation.module', "module")->addSelect("module") ->join($alias. '.site', 'site')->addSelect("site") ->leftJoin($alias . '.typeStructure', 'struct')->addSelect("struct") ->leftJoin($alias . '.inscriptions', "inscription")->addSelect("inscription") @@ -86,9 +88,17 @@ class SessionRepository extends DefaultEntityRepository ->setParameter('preparation', Etat::CODE_PREPARATION) ; - $result = $qb->getQuery()->getResult(); - usort($result, function (Session $a, Session $b) { return $a->getDateDebut(true) > $b->getDateDebut(true);}); + /** TODO SOMETHING WITH IT*/ + $now = new DateTime(); + $mois = ((int) $now->format('m')); + $annee = ((int) $now->format('Y')); + if ($mois < 9) $annee -= 1; + if (! $doctorant->hasMissionEnseignementFor($annee)) { + $qb = $qb->andWhere('module.requireMissionEnseignement = :false')->setParameter('false', false); + } + $result = $qb->getQuery()->getResult(); + usort($result, function (Session $a, Session $b) { return $a->getDateDebut() > $b->getDateDebut();}); return $result; } diff --git a/module/Formation/src/Formation/Form/Module/ModuleForm.php b/module/Formation/src/Formation/Form/Module/ModuleForm.php index a8d0d5390d7ccbb9d347a9b3686f449d1da40752..c4281759bcc39c8f5b831857f67e2eb3161e8704 100644 --- a/module/Formation/src/Formation/Form/Module/ModuleForm.php +++ b/module/Formation/src/Formation/Form/Module/ModuleForm.php @@ -3,6 +3,7 @@ namespace Formation\Form\Module; use Laminas\Form\Element\Button; +use Laminas\Form\Element\Checkbox; use Laminas\Form\Element\Text; use Laminas\Form\Element\Textarea; use Laminas\Form\Form; @@ -49,6 +50,17 @@ class ModuleForm extends Form { 'class' => 'required', ], ]); + //titre + $this->add([ + 'type' => Checkbox::class, + 'name' => 'mission_enseignement', + 'options' => [ + 'label' => "Les doctorants doivent avoir une mission d'enseignement déclarée", + ], + 'attributes' => [ + 'id' => 'mission_enseignement', + ], + ]); //submit $this->add([ @@ -69,6 +81,7 @@ class ModuleForm extends Form { 'libelle' => [ 'required' => true, ], 'description' => [ 'required' => false, ], 'lien' => [ 'required' => false, ], + 'mission_enseignement' => [ 'required' => false, ], ])); } } \ No newline at end of file diff --git a/module/Formation/src/Formation/Form/Module/ModuleHydrator.php b/module/Formation/src/Formation/Form/Module/ModuleHydrator.php index 3c02ed269bb7a1b09f45631bf26c51aa7a1683cd..78af680d3b94b2ede996b3a310fa2d1e38568f20 100644 --- a/module/Formation/src/Formation/Form/Module/ModuleHydrator.php +++ b/module/Formation/src/Formation/Form/Module/ModuleHydrator.php @@ -2,10 +2,10 @@ namespace Formation\Form\Module; +use Formation\Entity\Db\Module; use Structure\Service\Etablissement\EtablissementServiceAwareTrait; use Individu\Service\IndividuServiceAwareTrait; use Structure\Service\Structure\StructureServiceAwareTrait; -use Formation\Entity\Db\Formation; use Laminas\Hydrator\HydratorInterface; class ModuleHydrator implements HydratorInterface { @@ -13,34 +13,30 @@ class ModuleHydrator implements HydratorInterface { use IndividuServiceAwareTrait; use StructureServiceAwareTrait; - /** - * @param object|Formation $object - * @return array - */ public function extract(object $object) : array { + /** @var Module $object */ $data = [ 'libelle' => $object->getLibelle(), 'description' => $object->getDescription(), 'lien' => $object->getLien(), + 'mission_enseignement' => $object->isRequireMissionEnseignement()?"1":null, ]; return $data; } - /** - * @param array $data - * @param Formation $object - * @return Formation - */ - public function hydrate(array $data, $object) + public function hydrate(array $data, object $object): object { + /** @var Module $object */ $libelle = (isset($data['libelle']) AND trim($data['libelle']) !== '')?trim($data['libelle']):null; $description = (isset($data['description']) AND trim($data['description']) !== '')?trim($data['description']):null; $lien = (isset($data['lien']) AND trim($data['lien']) !== '')?trim($data['lien']):null; + $mission = (isset($data['mission_enseignement']) AND $data['mission_enseignement'] === "1")?true:false; $object->setLibelle($libelle); $object->setDescription($description); $object->setLien($lien); + $object->setRequireMissionEnseignement($mission); return $object; } diff --git a/module/Formation/src/Formation/View/Helper/partial/formateurs.phtml b/module/Formation/src/Formation/View/Helper/partial/formateurs.phtml index ff4189feb0b284bb6bb8baadae5eefad5bbb7f6c..22696c04545130df0fba18fd958cfede00472a60 100644 --- a/module/Formation/src/Formation/View/Helper/partial/formateurs.phtml +++ b/module/Formation/src/Formation/View/Helper/partial/formateurs.phtml @@ -10,7 +10,7 @@ use Formation\Entity\Db\Session; * @var array $options */ -$displayType = $options['display-type']; +$displayType = $options['display-type']??null; /** @var Formateur[] $formateurs */ $formateurs = $session->getFormateurs()->toArray(); diff --git a/module/Formation/view/formation/module/afficher.phtml b/module/Formation/view/formation/module/afficher.phtml index 3498f5416ae0944c71e0a125c95ea383baf88998..387ab1427d721694040822b6223a261c49ce6780 100644 --- a/module/Formation/view/formation/module/afficher.phtml +++ b/module/Formation/view/formation/module/afficher.phtml @@ -69,6 +69,13 @@ $urlRetour = $this->url('formation/module/afficher', ['module' => $module->getId <?php endif ?> </dl> +<?php if ($module->isRequireMissionEnseignement()) : ?> + <div class="alert alert-info"> + <span class="icon icon-information"></span> + Ce module nécessite une mission d'enseigment pour permettre l'inscription à ces sessions de formation. + </div> +<?php endif; ?> + <h2> Liste des formations associées au module </h2>