diff --git a/module/Mission/src/Assertion/OffreEmploiAssertion.php b/module/Mission/src/Assertion/OffreEmploiAssertion.php index adb15fa92a55b8e9edff5e83d459566a085ac5e5..444a98cddf60aca45982d88b0d8a68fc6b7b0fbc 100755 --- a/module/Mission/src/Assertion/OffreEmploiAssertion.php +++ b/module/Mission/src/Assertion/OffreEmploiAssertion.php @@ -38,11 +38,10 @@ class OffreEmploiAssertion extends AbstractAssertion implements EntityManagerAwa { switch ($page['route']) { case 'offre-emploi': - $query = 'SELECT id FROM offre_emploi WHERE histo_destruction IS NULL AND validation_id IS NOT NULL'; - $conn = $this->getEntityManager()->getConnection(); - - if (false === $conn->executeQuery($query)->fetchOne()) { - // Aucune offre => pas de lien + case 'candidature': + //Si il n'y a pas d'offre d'emploi alors il ne peut pas y avoir des candidatures + if(!$this->canHaveCandidature()) + { return false; } @@ -138,6 +137,9 @@ class OffreEmploiAssertion extends AbstractAssertion implements EntityManagerAwa return $assert; } break; + case 'candidature': + return $this->canHaveCandidature(); + break; } return true; } @@ -261,6 +263,16 @@ class OffreEmploiAssertion extends AbstractAssertion implements EntityManagerAwa ]); } + protected function canHaveCandidature() + { + $query = 'SELECT id FROM offre_emploi WHERE histo_destruction IS NULL AND validation_id IS NOT NULL'; + $conn = $this->getEntityManager()->getConnection(); + if (false === $conn->executeQuery($query)->fetchOne()) { + return false; + } + return true; + } + protected function assertCandidatureValider (Role $role, Candidature $candidature) diff --git a/module/Mission/src/Controller/OffreEmploiController.php b/module/Mission/src/Controller/OffreEmploiController.php index f7d7b3b3af721218419c6b1af63cddb8b74f5794..a6ea621140db50913482a562fba05fec8872d753 100755 --- a/module/Mission/src/Controller/OffreEmploiController.php +++ b/module/Mission/src/Controller/OffreEmploiController.php @@ -319,10 +319,14 @@ class OffreEmploiController extends AbstractController * @var WorkflowEtape $etapeDonneesPersos */ $intervenant = $this->getEvent()->getParam('intervenant'); + $renseignerDonneesPersonnelles = false; $canValiderCandidature = $this->isAllowed($intervenant, Privileges::MISSION_CANDIDATURE_VALIDER); $canRefuserCandidature = $this->isAllowed($intervenant, Privileges::MISSION_CANDIDATURE_REFUSER); $etapeDonneesPersos = $this->getServiceWorkflow()->getEtape(WfEtape::CODE_DONNEES_PERSO_SAISIE, $intervenant); - $renseignerDonneesPersonnelles = ($etapeDonneesPersos->getFranchie() == 1) ? false : true; + if(!empty($etapeDonneesPersos)) + { + $renseignerDonneesPersonnelles = ($etapeDonneesPersos->getFranchie() == 1) ? false : true; + } if (!$intervenant) { throw new \LogicException('Intervenant introuvable');