plugins/calendar
Thomas Brüderli
bruederli at kolabsys.com
Wed May 1 09:13:50 CEST 2013
plugins/calendar/drivers/kolab/kolab_calendar.php | 28 ++++++++++++++++++++--
1 file changed, 26 insertions(+), 2 deletions(-)
New commits:
commit 398cd6793a4fdd1a4e15ca34229883aedf2b6fb4
Author: Thomas Bruederli <thomas at roundcube.net>
Date: Wed May 1 09:12:35 2013 +0200
Fix searching by attendees in calendar events (#1774)
diff --git a/plugins/calendar/drivers/kolab/kolab_calendar.php b/plugins/calendar/drivers/kolab/kolab_calendar.php
index 590bb55..b9a6231 100644
--- a/plugins/calendar/drivers/kolab/kolab_calendar.php
+++ b/plugins/calendar/drivers/kolab/kolab_calendar.php
@@ -37,7 +37,7 @@ class kolab_calendar
private $cal;
private $events = array();
private $imap_folder = 'INBOX/Calendar';
- private $search_fields = array('title', 'description', 'location', '_attendees');
+ private $search_fields = array('title', 'description', 'location', 'attendees');
private $sensitivity_map = array('public', 'private', 'confidential');
@@ -227,7 +227,7 @@ class kolab_calendar
if (!empty($search)) {
$hit = false;
foreach ($this->search_fields as $col) {
- $sval = is_array($col) ? $event[$col[0]][$col[1]] : $event[$col];
+ $sval = is_array($event[$col]) ? self::_complex2string($event[$col]) : $event[$col];
if (empty($sval))
continue;
@@ -635,5 +635,29 @@ class kolab_calendar
return $event;
}
+ /**
+ * Convert a complex event attribute to a string value
+ */
+ private static function _complex2string($prop)
+ {
+ static $ignorekeys = array('role','status','rsvp');
+
+ $out = '';
+ if (is_array($prop)) {
+ foreach ($prop as $key => $val) {
+ if (is_numeric($key)) {
+ $out .= self::_complex2string($val, $fields);
+ }
+ else if (!in_array($key, $ignorekeys)) {
+ $out .= $val . ' ';
+ }
+ }
+ }
+ else if (is_string($prop) || is_numeric($prop)) {
+ $out .= $prop . ' ';
+ }
+
+ return rtrim($out);
+ }
}
More information about the commits
mailing list