Fix update_perso() pour autoriser les dates de naissance < 1970
This commit is contained in:
parent
212c845639
commit
f1e9b93060
@ -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,14 +75,15 @@ 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 gérer des dates avant 1970, les dates de naissance avant cette date ne seront pas sauvegardées");
|
&& $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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$contact->birthday_alert = $_POST["birthday_alert"];
|
$contact->birthday_alert = $_POST["birthday_alert"];
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user