Skip to content
Snippets Groups Projects
Commit f1e9b930 authored by Yannick Warnier's avatar Yannick Warnier
Browse files

Fix update_perso() pour autoriser les dates de naissance < 1970

parent 212c8456
No related branches found
No related tags found
No related merge requests found
...@@ -307,16 +307,8 @@ class Contact ...@@ -307,16 +307,8 @@ class Contact
if ($this->birthday>0) if ($this->birthday>0)
{ {
if (eregi('\-',$this->birthday)) $birthday = (int) $this->birthday;
{ $sql .= ", birthday='".$birthday."'";
// Si date = chaine
$sql .= ", birthday='".$this->birthday."'";
}
else
{
// Si date = timestamp
$sql .= ", birthday=".$this->db->idate($this->birthday);
}
} }
$sql .= " WHERE idp=$id"; $sql .= " WHERE idp=$id";
......
...@@ -75,13 +75,14 @@ if ($_POST["action"] == 'update') ...@@ -75,13 +75,14 @@ if ($_POST["action"] == 'update')
if ($_POST["birthdayyear"]) if ($_POST["birthdayyear"])
{ {
if ($_POST["birthdayyear"]<=1970 && $_SERVER["WINDIR"]) $birthday = (int) $_POST["birthdayday"];
{ $birthmonth = (int) $_POST["birthdaymonth"];
// windows mktime does not support negative date timestamp so birthday is not supported for old persons $birthyear = (int) $_POST["birthdayyear"];
$contact->birthday = $_POST["birthdayyear"].'-'.$_POST["birthdaymonth"].'-'.$_POST["birthdayday"]; if($birthmonth>=1 && $birthmonth<=12
// array_push($error,"Windows ne sachant pas grer des dates avant 1970, les dates de naissance avant cette date ne seront pas sauvegardes"); && $birthday>=1 && $birthday<=31
} else { && $birthyear>=1850 && $birthyear<=date('Y'))
$contact->birthday = mktime(0,0,0,$_POST["birthdaymonth"],$_POST["birthdayday"],$_POST["birthdayyear"]); {
$contact->birthday = $birthyear.$birthmonth.$birthday;
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment