mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-02 21:07:12 +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
e542243d30
commit
d34486462a
@ -1552,13 +1552,15 @@ class calendar_bo
|
|||||||
if ($GLOBALS['egw_info']['server']['hide_birthdays'] != 'yes')
|
if ($GLOBALS['egw_info']['server']['hide_birthdays'] != 'yes')
|
||||||
{
|
{
|
||||||
$contacts = CreateObject('phpgwapi.contacts');
|
$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)
|
if ($bdays)
|
||||||
{
|
{
|
||||||
// sort by month and day only
|
// 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\'];'));
|
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)
|
foreach($bdays as $pers)
|
||||||
{
|
{
|
||||||
|
$pers['bday'] = egw_time::to($pers['bday'],"m/d/Y");
|
||||||
list($m,$d,$y) = explode('/',$pers['bday']);
|
list($m,$d,$y) = explode('/',$pers['bday']);
|
||||||
if ($y > $year) continue; // not yet born
|
if ($y > $year) continue; // not yet born
|
||||||
$this->cached_holidays[$year][sprintf('%04d%02d%02d',$year,$m,$d)][] = array(
|
$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[$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']);
|
list($y,$m,$d) = explode('-',$row['bday']);
|
||||||
$rows[$n]['bday'] = sprintf('%d/%d/%04d',$m,$d,$y);
|
$rows[$n]['bday'] = sprintf('%d/%d/%04d',$m,$d,$y);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user