mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-22 23:00:56 +01:00
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
This commit is contained in:
parent
856c19553c
commit
5c8d3301d6
@ -1624,13 +1624,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(
|
||||
|
@ -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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user