From de16a663dc5fe40ed0437f598873064d3262b959 Mon Sep 17 00:00:00 2001
From: "florian.azizian" <florian.azizian@maarch.org>
Date: Tue, 4 Dec 2018 16:40:17 +0100
Subject: [PATCH] FEAT Add label in modal send to MaarchParapheur

---
 .../actions/sendToExternalSignatureBook.php          | 12 +++++++++---
 modules/visa/class/MaarchParapheurController.php     |  3 ++-
 2 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/apps/maarch_entreprise/actions/sendToExternalSignatureBook.php b/apps/maarch_entreprise/actions/sendToExternalSignatureBook.php
index 5ba0f8f1999..8db9f0bf084 100644
--- a/apps/maarch_entreprise/actions/sendToExternalSignatureBook.php
+++ b/apps/maarch_entreprise/actions/sendToExternalSignatureBook.php
@@ -109,9 +109,9 @@ function check_form($form_id, $values)
             }
         }
         if ($config['id'] == 'maarchParapheur') {
-            $objectSent = get_value_fields($values, 'objectSent');
+            $objectSentSign = get_value_fields($values, 'objectSentSign');
             $hasAttachmentError = hasAttachmentError();
-            if ($objectSent == 'attachment' && $hasAttachmentError['error']) {
+            if ($objectSentSign == 'attachment' && $hasAttachmentError['error']) {
                 if (!empty($_SESSION['stockCheckbox'])) {
                     $_SESSION['action_error'] = _MAIL_HAS_NO_RESPONSE_PROJECT . ' : ' . implode(",", $hasAttachmentError['resList']);
                 } else {
@@ -166,7 +166,13 @@ function manage_form($arr_id, $history, $id_action, $label_action, $status, $col
                 include_once 'modules/visa/class/MaarchParapheurController.php';
 
                 $processingUser = get_value_fields($values_form, 'processingUser');
-                $objectSent     = get_value_fields($values_form, 'objectSent');
+                $objectSentNote = get_value_fields($values_form, 'objectSentNote');
+                $objectSentSign = get_value_fields($values_form, 'objectSentSign');
+                if (!empty($objectSentNote)) {
+                    $objectSent = $objectSentNote;
+                } else {
+                    $objectSent = $objectSentSign;
+                }
                 $attachmentToFreeze = MaarchParapheurController::sendDatas([
                     'config'         => $config,
                     'resIdMaster'    => $res_id,
diff --git a/modules/visa/class/MaarchParapheurController.php b/modules/visa/class/MaarchParapheurController.php
index 69e6185cc3a..5903731b5f0 100755
--- a/modules/visa/class/MaarchParapheurController.php
+++ b/modules/visa/class/MaarchParapheurController.php
@@ -30,7 +30,8 @@ class MaarchParapheurController
             }
         }
         $html .= '</select><br /><br /><br /><br />';
-        $html .= '<input type="radio" name="objectSent" id="objectSent" value="mail" checked="checked" />' . _MAIL_NOTE . '<br/><input type="radio" name="objectSent" id="objectSent" value="attachment" />' . _ATTACHMENT_SIGNATURE .'<br /><br />';
+        $html .= '<input type="radio" name="objectSent" id="objectSentNote" value="mail" checked="checked" /><label for="objectSentNote" style="float: none;display: unset;">' . _MAIL_NOTE . '</label><br/>';
+        $html .= '<input type="radio" name="objectSent" id="objectSentSign" value="attachment" /><label for="objectSentSign" style="float: none;display: unset;">' . _ATTACHMENT_SIGNATURE .'</label><br /><br />';
 
         return $html;
     }
-- 
GitLab