From dcfffcb029a0bf52704e8857d1d3d51cd378bfa4 Mon Sep 17 00:00:00 2001 From: sparkyx Date: Sat, 19 Feb 2022 11:19:34 +0100 Subject: [PATCH] =?UTF-8?q?Usage=20#0002145:=20Date=20invalide=20accept?= =?UTF-8?q?=C3=A9e=20:?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- html/js/noalyss_script.js | 15 +++++++++++++-- include/class/follow_up.class.php | 1 + include/class/tax_summary.class.php | 4 ++-- include/export/export_form_pdf.php | 16 ++++++++++++++-- 4 files changed, 30 insertions(+), 6 deletions(-) diff --git a/html/js/noalyss_script.js b/html/js/noalyss_script.js index 7d9d6a4ed..8ee3b934d 100644 --- a/html/js/noalyss_script.js +++ b/html/js/noalyss_script.js @@ -340,7 +340,7 @@ function format_number(obj, p_prec) /** * Replace slash , space and minus by dot - * @param p_object + * @param p_object DOM Element date to check */ function format_date(p_object) { @@ -351,8 +351,19 @@ function format_date(p_object) var tmp_value = p_object.value; a_split=tmp_value.split('.'); if (a_split[2] && a_split[2].match(/[0-9]{2}/) && a_split[2].length==2) { - p_object.value=a_split[0]+"."+a_split[1]+"."+"20"+a_split[2]; + a_split[2]="20"+a_split[2]; + p_object.value=a_split[0]+"."+a_split[1]+"."+a_split[2]; } + var nMonth=parseFloat(a_split[1])-1; + var ma_date = new Date(a_split[2], nMonth, a_split[0]); + if(ma_date.getFullYear()==a_split[2] && ma_date.getMonth()==nMonth && ma_date.getDate() == a_split[0]){ + return; + } else { + new Effect.Highlight(p_object.id,{startcolor:"#ff0000"}); + p_object.value=""; + } + + } /** *@brief check if the object is hidden or show and perform the opposite, diff --git a/include/class/follow_up.class.php b/include/class/follow_up.class.php index 3b5a1baef..9b80e60ed 100644 --- a/include/class/follow_up.class.php +++ b/include/class/follow_up.class.php @@ -963,6 +963,7 @@ class Follow_Up $this->qcode_dest=$http->extract("qcode_dest","string",""); $this->f_id_dest=$http->extract("f_id_dest","string",null); $this->ag_timestamp=$http->extract("ag_timestamp","string",date('d.m.Y')); + $this->ag_timestamp=(isDate($this->ag_timestamp)==0)?date('d.m.Y'):$this->ag_timestamp; $this->dt_id=$http->extract("dt_id","string",""); $this->ag_state=$http->extract("ag_state","number",2); $this->ag_title=$http->extract("ag_title","string",""); diff --git a/include/class/tax_summary.class.php b/include/class/tax_summary.class.php index 1e88ad095..6c244a260 100644 --- a/include/class/tax_summary.class.php +++ b/include/class/tax_summary.class.php @@ -94,7 +94,7 @@ class Tax_Summary public function set_date_start($date_start) { if (isDate($date_start)==NULL) - throw Exception(_("Format date invalide").$date_start); + throw new Exception(_("Format date invalide").$date_start); $this->date_start=$date_start; return $this; } @@ -114,7 +114,7 @@ class Tax_Summary public function set_date_end($date_end) { if (isDate($date_end)==NULL) - throw Exception(_("Format date invalide").$date_end); + throw new Exception(_("Format date invalide").$date_end); $this->date_end=$date_end; return $this; } diff --git a/include/export/export_form_pdf.php b/include/export/export_form_pdf.php index 272b59bbe..e9f9778b2 100644 --- a/include/export/export_form_pdf.php +++ b/include/export/export_form_pdf.php @@ -62,8 +62,20 @@ if ( $step == 0 ) } else { - $from_date=$http->get('from_date',"date"); - $to_date=$http->get('to_date',"date"); + try { + $from_date=$http->get('from_date',"date"); + } catch (Exception $e) { + $from_date=date('d.m.Y'); + } + try + { + $to_date=$http->get('to_date',"date"); + } + catch (Exception $exc) + { + $to_date=date('d.m.Y'); + } + $array=$Form->get_row( $from_date,$to_date, $type_periode); }