# R32396 - in /trunk: calendar/inc/class.calendar\_bo.inc.php phpgwapi/inc/class.contacts.inc.php

**URL:** <https://help.egroupware.org/t/r32396-in-trunk-calendar-inc-class-calendar-bo-inc-php-phpgwapi-inc-class-contacts-inc-php/41569>\
**Category:** eGW-svn\
**Created:** [September 30, 2010, 9:32am UTC](https://help.egroupware.org/t/r32396-in-trunk-calendar-inc-class-calendar-bo-inc-php-phpgwapi-inc-class-contacts-inc-php/41569 "2010-09-30T09:32:34Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![leithoff](https://help.egroupware.org/letter_avatar_proxy/v4/letter/l/58956e/32.png) [@leithoff](https://help.egroupware.org/u/leithoff)\
**Post date:** [September 30, 2010, 9:32am UTC](https://help.egroupware.org/t/r32396-in-trunk-calendar-inc-class-calendar-bo-inc-php-phpgwapi-inc-class-contacts-inc-php/41569/1 "2010-09-30T09:32:34Z")

</div>

Author: leithoff  
New Revision: 32396

URL: [http://www.egroupware.org/viewvc/egroupware?rev=32396&view=rev](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](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](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](http://p.sf.net/sfu/novell-sfdev2dev)

* * *

eGroupWare-cvs mailing list  
[eGroupWare-cvs@lists.sourceforge.net](mailto:eGroupWare-cvs@lists.sourceforge.net)  
[https://lists.sourceforge.net/lists/listinfo/egroupware-cvs](https://lists.sourceforge.net/lists/listinfo/egroupware-cvs)
