mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-22 06:30:59 +01:00
Addressbook - make sure import target addressbook is valid, if not use personal addressbook.
This commit is contained in:
parent
a2df97005c
commit
6b71e997fe
@ -68,6 +68,16 @@ class addressbook_import_contacts_csv extends importexport_basic_import_csv {
|
||||
$contact_owner = isset( $_definition->plugin_options['contact_owner'] ) ?
|
||||
$_definition->plugin_options['contact_owner'] : $this->user;
|
||||
|
||||
// Check to make sure target addressbook is valid
|
||||
if(!in_array($contact_owner, array_keys($this->bocontacts->get_addressbooks(Api\Acl::ADD))))
|
||||
{
|
||||
$this->warnings[0] = lang("Unable to import into %1, using %2",
|
||||
$contact_owner . ' ('.Api\Accounts::username($record->owner) . ')',
|
||||
Api\Accounts::username($this->user)
|
||||
);
|
||||
$contact_owner = 'personal';
|
||||
}
|
||||
|
||||
// Import into importer's personal addressbook
|
||||
if($contact_owner == 'personal')
|
||||
{
|
||||
|
@ -120,6 +120,10 @@ class addressbook_wizard_import_contacts_csv extends importexport_wizard_basic_i
|
||||
|
||||
$bocontacts = new Api\Contacts();
|
||||
$sel_options['contact_owner'] = array('personal' => lang("Importer's personal")) + $bocontacts->get_addressbooks(Acl::ADD);
|
||||
if(!in_array($content['contact_owner'], $sel_options['contact_owner']))
|
||||
{
|
||||
$sel_options['contact_owner'][$content['contact_owner']] = lang("'%1' is not allowed ('%2')!", $content['contact_owner'], implode(',',array_keys($sel_options['contact_owner'])));
|
||||
}
|
||||
if(!in_array('owner', $content['field_mapping'])) {
|
||||
$content['no_owner_map'] = true;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user