Usage #0002145: Date invalide acceptée :

This commit is contained in:
sparkyx 2022-02-19 11:19:34 +01:00
parent 03469c646f
commit dcfffcb029
4 changed files with 30 additions and 6 deletions

View file

@ -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,

View file

@ -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","");

View file

@ -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;
}

View file

@ -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);
}