Commit ec5685e5 authored by Antony Le Courtes's avatar Antony Le Courtes
Browse files

Correction assertion pour ne pas afficher le menu candidatur sur le menu de...

Correction assertion pour ne pas afficher le menu candidatur sur le menu de l'intervenant si on est sur une instance enseignement.
parent 918c83f0
Loading
Loading
Loading
Loading
+17 −5
Original line number Diff line number Diff line
@@ -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)
+5 −1
Original line number Diff line number Diff line
@@ -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);
        if(!empty($etapeDonneesPersos))
        {
            $renseignerDonneesPersonnelles = ($etapeDonneesPersos->getFranchie() == 1) ? false : true;
        }

        if (!$intervenant) {
            throw new \LogicException('Intervenant introuvable');