Commit eef71983 authored by Stephane Bouvry's avatar Stephane Bouvry
Browse files

Fix : Erreur d'envoi des signatures (intitulé trop long)

parent 3b29880b
Loading
Loading
Loading
Loading
+16 −6
Original line number Diff line number Diff line
@@ -148,24 +148,31 @@ class ContractDocumentService implements UseOscarConfigurationService, UseEntity
            $this->getLoggerService()->critical($msg);
            throw new OscarException($msg);
        }

        // écriture des informations pour la signature
        $contextShort = sprintf(
            "Activité %s, '%s' (Projet %s)",
            "Activité %s (Projet %s) : '%s' ",
            $activity->getOscarNum(),
            $activity->getLabel(),
            $activity->getAcronym()
            $activity->getAcronym(),
            $activity->getLabel()
        );

        $contextLong = sprintf(
            "Document %s (%s) dans l'activité Oscar %s : '%s' (Projet %s)",
            "Document %s (%s) dans l'activité Oscar %s (Projet %s) : '%s'",
            $document->getFileName(),
            $document->getTypeDocument()->getLabel(),
            $activity->getOscarNum(),
            $activity->getAcronym(),
            $activity->getLabel(),
            $activity->getAcronym()
        );

        // Patch (texte trop long)
        if( strlen($contextShort) > 255 ){
            $contextShort = substr($contextShort, 0, 250) . '...';
        }
        if( strlen($contextLong) > 255 ){
            $contextLong = substr($contextLong, 0, 250) . '...';
        }

        // On recrée le modèle de données du processus de signature
        // But : Le comparer aux données reçues pour valider
        $signatureFlowDatas = $this->getSignatureService()->createSignatureFlowDatasById(
@@ -250,12 +257,14 @@ class ContractDocumentService implements UseOscarConfigurationService, UseEntity
        }

        try {
            error_log('ICI');
            // Création du processus
            // TODO Découplage Process / SignatureFlow
            $process = $this->getProcessService()->createUnconfiguredProcess($fileName, $signatureFlow->getId());
            $this->getProcessService()->configureProcess($process, $signatureFlowDatas, $signatureFlow);
            $document->setProcess($process);
            $this->getEntityManager()->flush();
            error_log('LA');
            $this->getProcessService()->trigger($process, true);
            $this->getActivityLogService()->addUserInfo(
                "a déclenché un circuit de signature pour '$document'",
@@ -264,6 +273,7 @@ class ContractDocumentService implements UseOscarConfigurationService, UseEntity
            );
        } catch (\Exception $e) {
            $this->getLoggerService()->critical($e->getMessage());
            throw $e;
        }
    }