Commit 75795e04 authored by Stephane Bouvry's avatar Stephane Bouvry
Browse files

MAJ : Commande de notification

parent 47964021
Loading
Loading
Loading
Loading
Loading
+8 −1
Original line number Diff line number Diff line
@@ -15,14 +15,21 @@ class SignatureNotificationsCommand extends SignatureCommandAbstract
    {
        $this
            ->setDescription("Notifications manuelles des signatures")
            ->addOption('history', 'i', InputOption::VALUE_NONE)
            ->addOption('dateref', 'd', InputOption::VALUE_OPTIONAL, "Date de rappel", 'now')
        ;
    }

    protected function execute(InputInterface $input, OutputInterface $output): int
    {
        $io = $this->getIO($input, $output);
        $dateRef = $input->getOption('dateref');

        $date = new \DateTime();
        if( $dateRef ){
            $date = new \DateTime($dateRef);
        }

        $this->getSignatureService()->recallSignatures($date);
        // TODO

        return self::SUCCESS;
+4 −1
Original line number Diff line number Diff line
@@ -748,13 +748,14 @@ class SignatureService
            $daysSinceLastRecall = $dateRef->diff($from)->days;
            if( $daysSinceLastRecall >= $days_beetween_recalls ){
                $this->recallSignature($signature);
            } else {
                $this->getLoggerService()->debug("$signature (non envoyé, delais de $days_beetween_recalls jours)");
            }
        }
    }

    public function recallSignature(Signature $signature) :void
    {
        echo " #### $signature \n";
        foreach ($signature->getRecipients() as $recipient) {
            if( !$recipient->isDone() ){
                $this->notificationRecipientSend($recipient);
@@ -1052,6 +1053,8 @@ class SignatureService
        // Obtenir le lien
        $link = $signatureRecipient->getUrlDocument();

        $this->getLoggerService()->debug("Envoi notification pour '$signatureRecipient'");

        $subject = $this->getSignatureConfigurationService()->get_mail_recipient_subject();
        $message = $this->getSignatureConfigurationService()->get_mail_recipient_message();
        $datas = [