mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-25 01:13:25 +01:00
allow to filter by (not) shared and add groups to shared-with filter
This commit is contained in:
parent
d17f73cd79
commit
f6aad0cd46
@ -348,6 +348,12 @@ class addressbook_ui extends addressbook_bo
|
||||
}
|
||||
$content['nm']['grouped_view_label'] = $sel_options['grouped_view'][(string) $content['nm']['grouped_view']];
|
||||
|
||||
// allow to also filter by (not) shared contacts
|
||||
$sel_options['shared_with'] = [
|
||||
'not' => lang('not shared'),
|
||||
'shared' => lang('shared'),
|
||||
];
|
||||
|
||||
$this->tmpl->read('addressbook.index');
|
||||
return $this->tmpl->exec('addressbook.addressbook_ui.index',
|
||||
$content,$sel_options,array(),$preserv);
|
||||
|
@ -379,6 +379,7 @@ no categories selected addressbook de keine Kategorien ausgewählt
|
||||
no distribution list addressbook de Keine Verteilerliste
|
||||
no fallback addressbook de Keine Ausweichlösung
|
||||
no vcard addressbook de Keine vCard
|
||||
not shared addressbook de nicht geteilt
|
||||
number addressbook de Nummer
|
||||
number of records to read (%1) addressbook de Anzahl der einzulesenden Datensätze (%1)
|
||||
open %1 crm view addressbook de Öffnet %1 in der CRM-Ansicht
|
||||
@ -458,6 +459,7 @@ set full name and file as field in contacts of all users (either all or only emp
|
||||
set only full name addressbook de Nur vollen Namen setzen
|
||||
share into addressbook addressbook de Teilen in Adressbuch
|
||||
share writable addressbook de Bearbeitbar teilen
|
||||
shared addressbook de geteilt
|
||||
shared by me addressbook de Von mir geteilt
|
||||
shared into addressbook %1 addressbook de geteilt in Adressbuch %1
|
||||
shared with addressbook de Geteilt mit
|
||||
|
@ -379,6 +379,7 @@ no categories selected addressbook en No categories selected
|
||||
no distribution list addressbook en No distribution list
|
||||
no fallback addressbook en No fallback
|
||||
no vcard addressbook en No vCard
|
||||
not shared addressbook en not shared
|
||||
number addressbook en Number
|
||||
number of records to read (%1) addressbook en Number of records to read (%1)
|
||||
open %1 crm view addressbook en Open %1 CRM view
|
||||
@ -458,6 +459,7 @@ set full name and file as field in contacts of all users (either all or only emp
|
||||
set only full name addressbook en Set only full name
|
||||
share into addressbook addressbook en Share into addressbook
|
||||
share writable addressbook en Share writable
|
||||
shared addressbook en shared
|
||||
shared by me addressbook en Shared by me
|
||||
shared into addressbook %1 addressbook en shared into addressbook %1
|
||||
shared with addressbook en Shared with
|
||||
|
@ -87,7 +87,7 @@
|
||||
<nextmatch-header label="Distribution lists" id="distribution_list"/>
|
||||
<vbox>
|
||||
<nextmatch-header label="Addressbook" id="owner"/>
|
||||
<nextmatch-accountfilter empty_label="Shared with" id="shared_with"/>
|
||||
<nextmatch-accountfilter empty_label="Shared with" id="shared_with" account_type="both"/>
|
||||
</vbox>
|
||||
<nextmatch-sortheader label="ID" id="contact_id"/>
|
||||
<vbox>
|
||||
|
@ -668,17 +668,29 @@ class Sql extends Api\Storage
|
||||
}
|
||||
}
|
||||
}
|
||||
// shared with column and filter
|
||||
if (!is_array($extra_cols)) $extra_cols = $extra_cols ? explode(',',$extra_cols) : array();
|
||||
$shared_with = '(SELECT '.$this->db->group_concat('DISTINCT shared_with').' FROM '.self::SHARED_TABLE.
|
||||
' WHERE '.self::SHARED_TABLE.'.contact_id='.$this->table_name.'.contact_id AND shared_deleted IS NULL)';
|
||||
if (($key = array_search('shared_with', $extra_cols)) !== false)
|
||||
{
|
||||
$extra_cols[$key] = '(SELECT '.$this->db->group_concat('DISTINCT shared_with').' FROM '.self::SHARED_TABLE.
|
||||
' WHERE '.self::SHARED_TABLE.'.contact_id='.$this->table_name.'.contact_id AND shared_deleted IS NULL) AS shared_with';
|
||||
$extra_cols[$key] = "$shared_with AS shared_with";
|
||||
}
|
||||
if (!empty($filter['shared_with']))
|
||||
switch ((string)$filter['shared_with'])
|
||||
{
|
||||
$join .= ' JOIN '.self::SHARED_TABLE.' sw ON '.$this->table_name.'.contact_id=sw.contact_id AND sw.'.
|
||||
$this->db->expression(self::SHARED_TABLE, ['shared_with' => $filter['shared_with']]).
|
||||
' AND sw.shared_deleted IS NULL';
|
||||
case '': // filter not set
|
||||
break;
|
||||
case 'not':
|
||||
$filter[] = $shared_with.' IS NULL';
|
||||
break;
|
||||
case 'shared':
|
||||
$filter[] = $shared_with.' IS NOT NULL';
|
||||
break;
|
||||
default:
|
||||
$join .= ' JOIN '.self::SHARED_TABLE.' sw ON '.$this->table_name.'.contact_id=sw.contact_id AND sw.'.
|
||||
$this->db->expression(self::SHARED_TABLE, ['shared_with' => $filter['shared_with']]).
|
||||
' AND sw.shared_deleted IS NULL';
|
||||
break;
|
||||
}
|
||||
unset($filter['shared_with']);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user