Add ability to specify that imported contacts go to importer's personal addressbook

This commit is contained in:
Nathan Gray 2011-07-28 23:26:08 +00:00
parent 632a91774d
commit d6bf31a1b1
2 changed files with 12 additions and 6 deletions

View File

@ -135,9 +135,15 @@ class addressbook_import_contacts_csv implements importexport_iface_import_plugi
$_lookups = array();
// set eventOwner
$_definition->plugin_options['contact_owner'] = isset( $_definition->plugin_options['contact_owner'] ) ?
// set contact owner
$contact_owner = isset( $_definition->plugin_options['contact_owner'] ) ?
$_definition->plugin_options['contact_owner'] : $this->user;
// Import into importer's personal addressbook
if($contact_owner == 'personal')
{
$contact_owner = $this->user;
}
// Start counting successes
$count = 0;
@ -163,15 +169,15 @@ class addressbook_import_contacts_csv implements importexport_iface_import_plugi
$this->errors[$import_csv->get_current_position()] = lang(
'Unable to convert "%1" to account ID. Using plugin setting (%2) for owner.',
$record['owner'],
common::grab_owner_name($_definition->plugin_options['contact_owner'])
common::grab_owner_name($contact_owner)
);
$record['owner'] = $_definition->plugin_options['contact_owner'];
$record['owner'] = $contact_owner;
} else {
$record['owner'] = $new_owner;
}
}
} else {
$record['owner'] = $_definition->plugin_options['contact_owner'];
$record['owner'] = $contact_owner;
}
// Automatically handle text categories without explicit translation

View File

@ -112,7 +112,7 @@ class addressbook_wizard_import_contacts_csv extends importexport_wizard_basic_i
}
$bocontacts = new addressbook_bo();
$sel_options['contact_owner'] = $bocontacts->get_addressbooks(EGW_ACL_ADD);
$sel_options['contact_owner'] = array('personal' => lang("Importer's personal")) + $bocontacts->get_addressbooks(EGW_ACL_ADD);
if(!in_array('owner', $content['field_mapping'])) {
$content['no_owner_map'] = true;
}