From d69661ab550857e68392c2b994936dcdec7474f1 Mon Sep 17 00:00:00 2001 From: Nathan Gray Date: Mon, 4 Jul 2011 21:22:57 +0000 Subject: [PATCH] Don't use start or end for range labels if they're missing / 0 --- calendar/inc/class.calendar_merge.inc.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/calendar/inc/class.calendar_merge.inc.php b/calendar/inc/class.calendar_merge.inc.php index b78399f8a6..89289cc77a 100644 --- a/calendar/inc/class.calendar_merge.inc.php +++ b/calendar/inc/class.calendar_merge.inc.php @@ -121,8 +121,8 @@ class calendar_merge extends bo_merge $id = array('start' => PHP_INT_MAX, 'end' => 0); $this->ids = array(); foreach($events as $event) { - if($event['start'] < $id['start']) $id['start'] = $event['start']; - if($event['end'] > $id['end']) $id['end'] = $event['end']; + if($event['start'] && $event['start'] < $id['start']) $id['start'] = $event['start']; + if($event['end'] && $event['end'] > $id['end']) $id['end'] = $event['end']; // Keep ids for future use $this->ids[] = $event['id']; } @@ -225,8 +225,8 @@ class calendar_merge extends bo_merge if($date[0]['start']) { $id = array('start' => PHP_INT_MAX, 'end' => 0); foreach($date as $event) { - if($event['start'] < $id['start']) $id['start'] = $event['start']; - if($event['end'] > $id['end']) $id['end'] = $event['end']; + if($event['start'] && $event['start'] < $id['start']) $id['start'] = $event['start']; + if($event['end'] && $event['end'] > $id['end']) $id['end'] = $event['end']; } $date = $id; } else { @@ -309,8 +309,8 @@ class calendar_merge extends bo_merge { $dates = array('start' => PHP_INT_MAX, 'end' => 0); foreach($id as $event) { - if($event['start'] < $dates['start']) $dates['start'] = $event['start']; - if($event['end'] > $dates['end']) $dates['end'] = $event['end']; + if($event['start'] && $event['start'] < $dates['start']) $dates['start'] = $event['start']; + if($event['end'] && $event['end'] > $dates['end']) $dates['end'] = $event['end']; } $id = $dates; }