From 01efd31530ed8b89ca7ec663e2906627ffc5cd81 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur <eldy@users.sourceforge.net> Date: Sun, 12 Mar 2006 00:29:09 +0000 Subject: [PATCH] =?UTF-8?q?New:=20Possibilit=E9=20de=20choisir=20le=20gest?= =?UTF-8?q?ionnaire=20de=20popup=20date?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- htdocs/html.form.class.php | 4 +++- htdocs/lib/lib_head.js | 20 ++++++++++++++++---- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/htdocs/html.form.class.php b/htdocs/html.form.class.php index 68681427413..fbf3bea7c00 100644 --- a/htdocs/html.form.class.php +++ b/htdocs/html.form.class.php @@ -1631,7 +1631,9 @@ class Form $formated_date=dolibarr_print_date($set_time,$conf->format_date_short); // Zone de saisie manuelle de la date - print '<input id="'.$prefix.'" name="'.$prefix.'" type="text" size="11" maxlength="11" value="'.$formated_date.'"> '; + print '<input id="'.$prefix.'" name="'.$prefix.'" type="text" size="11" maxlength="11" value="'.$formated_date.'"'; + print ' onChange="dpChangeDay(\''.$prefix.'\',\''.$conf->format_date_short_java.'\')"'; + print '> '; // Icone calendrier print '<button id="'.$prefix.'Button" type="button" class="dpInvisibleButtons"'; diff --git a/htdocs/lib/lib_head.js b/htdocs/lib/lib_head.js index e23dc117b0a..38b7c24dee0 100644 --- a/htdocs/lib/lib_head.js +++ b/htdocs/lib/lib_head.js @@ -106,15 +106,27 @@ function loadMonth(base,month,year,ymd) showDP.box.innerHTML=req.responseText; } - -function closeDPBox(){ +function closeDPBox() +{ document.body.removeChild(showDP.box); displaySelectBoxes(); showDP.box=null; showDP.datefieldID=null; } -function dpClickDay(year,month,day,format){ +function dpChangeDay(dateFieldID,format) +{ + showDP.datefieldID=dateFieldID; + var thefield=getObjectFromID(dateFieldID); + + var date=getDateFromFormat(thefield.value,format); + + if (date) dpClickDay(date.getFullYear(),date.getMonth()+1,date.getDate(),format) + else dpClickDay(0,0,0,format); +} + +function dpClickDay(year,month,day,format) +{ var thefield=getObjectFromID(showDP.datefieldID); var thefieldday=getObjectFromID(showDP.datefieldID+"day"); var thefieldmonth=getObjectFromID(showDP.datefieldID+"month"); @@ -126,7 +138,7 @@ function dpClickDay(year,month,day,format){ dt.setDate(day); thefield.value=formatDate(dt,format); - if(thefield.onchange) thefield.onchange.call(thefield); +// if(thefield.onchange) thefield.onchange.call(thefield); thefieldday.value=day; if(thefieldday.onchange) thefieldday.onchange.call(thefieldday); -- GitLab