forked from extern/egroupware
Use static convert from importexport to handle human values, custom fields
This commit is contained in:
parent
59a0fc75ad
commit
450b380de1
@ -22,6 +22,12 @@ class addressbook_egw_record implements importexport_iface_egw_record
|
|||||||
private $contact = array();
|
private $contact = array();
|
||||||
private $bocontacts;
|
private $bocontacts;
|
||||||
|
|
||||||
|
// Used in conversions
|
||||||
|
static $types = array(
|
||||||
|
'select-account' => array('owner','creator','modifier'),
|
||||||
|
'date-time' => array('modified','created','last_event','next_event'),
|
||||||
|
'select-cat' => array('cat_id'),
|
||||||
|
);
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -16,12 +16,6 @@
|
|||||||
*/
|
*/
|
||||||
class addressbook_export_contacts_csv implements importexport_iface_export_plugin {
|
class addressbook_export_contacts_csv implements importexport_iface_export_plugin {
|
||||||
|
|
||||||
// Used in conversions
|
|
||||||
static $types = array(
|
|
||||||
'select-account' => array('owner','creator','modifier'),
|
|
||||||
'date-time' => array('modified','created','last_event','next_event'),
|
|
||||||
'select-cat' => array('cat_id'),
|
|
||||||
);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constants used for exploding categories & multi-selectboxes into seperate fields
|
* Constants used for exploding categories & multi-selectboxes into seperate fields
|
||||||
@ -195,7 +189,7 @@ class addressbook_export_contacts_csv implements importexport_iface_export_plugi
|
|||||||
// Some conversion
|
// Some conversion
|
||||||
$this->convert($contact, $options);
|
$this->convert($contact, $options);
|
||||||
if($options['convert']) {
|
if($options['convert']) {
|
||||||
importexport_export_csv::convert($contact, self::$types, 'addressbook');
|
importexport_export_csv::convert($contact, addressbook_egw_record::$types, 'addressbook');
|
||||||
} else {
|
} else {
|
||||||
// Implode arrays, so they don't say 'Array'
|
// Implode arrays, so they don't say 'Array'
|
||||||
foreach($contact->get_record_array() as $key => $value) {
|
foreach($contact->get_record_array() as $key => $value) {
|
||||||
|
@ -133,6 +133,8 @@ class addressbook_import_contacts_csv implements importexport_iface_import_plugi
|
|||||||
$import_csv->skip_records(1);
|
$import_csv->skip_records(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$_lookups = array();
|
||||||
|
|
||||||
// set eventOwner
|
// set eventOwner
|
||||||
$_definition->plugin_options['contact_owner'] = isset( $_definition->plugin_options['contact_owner'] ) ?
|
$_definition->plugin_options['contact_owner'] = isset( $_definition->plugin_options['contact_owner'] ) ?
|
||||||
$_definition->plugin_options['contact_owner'] : $this->user;
|
$_definition->plugin_options['contact_owner'] : $this->user;
|
||||||
@ -150,6 +152,8 @@ class addressbook_import_contacts_csv implements importexport_iface_import_plugi
|
|||||||
// don't import empty contacts
|
// don't import empty contacts
|
||||||
if( count( array_unique( $record ) ) < 2 ) continue;
|
if( count( array_unique( $record ) ) < 2 ) continue;
|
||||||
|
|
||||||
|
importexport_import_csv::convert($record, addressbook_egw_record::$types, 'addressbook', $_lookups);
|
||||||
|
|
||||||
// Set owner, unless it's supposed to come from CSV file
|
// Set owner, unless it's supposed to come from CSV file
|
||||||
if($_definition->plugin_options['owner_from_csv']) {
|
if($_definition->plugin_options['owner_from_csv']) {
|
||||||
if($record['owner'] && !is_numeric($record['owner'])) {
|
if($record['owner'] && !is_numeric($record['owner'])) {
|
||||||
|
Loading…
Reference in New Issue
Block a user