From e940e4d782064bf52bb8fa1f61c09056b908e772 Mon Sep 17 00:00:00 2001
From: Nestor <npegane@hotmail.com>
Date: Fri, 8 Sep 2017 11:15:05 +0200
Subject: [PATCH] =?UTF-8?q?FIX=20#5904=20Ajout=20du=20contr=C3=B4le=20aucu?=
 =?UTF-8?q?ne=20librairie=20suppl=C3=A9mentaire=20necessaire?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 modules/avis/send_docs_to_recommendation.php | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/modules/avis/send_docs_to_recommendation.php b/modules/avis/send_docs_to_recommendation.php
index 86f07e35a75..98b82f03c61 100755
--- a/modules/avis/send_docs_to_recommendation.php
+++ b/modules/avis/send_docs_to_recommendation.php
@@ -132,12 +132,12 @@ function get_form_txt($values, $path_manage_action,  $id_action, $table, $module
         }
     }
 
-    $frm_str .='<b>'._RECOMMENDATION_LIMIT_DATE.':</b><br/>';
+    $frm_str .='<b>'._RECOMMENDATION_LIMIT_DATE.' <span class="red_asterisk"><i class="fa fa-star"></i></span> :</b> <br/>';
     $frm_str .= '<input name="recommendation_limit_date_tr" type="text" '
         . 'id="recommendation_limit_date_tr" value="" placeholder="JJ-MM-AAAA" onfocus="checkRealDateAvis();" onChange="checkRealDateAvis();"  onclick="clear_error(\'frm_error_'
         . $actionId . '\');showCalender(this);"  onblur="document.getElementById(\'recommendation_limit_date\').value=document.getElementById(\'recommendation_limit_date_tr\').value;"/>';
     $frm_str .='<br/>';
-    $frm_str .='<br/><b>'._RECOMMENDATION_NOTE.':</b><br/>';
+    $frm_str .='<br/><b>'._RECOMMENDATION_NOTE.' :</b><br/>';
     $frm_str .= '<select name="templateNotes" id="templateNotes" style="width:98%;margin-bottom: 10px;background-color: White;border: 1px solid #999;color: #666;text-align: left;" '
                 . 'onchange="addTemplateToNote($(\'templateNotes\').value, \''
                 . $_SESSION['config']['businessappurl'] . 'index.php?display=true'
@@ -195,6 +195,15 @@ function get_form_txt($values, $path_manage_action,  $id_action, $table, $module
         $_SESSION['action_error'] = _NOTE. " " . _MANDATORY;
         return false;
     }
+
+    $d = DateTime::createFromFormat('d-m-Y', $recommendation_limit_date);
+
+    if ($d && $d->format('d-m-Y') === $recommendation_limit_date) {
+    } else {
+        $_SESSION['action_error'] = _RECOMMENDATION_LIMIT_DATE. " " . _WRONG_FORMAT;
+        return false;
+    }
+
     return true;
  }
 
-- 
GitLab