Loading data/ddl/ref-constraint/PLAFOND_STATUT_STATUT_FK.php +1 −1 Changes for data/ddl/ref-constraint/PLAFOND_STATUT_STATUT_FK.php: 1 added line, 1 removed line. Original line number Diff line number Diff line Loading @@ -6,7 +6,7 @@ return [ 'name' => 'PLAFOND_STATUT_STATUT_FK', 'table' => 'PLAFOND_STATUT', 'rtable' => 'STATUT', 'delete_rule' => NULL, 'delete_rule' => 'CASCADE', 'index' => NULL, 'columns' => [ 'STATUT_ID' => 'ID', Loading module/Application/src/Controller/DroitsController.php +3 −21 Changes for module/Application/src/Controller/DroitsController.php: 3 added lines, 21 removed lines. Original line number Diff line number Diff line Loading @@ -128,42 +128,24 @@ class DroitsController extends AbstractController public function privilegesAction() { $filters = []; if ($categorieFilter = $this->params()->fromQuery('cat')) { $filters['cat'] = $categorieFilter; } if ($rsFilter = $this->params()->fromQuery('rs')) { $filters['rs'] = $rsFilter; } $ps = $this->getServicePrivilege()->getList(); $privileges = []; foreach ($ps as $privilege) { $categorie = $privilege->getCategorie(); $ok = true; if ($categorieFilter && $categorieFilter != $categorie->getCode()) $ok = false; if ($ok) { if (!isset($privileges[$categorie->getCode()])) { $privileges[$categorie->getCode()] = [ 'categorie' => $categorie, 'categorieLink' => $this->url()->fromRoute(null, [], ['query' => $filters + ['cat' => $categorie->getCode()]], true), 'privileges' => [], ]; } $privileges[$categorie->getCode()]['privileges'][] = $privilege; } } if ($rsFilter == 'r' || !$rsFilter) { $qb = $this->getServiceRole()->finderByHistorique(); $roles = $this->getServiceRole()->getList($qb); } else { $roles = []; } $dql = "SELECT r FROM " . Role::class . " r WHERE r.histoDestruction IS NULL AND r.code <> :roleAdmin ORDER BY r.libelle"; $roles = $this->em()->createQuery($dql)->setParameter('roleAdmin', Role::ADMINISTRATEUR)->getResult(); return compact('privileges', 'roles', 'filters'); return compact('privileges', 'roles'); } Loading module/Application/src/Controller/ServiceController.php +5 −3 Changes for module/Application/src/Controller/ServiceController.php: 5 added lines, 3 removed lines. Original line number Diff line number Diff line Loading @@ -5,6 +5,7 @@ namespace Application\Controller; use Application\Entity\Db\ElementPedagogique; use Application\Entity\Db\Service; use Application\Entity\Db\Validation; use Application\Form\Service\Saisie; use Application\Form\Service\Traits\RechercheFormAwareTrait; use Application\Form\Service\Traits\SaisieAwareTrait; use Plafond\Processus\PlafondProcessusAwareTrait; Loading Loading @@ -522,14 +523,15 @@ class ServiceController extends AbstractController try { $entity = $service->save($entity); $form->get('service')->get('id')->setValue($entity->getId()); // transmet le nouvel ID } catch (\Exception $e) { $this->flashMessenger()->addErrorMessage($this->translate($e)); } $hFin = $entity->getVolumeHoraireListe()->getHeures(); $this->updateTableauxBord($entity->getIntervenant()); if (!$this->getProcessusPlafond()->endTransaction($entity->getIntervenant(), $typeVolumeHoraire, $hFin < $hDeb)) { $this->updateTableauxBord($entity->getIntervenant()); } } catch (\Exception $e) { $this->flashMessenger()->addErrorMessage($this->translate($e)); $this->em()->rollback(); } } } else { $this->flashMessenger()->addErrorMessage('La validation du formulaire a échoué. L\'enregistrement des données n\'a donc pas été fait.'); Loading module/Intervenant/config/module.config.php +4 −4 Changes for module/Intervenant/config/module.config.php: 4 added lines, 4 removed lines. Original line number Diff line number Diff line Loading @@ -31,9 +31,9 @@ return [ 'route' => '/trier', 'action' => 'trier', ], 'clone' => [ 'route' => '/clone/:statut', 'action' => 'clone', 'dupliquer' => [ 'route' => '/dupliquer/:statut', 'action' => 'dupliquer', 'constraints' => [ 'statut' => '[0-9]*', ], Loading Loading @@ -62,7 +62,7 @@ return [ ], [ 'controller' => 'Intervenant\Controller\Statut', 'action' => ['delete', 'trier', 'clone'], 'action' => ['delete', 'trier', 'dupliquer'], 'privileges' => [Privileges::INTERVENANT_STATUT_EDITION], ], ], Loading module/Intervenant/src/Controller/StatutController.php +19 −32 Changes for module/Intervenant/src/Controller/StatutController.php: 19 added lines, 32 removed lines. Original line number Diff line number Diff line Loading @@ -7,10 +7,12 @@ use Application\Controller\AbstractController; use Application\Service\Traits\ContextServiceAwareTrait; use Intervenant\Entity\Db\Statut; use Application\Provider\Privilege\Privileges; use Intervenant\Form\StatutSaisieForm; use Intervenant\Form\StatutSaisieFormAwareTrait; use Application\Provider\Role\RoleProvider; use Application\Service\Traits\DossierAutreServiceAwareTrait; use Intervenant\Service\StatutServiceAwareTrait; use Plafond\Form\PlafondConfigFormAwareTrait; use Plafond\Service\PlafondServiceAwareTrait; use UnicaenApp\View\Model\MessengerViewModel; use Intervenant\Service\TypeIntervenantServiceAwareTrait; Loading @@ -26,6 +28,7 @@ class StatutController extends AbstractController use DossierAutreServiceAwareTrait; use ContextServiceAwareTrait; use PlafondServiceAwareTrait; use PlafondConfigFormAwareTrait; public function indexAction() { Loading Loading @@ -73,57 +76,42 @@ class StatutController extends AbstractController $canEdit = $this->isAllowed($statut, Privileges::INTERVENANT_STATUT_EDITION); if ($canEdit) { $form->bindRequestSave($statut, $this->getRequest(), function (Statut $si) use ($plafonds) { try { $request = $this->getRequest(); $form->bindRequestSave($statut, $request, function (Statut $si) use ($plafonds, $request) { $isNew = !$si->getId(); $this->getServiceStatut()->save($si); foreach ($plafonds as $plafond) { $this->getServicePlafond()->saveConfig($plafond); } $this->getFormPlafondConfig()->requestSaveConfigs($plafonds, $request); unset($this->getCacheContainer(RoleProvider::class)->statutsInfo); $this->flashMessenger()->addSuccessMessage('Enregistrement effectué'); if ($isNew) { $this->redirect()->toRoute('statut/saisie', ['statut' => $si->getId()]); } } catch (\Exception $e) { $this->flashMessenger()->addErrorMessage($this->translate($e)); } }); } else { $form->bind($statut); $form->readOnly(); } return compact('typesIntervenants', 'canEdit', 'statut', 'statuts', 'form', 'title', 'plafonds'); $vm = new ViewModel(); $vm->setTemplate('intervenant/statut/saisie'); $vm->setVariables(compact('typesIntervenants', 'canEdit', 'statut', 'statuts', 'form', 'title', 'plafonds')); return $vm; } public function cloneAction() public function dupliquerAction() { /* @var $statut Statut */ $statut = $this->getEvent()->getParam('statut'); $newStatut = $statut->dupliquer(); $newStatut->setOrdre($this->getServiceStatut()->fetchMaxOrdre() + 1); $form = $this->getFormStatutSaisie(); $title = 'Duplication d\'un statut d\'intervenant'; $champsAutres = $this->getServiceDossierAutre()->getList(); $vm = $this->saisieAction(); $form->bindRequestSave($newStatut, $this->getRequest(), function (Statut $si) { try { $this->getServiceStatut()->save($si); unset($this->getCacheContainer(RoleProvider::class)->statutsInfo); $this->flashMessenger()->addSuccessMessage('Duplication effectuée'); } catch (\Exception $e) { $this->flashMessenger()->addErrorMessage($this->translate($e)); } }); /** @var StatutSaisieForm $form */ $form = $vm->getVariable('form'); $form->setAttribute('action', $this->url()->fromRoute('statut/saisie')); $form->get('code')->setValue(null); $form->get('libelle')->setValue($form->get('libelle')->getValue() . ' (Copie)'); $viewModel = new ViewModel(); $viewModel->setVariables(compact('form', 'title')); $viewModel->setTemplate('application/statut/saisie'); return $viewModel; return $vm; } Loading @@ -134,7 +122,6 @@ class StatutController extends AbstractController $canEdit = $this->isAllowed(Privileges::getResourceId(Privileges::INTERVENANT_STATUT_EDITION)); if (!$canEdit) { $this->flashMessenger()->addErrorMessage('Statut non modifiable : droit non accordé, car vous n\'avez pas le privilège pour cela ou bien le statut est synchronisé depuis un autre logiciel'); } else { Loading Loading
data/ddl/ref-constraint/PLAFOND_STATUT_STATUT_FK.php +1 −1 Changes for data/ddl/ref-constraint/PLAFOND_STATUT_STATUT_FK.php: 1 added line, 1 removed line. Original line number Diff line number Diff line Loading @@ -6,7 +6,7 @@ return [ 'name' => 'PLAFOND_STATUT_STATUT_FK', 'table' => 'PLAFOND_STATUT', 'rtable' => 'STATUT', 'delete_rule' => NULL, 'delete_rule' => 'CASCADE', 'index' => NULL, 'columns' => [ 'STATUT_ID' => 'ID', Loading
module/Application/src/Controller/DroitsController.php +3 −21 Changes for module/Application/src/Controller/DroitsController.php: 3 added lines, 21 removed lines. Original line number Diff line number Diff line Loading @@ -128,42 +128,24 @@ class DroitsController extends AbstractController public function privilegesAction() { $filters = []; if ($categorieFilter = $this->params()->fromQuery('cat')) { $filters['cat'] = $categorieFilter; } if ($rsFilter = $this->params()->fromQuery('rs')) { $filters['rs'] = $rsFilter; } $ps = $this->getServicePrivilege()->getList(); $privileges = []; foreach ($ps as $privilege) { $categorie = $privilege->getCategorie(); $ok = true; if ($categorieFilter && $categorieFilter != $categorie->getCode()) $ok = false; if ($ok) { if (!isset($privileges[$categorie->getCode()])) { $privileges[$categorie->getCode()] = [ 'categorie' => $categorie, 'categorieLink' => $this->url()->fromRoute(null, [], ['query' => $filters + ['cat' => $categorie->getCode()]], true), 'privileges' => [], ]; } $privileges[$categorie->getCode()]['privileges'][] = $privilege; } } if ($rsFilter == 'r' || !$rsFilter) { $qb = $this->getServiceRole()->finderByHistorique(); $roles = $this->getServiceRole()->getList($qb); } else { $roles = []; } $dql = "SELECT r FROM " . Role::class . " r WHERE r.histoDestruction IS NULL AND r.code <> :roleAdmin ORDER BY r.libelle"; $roles = $this->em()->createQuery($dql)->setParameter('roleAdmin', Role::ADMINISTRATEUR)->getResult(); return compact('privileges', 'roles', 'filters'); return compact('privileges', 'roles'); } Loading
module/Application/src/Controller/ServiceController.php +5 −3 Changes for module/Application/src/Controller/ServiceController.php: 5 added lines, 3 removed lines. Original line number Diff line number Diff line Loading @@ -5,6 +5,7 @@ namespace Application\Controller; use Application\Entity\Db\ElementPedagogique; use Application\Entity\Db\Service; use Application\Entity\Db\Validation; use Application\Form\Service\Saisie; use Application\Form\Service\Traits\RechercheFormAwareTrait; use Application\Form\Service\Traits\SaisieAwareTrait; use Plafond\Processus\PlafondProcessusAwareTrait; Loading Loading @@ -522,14 +523,15 @@ class ServiceController extends AbstractController try { $entity = $service->save($entity); $form->get('service')->get('id')->setValue($entity->getId()); // transmet le nouvel ID } catch (\Exception $e) { $this->flashMessenger()->addErrorMessage($this->translate($e)); } $hFin = $entity->getVolumeHoraireListe()->getHeures(); $this->updateTableauxBord($entity->getIntervenant()); if (!$this->getProcessusPlafond()->endTransaction($entity->getIntervenant(), $typeVolumeHoraire, $hFin < $hDeb)) { $this->updateTableauxBord($entity->getIntervenant()); } } catch (\Exception $e) { $this->flashMessenger()->addErrorMessage($this->translate($e)); $this->em()->rollback(); } } } else { $this->flashMessenger()->addErrorMessage('La validation du formulaire a échoué. L\'enregistrement des données n\'a donc pas été fait.'); Loading
module/Intervenant/config/module.config.php +4 −4 Changes for module/Intervenant/config/module.config.php: 4 added lines, 4 removed lines. Original line number Diff line number Diff line Loading @@ -31,9 +31,9 @@ return [ 'route' => '/trier', 'action' => 'trier', ], 'clone' => [ 'route' => '/clone/:statut', 'action' => 'clone', 'dupliquer' => [ 'route' => '/dupliquer/:statut', 'action' => 'dupliquer', 'constraints' => [ 'statut' => '[0-9]*', ], Loading Loading @@ -62,7 +62,7 @@ return [ ], [ 'controller' => 'Intervenant\Controller\Statut', 'action' => ['delete', 'trier', 'clone'], 'action' => ['delete', 'trier', 'dupliquer'], 'privileges' => [Privileges::INTERVENANT_STATUT_EDITION], ], ], Loading
module/Intervenant/src/Controller/StatutController.php +19 −32 Changes for module/Intervenant/src/Controller/StatutController.php: 19 added lines, 32 removed lines. Original line number Diff line number Diff line Loading @@ -7,10 +7,12 @@ use Application\Controller\AbstractController; use Application\Service\Traits\ContextServiceAwareTrait; use Intervenant\Entity\Db\Statut; use Application\Provider\Privilege\Privileges; use Intervenant\Form\StatutSaisieForm; use Intervenant\Form\StatutSaisieFormAwareTrait; use Application\Provider\Role\RoleProvider; use Application\Service\Traits\DossierAutreServiceAwareTrait; use Intervenant\Service\StatutServiceAwareTrait; use Plafond\Form\PlafondConfigFormAwareTrait; use Plafond\Service\PlafondServiceAwareTrait; use UnicaenApp\View\Model\MessengerViewModel; use Intervenant\Service\TypeIntervenantServiceAwareTrait; Loading @@ -26,6 +28,7 @@ class StatutController extends AbstractController use DossierAutreServiceAwareTrait; use ContextServiceAwareTrait; use PlafondServiceAwareTrait; use PlafondConfigFormAwareTrait; public function indexAction() { Loading Loading @@ -73,57 +76,42 @@ class StatutController extends AbstractController $canEdit = $this->isAllowed($statut, Privileges::INTERVENANT_STATUT_EDITION); if ($canEdit) { $form->bindRequestSave($statut, $this->getRequest(), function (Statut $si) use ($plafonds) { try { $request = $this->getRequest(); $form->bindRequestSave($statut, $request, function (Statut $si) use ($plafonds, $request) { $isNew = !$si->getId(); $this->getServiceStatut()->save($si); foreach ($plafonds as $plafond) { $this->getServicePlafond()->saveConfig($plafond); } $this->getFormPlafondConfig()->requestSaveConfigs($plafonds, $request); unset($this->getCacheContainer(RoleProvider::class)->statutsInfo); $this->flashMessenger()->addSuccessMessage('Enregistrement effectué'); if ($isNew) { $this->redirect()->toRoute('statut/saisie', ['statut' => $si->getId()]); } } catch (\Exception $e) { $this->flashMessenger()->addErrorMessage($this->translate($e)); } }); } else { $form->bind($statut); $form->readOnly(); } return compact('typesIntervenants', 'canEdit', 'statut', 'statuts', 'form', 'title', 'plafonds'); $vm = new ViewModel(); $vm->setTemplate('intervenant/statut/saisie'); $vm->setVariables(compact('typesIntervenants', 'canEdit', 'statut', 'statuts', 'form', 'title', 'plafonds')); return $vm; } public function cloneAction() public function dupliquerAction() { /* @var $statut Statut */ $statut = $this->getEvent()->getParam('statut'); $newStatut = $statut->dupliquer(); $newStatut->setOrdre($this->getServiceStatut()->fetchMaxOrdre() + 1); $form = $this->getFormStatutSaisie(); $title = 'Duplication d\'un statut d\'intervenant'; $champsAutres = $this->getServiceDossierAutre()->getList(); $vm = $this->saisieAction(); $form->bindRequestSave($newStatut, $this->getRequest(), function (Statut $si) { try { $this->getServiceStatut()->save($si); unset($this->getCacheContainer(RoleProvider::class)->statutsInfo); $this->flashMessenger()->addSuccessMessage('Duplication effectuée'); } catch (\Exception $e) { $this->flashMessenger()->addErrorMessage($this->translate($e)); } }); /** @var StatutSaisieForm $form */ $form = $vm->getVariable('form'); $form->setAttribute('action', $this->url()->fromRoute('statut/saisie')); $form->get('code')->setValue(null); $form->get('libelle')->setValue($form->get('libelle')->getValue() . ' (Copie)'); $viewModel = new ViewModel(); $viewModel->setVariables(compact('form', 'title')); $viewModel->setTemplate('application/statut/saisie'); return $viewModel; return $vm; } Loading @@ -134,7 +122,6 @@ class StatutController extends AbstractController $canEdit = $this->isAllowed(Privileges::getResourceId(Privileges::INTERVENANT_STATUT_EDITION)); if (!$canEdit) { $this->flashMessenger()->addErrorMessage('Statut non modifiable : droit non accordé, car vous n\'avez pas le privilège pour cela ou bien le statut est synchronisé depuis un autre logiciel'); } else { Loading