Fix searching by attendees in calendar events (#1774)
This commit is contained in:
parent
e80b7ae73c
commit
398cd6793a
1 changed files with 26 additions and 2 deletions
|
@ -37,7 +37,7 @@ class kolab_calendar
|
||||||
private $cal;
|
private $cal;
|
||||||
private $events = array();
|
private $events = array();
|
||||||
private $imap_folder = 'INBOX/Calendar';
|
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');
|
private $sensitivity_map = array('public', 'private', 'confidential');
|
||||||
|
|
||||||
|
|
||||||
|
@ -227,7 +227,7 @@ class kolab_calendar
|
||||||
if (!empty($search)) {
|
if (!empty($search)) {
|
||||||
$hit = false;
|
$hit = false;
|
||||||
foreach ($this->search_fields as $col) {
|
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))
|
if (empty($sval))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
@ -635,5 +635,29 @@ class kolab_calendar
|
||||||
return $event;
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue