Addressbook: Allow to choose the target addressbook when importing

This commit is contained in:
nathan 2023-01-10 14:33:58 -07:00
parent 14dcad566b
commit 115ca40737
2 changed files with 23 additions and 1 deletions

View File

@ -446,7 +446,20 @@ class addressbook_import_contacts_csv extends importexport_basic_import_csv {
*/
public function get_options_etpl(importexport_definition &$definition=null)
{
// lets do it!
$contacts = new EGroupware\Api\Contacts();
$options = array(
'name' => 'addressbook.import_csv',
'content' => array(
'owner_from_csv' => $definition->plugin_options['owner_from_csv'],
'owner' => $definition->plugin_options['contact_owner'] == 'personal' ?
$GLOBALS['egw_info']['user']['account_id'] :
$definition->plugin_options['contact_owner']
),
'sel_options' => array(
'owner' => $contacts->get_addressbooks(Api\Acl::ADD)
)
);
return $options;
}
/**

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE overlay PUBLIC "-//EGroupware GmbH//eTemplate 2.0//EN" "https://www.egroupware.org/etemplate2.0.dtd">
<overlay>
<template id="addressbook.import_csv" template="" lang="" group="0" version="1.9.001">
<et2-select id="owner" label="Addressbook" class="et2-label-fixed"></et2-select>
<et2-checkbox id="owner_from_csv" label="Use field from CSV if possible"></et2-checkbox>
<template id="importexport.import_dialog.csv"/>
</template>
</overlay>