Commit 9ade5e7d authored by Stephane Bouvry's avatar Stephane Bouvry
Browse files

- Traitement du CAS : Suppression dans le parapheur entre l'envoi par...

 - Traitement du CAS : Suppression dans le parapheur entre l'envoi par l'application et la mise à jour du status (les demandes restaient en attente)
 - Ajout d'une commande CRONnable pour la mise à jour des signatures simples
 - MAJ du composer pour les dépendances (Console) et forcer l'executable 'unicaen-signature'
parent 6cadef41
Loading
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -8,10 +8,11 @@
    }
  ],
  "bin": [
    "unicaen-signature"
    "bin/unicaen-signature"
  ],
  "require": {
    "fightbulc/moment": "^1.30"
    "fightbulc/moment": "^1.30",
    "symfony/console": "^6.0"
  },
  "autoload": {
    "psr-0": {
+10 −0
Original line number Diff line number Diff line
@@ -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
+3 −3
Original line number Diff line number Diff line
@@ -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()
    {
@@ -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(),
+54 −0
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
+5 −0
Original line number Diff line number Diff line
@@ -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