mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-28 17:48:56 +01:00
Some destination addressbook checking - must exist as an addressbook, not just an account or group
This commit is contained in:
parent
86a8ce1839
commit
b85e5d0889
@ -187,6 +187,23 @@ class addressbook_import_contacts_csv implements importexport_iface_import_plugi
|
|||||||
$record['owner'] = $contact_owner;
|
$record['owner'] = $contact_owner;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Check that owner (addressbook) is allowed
|
||||||
|
if(!in_array($record['owner'], $this->bocontacts->get_addressbooks()))
|
||||||
|
{
|
||||||
|
$this->errors[$import_csv->get_current_position()] = lang("Unable to import into %1, using %2",
|
||||||
|
common::grab_owner_name($record['owner']),
|
||||||
|
common::grab_owner_name($this->user)
|
||||||
|
);
|
||||||
|
$record['owner'] = $this->user;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Do not allow owner == 0 (accounts) without an account_id
|
||||||
|
// It causes the contact to be filed as an account, and can't delete
|
||||||
|
if(!$record['owner'] && !$record['account_id'])
|
||||||
|
{
|
||||||
|
$record['owner'] = $this->user;
|
||||||
|
}
|
||||||
|
|
||||||
// Also handle categories in their own field
|
// Also handle categories in their own field
|
||||||
$more_categories = array();
|
$more_categories = array();
|
||||||
foreach($_definition->plugin_options['field_mapping'] as $number => $field_name) {
|
foreach($_definition->plugin_options['field_mapping'] as $number => $field_name) {
|
||||||
@ -318,6 +335,7 @@ class addressbook_import_contacts_csv implements importexport_iface_import_plugi
|
|||||||
// org_name is a trigger to update n_fileas
|
// org_name is a trigger to update n_fileas
|
||||||
$_data['org_name'] = '';
|
$_data['org_name'] = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( $this->dry_run ) {
|
if ( $this->dry_run ) {
|
||||||
//print_r($_data);
|
//print_r($_data);
|
||||||
$this->results[$_action]++;
|
$this->results[$_action]++;
|
||||||
@ -332,7 +350,7 @@ class addressbook_import_contacts_csv implements importexport_iface_import_plugi
|
|||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
throw new egw_exception('Unsupported action');
|
throw new egw_exception('Unsupported action: '. $_action);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user