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

Fix destinataires multiples

parent 009100a8
Loading
Loading
Loading
Loading
Loading
+12 −10
Original line number Diff line number Diff line
@@ -169,10 +169,11 @@ class AdministrationController extends AbstractActionController
    public function processAction(): ViewModel
    {
        try {
            return new ViewModel([
            $datas = [
                'processes'      => $this->getProcessService()->getProcesses(),
                'signatureflows' => $this->getProcessService()->getSignatureFlows()
                                 ]);
            ];
            return new ViewModel($datas);
        } catch (\Exception $e) {
            $this->flash()->addErrorMessage('Impossible de charger les processus en cours : ' . $e->getMessage());
        }
@@ -191,14 +192,14 @@ class AdministrationController extends AbstractActionController
            $documentPreviewUrl = $this->url()->fromRoute('unicaen-signature/process/document', ['id' => $id]);

            if ($this->getRequest()->isXmlHttpRequest() || $this->getRequest()->getQuery('format') == 'json') {
                return new JsonModel([
                                         'datas' => $this->getProcessService()->getSignatureService(
                                         )->createSignatureFlowDatasById(
                $datas = [
                    'datas' => $this->getProcessService()->getSignatureService()->createSignatureFlowDatasById(
                        $documentPreviewUrl,
                        $process->getSignatureFlow()->getId(),
                        []
                    )
                                     ]);
                ];
                return new JsonModel($datas);
            }

            if ($this->getRequest()->isPost()) {
@@ -334,6 +335,7 @@ class AdministrationController extends AbstractActionController
                        $this->getSignatureService()->saveSignatureFlowFromJSON($datas);
                        return new JsonModel(['message' => "ok"]);
                    } catch (Exception $e) {
                        $this->getProcessService()->getLoggerService()->error($e->getMessage());
                        $this->response->setCustomStatusCode(Response::STATUS_CODE_501);
                        return new JsonModel(['error' => $e->getMessage()]);
                    }
@@ -346,6 +348,7 @@ class AdministrationController extends AbstractActionController
                        $this->getSignatureService()->deleteSignatureFlowFromJSON($datas);
                        return new JsonModel(['message' => "ok"]);
                    } catch (Exception $e) {
                        $this->getProcessService()->getLoggerService()->error($e->getMessage());
                        $this->response->setCustomStatusCode(Response::STATUS_CODE_501);
                        return new JsonModel(['error' => $e->getMessage()]);
                    }
@@ -360,11 +363,10 @@ class AdministrationController extends AbstractActionController
        $signatureflows = $this->getSignatureService()->getSignatureFlows(SignatureConstants::FORMAT_ARRAY);
        foreach ($signatureflows as $i => $sf) {
            foreach ($sf['steps'] as $j => &$step) {
                $this->getSignatureService()->getLoggerService()->debug("ICI");
                $options = $this->getSignatureService()->getSignatureConfigurationService(
                )->getDefaultMethodOptionsByKey($step['method']);
                $options = $this->getSignatureService()
                    ->getSignatureConfigurationService()
                    ->getDefaultMethodOptionsByKey($step['method']);

                $this->getSignatureService()->getLoggerService()->debug(print_r($options, true));
                foreach ($options as $key => $value) {
                    if (!array_key_exists($key, $step['options'])) {
                        $step['options'][$key] = $value;
+4 −2
Original line number Diff line number Diff line
@@ -357,8 +357,10 @@ class SignatureService
                    $step->setSignatureFlow($signatureFlow);
                }
                $step->setLabel($stepData['label'])
                    ->setAllRecipientsSign($stepData['allRecipientsSign'])
                    ->setNotificationsRecipients($stepData['notificationsRecipients'])
                    ->setAllRecipientsSign($stepData['allRecipientsSign'] && $stepData['allRecipientsSign'] == true)
                    ->setNotificationsRecipients(
                        $stepData['notificationsRecipients'] && $stepData['notificationsRecipients'] == true
                    )
                    ->setOptions($stepData['options'] ? $stepData['options'] : [])
                    ->setLetterfileName($stepData['letterfile'])
                    ->setRecipientsMethod($stepData['method'])