summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Bruederli <thomas@roundcube.net>2013-05-01 07:12:35 (GMT)
committerThomas Bruederli <thomas@roundcube.net>2013-05-01 07:18:02 (GMT)
commit9670666e3c724f18d961526d0125d67e4ab4a88b (patch)
tree25d46355e1ffeab78d67fa9eef6027321be97767
parentc1eb5b5d526b38753641afaec7833481c7610621 (diff)
downloadroundcubemail-plugins-kolab-9670666e3c724f18d961526d0125d67e4ab4a88b.tar.gz
Fix searching by attendees in calendar events (#1774)
-rw-r--r--plugins/calendar/drivers/kolab/kolab_calendar.php28
1 files changed, 26 insertions, 2 deletions
diff --git a/plugins/calendar/drivers/kolab/kolab_calendar.php b/plugins/calendar/drivers/kolab/kolab_calendar.php
index 33aa551..8f95117 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');
@@ -230,7 +230,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;
@@ -544,5 +544,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);
+ }
}