Loading module/Intervenant/src/Entity/Db/Statut.php +228 −225 Original line number Diff line number Diff line Loading @@ -25,14 +25,15 @@ class Statut implements ParametreEntityInterface, RoleInterface, ResourceInterfa { const CODE_AUTRES = 'AUTRES'; const CODE_NON_AUTORISE = 'NON_AUTORISE'; const ENSEIGNEMENT_MODALITE_SEMESTRIEL = 'semestriel'; const ENSEIGNEMENT_MODALITE_CALENDAIRE = 'calendaire'; const ENSEIGNEMENT_MODALITE_SEMESTRIEL = 'semestriel'; use ParametreEntityTrait; use TypeIntervenantAwareTrait; use EntityManagerAwareTrait; private ?string $code = null; private ?string $libelle = null; Loading Loading @@ -204,83 +205,83 @@ class Statut implements ParametreEntityInterface, RoleInterface, ResourceInterfa public function getResourceId() public function getLibelle (): ?string { return 'Statut'; return $this->libelle; } public function axiosDefinition(): array public function setLibelle (?string $libelle): Statut { return ['libelle', 'code']; $this->libelle = $libelle; return $this; } public function getRoleId(): string public function getResourceId () { return 'statut/' . $this->getCode(); return 'Statut'; } public function estPermanent(): bool public function axiosDefinition (): array { return $this->getTypeIntervenant()->getCode() == TypeIntervenant::CODE_PERMANENT; return ['libelle', 'code']; } public function estVacataire(): bool public function getRoleId (): string { return $this->getTypeIntervenant()->getCode() == TypeIntervenant::CODE_EXTERIEUR; return 'statut/' . $this->getCode(); } public function isNonAutorise(): bool public function getCode (): ?string { return $this->code === self::CODE_NON_AUTORISE; return $this->code; } public function isAutres(): bool public function setCode (?string $code): Statut { return $this->code === self::CODE_AUTRES; $this->code = $code; return $this; } public function getCode(): ?string public function estPermanent (): bool { return $this->code; return $this->getTypeIntervenant()->getCode() == TypeIntervenant::CODE_PERMANENT; } public function setCode(?string $code): Statut public function estVacataire (): bool { $this->code = $code; return $this; return $this->getTypeIntervenant()->getCode() == TypeIntervenant::CODE_EXTERIEUR; } public function getLibelle(): ?string public function isNonAutorise (): bool { return $this->libelle; return $this->code === self::CODE_NON_AUTORISE; } public function setLibelle(?string $libelle): Statut public function isAutres (): bool { $this->libelle = $libelle; return $this; return $this->code === self::CODE_AUTRES; } Loading Loading @@ -1522,18 +1523,31 @@ class Statut implements ParametreEntityInterface, RoleInterface, ResourceInterfa public function getModeEnseignementPrevisionnel(): ?string public function isModeEnseignementSemestriel (?TypeVolumeHoraire $typeVolumeHoraire = null): bool { return $this->modeEnseignementPrevisionnel; if ($typeVolumeHoraire instanceof TypeVolumeHoraire) { $codeTypeVolumeHoraire = $typeVolumeHoraire->getCode(); } else { $codeTypeVolumeHoraire = TypeVolumeHoraire::CODE_PREVU; } if ($codeTypeVolumeHoraire == TypeVolumeHoraire::CODE_REALISE) { $modeRealise = $this->getModeEnseignementRealise(); if ($modeRealise == self::ENSEIGNEMENT_MODALITE_SEMESTRIEL || is_null($modeRealise)) { return true; } return false; } else { $modePrevisionnel = $this->getModeEnseignementPrevisionnel(); if ($modePrevisionnel == self::ENSEIGNEMENT_MODALITE_SEMESTRIEL || is_null($modePrevisionnel)) { return true; } public function setModeEnseignementPrevisionnel(?string $mode): Statut { $this->modeEnseignementPrevisionnel = $mode; return false; } return $this; return true; } Loading @@ -1554,31 +1568,27 @@ class Statut implements ParametreEntityInterface, RoleInterface, ResourceInterfa public function isModeEnseignementSemestriel(?TypeVolumeHoraire $typeVolumeHoraire = null): bool public function getModeEnseignementPrevisionnel (): ?string { if ($typeVolumeHoraire instanceof TypeVolumeHoraire) { $codeTypeVolumeHoraire = $typeVolumeHoraire->getCode(); } else { $codeTypeVolumeHoraire = TypeVolumeHoraire::CODE_PREVU; return $this->modeEnseignementPrevisionnel; } if ($codeTypeVolumeHoraire == TypeVolumeHoraire::CODE_REALISE) { $modeRealise = $this->getModeEnseignementRealise(); if ($modeRealise == self::ENSEIGNEMENT_MODALITE_SEMESTRIEL || is_null($modeRealise)) { return true; } return false; } else { $modePrevisionnel = $this->getModeEnseignementPrevisionnel(); if ($modePrevisionnel == self::ENSEIGNEMENT_MODALITE_SEMESTRIEL || is_null($modePrevisionnel)) { return true; } return false; public function setModeEnseignementPrevisionnel (?string $mode): Statut { $this->modeEnseignementPrevisionnel = $mode; return $this; } return true; public function hasPrivilege (string $privilege): bool { $privileges = $this->getPrivileges(); return isset($privileges[$privilege]) && $privileges[$privilege]; } Loading Loading @@ -1648,6 +1658,8 @@ class Statut implements ParametreEntityInterface, RoleInterface, ResourceInterfa Privileges::MISSION_EDITION => $this->mission && $this->missionEdition, Privileges::MISSION_EDITION_REALISE => $this->mission && $this->missionRealiseEdition, Privileges::MISSION_OFFRE_EMPLOI_POSTULER => $this->offreEmploiPostuler, Privileges::MISSION_OFFRE_EMPLOI_VISUALISATION => $this->offreEmploiPostuler, ]; return $privileges; Loading @@ -1655,15 +1667,6 @@ class Statut implements ParametreEntityInterface, RoleInterface, ResourceInterfa public function hasPrivilege(string $privilege): bool { $privileges = $this->getPrivileges(); return isset($privileges[$privilege]) && $privileges[$privilege]; } /** * @return DossierAutre[] */ Loading module/Mission/src/Assertion/OffreEmploiAssertion.php +57 −59 Original line number Diff line number Diff line Loading @@ -63,6 +63,21 @@ class OffreEmploiAssertion extends AbstractAssertion protected function assertStructure (Role $role, ?Structure $structure): bool { if (!$structure) { return true; } if (!$role->getStructure()) { return true; } return $role->getStructure() == $structure; } protected function assertOffreEmploiEdition (Role $role, OffreEmploi $offre) { $haveRole = $this->haveRole(); Loading @@ -77,8 +92,31 @@ class OffreEmploiAssertion extends AbstractAssertion protected function assertOffreEmploiSupprimer(Role $role, OffreEmploi $offre) protected function haveRole () { $role = $this->getRole(); if ($role instanceof Role) { return true; } return false; } protected function assertOffreEmploi (Role $role, OffreEmploi $offre) { return $this->asserts([ $this->assertStructure($role, $offre->getStructure()), ]); } protected function assertOffreEmploiValidation (Role $role, OffreEmploi $offre) { return $this->asserts([ $this->haveRole(), $this->assertOffreEmploi($role, $offre), Loading Loading @@ -114,13 +152,16 @@ class OffreEmploiAssertion extends AbstractAssertion protected function assertOffreEmploiValidation(Role $role, OffreEmploi $offre) protected function haveIntervenant () { $role = $this->getRole(); if ($role instanceof Role) { if ($role->getIntervenant() instanceof Intervenant) { return true; } } return $this->asserts([ $this->haveRole(), $this->assertOffreEmploi($role, $offre), ]); return false; } Loading @@ -143,59 +184,16 @@ class OffreEmploiAssertion extends AbstractAssertion protected function assertOffreEmploi(Role $role, OffreEmploi $offre) protected function assertOffreEmploiSupprimer (Role $role, OffreEmploi $offre) { return $this->asserts([ $this->assertStructure($role, $offre->getStructure()), $this->haveRole(), $this->assertOffreEmploi($role, $offre), ]); } protected function assertStructure(Role $role, ?Structure $structure): bool { if (!$structure) { return true; } if (!$role->getStructure()) { return true; } $test = ($role->getStructure() == $structure); return $role->getStructure() == $structure; } protected function haveRole() { $role = $this->getRole(); if ($role instanceof Role) { return true; } return false; } protected function haveIntervenant() { $role = $this->getRole(); if ($role instanceof Role) { if ($role->getIntervenant() instanceof Intervenant) { return true; } } return false; } protected function haveCandidature () { Loading module/Mission/src/Service/CandidatureService.php +5 −4 Original line number Diff line number Diff line Loading @@ -144,12 +144,13 @@ class CandidatureService extends AbstractEntityService $subject = $this->getServiceParametres()->get($sujet); $subject = str_replace(':intervenant', $vIntervenant, $subject); $to = (!empty($intervenant->getEmailPerso())) ? : $intervenant->getEmailPro(); if (empty($to)) { $this->flashMessenger()->addErrorMessage('Le candidat n\'a pas d\'email de renseigné'); } else { if (!empty($to)) { $this->getMailService()->sendMail($to, $subject, $html); $this->flashMessenger()->addSuccessMessage('Un mail d\'information a été envoyé au candidat'); return true; } return false; } } Loading
module/Intervenant/src/Entity/Db/Statut.php +228 −225 Original line number Diff line number Diff line Loading @@ -25,14 +25,15 @@ class Statut implements ParametreEntityInterface, RoleInterface, ResourceInterfa { const CODE_AUTRES = 'AUTRES'; const CODE_NON_AUTORISE = 'NON_AUTORISE'; const ENSEIGNEMENT_MODALITE_SEMESTRIEL = 'semestriel'; const ENSEIGNEMENT_MODALITE_CALENDAIRE = 'calendaire'; const ENSEIGNEMENT_MODALITE_SEMESTRIEL = 'semestriel'; use ParametreEntityTrait; use TypeIntervenantAwareTrait; use EntityManagerAwareTrait; private ?string $code = null; private ?string $libelle = null; Loading Loading @@ -204,83 +205,83 @@ class Statut implements ParametreEntityInterface, RoleInterface, ResourceInterfa public function getResourceId() public function getLibelle (): ?string { return 'Statut'; return $this->libelle; } public function axiosDefinition(): array public function setLibelle (?string $libelle): Statut { return ['libelle', 'code']; $this->libelle = $libelle; return $this; } public function getRoleId(): string public function getResourceId () { return 'statut/' . $this->getCode(); return 'Statut'; } public function estPermanent(): bool public function axiosDefinition (): array { return $this->getTypeIntervenant()->getCode() == TypeIntervenant::CODE_PERMANENT; return ['libelle', 'code']; } public function estVacataire(): bool public function getRoleId (): string { return $this->getTypeIntervenant()->getCode() == TypeIntervenant::CODE_EXTERIEUR; return 'statut/' . $this->getCode(); } public function isNonAutorise(): bool public function getCode (): ?string { return $this->code === self::CODE_NON_AUTORISE; return $this->code; } public function isAutres(): bool public function setCode (?string $code): Statut { return $this->code === self::CODE_AUTRES; $this->code = $code; return $this; } public function getCode(): ?string public function estPermanent (): bool { return $this->code; return $this->getTypeIntervenant()->getCode() == TypeIntervenant::CODE_PERMANENT; } public function setCode(?string $code): Statut public function estVacataire (): bool { $this->code = $code; return $this; return $this->getTypeIntervenant()->getCode() == TypeIntervenant::CODE_EXTERIEUR; } public function getLibelle(): ?string public function isNonAutorise (): bool { return $this->libelle; return $this->code === self::CODE_NON_AUTORISE; } public function setLibelle(?string $libelle): Statut public function isAutres (): bool { $this->libelle = $libelle; return $this; return $this->code === self::CODE_AUTRES; } Loading Loading @@ -1522,18 +1523,31 @@ class Statut implements ParametreEntityInterface, RoleInterface, ResourceInterfa public function getModeEnseignementPrevisionnel(): ?string public function isModeEnseignementSemestriel (?TypeVolumeHoraire $typeVolumeHoraire = null): bool { return $this->modeEnseignementPrevisionnel; if ($typeVolumeHoraire instanceof TypeVolumeHoraire) { $codeTypeVolumeHoraire = $typeVolumeHoraire->getCode(); } else { $codeTypeVolumeHoraire = TypeVolumeHoraire::CODE_PREVU; } if ($codeTypeVolumeHoraire == TypeVolumeHoraire::CODE_REALISE) { $modeRealise = $this->getModeEnseignementRealise(); if ($modeRealise == self::ENSEIGNEMENT_MODALITE_SEMESTRIEL || is_null($modeRealise)) { return true; } return false; } else { $modePrevisionnel = $this->getModeEnseignementPrevisionnel(); if ($modePrevisionnel == self::ENSEIGNEMENT_MODALITE_SEMESTRIEL || is_null($modePrevisionnel)) { return true; } public function setModeEnseignementPrevisionnel(?string $mode): Statut { $this->modeEnseignementPrevisionnel = $mode; return false; } return $this; return true; } Loading @@ -1554,31 +1568,27 @@ class Statut implements ParametreEntityInterface, RoleInterface, ResourceInterfa public function isModeEnseignementSemestriel(?TypeVolumeHoraire $typeVolumeHoraire = null): bool public function getModeEnseignementPrevisionnel (): ?string { if ($typeVolumeHoraire instanceof TypeVolumeHoraire) { $codeTypeVolumeHoraire = $typeVolumeHoraire->getCode(); } else { $codeTypeVolumeHoraire = TypeVolumeHoraire::CODE_PREVU; return $this->modeEnseignementPrevisionnel; } if ($codeTypeVolumeHoraire == TypeVolumeHoraire::CODE_REALISE) { $modeRealise = $this->getModeEnseignementRealise(); if ($modeRealise == self::ENSEIGNEMENT_MODALITE_SEMESTRIEL || is_null($modeRealise)) { return true; } return false; } else { $modePrevisionnel = $this->getModeEnseignementPrevisionnel(); if ($modePrevisionnel == self::ENSEIGNEMENT_MODALITE_SEMESTRIEL || is_null($modePrevisionnel)) { return true; } return false; public function setModeEnseignementPrevisionnel (?string $mode): Statut { $this->modeEnseignementPrevisionnel = $mode; return $this; } return true; public function hasPrivilege (string $privilege): bool { $privileges = $this->getPrivileges(); return isset($privileges[$privilege]) && $privileges[$privilege]; } Loading Loading @@ -1648,6 +1658,8 @@ class Statut implements ParametreEntityInterface, RoleInterface, ResourceInterfa Privileges::MISSION_EDITION => $this->mission && $this->missionEdition, Privileges::MISSION_EDITION_REALISE => $this->mission && $this->missionRealiseEdition, Privileges::MISSION_OFFRE_EMPLOI_POSTULER => $this->offreEmploiPostuler, Privileges::MISSION_OFFRE_EMPLOI_VISUALISATION => $this->offreEmploiPostuler, ]; return $privileges; Loading @@ -1655,15 +1667,6 @@ class Statut implements ParametreEntityInterface, RoleInterface, ResourceInterfa public function hasPrivilege(string $privilege): bool { $privileges = $this->getPrivileges(); return isset($privileges[$privilege]) && $privileges[$privilege]; } /** * @return DossierAutre[] */ Loading
module/Mission/src/Assertion/OffreEmploiAssertion.php +57 −59 Original line number Diff line number Diff line Loading @@ -63,6 +63,21 @@ class OffreEmploiAssertion extends AbstractAssertion protected function assertStructure (Role $role, ?Structure $structure): bool { if (!$structure) { return true; } if (!$role->getStructure()) { return true; } return $role->getStructure() == $structure; } protected function assertOffreEmploiEdition (Role $role, OffreEmploi $offre) { $haveRole = $this->haveRole(); Loading @@ -77,8 +92,31 @@ class OffreEmploiAssertion extends AbstractAssertion protected function assertOffreEmploiSupprimer(Role $role, OffreEmploi $offre) protected function haveRole () { $role = $this->getRole(); if ($role instanceof Role) { return true; } return false; } protected function assertOffreEmploi (Role $role, OffreEmploi $offre) { return $this->asserts([ $this->assertStructure($role, $offre->getStructure()), ]); } protected function assertOffreEmploiValidation (Role $role, OffreEmploi $offre) { return $this->asserts([ $this->haveRole(), $this->assertOffreEmploi($role, $offre), Loading Loading @@ -114,13 +152,16 @@ class OffreEmploiAssertion extends AbstractAssertion protected function assertOffreEmploiValidation(Role $role, OffreEmploi $offre) protected function haveIntervenant () { $role = $this->getRole(); if ($role instanceof Role) { if ($role->getIntervenant() instanceof Intervenant) { return true; } } return $this->asserts([ $this->haveRole(), $this->assertOffreEmploi($role, $offre), ]); return false; } Loading @@ -143,59 +184,16 @@ class OffreEmploiAssertion extends AbstractAssertion protected function assertOffreEmploi(Role $role, OffreEmploi $offre) protected function assertOffreEmploiSupprimer (Role $role, OffreEmploi $offre) { return $this->asserts([ $this->assertStructure($role, $offre->getStructure()), $this->haveRole(), $this->assertOffreEmploi($role, $offre), ]); } protected function assertStructure(Role $role, ?Structure $structure): bool { if (!$structure) { return true; } if (!$role->getStructure()) { return true; } $test = ($role->getStructure() == $structure); return $role->getStructure() == $structure; } protected function haveRole() { $role = $this->getRole(); if ($role instanceof Role) { return true; } return false; } protected function haveIntervenant() { $role = $this->getRole(); if ($role instanceof Role) { if ($role->getIntervenant() instanceof Intervenant) { return true; } } return false; } protected function haveCandidature () { Loading
module/Mission/src/Service/CandidatureService.php +5 −4 Original line number Diff line number Diff line Loading @@ -144,12 +144,13 @@ class CandidatureService extends AbstractEntityService $subject = $this->getServiceParametres()->get($sujet); $subject = str_replace(':intervenant', $vIntervenant, $subject); $to = (!empty($intervenant->getEmailPerso())) ? : $intervenant->getEmailPro(); if (empty($to)) { $this->flashMessenger()->addErrorMessage('Le candidat n\'a pas d\'email de renseigné'); } else { if (!empty($to)) { $this->getMailService()->sendMail($to, $subject, $html); $this->flashMessenger()->addSuccessMessage('Un mail d\'information a été envoyé au candidat'); return true; } return false; } }