Loading doc/dev/README.md +10 −0 Viewed Changes for doc/dev/README.md: 10 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -2,6 +2,16 @@ ## Utilisation des commandes ### Console de base ```bash php vendor/bin/unicaen-signature ``` ### Commandes dans votre application (exemple) Exemple, créer un fichier `bin/commands.php` : ```php Loading src/Command/SignatureUpdateAllCommand.php→src/Command/SignatureUpdateAllProcessesCommand.php +3 −3 Viewed Changes for src/Command/SignatureUpdateAllProcessesCommand.php: 3 added lines, 3 removed lines. Original line number Diff line number Diff line Loading @@ -7,9 +7,9 @@ use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; use UnicaenSignature\Entity\Db\Signature; class SignatureUpdateAllCommand extends SignatureCommandAbstract class SignatureUpdateAllProcessesCommand extends SignatureCommandAbstract { protected static $defaultName = 'signature:update-all'; protected static $defaultName = 'signature:update-process-all'; protected function configure() { Loading @@ -19,12 +19,12 @@ class SignatureUpdateAllCommand extends SignatureCommandAbstract protected function execute(InputInterface $input, OutputInterface $output): int { $io = $this->getIO($input, $output); $headers = ['id', 'label', 'status', 'msg']; $rows = []; foreach ($this->getProcessService()->getProcesses() as $process) { $io->text($process); $msg = "Rien à faire"; $row = [ $process->getId(), Loading src/Command/SignatureUpdateAllSimpleSignatureCommand.php 0 → 100644 +54 −0 Viewed Changes for src/Command/SignatureUpdateAllSimpleSignatureCommand.php: 54 added lines, 0 removed lines. Original line number Diff line number Diff line <?php namespace UnicaenSignature\Command; use Laminas\ServiceManager\ServiceManager; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; use UnicaenSignature\Entity\Db\Signature; class SignatureUpdateAllSimpleSignatureCommand extends SignatureCommandAbstract { protected static $defaultName = 'signature:update-simplesignature-all'; protected function configure() { $this ->setDescription("Actualise l'état des signatures"); } protected function execute(InputInterface $input, OutputInterface $output): int { $io = $this->getIO($input, $output); $headers = ['id', 'label', 'status', 'Parapheur', 'Remote ID', 'doc', 'msg']; $rows = []; /** @var Signature $signature */ foreach ($this->getSignatureService()->getSignaturesSimples() as $signature) { $msg = "Rien à faire"; $row = [ $signature->getId(), $signature->getLabel(), $signature->getStatusText(), $signature->getLetterfileKey(), $signature->getDocumentRemotekey(), $signature->getDocumentPath(), ]; $msg = "Rien à faire"; if( $signature->isUpdatable() ){ try { $this->getSignatureService()->updateStatusSignature($signature); $msg = "Fait (" . $signature->getStatusText() . ")"; } catch (\Exception $e) { $msg = 'Error : ' . $e->getMessage(); } } $row[] = $msg; $rows[] = $row; } $io->table($headers, $rows); return self::SUCCESS; } } No newline at end of file src/Entity/Db/Signature.php +5 −0 Viewed Changes for src/Entity/Db/Signature.php: 5 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -557,6 +557,11 @@ class Signature return $this->getStatus() == self::STATUS_SIGNATURE_DRAFT; } public function isUpdatable():bool { return $this->getStatus() == self::STATUS_SIGNATURE_WAIT; } public function isFinished(): bool { $deletable = [ Loading src/Service/SignatureService.php +19 −0 Viewed Changes for src/Service/SignatureService.php: 19 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -553,14 +553,33 @@ class SignatureService $this->getLoggerService()->debug("Actualisation du statut pour '$signature'"); try { if (!$signature->isFinished()) { $documentSrc = $this->getSignatureConfigurationService()->getDocumentsLocation() . DIRECTORY_SEPARATOR . $signature->getDocumentPath(); if( !is_writable($documentSrc) ){ $err = "Impossible de mettre à jour la signature, l'emplacement de dépôt du document n'est pas accessible en écriture"; $this->getLoggerService()->critical("$err : '$documentSrc'"); throw new SignatureException($err); } $letterFileStrategy = $this->getLetterfileService()->getLetterFileStrategy( $signature->getLetterfileKey() ); $infos = $letterFileStrategy->getSignatureInfos($signature); $status = $infos->getStatus(); $status_remote = $infos->getStatusRemote(); $currentStatus = $signature->getStatusText(); $this->getLoggerService()->debug("Statut en cours '$currentStatus', statut reçu > '$status' ($status_remote)"); $statusChanged = $signature->getStatus() !== $status; if( $statusChanged ){ $this->getLoggerService()->debug("Le statut a changé > '$status'"); } $signature->setStatus($status) ->setDateUpdate(new \DateTime()); Loading Loading
doc/dev/README.md +10 −0 Viewed Changes for doc/dev/README.md: 10 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -2,6 +2,16 @@ ## Utilisation des commandes ### Console de base ```bash php vendor/bin/unicaen-signature ``` ### Commandes dans votre application (exemple) Exemple, créer un fichier `bin/commands.php` : ```php Loading
src/Command/SignatureUpdateAllCommand.php→src/Command/SignatureUpdateAllProcessesCommand.php +3 −3 Viewed Changes for src/Command/SignatureUpdateAllProcessesCommand.php: 3 added lines, 3 removed lines. Original line number Diff line number Diff line Loading @@ -7,9 +7,9 @@ use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; use UnicaenSignature\Entity\Db\Signature; class SignatureUpdateAllCommand extends SignatureCommandAbstract class SignatureUpdateAllProcessesCommand extends SignatureCommandAbstract { protected static $defaultName = 'signature:update-all'; protected static $defaultName = 'signature:update-process-all'; protected function configure() { Loading @@ -19,12 +19,12 @@ class SignatureUpdateAllCommand extends SignatureCommandAbstract protected function execute(InputInterface $input, OutputInterface $output): int { $io = $this->getIO($input, $output); $headers = ['id', 'label', 'status', 'msg']; $rows = []; foreach ($this->getProcessService()->getProcesses() as $process) { $io->text($process); $msg = "Rien à faire"; $row = [ $process->getId(), Loading
src/Command/SignatureUpdateAllSimpleSignatureCommand.php 0 → 100644 +54 −0 Viewed Changes for src/Command/SignatureUpdateAllSimpleSignatureCommand.php: 54 added lines, 0 removed lines. Original line number Diff line number Diff line <?php namespace UnicaenSignature\Command; use Laminas\ServiceManager\ServiceManager; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; use UnicaenSignature\Entity\Db\Signature; class SignatureUpdateAllSimpleSignatureCommand extends SignatureCommandAbstract { protected static $defaultName = 'signature:update-simplesignature-all'; protected function configure() { $this ->setDescription("Actualise l'état des signatures"); } protected function execute(InputInterface $input, OutputInterface $output): int { $io = $this->getIO($input, $output); $headers = ['id', 'label', 'status', 'Parapheur', 'Remote ID', 'doc', 'msg']; $rows = []; /** @var Signature $signature */ foreach ($this->getSignatureService()->getSignaturesSimples() as $signature) { $msg = "Rien à faire"; $row = [ $signature->getId(), $signature->getLabel(), $signature->getStatusText(), $signature->getLetterfileKey(), $signature->getDocumentRemotekey(), $signature->getDocumentPath(), ]; $msg = "Rien à faire"; if( $signature->isUpdatable() ){ try { $this->getSignatureService()->updateStatusSignature($signature); $msg = "Fait (" . $signature->getStatusText() . ")"; } catch (\Exception $e) { $msg = 'Error : ' . $e->getMessage(); } } $row[] = $msg; $rows[] = $row; } $io->table($headers, $rows); return self::SUCCESS; } } No newline at end of file
src/Entity/Db/Signature.php +5 −0 Viewed Changes for src/Entity/Db/Signature.php: 5 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -557,6 +557,11 @@ class Signature return $this->getStatus() == self::STATUS_SIGNATURE_DRAFT; } public function isUpdatable():bool { return $this->getStatus() == self::STATUS_SIGNATURE_WAIT; } public function isFinished(): bool { $deletable = [ Loading
src/Service/SignatureService.php +19 −0 Viewed Changes for src/Service/SignatureService.php: 19 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -553,14 +553,33 @@ class SignatureService $this->getLoggerService()->debug("Actualisation du statut pour '$signature'"); try { if (!$signature->isFinished()) { $documentSrc = $this->getSignatureConfigurationService()->getDocumentsLocation() . DIRECTORY_SEPARATOR . $signature->getDocumentPath(); if( !is_writable($documentSrc) ){ $err = "Impossible de mettre à jour la signature, l'emplacement de dépôt du document n'est pas accessible en écriture"; $this->getLoggerService()->critical("$err : '$documentSrc'"); throw new SignatureException($err); } $letterFileStrategy = $this->getLetterfileService()->getLetterFileStrategy( $signature->getLetterfileKey() ); $infos = $letterFileStrategy->getSignatureInfos($signature); $status = $infos->getStatus(); $status_remote = $infos->getStatusRemote(); $currentStatus = $signature->getStatusText(); $this->getLoggerService()->debug("Statut en cours '$currentStatus', statut reçu > '$status' ($status_remote)"); $statusChanged = $signature->getStatus() !== $status; if( $statusChanged ){ $this->getLoggerService()->debug("Le statut a changé > '$status'"); } $signature->setStatus($status) ->setDateUpdate(new \DateTime()); Loading