Loading module/Administration/src/DataSource/DataSource.php +7 −6 Original line number Diff line number Diff line Loading @@ -2,6 +2,7 @@ namespace Administration\DataSource; use Application\Entity\Db\Annee; use Application\Entity\Db\Perimetre; use Unicaen\BddAdmin\BddAwareTrait; use Workflow\Entity\Db\WorkflowEtapeDependance; Loading Loading @@ -176,7 +177,7 @@ class DataSource $data = $donneesParDefaut['STATUT']; $statuts = []; for ($a = 2010; $a <= 2099; $a++) { for ($a = Annee::MIN_DATA; $a <= Annee::MAX; $a++) { foreach ($data as $d) { $d['ANNEE_ID'] = $a; $d['HISTO_MODIFICATEUR_ID'] = null; Loading @@ -195,7 +196,7 @@ class DataSource $data = $donneesParDefaut['FONCTION_REFERENTIEL']; $fonctions = []; for ($a = 2010; $a <= 2099; $a++) { for ($a = Annee::MIN_DATA; $a <= Annee::MAX; $a++) { foreach ($data as $d) { $d['ANNEE_ID'] = $a; $d['HISTO_MODIFICATEUR_ID'] = null; Loading @@ -214,7 +215,7 @@ class DataSource $data = $donneesParDefaut['TYPE_PIECE_JOINTE_STATUT']; $statuts = []; for ($a = 2010; $a <= 2099; $a++) { for ($a = Annee::MIN_DATA; $a <= Annee::MAX; $a++) { foreach ($data as $d) { $d['ANNEE_ID'] = $a; $d['HISTO_MODIFICATEUR_ID'] = null; Loading Loading @@ -347,7 +348,7 @@ class DataSource $tms = []; for ($a = 2010; $a <= 2099; $a++) { for ($a = Annee::MIN_DATA; $a <= Annee::MAX; $a++) { foreach ($data as $code => $tm) { $tms[] = [ 'CODE' => $code, Loading Loading @@ -433,7 +434,7 @@ class DataSource 'histo_modificateur_id' => null, ]; for ($a = 2010; $a <= 2099; $a++) { for ($a = Annee::MIN_DATA; $a <= Annee::MAX; $a++) { $edata['annee_id'] = $a; mpg_upper($edata); $etapes[] = $edata; Loading Loading @@ -463,7 +464,7 @@ class DataSource 'histo_modificateur_id' => null, ]; for ($a = 2010; $a <= 2099; $a++) { for ($a = Annee::MIN_DATA; $a <= Annee::MAX; $a++) { $ndep = $dep; $ndep['etape_suivante_id'] .= '-'.(string)$a; $ndep['etape_precedante_id'] .= '-'.(string)$a; Loading module/Application/src/Entity/Db/Annee.php +1 −0 Original line number Diff line number Diff line Loading @@ -8,6 +8,7 @@ namespace Application\Entity\Db; class Annee { const MIN = 1950; const MIN_DATA = 2010; const MAX = 2099; /** Loading module/Workflow/src/Command/WorkflowResetCommand.php +22 −16 Original line number Diff line number Diff line Loading @@ -30,8 +30,11 @@ class WorkflowResetCommand extends Command { $io = new SymfonyStyle($input, $output); $bdd = $this->getBdd()->setLogger($io); $io->title($this->getDescription()); $confirmed = $io->confirm('Êtes-vous sûr de vouloir réinitialiser le workflow ?', false); if ($confirmed) { try { $bdd->data()->addAction('workflow-reset', 'Réinitialisation du workflow'); Loading @@ -47,7 +50,10 @@ class WorkflowResetCommand extends Command $io->error($e->getMessage()); return Command::FAILURE; } return Command::SUCCESS; } else { $io->warning('Opération annulée.'); return Command::FAILURE; } } } No newline at end of file module/Workflow/src/Service/WorkflowService.php +33 −6 Original line number Diff line number Diff line Loading @@ -27,7 +27,7 @@ use Workflow\Model\FeuilleDeRoute; */ class WorkflowService extends AbstractService { const ETAPES_CACHE_ID = 'Workflow_Service_WorkflowService_getEtapes'; const string ETAPES_CACHE_ID = 'Workflow_Service_getEtapes'; use ContextServiceAwareTrait; use EntityManagerAwareTrait; Loading Loading @@ -57,9 +57,15 @@ class WorkflowService extends AbstractService /** * @return array|WorkflowEtape[] */ public function getEtapes(): array public function getEtapes(Annee|int|null $annee = null): array { if ($annee instanceof Annee) { $anneeId = $annee->getId(); } elseif (isset($annee)) { $anneeId = $annee; } else { $anneeId = $this->getServiceContext()->getAnnee()->getId(); } if (empty($this->workflowEtapes)) { $this->workflowEtapes = []; Loading Loading @@ -113,7 +119,7 @@ class WorkflowService extends AbstractService $cache = $em->getConfiguration()->getResultCache(); $items = []; for( $a=2010;$a<=Annee::MAX;$a++){ for ($a = Annee::MIN_DATA; $a <= Annee::MAX; $a++) { $items[] = self::ETAPES_CACHE_ID . '_' . $a; } $cache->deleteItems($items); Loading Loading @@ -262,6 +268,7 @@ class WorkflowService extends AbstractService * @param Intervenant|null $intervenant * @param Structure|null $structure * @return WorkflowEtape * @deprecated */ public function getPreviousAccessibleEtape($etape, ?Intervenant $intervenant = null, ?Structure $structure = null) { Loading @@ -283,6 +290,13 @@ class WorkflowService extends AbstractService /** * @param $etape * @param Intervenant|null $intervenant * @param Structure|null $structure * @return array * @deprecated */ protected function prepareEtapeParams($etape, ?Intervenant $intervenant = null, ?Structure $structure = null) { switch (true) { Loading Loading @@ -332,6 +346,7 @@ class WorkflowService extends AbstractService * @param Structure|null $structure * * @return WorkflowEtape|null * @deprecated */ public function getEtapeCourante(?Intervenant $intervenant = null, ?Structure $structure = null) { Loading @@ -352,6 +367,7 @@ class WorkflowService extends AbstractService * @param Structure|null $structure * * @return WorkflowEtape[] * @deprecated */ public function getFeuilleDeRouteOld(?Intervenant $intervenant = null, ?Structure $structure = null) { Loading Loading @@ -408,6 +424,7 @@ class WorkflowService extends AbstractService * @param Intervenant|null $intervenant * * @return TblWorkflow[] * @deprecated */ protected function getEtapesOld(Intervenant $intervenant, ?Structure $structure = null, bool $calcIfEmpty = true) { Loading Loading @@ -546,6 +563,7 @@ class WorkflowService extends AbstractService * @param Structure|null $structure * * @return WorkflowEtape * @deprecated */ public function getEtape($etape, ?Intervenant $intervenant = null, ?Structure $structure = null) { Loading Loading @@ -574,6 +592,7 @@ class WorkflowService extends AbstractService /** * @param $data WorkflowEtape[] * @deprecated */ protected function calculEtats($data) { Loading Loading @@ -615,6 +634,7 @@ class WorkflowService extends AbstractService * @param Structure|null $structure * * @return WorkflowEtape * @deprecated */ public function getNextEtape($etape, ?Intervenant $intervenant = null, ?Structure $structure = null) { Loading @@ -636,6 +656,12 @@ class WorkflowService extends AbstractService /** * @param $etape * @return bool * @throws \Exception * @deprecated */ public function isAllowed($etape) { if ($etape instanceof WorkflowEtape) { Loading @@ -658,6 +684,7 @@ class WorkflowService extends AbstractService * @param Structure|null $structure * * @return WorkflowEtape * @deprecated */ public function getNextAccessibleEtape($etape, ?Intervenant $intervenant = null, ?Structure $structure = null) { Loading Loading
module/Administration/src/DataSource/DataSource.php +7 −6 Original line number Diff line number Diff line Loading @@ -2,6 +2,7 @@ namespace Administration\DataSource; use Application\Entity\Db\Annee; use Application\Entity\Db\Perimetre; use Unicaen\BddAdmin\BddAwareTrait; use Workflow\Entity\Db\WorkflowEtapeDependance; Loading Loading @@ -176,7 +177,7 @@ class DataSource $data = $donneesParDefaut['STATUT']; $statuts = []; for ($a = 2010; $a <= 2099; $a++) { for ($a = Annee::MIN_DATA; $a <= Annee::MAX; $a++) { foreach ($data as $d) { $d['ANNEE_ID'] = $a; $d['HISTO_MODIFICATEUR_ID'] = null; Loading @@ -195,7 +196,7 @@ class DataSource $data = $donneesParDefaut['FONCTION_REFERENTIEL']; $fonctions = []; for ($a = 2010; $a <= 2099; $a++) { for ($a = Annee::MIN_DATA; $a <= Annee::MAX; $a++) { foreach ($data as $d) { $d['ANNEE_ID'] = $a; $d['HISTO_MODIFICATEUR_ID'] = null; Loading @@ -214,7 +215,7 @@ class DataSource $data = $donneesParDefaut['TYPE_PIECE_JOINTE_STATUT']; $statuts = []; for ($a = 2010; $a <= 2099; $a++) { for ($a = Annee::MIN_DATA; $a <= Annee::MAX; $a++) { foreach ($data as $d) { $d['ANNEE_ID'] = $a; $d['HISTO_MODIFICATEUR_ID'] = null; Loading Loading @@ -347,7 +348,7 @@ class DataSource $tms = []; for ($a = 2010; $a <= 2099; $a++) { for ($a = Annee::MIN_DATA; $a <= Annee::MAX; $a++) { foreach ($data as $code => $tm) { $tms[] = [ 'CODE' => $code, Loading Loading @@ -433,7 +434,7 @@ class DataSource 'histo_modificateur_id' => null, ]; for ($a = 2010; $a <= 2099; $a++) { for ($a = Annee::MIN_DATA; $a <= Annee::MAX; $a++) { $edata['annee_id'] = $a; mpg_upper($edata); $etapes[] = $edata; Loading Loading @@ -463,7 +464,7 @@ class DataSource 'histo_modificateur_id' => null, ]; for ($a = 2010; $a <= 2099; $a++) { for ($a = Annee::MIN_DATA; $a <= Annee::MAX; $a++) { $ndep = $dep; $ndep['etape_suivante_id'] .= '-'.(string)$a; $ndep['etape_precedante_id'] .= '-'.(string)$a; Loading
module/Application/src/Entity/Db/Annee.php +1 −0 Original line number Diff line number Diff line Loading @@ -8,6 +8,7 @@ namespace Application\Entity\Db; class Annee { const MIN = 1950; const MIN_DATA = 2010; const MAX = 2099; /** Loading
module/Workflow/src/Command/WorkflowResetCommand.php +22 −16 Original line number Diff line number Diff line Loading @@ -30,8 +30,11 @@ class WorkflowResetCommand extends Command { $io = new SymfonyStyle($input, $output); $bdd = $this->getBdd()->setLogger($io); $io->title($this->getDescription()); $confirmed = $io->confirm('Êtes-vous sûr de vouloir réinitialiser le workflow ?', false); if ($confirmed) { try { $bdd->data()->addAction('workflow-reset', 'Réinitialisation du workflow'); Loading @@ -47,7 +50,10 @@ class WorkflowResetCommand extends Command $io->error($e->getMessage()); return Command::FAILURE; } return Command::SUCCESS; } else { $io->warning('Opération annulée.'); return Command::FAILURE; } } } No newline at end of file
module/Workflow/src/Service/WorkflowService.php +33 −6 Original line number Diff line number Diff line Loading @@ -27,7 +27,7 @@ use Workflow\Model\FeuilleDeRoute; */ class WorkflowService extends AbstractService { const ETAPES_CACHE_ID = 'Workflow_Service_WorkflowService_getEtapes'; const string ETAPES_CACHE_ID = 'Workflow_Service_getEtapes'; use ContextServiceAwareTrait; use EntityManagerAwareTrait; Loading Loading @@ -57,9 +57,15 @@ class WorkflowService extends AbstractService /** * @return array|WorkflowEtape[] */ public function getEtapes(): array public function getEtapes(Annee|int|null $annee = null): array { if ($annee instanceof Annee) { $anneeId = $annee->getId(); } elseif (isset($annee)) { $anneeId = $annee; } else { $anneeId = $this->getServiceContext()->getAnnee()->getId(); } if (empty($this->workflowEtapes)) { $this->workflowEtapes = []; Loading Loading @@ -113,7 +119,7 @@ class WorkflowService extends AbstractService $cache = $em->getConfiguration()->getResultCache(); $items = []; for( $a=2010;$a<=Annee::MAX;$a++){ for ($a = Annee::MIN_DATA; $a <= Annee::MAX; $a++) { $items[] = self::ETAPES_CACHE_ID . '_' . $a; } $cache->deleteItems($items); Loading Loading @@ -262,6 +268,7 @@ class WorkflowService extends AbstractService * @param Intervenant|null $intervenant * @param Structure|null $structure * @return WorkflowEtape * @deprecated */ public function getPreviousAccessibleEtape($etape, ?Intervenant $intervenant = null, ?Structure $structure = null) { Loading @@ -283,6 +290,13 @@ class WorkflowService extends AbstractService /** * @param $etape * @param Intervenant|null $intervenant * @param Structure|null $structure * @return array * @deprecated */ protected function prepareEtapeParams($etape, ?Intervenant $intervenant = null, ?Structure $structure = null) { switch (true) { Loading Loading @@ -332,6 +346,7 @@ class WorkflowService extends AbstractService * @param Structure|null $structure * * @return WorkflowEtape|null * @deprecated */ public function getEtapeCourante(?Intervenant $intervenant = null, ?Structure $structure = null) { Loading @@ -352,6 +367,7 @@ class WorkflowService extends AbstractService * @param Structure|null $structure * * @return WorkflowEtape[] * @deprecated */ public function getFeuilleDeRouteOld(?Intervenant $intervenant = null, ?Structure $structure = null) { Loading Loading @@ -408,6 +424,7 @@ class WorkflowService extends AbstractService * @param Intervenant|null $intervenant * * @return TblWorkflow[] * @deprecated */ protected function getEtapesOld(Intervenant $intervenant, ?Structure $structure = null, bool $calcIfEmpty = true) { Loading Loading @@ -546,6 +563,7 @@ class WorkflowService extends AbstractService * @param Structure|null $structure * * @return WorkflowEtape * @deprecated */ public function getEtape($etape, ?Intervenant $intervenant = null, ?Structure $structure = null) { Loading Loading @@ -574,6 +592,7 @@ class WorkflowService extends AbstractService /** * @param $data WorkflowEtape[] * @deprecated */ protected function calculEtats($data) { Loading Loading @@ -615,6 +634,7 @@ class WorkflowService extends AbstractService * @param Structure|null $structure * * @return WorkflowEtape * @deprecated */ public function getNextEtape($etape, ?Intervenant $intervenant = null, ?Structure $structure = null) { Loading @@ -636,6 +656,12 @@ class WorkflowService extends AbstractService /** * @param $etape * @return bool * @throws \Exception * @deprecated */ public function isAllowed($etape) { if ($etape instanceof WorkflowEtape) { Loading @@ -658,6 +684,7 @@ class WorkflowService extends AbstractService * @param Structure|null $structure * * @return WorkflowEtape * @deprecated */ public function getNextAccessibleEtape($etape, ?Intervenant $intervenant = null, ?Structure $structure = null) { Loading