Loading module/Application/src/Assertion/ChargensAssertion.php +12 −2 Changes for module/Application/src/Assertion/ChargensAssertion.php: 12 added lines, 2 removed lines. Original line number Diff line number Diff line Loading @@ -111,11 +111,21 @@ class ChargensAssertion extends AbstractAssertion private function assertScenarioStructureEdition(Structure $structure = null) { /** @var Role $role */ $role = $this->getRole(); $asserts = []; if ($structure) { return $this->getAcl()->isAllowed($this->getRole(), Privileges::getResourceId(Privileges::CHARGENS_SCENARIO_COMPOSANTE_EDITION)); $asserts[] = $this->getAcl()->isAllowed($this->getRole(), Privileges::getResourceId(Privileges::CHARGENS_SCENARIO_COMPOSANTE_EDITION)); if ($role->getStructure()){ $asserts[] = $structure->inStructure($role->getStructure()); } } else { return $this->getAcl()->isAllowed($this->getRole(), Privileges::getResourceId(Privileges::CHARGENS_SCENARIO_ETABLISSEMENT_EDITION)); $asserts[] = $this->getAcl()->isAllowed($this->getRole(), Privileges::getResourceId(Privileges::CHARGENS_SCENARIO_ETABLISSEMENT_EDITION)); } return $this->asserts($asserts); } } No newline at end of file module/Application/src/Form/Chargens/FiltreForm.php +14 −14 Changes for module/Application/src/Form/Chargens/FiltreForm.php: 14 added lines, 14 removed lines. Original line number Diff line number Diff line Loading @@ -166,40 +166,33 @@ class FiltreForm extends AbstractForm { $cStructure = $this->getServiceContext()->getStructure(); if ($cStructure) { $this->structures = [$cStructure]; } else { $qb = $this->getServiceStructure()->finderByHistorique(); $this->getServiceStructure()->finderByEnseignement($qb); $this->structures = $this->getServiceStructure()->getList($qb); } $etapesSql = ' SELECT DISTINCT e.id, e.code, e.libelle, e.structure_id str.ids structure_ids FROM etape e JOIN noeud n ON n.etape_id = e.id JOIN lien l ON l.noeud_sup_id = n.id JOIN structure str ON str.id = e.structure_id WHERE e.histo_destruction IS NULL AND n.histo_destruction IS NULL AND l.histo_destruction IS NULL AND e.annee_id = ' . $this->getServiceContext()->getAnnee()->getId() . ' ' . (($s = $this->getServiceContext()->getStructure()) ? 'AND e.structure_id = ' . $s->getId() : '') . ' ' . (($s = $this->getServiceContext()->getStructure()) ? 'AND str.ids LIKE \'' . $s->idsFilter() . "'" : '') . ' ORDER BY e.libelle, e.code '; $this->etapes = []; $dEtapes = $this->getServiceEtape()->getEntityManager()->getConnection()->fetchAllAssociative($etapesSql); /*$qb = $this->getServiceEtape()->finderByHistorique(); $this->getServiceEtape()->finderByContext($qb); $this->etapes = $this->getServiceEtape()->getList($qb);*/ $qb = $this->getServiceScenario()->finderByHistorique(); $this->getServiceScenario()->finderByContext($qb); $this->scenarios = $this->getServiceScenario()->getList($qb); Loading @@ -210,16 +203,19 @@ class FiltreForm extends AbstractForm foreach ($dEtapes as $e) { $id = (int)$e['ID']; $label = $e['LIBELLE'] . ' (' . $e['CODE'] . ')'; $sid = (int)$e['STRUCTURE_ID']; $sids = explode('-', substr($e['STRUCTURE_IDS'], 1, -1)); $this->etapes[$id] = $label; foreach ($sids as $sid) { $sid = (int)$sid; if (!isset($sEtapes[$sid])) { $sEtapes[$sid] = []; } $sEtapes[$sid][] = $id; $eStructures[$id] = $sid; } } foreach ($this->scenarios as $scenario) { $sid = $scenario->getStructure() ? $scenario->getStructure()->getId() : 0; Loading @@ -231,10 +227,14 @@ class FiltreForm extends AbstractForm } foreach ($structures as $structure) { if (!isset($sScenarios[$structure->getId()])) { $sScenarios[$structure->getId()] = []; $ids = $structure->getIdsArray(); foreach ($ids as $sid) { if (!isset($sScenarios[$sid])) { $sScenarios[$sid] = []; } $sScenarios[$sid][] = $scenario->getId(); } $sScenarios[$structure->getId()][] = $scenario->getId(); } } Loading module/Application/src/Provider/Chargens/LienProvider.php +2 −2 Changes for module/Application/src/Provider/Chargens/LienProvider.php: 2 added lines, 2 removed lines. Original line number Diff line number Diff line Loading @@ -276,9 +276,9 @@ class LienProvider $cStructure = $this->chargens->getServiceContext()->getStructure(); $canEdit = false; if ($cStructure) { $structureId = $lien->getStructure(false); $lStructure = $lien->getStructure(true); if (!$structureId || $structureId == $cStructure->getId()) { if (!$lStructure || $lStructure->inStructure($cStructure)) { $canEdit = true; } } else { Loading module/Application/src/Provider/Chargens/NoeudProvider.php +2 −2 Changes for module/Application/src/Provider/Chargens/NoeudProvider.php: 2 added lines, 2 removed lines. Original line number Diff line number Diff line Loading @@ -440,9 +440,9 @@ class NoeudProvider $cStructure = $this->chargens->getServiceContext()->getStructure(); $canEdit = false; if ($cStructure) { $structureId = $noeud->getStructure(false); $nStructure = $noeud->getStructure(true); if (!$structureId || $structureId == $cStructure->getId()) { if (!$nStructure || $nStructure->inStructure($cStructure)) { $canEdit = true; } } else { Loading module/Application/src/Provider/Chargens/ScenarioNoeudProvider.php +2 −2 Changes for module/Application/src/Provider/Chargens/ScenarioNoeudProvider.php: 2 added lines, 2 removed lines. Original line number Diff line number Diff line Loading @@ -88,12 +88,12 @@ class ScenarioNoeudProvider $scenarioNoeud = $scenarioNoeuds[$scenarioNoeudId]; $typeHeures = $this->chargens->getEntities()->get(TypeHeures::class, $typeHeuresId); $etape = $this->chargens->getEntities()->get(Etape::class, $etapeId); if ($etape) { $scenarioNoeudEffectif = new ScenarioNoeudEffectif($scenarioNoeud, $typeHeures, $etape); $sneHydrator->hydrate($d, $scenarioNoeudEffectif); $scenarioNoeud->addEffectif($scenarioNoeudEffectif); } } $sns = $this->getScenarioNoeudSeuilsData($noeudIds); $snsHydrator = new ScenarioNoeudSeuilDbHydrator(); Loading Loading
module/Application/src/Assertion/ChargensAssertion.php +12 −2 Changes for module/Application/src/Assertion/ChargensAssertion.php: 12 added lines, 2 removed lines. Original line number Diff line number Diff line Loading @@ -111,11 +111,21 @@ class ChargensAssertion extends AbstractAssertion private function assertScenarioStructureEdition(Structure $structure = null) { /** @var Role $role */ $role = $this->getRole(); $asserts = []; if ($structure) { return $this->getAcl()->isAllowed($this->getRole(), Privileges::getResourceId(Privileges::CHARGENS_SCENARIO_COMPOSANTE_EDITION)); $asserts[] = $this->getAcl()->isAllowed($this->getRole(), Privileges::getResourceId(Privileges::CHARGENS_SCENARIO_COMPOSANTE_EDITION)); if ($role->getStructure()){ $asserts[] = $structure->inStructure($role->getStructure()); } } else { return $this->getAcl()->isAllowed($this->getRole(), Privileges::getResourceId(Privileges::CHARGENS_SCENARIO_ETABLISSEMENT_EDITION)); $asserts[] = $this->getAcl()->isAllowed($this->getRole(), Privileges::getResourceId(Privileges::CHARGENS_SCENARIO_ETABLISSEMENT_EDITION)); } return $this->asserts($asserts); } } No newline at end of file
module/Application/src/Form/Chargens/FiltreForm.php +14 −14 Changes for module/Application/src/Form/Chargens/FiltreForm.php: 14 added lines, 14 removed lines. Original line number Diff line number Diff line Loading @@ -166,40 +166,33 @@ class FiltreForm extends AbstractForm { $cStructure = $this->getServiceContext()->getStructure(); if ($cStructure) { $this->structures = [$cStructure]; } else { $qb = $this->getServiceStructure()->finderByHistorique(); $this->getServiceStructure()->finderByEnseignement($qb); $this->structures = $this->getServiceStructure()->getList($qb); } $etapesSql = ' SELECT DISTINCT e.id, e.code, e.libelle, e.structure_id str.ids structure_ids FROM etape e JOIN noeud n ON n.etape_id = e.id JOIN lien l ON l.noeud_sup_id = n.id JOIN structure str ON str.id = e.structure_id WHERE e.histo_destruction IS NULL AND n.histo_destruction IS NULL AND l.histo_destruction IS NULL AND e.annee_id = ' . $this->getServiceContext()->getAnnee()->getId() . ' ' . (($s = $this->getServiceContext()->getStructure()) ? 'AND e.structure_id = ' . $s->getId() : '') . ' ' . (($s = $this->getServiceContext()->getStructure()) ? 'AND str.ids LIKE \'' . $s->idsFilter() . "'" : '') . ' ORDER BY e.libelle, e.code '; $this->etapes = []; $dEtapes = $this->getServiceEtape()->getEntityManager()->getConnection()->fetchAllAssociative($etapesSql); /*$qb = $this->getServiceEtape()->finderByHistorique(); $this->getServiceEtape()->finderByContext($qb); $this->etapes = $this->getServiceEtape()->getList($qb);*/ $qb = $this->getServiceScenario()->finderByHistorique(); $this->getServiceScenario()->finderByContext($qb); $this->scenarios = $this->getServiceScenario()->getList($qb); Loading @@ -210,16 +203,19 @@ class FiltreForm extends AbstractForm foreach ($dEtapes as $e) { $id = (int)$e['ID']; $label = $e['LIBELLE'] . ' (' . $e['CODE'] . ')'; $sid = (int)$e['STRUCTURE_ID']; $sids = explode('-', substr($e['STRUCTURE_IDS'], 1, -1)); $this->etapes[$id] = $label; foreach ($sids as $sid) { $sid = (int)$sid; if (!isset($sEtapes[$sid])) { $sEtapes[$sid] = []; } $sEtapes[$sid][] = $id; $eStructures[$id] = $sid; } } foreach ($this->scenarios as $scenario) { $sid = $scenario->getStructure() ? $scenario->getStructure()->getId() : 0; Loading @@ -231,10 +227,14 @@ class FiltreForm extends AbstractForm } foreach ($structures as $structure) { if (!isset($sScenarios[$structure->getId()])) { $sScenarios[$structure->getId()] = []; $ids = $structure->getIdsArray(); foreach ($ids as $sid) { if (!isset($sScenarios[$sid])) { $sScenarios[$sid] = []; } $sScenarios[$sid][] = $scenario->getId(); } $sScenarios[$structure->getId()][] = $scenario->getId(); } } Loading
module/Application/src/Provider/Chargens/LienProvider.php +2 −2 Changes for module/Application/src/Provider/Chargens/LienProvider.php: 2 added lines, 2 removed lines. Original line number Diff line number Diff line Loading @@ -276,9 +276,9 @@ class LienProvider $cStructure = $this->chargens->getServiceContext()->getStructure(); $canEdit = false; if ($cStructure) { $structureId = $lien->getStructure(false); $lStructure = $lien->getStructure(true); if (!$structureId || $structureId == $cStructure->getId()) { if (!$lStructure || $lStructure->inStructure($cStructure)) { $canEdit = true; } } else { Loading
module/Application/src/Provider/Chargens/NoeudProvider.php +2 −2 Changes for module/Application/src/Provider/Chargens/NoeudProvider.php: 2 added lines, 2 removed lines. Original line number Diff line number Diff line Loading @@ -440,9 +440,9 @@ class NoeudProvider $cStructure = $this->chargens->getServiceContext()->getStructure(); $canEdit = false; if ($cStructure) { $structureId = $noeud->getStructure(false); $nStructure = $noeud->getStructure(true); if (!$structureId || $structureId == $cStructure->getId()) { if (!$nStructure || $nStructure->inStructure($cStructure)) { $canEdit = true; } } else { Loading
module/Application/src/Provider/Chargens/ScenarioNoeudProvider.php +2 −2 Changes for module/Application/src/Provider/Chargens/ScenarioNoeudProvider.php: 2 added lines, 2 removed lines. Original line number Diff line number Diff line Loading @@ -88,12 +88,12 @@ class ScenarioNoeudProvider $scenarioNoeud = $scenarioNoeuds[$scenarioNoeudId]; $typeHeures = $this->chargens->getEntities()->get(TypeHeures::class, $typeHeuresId); $etape = $this->chargens->getEntities()->get(Etape::class, $etapeId); if ($etape) { $scenarioNoeudEffectif = new ScenarioNoeudEffectif($scenarioNoeud, $typeHeures, $etape); $sneHydrator->hydrate($d, $scenarioNoeudEffectif); $scenarioNoeud->addEffectif($scenarioNoeudEffectif); } } $sns = $this->getScenarioNoeudSeuilsData($noeudIds); $snsHydrator = new ScenarioNoeudSeuilDbHydrator(); Loading