Commit 6cadef41 authored by Stephane Bouvry's avatar Stephane Bouvry
Browse files

Merge branch 'v0.0.9' into 'master'

Fix : Erreur de notification

See merge request !5
parents 6277e213 58fa3bc5
Loading
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -33,7 +33,7 @@ class SignatureProcessCommand extends SignatureCommandAbstract
                $io->title("Liste des processus");
                $headers = ['ID', 'Label', 'étape(s)', 'status'];
                $rows = [];
                foreach ($this->getSignatureService()->getProcess() as $process) {
                foreach ($this->getProcessService()->getProcesses() as $process) {
                    $rows[] = [
                        $process->getId(),
                        $process->getLabel(),
+1 −1
Original line number Diff line number Diff line
@@ -38,8 +38,8 @@ class SignatureUpdateAllCommand extends SignatureCommandAbstract
                } catch (\Exception $e) {
                    $msg = 'Error : ' . $e->getMessage();
                }
                $row[] = $msg;
            }
            $row[] = $msg;
            $rows[] = $row;
        }
        $io->table($headers, $rows);
+1 −1
Original line number Diff line number Diff line
@@ -156,7 +156,7 @@ class ProcessStep
            'order' => $this->getOrder(),
            'status' => $this->getStatus(),
            'status_text' => $this->getStatusText(),
            'recipients' => $recipients,
            'recipients' => $recipients
        ];
    }

+1 −0
Original line number Diff line number Diff line
@@ -351,6 +351,7 @@ class SignatureRecipient
            'email' => $this->getEmail(),
            'status' => $this->getStatus(),
            'status_text' => $this->getStatusText(),
            'dateFinished' => $this->getDateFinished() ? $this->getDateFinished()->format('Y-m-d H:i:s') : null,
        ];
    }
}
 No newline at end of file
+19 −8
Original line number Diff line number Diff line
@@ -592,7 +592,8 @@ class SignatureService
                        $this->getDocumentSignedSignature($signature)
                    )) {
                        $this->getLoggerService()->errorLogAndThrow(
                            new SignatureException("Impossible de récupérer le document signé")
                            new SignatureException("Impossible de récupérer le document signé"),
                            "Impossible d'écrire le document"
                        );
                    }
                }
@@ -800,14 +801,14 @@ class SignatureService
    {
        if ($signature->isNotifiable()) {
            $notificationsCaller = $this->getSignatureConfigurationService()->getNotificationsCaller();
            if (count($notificationsCaller) == 0) {
                $msg = "Aucune procédure de notification configurée";
                $this->getLoggerService()->error($msg);
                throw new SignatureException($msg);
            }
//            if (count($notificationsCaller) == 0) {
//                $msg = "Aucune procédure de notification configurée";
//                $this->getLoggerService()->error($msg);
//                throw new SignatureException($msg);
//            }

            // Pour générer les URLs dans les messages
            $url = $this->getServiceContainer()
            $urlBuilder = $this->getServiceContainer()
                ->get('ViewHelperManager')
                ->get('url');

@@ -829,7 +830,8 @@ class SignatureService

            foreach ($signature->getRecipients() as $recipient) {
                if ($action == 'viser') {
                    $link = $baseUrl . $url(
                    // TODO Pose problème !!!
                    $link = $baseUrl . $urlBuilder(
                        'unicaen-signature/internal/visa',
                        ['key' => $recipient->getKeyAccess()]
                    );
@@ -845,7 +847,16 @@ class SignatureService
                    $body = str_ireplace($find, $replace, $messageBody);
                    $subject = str_ireplace($find, $replace, $messageSubject);

                    if( is_callable($caller) ){
                        $this->getLoggerService()->error("Un procédé de notification n'est pas 'callable'");
                    } else {
                        try {
                            $caller($this->getServiceContainer(), $recipient, $subject, $body);
                        } catch (\Exception $e) {
                            $this->getLoggerService()->error("Un problème est survenu lors de l'envois des notifications");
                        }
                    }

                }
            }
        }