From d34486462a8684568d4d305607c99fb48273245d Mon Sep 17 00:00:00 2001 From: Klaus Leithoff Date: Fri, 17 Sep 2010 14:00:50 +0000 Subject: [PATCH] postgres compatibility gathering of birthdays for homearea (calendar merge of birtdays into holidays) order by column must be part of distinct selection list; adapting calendar home view to meet expected date format by using egw_time::to --- calendar/inc/class.calendar_bo.inc.php | 4 +++- phpgwapi/inc/class.contacts.inc.php | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/calendar/inc/class.calendar_bo.inc.php b/calendar/inc/class.calendar_bo.inc.php index 6a45e46206..769f8f8f11 100644 --- a/calendar/inc/class.calendar_bo.inc.php +++ b/calendar/inc/class.calendar_bo.inc.php @@ -1552,13 +1552,15 @@ class calendar_bo if ($GLOBALS['egw_info']['server']['hide_birthdays'] != 'yes') { $contacts = CreateObject('phpgwapi.contacts'); - $bdays =& $contacts->read(0,0,array('id','n_family','n_given','n_prefix','n_middle','bday'),'',"bday=!'',n_family=!''",'ASC','bday'); + // note: contact read/old_read transforms contact_bday to bday only + $bdays =& $contacts->read(0,0,array('id','n_family','n_given','n_prefix','n_middle','contact_bday'),'',"contact_bday=!'',n_family=!''",'ASC','contact_bday'); if ($bdays) { // sort by month and day only 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) { + $pers['bday'] = egw_time::to($pers['bday'],"m/d/Y"); list($m,$d,$y) = explode('/',$pers['bday']); if ($y > $year) continue; // not yet born $this->cached_holidays[$year][sprintf('%04d%02d%02d',$year,$m,$d)][] = array( diff --git a/phpgwapi/inc/class.contacts.inc.php b/phpgwapi/inc/class.contacts.inc.php index f17418f2f6..b456d1f04d 100644 --- a/phpgwapi/inc/class.contacts.inc.php +++ b/phpgwapi/inc/class.contacts.inc.php @@ -138,8 +138,9 @@ class contacts extends addressbook_bo { if (isset($row[$new])) $rows[$n][$old] = $row[$new]; - if (isset($row['bday'])) + if (isset($row['bday']) || isset($row['contact_bday'])) { + $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); }