From f314bc697d32985659d60cadd650c3264f85c90e Mon Sep 17 00:00:00 2001
From: Alex ORLUC <alex.orluc@maarch.org>
Date: Wed, 5 Apr 2017 17:26:13 +0200
Subject: [PATCH] FEAT #4774 add RAZ if NO_RETRN

---
 modules/attachments/js/functions.js | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/modules/attachments/js/functions.js b/modules/attachments/js/functions.js
index 7cf48f8b6cc..98d2a5344ab 100644
--- a/modules/attachments/js/functions.js
+++ b/modules/attachments/js/functions.js
@@ -148,6 +148,14 @@ function delLastTransmission() {
   }
 }
 
+function hideInput(currentValue, editDate) {
+	if (currentValue == "NO_RTURN") {
+		editDate.value = null
+	} else {
+		editDate.value = defineBackDate();
+	}
+}
+
 function addNewTransmission(prePath, docId, canCreateContact, langString, user) {
   var size = $j('#transmission')[0].childElementCount;
   
@@ -195,7 +203,7 @@ function addNewTransmission(prePath, docId, canCreateContact, langString, user)
                       "<label>" + "Date de retour attendue" + "</label>" +
                       "<input type='hidden' name='withDelay" + size + "' id='withDelay" + size + "' value='' style='width: 75px' />" +
                       "<input type='text' name='transmissionBackDate" + size + "' id='transmissionBackDate" + size + "' onClick='showCalender(this);' onfocus='checkBackDate(this)' value='' style='width: 75px' />" +
-                      "<select name='transmissionExpectedDate" + size + "' id='transmissionExpectedDate" + size + "' style='margin-left: 20px;width: 105px' />" +
+                      "<select name='transmissionExpectedDate" + size + "' id='transmissionExpectedDate" + size + "' style='margin-left: 20px;width: 105px' onchange = 'hideInput(this.options[this.selectedIndex].value,transmissionBackDate" + size +")'/>" +
                         "<option value='EXP_RTURN'>Attente retour</option>" +
                         "<option value='NO_RTURN'>Pas de retour</option>" +
                       "</select>" +
-- 
GitLab