Commit ec14e559 authored by Jean-Philippe Metivier's avatar Jean-Philippe Metivier
Browse files

Fix bug application-bloc et competence-bloc lorsque l'element est une formation

parent d6f5d143
Loading
Loading
Loading
Loading
+8 −2
Original line number Diff line number Diff line
@@ -10,6 +10,7 @@ use Application\Provider\Privilege\AgentPrivileges;
use Application\Provider\Privilege\FicheMetierPrivileges;
use Application\View\Helper\CompetenceBlocViewHelper;
use Formation\Entity\Db\Formation;
use Formation\Provider\Privilege\FormationPrivileges;

/**
 * @see \Application\View\Helper\ApplicationBlocViewHelper
@@ -39,10 +40,15 @@ $canAcquisModifier = false;
if ($objet instanceof FicheMetier) {
    $canAcquisAfficher = $this->isAllowed(FicheMetierPrivileges::getResourceId(FicheMetierPrivileges::FICHEMETIER_AFFICHER));
    $canAcquisModifier = $this->isAllowed(FicheMetierPrivileges::getResourceId(FicheMetierPrivileges::FICHEMETIER_MODIFIER));
} else {
    if ($objet instanceof Formation) {
        $canAcquisAfficher = $this->isAllowed(FormationPrivileges::getResourceId(FormationPrivileges::FORMATION_AFFICHER));
        $canAcquisModifier = $this->isAllowed(FormationPrivileges::getResourceId(FormationPrivileges::FORMATION_MODIFIER));
    } else {
        $canAcquisAfficher = $this->isAllowed($objet, AgentPrivileges::AGENT_ACQUIS_AFFICHER);
        $canAcquisModifier = $this->isAllowed($objet, AgentPrivileges::AGENT_ACQUIS_MODIFIER);
    }
}

$canAfficher        = (CompetenceBlocViewHelper::isActionActivee($options, 'afficher')  AND $canAcquisAfficher);
$canAjouter         = (CompetenceBlocViewHelper::isActionActivee($options, 'ajouter')   AND $canAcquisModifier);
+8 −2
Original line number Diff line number Diff line
@@ -12,6 +12,7 @@ use Application\Provider\Privilege\CompetencePrivileges;
use Application\Provider\Privilege\FicheMetierPrivileges;
use Application\View\Helper\CompetenceBlocViewHelper;
use Formation\Entity\Db\Formation;
use Formation\Provider\Privilege\FormationPrivileges;

/**
 * @see \Application\View\Helper\CompetenceBlocViewHelper
@@ -41,10 +42,15 @@ $canAcquisModifier = false;
if ($objet instanceof FicheMetier) {
    $canAcquisAfficher = $this->isAllowed(FicheMetierPrivileges::getResourceId(FicheMetierPrivileges::FICHEMETIER_AFFICHER));
    $canAcquisModifier = $this->isAllowed(FicheMetierPrivileges::getResourceId(FicheMetierPrivileges::FICHEMETIER_MODIFIER));
} else {
    if ($objet instanceof Formation) {
        $canAcquisAfficher = $this->isAllowed(FormationPrivileges::getResourceId(FormationPrivileges::FORMATION_AFFICHER));
        $canAcquisModifier = $this->isAllowed(FormationPrivileges::getResourceId(FormationPrivileges::FORMATION_MODIFIER));
    } else {
        $canAcquisAfficher = $this->isAllowed($objet, AgentPrivileges::AGENT_ACQUIS_AFFICHER);
        $canAcquisModifier = $this->isAllowed($objet, AgentPrivileges::AGENT_ACQUIS_MODIFIER);
    }
}

$canAfficher        = (CompetenceBlocViewHelper::isActionActivee($options, 'afficher')  AND $canAcquisAfficher);
$canAjouter         = (CompetenceBlocViewHelper::isActionActivee($options, 'ajouter')   AND $canAcquisModifier);