Loading module/Formation/src/Formation/Assertion/FormationExterne/FormationExterneAssertion.php +7 −3 Original line number Diff line number Diff line Loading @@ -66,11 +66,14 @@ class FormationExterneAssertion extends AbstractAssertion implements AssertionI case 'restaurer' : case 'supprimer-attestation' : case 'telecharger-attestation' : if ($formationExterne instanceof FormationExterne) { return $this->scopeValide($formationExterne); } case 'valider-formation-externe' : case 'refuser-formation-externe' : case 'revoquer-formation-externe' : if ($formationExterne) { return $this->scopeValide($formationExterne); if ($formationExterne instanceof FormationExterne) { return $formationExterne->estNonHistorise() && $this->scopeValide($formationExterne); } } return true; Loading @@ -94,8 +97,9 @@ class FormationExterneAssertion extends AbstractAssertion implements AssertionI if($role->isDoctorant() && $formationExterne->getValidation(TypeValidation::CODE_VALIDATION_FORMATION_EXTERNE)) return false; case FormationPrivileges::FORMATION_FORMATIONEXTERNE_TELECHARGER_ATTESTATION : case FormationPrivileges::FORMATION_FORMATIONEXTERNE_GERER_VALIDATION : return $this->scopeValide($formationExterne); case FormationPrivileges::FORMATION_FORMATIONEXTERNE_GERER_VALIDATION : return $formationExterne->estNonHistorise() && $this->scopeValide($formationExterne); } return true; Loading module/Formation/src/Formation/Controller/FormationController.php +1 −1 Original line number Diff line number Diff line Loading @@ -103,7 +103,7 @@ class FormationController extends AbstractController $this->fichierService->saveFichiers($fichiers); $formation->setFiche(array_pop($fichiers)); } $this->getFormationService()->create($formation); $this->getFormationService()->create($formation, $form->get('competences')->getValue()); } } Loading module/Formation/src/Formation/Controller/FormationExterneController.php +1 −1 Original line number Diff line number Diff line Loading @@ -71,7 +71,7 @@ class FormationExterneController extends AbstractController $this->fichierService->saveFichiers($fichiers); $formationExterne->setAttestation(array_pop($fichiers)); } $this->formationExterneService->create($formationExterne); $this->formationExterneService->create($formationExterne, $form->get('competences')->getValue()); } } Loading module/Formation/src/Formation/Entity/Db/Mapping/Formation.Entity.Db.FormationExterne.dcm.xml +5 −1 Original line number Diff line number Diff line Loading @@ -26,7 +26,11 @@ <join-column name="attestation_id" referenced-column-name="id" on-delete="CASCADE" nullable="false" unique="true"/> </one-to-one> <one-to-many field="validations" target-entity="Validation\Entity\Db\ValidationFormationExterne" mapped-by="formationExterne"/> <one-to-many field="validations" target-entity="Validation\Entity\Db\ValidationFormationExterne" mapped-by="formationExterne"> <cascade> <cascade-remove/> </cascade> </one-to-many> <!-- HISTORISATION ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --> <field name="histoCreation" type="datetime" column="histo_creation" nullable="false"/> Loading module/Formation/src/Formation/Form/Formation/FormationExterne/FormationExterneHydrator.php +26 −25 Original line number Diff line number Diff line Loading @@ -53,15 +53,16 @@ class FormationExterneHydrator extends DoctrineObject $object = parent::hydrate($data, $object); // Gestion des relations $competences = $data['competences'] ?? null; $this->gererSousCompetencesRNCP($competences, $object); $this->gererSousCompetencesRNCP($data, $object); return $object; } private function gererSousCompetencesRNCP(array|null $idsSelectionnes, FormationExterne $formation): void private function gererSousCompetencesRNCP(array $data, FormationExterne $formation): void { $idsSelectionnes = array_map('intval', $idsSelectionnes ?? []); if ((!empty($data['competences']) && is_array($data['competences'])) || !isset($data['competences'])) { /** @var int[] $idsSelectionnes */ $idsSelectionnes = array_map('intval', $data['competences'] ?? []); /** @var SousCompetence[] $actuelles */ $actuelles = $this->getSousCompetenceService() Loading @@ -79,14 +80,14 @@ class FormationExterneHydrator extends DoctrineObject } //Ajout des nouvelles relations if ($formation->getId() !== null) { foreach ($idsSelectionnes as $id) { $sousCompetence = $this->getSousCompetenceService() ->getRepository() ->find($id); $sousCompetence = $this->getSousCompetenceService()->getRepository()->find($id); if ($sousCompetence instanceof SousCompetence) { $formation->addSousCompetence($sousCompetence); } } } } } } No newline at end of file Loading
module/Formation/src/Formation/Assertion/FormationExterne/FormationExterneAssertion.php +7 −3 Original line number Diff line number Diff line Loading @@ -66,11 +66,14 @@ class FormationExterneAssertion extends AbstractAssertion implements AssertionI case 'restaurer' : case 'supprimer-attestation' : case 'telecharger-attestation' : if ($formationExterne instanceof FormationExterne) { return $this->scopeValide($formationExterne); } case 'valider-formation-externe' : case 'refuser-formation-externe' : case 'revoquer-formation-externe' : if ($formationExterne) { return $this->scopeValide($formationExterne); if ($formationExterne instanceof FormationExterne) { return $formationExterne->estNonHistorise() && $this->scopeValide($formationExterne); } } return true; Loading @@ -94,8 +97,9 @@ class FormationExterneAssertion extends AbstractAssertion implements AssertionI if($role->isDoctorant() && $formationExterne->getValidation(TypeValidation::CODE_VALIDATION_FORMATION_EXTERNE)) return false; case FormationPrivileges::FORMATION_FORMATIONEXTERNE_TELECHARGER_ATTESTATION : case FormationPrivileges::FORMATION_FORMATIONEXTERNE_GERER_VALIDATION : return $this->scopeValide($formationExterne); case FormationPrivileges::FORMATION_FORMATIONEXTERNE_GERER_VALIDATION : return $formationExterne->estNonHistorise() && $this->scopeValide($formationExterne); } return true; Loading
module/Formation/src/Formation/Controller/FormationController.php +1 −1 Original line number Diff line number Diff line Loading @@ -103,7 +103,7 @@ class FormationController extends AbstractController $this->fichierService->saveFichiers($fichiers); $formation->setFiche(array_pop($fichiers)); } $this->getFormationService()->create($formation); $this->getFormationService()->create($formation, $form->get('competences')->getValue()); } } Loading
module/Formation/src/Formation/Controller/FormationExterneController.php +1 −1 Original line number Diff line number Diff line Loading @@ -71,7 +71,7 @@ class FormationExterneController extends AbstractController $this->fichierService->saveFichiers($fichiers); $formationExterne->setAttestation(array_pop($fichiers)); } $this->formationExterneService->create($formationExterne); $this->formationExterneService->create($formationExterne, $form->get('competences')->getValue()); } } Loading
module/Formation/src/Formation/Entity/Db/Mapping/Formation.Entity.Db.FormationExterne.dcm.xml +5 −1 Original line number Diff line number Diff line Loading @@ -26,7 +26,11 @@ <join-column name="attestation_id" referenced-column-name="id" on-delete="CASCADE" nullable="false" unique="true"/> </one-to-one> <one-to-many field="validations" target-entity="Validation\Entity\Db\ValidationFormationExterne" mapped-by="formationExterne"/> <one-to-many field="validations" target-entity="Validation\Entity\Db\ValidationFormationExterne" mapped-by="formationExterne"> <cascade> <cascade-remove/> </cascade> </one-to-many> <!-- HISTORISATION ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ --> <field name="histoCreation" type="datetime" column="histo_creation" nullable="false"/> Loading
module/Formation/src/Formation/Form/Formation/FormationExterne/FormationExterneHydrator.php +26 −25 Original line number Diff line number Diff line Loading @@ -53,15 +53,16 @@ class FormationExterneHydrator extends DoctrineObject $object = parent::hydrate($data, $object); // Gestion des relations $competences = $data['competences'] ?? null; $this->gererSousCompetencesRNCP($competences, $object); $this->gererSousCompetencesRNCP($data, $object); return $object; } private function gererSousCompetencesRNCP(array|null $idsSelectionnes, FormationExterne $formation): void private function gererSousCompetencesRNCP(array $data, FormationExterne $formation): void { $idsSelectionnes = array_map('intval', $idsSelectionnes ?? []); if ((!empty($data['competences']) && is_array($data['competences'])) || !isset($data['competences'])) { /** @var int[] $idsSelectionnes */ $idsSelectionnes = array_map('intval', $data['competences'] ?? []); /** @var SousCompetence[] $actuelles */ $actuelles = $this->getSousCompetenceService() Loading @@ -79,14 +80,14 @@ class FormationExterneHydrator extends DoctrineObject } //Ajout des nouvelles relations if ($formation->getId() !== null) { foreach ($idsSelectionnes as $id) { $sousCompetence = $this->getSousCompetenceService() ->getRepository() ->find($id); $sousCompetence = $this->getSousCompetenceService()->getRepository()->find($id); if ($sousCompetence instanceof SousCompetence) { $formation->addSousCompetence($sousCompetence); } } } } } } No newline at end of file