From 9aa040bec2b93227637de2a1a683a0fa54068bf1 Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Fri, 15 Feb 2008 02:17:47 +0000 Subject: [PATCH] "fixed not working last event" --- addressbook/inc/class.addressbook_merge.inc.php | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/addressbook/inc/class.addressbook_merge.inc.php b/addressbook/inc/class.addressbook_merge.inc.php index 7e447029ca..f7c45862c1 100644 --- a/addressbook/inc/class.addressbook_merge.inc.php +++ b/addressbook/inc/class.addressbook_merge.inc.php @@ -155,16 +155,24 @@ class addressbook_merge // extends bo_merge 'num_rows' => 20, 'order' => 'cal_start', )); - array_unshift($events,false); unset($events[0]); // renumber the array to start with key 1, instead of 0 - if ($last_event_too) + if ($events) { - list($events['-1']) = $calendar->search(array( + array_unshift($events,false); unset($events[0]); // renumber the array to start with key 1, instead of 0 + } + else + { + $events = array(); + } + if ($last_event_too=true) + { + $last = $calendar->search(array( 'end' => $calendar->now_su, 'users' => 'c'.$id, 'offset' => 0, 'num_rows' => 1, 'order' => 'cal_start DESC', )); + if ($last) $events['-1'] = array_shift($last); // returned events are indexed by cal_id! } $replacements = array(); foreach($events as $n => $event) @@ -311,7 +319,7 @@ class addressbook_merge // extends bo_merge echo '$$'.$name.'$$'.$label."\n"; } $GLOBALS['egw']->translation->add_app('calendar'); - echo '

'.lang('Calendar fields:')." # = 1, 2, ..., 20

"; + echo '

'.lang('Calendar fields:')." # = 1, 2, ..., 20, -1

"; foreach(array( 'title' => lang('Title'), 'description' => lang('Description'),