Tag contacts that have a birthday date set and allow to directly select them

This commit is contained in:
Thomas Bruederli 2014-01-28 15:51:09 +01:00
parent df7030f306
commit 0950ff12dc
2 changed files with 21 additions and 0 deletions

View file

@ -400,6 +400,11 @@ class rcube_kolab_contacts extends rcube_addressbook
// NOTE: this is only some rough pre-filtering but probably includes false positives // NOTE: this is only some rough pre-filtering but probably includes false positives
$squery = $this->_search_query($fields, $value, $mode); $squery = $this->_search_query($fields, $value, $mode);
// add magic selector to select contacts with birthday dates only
if (in_array('birthday', $required)) {
$squery[] = array('tags', '=', 'x-has-birthday');
}
// get all/matching records // get all/matching records
$this->_fetch_contacts($squery); $this->_fetch_contacts($squery);

View file

@ -407,6 +407,22 @@ class kolab_format_contact extends kolab_format
return array_unique(rcube_utils::normalize_string($data, true)); return array_unique(rcube_utils::normalize_string($data, true));
} }
/**
* Callback for kolab_storage_cache to get object specific tags to cache
*
* @return array List of tags to save in cache
*/
public function get_tags()
{
$tags = array();
if (!empty($this->data['birthday'])) {
$tags[] = 'x-has-birthday';
}
return $tags;
}
/** /**
* Helper method to copy contents of an Address vector to the contact data object * Helper method to copy contents of an Address vector to the contact data object
*/ */