Author: leithoff
New Revision: 32396
URL: http://www.egroupware.org/viewvc/egroupware?rev=32396&view=rev
Log:
preventing invalid birthdays stored with the datastore such as 0000-00-00 or 0.0.00 to transform to a birthday
Modified:
trunk/calendar/inc/class.calendar_bo.inc.php
trunk/phpgwapi/inc/class.contacts.inc.php
Modified: trunk/calendar/inc/class.calendar_bo.inc.php
URL: http://www.egroupware.org/viewvc/egroupware/trunk/calendar/inc/class.calendar_bo.inc.php?rev=32396&r1=32395&r2=32396&view=diff
— trunk/calendar/inc/class.calendar_bo.inc.php (original)
+++ trunk/calendar/inc/class.calendar_bo.inc.php Thu Sep 30 11:32:34 2010
@@ -1632,6 +1632,22 @@
usort($bdays,create_function(’$a,$b’,‘return (int) $a[‘bday’] == (int) $b[‘bday’] ? strcmp($a[‘bday’],$b[‘bday’]) : (int) $a[‘bday’] - (int) $b[‘bday’];’));
foreach($bdays as $pers)
{
-
if (isset($pers['bday']) && ($pers['bday']=='0000-00-00 0' || $pers['bday']=='0000-00-00' || $pers['bday']=='0.0.00')) -
{ -
//error_log(__METHOD__.__LINE__.' Entry with invalid birthday:'.array2string($pers)); -
$pers['bday']=null; -
} -
if (isset($pers['contact_bday']) && ($pers['contact_bday']=='0000-00-00 0' || $pers['contact_bday']=='0000-00-00' || $pers['contact_bday']=='0.0.00')) -
{ -
//error_log(__METHOD__.__LINE__.' Entry with invalid birthday:'.array2string($pers)); -
$pers['contact_bday']=null; -
} -
if (empty($pers['bday']) && !empty($pers['contact_bday'])) $pers['bday'] = $pers['contact_bday']; -
if (empty($pers['bday'])) -
{ -
//error_log(__METHOD__.__LINE__.' Skipping entry for invalid birthday:'.array2string($pers)); -
continue; -
} $pers['bday'] = egw_time::to($pers['bday'],"m/d/Y"); list($m,$d,$y) = explode('/',$pers['bday']); if ($y > $year) continue; // not yet born
Modified: trunk/phpgwapi/inc/class.contacts.inc.php
URL: http://www.egroupware.org/viewvc/egroupware/trunk/phpgwapi/inc/class.contacts.inc.php?rev=32396&r1=32395&r2=32396&view=diff
— trunk/phpgwapi/inc/class.contacts.inc.php (original)
+++ trunk/phpgwapi/inc/class.contacts.inc.php Thu Sep 30 11:32:34 2010
@@ -140,9 +140,22 @@
if (isset($row['bday']) || isset($row['contact_bday']))
{
-
$bdayset=true; -
if (isset($row['bday']) && ($row['bday']=='0000-00-00 0' || $row['bday']=='0000-00-00' || $row['bday']=='0.0.00')) -
{ -
$rows[$n]['bday'] = $row['bday']=null; -
$bdayset=false; -
} -
if (isset($row['contact_bday']) && ($row['contact_bday']=='0000-00-00 0' || $row['contact_bday']=='0000-00-00' || $row['contact_bday']=='0.0.00')) -
{ -
$rows[$n]['contact_bday'] = $row['contact_bday']=null; -
$bdayset=false; -
} -
if ($bdayset==false) continue; // dont try to make a date out of that $row['bday'] = egw_time::to((isset($row['bday'])?$row['bday']:$row['contact_bday']),"Y-m-d"); list($y,$m,$d) = explode('-',$row['bday']); $rows[$n]['bday'] = sprintf('%d/%d/%04d',$m,$d,$y); -
} } }
Start uncovering the many advantages of virtual appliances
and start using them to simplify application deployment and
accelerate your shift to cloud computing.
http://p.sf.net/sfu/novell-sfdev2dev
eGroupWare-cvs mailing list
eGroupWare-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/egroupware-cvs