mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-07 16:44:20 +01:00
* allow to pick CC of tickets from addressbook
- also added a different approach allowing apps to register themselfs multiple times in the link registry, was necessary as types approach from Nathan changes the usage of the original app, while this adds sub-types like an arbitrary app responded to the link hook
This commit is contained in:
parent
d5962bd0ed
commit
1f8e2e93df
@ -1209,16 +1209,18 @@ class addressbook_bo extends addressbook_so
|
||||
{
|
||||
$criteria = is_array($pattern) ? $pattern['search'] : $pattern;
|
||||
}
|
||||
if($options['start'] || $options['num_rows']) {
|
||||
if($options['start'] || $options['num_rows'])
|
||||
{
|
||||
$limit = array($options['start'], $options['num_rows']);
|
||||
}
|
||||
$filter = (array)$options['filter'];
|
||||
if ($GLOBALS['egw_info']['user']['preferences']['addressbook']['hide_accounts']) $filter['account_id'] = null;
|
||||
if (($contacts = parent::search($criteria,false,'org_name,n_family,n_given,cat_id','','%',false,'OR', $limit, $filter)))
|
||||
if (($contacts = parent::search($criteria,false,'org_name,n_family,n_given,cat_id,contact_email','','%',false,'OR', $limit, $filter)))
|
||||
{
|
||||
foreach($contacts as $contact)
|
||||
{
|
||||
$result[$contact['id']] = $this->link_title($contact);
|
||||
$result[$contact['id']] = $this->link_title($contact).
|
||||
($options['type'] === 'email' ? ' <'.$contact['email'].'>' : '');
|
||||
// show category color
|
||||
if ($contact['cat_id'] && ($color = etemplate::cats2color($contact['cat_id'])))
|
||||
{
|
||||
@ -1233,6 +1235,27 @@ class addressbook_bo extends addressbook_so
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Query for subtype email (returns only contacts with email address set)
|
||||
*
|
||||
* @param string|array $pattern
|
||||
* @param array $options
|
||||
* @return Ambigous <multitype:, string, multitype:Ambigous <multitype:, string> string >
|
||||
*/
|
||||
function link_query_email($pattern, Array &$options = array())
|
||||
{
|
||||
if (isset($options['filter']) && !is_array($options['filter']))
|
||||
{
|
||||
$options['filter'] = (array)$options['filter'];
|
||||
}
|
||||
// return only contacts with email set
|
||||
$options['filter'][] = "contact_email LIKE '%@%'";
|
||||
|
||||
// let link query know, to append email to list
|
||||
$options['type'] = 'email';
|
||||
|
||||
return $this->link_query($pattern,$options);
|
||||
}
|
||||
/**
|
||||
* Check access to the projects file store
|
||||
*
|
||||
@ -1244,7 +1267,7 @@ class addressbook_bo extends addressbook_so
|
||||
{
|
||||
return $this->check_perms($check,$id);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* returns info about contacts for calender
|
||||
*
|
||||
|
@ -323,6 +323,12 @@ class addressbook_hooks
|
||||
'add_popup' => '870x440',
|
||||
'file_access'=> 'addressbook.addressbook_bo.file_access',
|
||||
'default_types' => array('n' => array('name' => 'contact', 'options' => array('icon' => 'navbar.png','template' => 'addressbook.edit'))),
|
||||
// registers an addtional type 'addressbook-email', returning only contacts with email, title has email appended
|
||||
'additional' => array(
|
||||
'addressbook-email' => array(
|
||||
'query' => 'addressbook.addressbook_bo.link_query_email',
|
||||
),
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -61,6 +61,11 @@
|
||||
* ),
|
||||
* 'edit_id' => 'app_id',
|
||||
* 'edit_popup' => '400x300',
|
||||
* 'additional' => array( // allow one app to register sub-types,
|
||||
* 'app-sub' => array( // different from 'types' approach above
|
||||
* // every value defined above
|
||||
* )
|
||||
* )
|
||||
* }
|
||||
* All entries are optional, thought you only get conected functionality, if you implement them ...
|
||||
*
|
||||
@ -142,6 +147,15 @@ class egw_link extends solink
|
||||
{
|
||||
foreach($search_link_hooks as $app => $data)
|
||||
{
|
||||
// allow apps to register additional types
|
||||
if (isset($data['additional']))
|
||||
{
|
||||
foreach($data['additional'] as $name => $values)
|
||||
{
|
||||
self::$app_register[$name] = $values;
|
||||
}
|
||||
unset($data['additional']);
|
||||
}
|
||||
if (is_array($data))
|
||||
{
|
||||
self::$app_register[$app] = $data;
|
||||
|
Loading…
Reference in New Issue
Block a user