diff --git a/addressbook/importexport/class.export_contacts_csv.inc.php b/addressbook/importexport/class.export_contacts_csv.inc.php
index d3928b97b7..7a12866d0c 100644
--- a/addressbook/importexport/class.export_contacts_csv.inc.php
+++ b/addressbook/importexport/class.export_contacts_csv.inc.php
@@ -27,8 +27,8 @@ class export_contacts_csv implements iface_export_plugin {
*
* @param egw_record $_definition
*/
- public static function export( $_stream, $_charset, definition $_definition) {
- $options = $_definition->options;
+ public function export( $_stream, definition $_definition) {
+ $options = $_definition->plugin_options;
$uicontacts = new uicontacts();
$selection = array();
@@ -41,8 +41,7 @@ class export_contacts_csv implements iface_export_plugin {
$selection = explode(',',$options['selection']);
}
- $options['begin_with_fieldnames'] = true;
- $export_object = new export_csv($_stream, $_charset, (array)$options);
+ $export_object = new export_csv($_stream, (array)$options);
$export_object->set_mapping($options['mapping']);
// $options['selection'] is array of identifiers as this plugin doesn't
@@ -87,7 +86,7 @@ class export_contacts_csv implements iface_export_plugin {
*
* @return string html
*/
- public static function get_options_etpl() {
+ public function get_options_etpl() {
return 'addressbook.export_csv_options';
}
@@ -95,7 +94,7 @@ class export_contacts_csv implements iface_export_plugin {
* returns slectors of this plugin via xajax
*
*/
- public static function get_selectors_etpl() {
+ public function get_selectors_etpl() {
return 'Selectors:';
}
}
diff --git a/addressbook/importexport/class.import_contacts_csv.inc.php b/addressbook/importexport/class.import_contacts_csv.inc.php
index a915cf2f50..1bdf9892c4 100644
--- a/addressbook/importexport/class.import_contacts_csv.inc.php
+++ b/addressbook/importexport/class.import_contacts_csv.inc.php
@@ -20,15 +20,12 @@ require_once(EGW_INCLUDE_ROOT.'/importexport/inc/class.import_csv.inc.php');
class import_contacts_csv implements iface_import_plugin {
private static $plugin_options = array(
- 'fieldsep', //char
- 'charset', //string
- 'addressbook', //char
- 'owner', // comma seperated list of int
- 'csv_fields', // array( $csv_col_num => csv_field_name)
+ 'fieldsep', // char
+ 'charset', // string
+ 'contact_owner', // int
+ 'field_conversion', // array( $csv_col_num => conversion)
'field_mapping', // array( $csv_col_num => adb_filed)
- 'field_translation', // array( $csv_col_num => translation)
'has_header_line', //bool
- 'max', // int
'conditions', /* => array containing condition arrays:
'type' => 0, // exists
'string' => '#kundennummer',
@@ -46,7 +43,7 @@ class import_contacts_csv implements iface_import_plugin {
/**
* actions wich could be done to data entries
*/
- private static $actions = array( 'none', 'update', 'insert', 'delte', );
+ private static $actions = array( 'none', 'update', 'insert', 'delete', );
/**
* conditions for actions
@@ -73,7 +70,7 @@ class import_contacts_csv implements iface_import_plugin {
* @param string $_charset
* @param definition $_definition
*/
- public function import( $_stream, $_charset, definition $_definition ) {
+ public function import( $_stream, definition $_definition ) {
$import_csv = new import_csv( $_stream, array(
'fieldsep' => $_definition->plugin_options['fieldsep'],
'charset' => $_definition->plugin_options['charset'],
@@ -82,23 +79,22 @@ class import_contacts_csv implements iface_import_plugin {
// fetch the addressbook bo
$this->bocontacts = CreateObject('addressbook.bocontacts');
- // set FieldMapping. Throw away empty / not assigned entrys
- $import_csv->mapping = array_diff($_definition->plugin_options['field_mapping'],array(''));
+ // set FieldMapping.
+ $import_csv->mapping = $_definition->plugin_options['field_mapping'];
- // renamed from translation to conversion
- $import_csv->conversion = $_definition->plugin_options['field_conversion'] ?
- $_definition->plugin_options['field_conversion'] :
- $_definition->plugin_options['field_translation'];
+ // set FieldConversion
+ $import_csv->conversion = $_definition->plugin_options['field_conversion'];
//check if file has a header line
if ($_definition->plugin_options['has_header_line']) {
$record = $import_csv->get_record();
}
- // TODO: Throw away spechial chars ?
- // TODO: check conversion:
- // - is not existing cat created?
- // - usermapping?
+ // set contactOwner
+ if ( isset( $_definition->plugin_options['contact_owner'] )
+ && abs( $_definition->plugin_options['contact_owner'] > 0 ) ) {
+ $record['contact_owner'] = $_definition->plugin_options['contact_owner'];
+ }
while ( $record = $import_csv->get_record() ) {
@@ -136,7 +132,7 @@ class import_contacts_csv implements iface_import_plugin {
}
} else {
// unconditional insert
- $this->action( 'insert', $values );
+ $this->action( 'insert', $record );
}
}
}
@@ -149,7 +145,6 @@ class import_contacts_csv implements iface_import_plugin {
* @return bool success or not
*/
private function action ( $_action, $_data ) {
- print_r($_data);
switch ($_action) {
case 'none' :
return true;
diff --git a/addressbook/importexport/definitions/outlook_csv_english.xml b/addressbook/importexport/definitions/outlook_csv_english.xml
index 8ea1389eb7..5d3caf3f6b 100644
--- a/addressbook/importexport/definitions/outlook_csv_english.xml
+++ b/addressbook/importexport/definitions/outlook_csv_english.xml
@@ -12,9 +12,11 @@
export_contacts_csv
export
- -1
+ Default
+ TRUE
+ iso-8859-15
Title
First Name
@@ -52,7 +54,7 @@
Notes
- 0
+ admin
Exports selected contacts for english version of MS Outlook
diff --git a/addressbook/importexport/definitions/outlook_csv_finish.xml b/addressbook/importexport/definitions/outlook_csv_finish.xml
index 63e56b4038..7e6b11c34a 100644
--- a/addressbook/importexport/definitions/outlook_csv_finish.xml
+++ b/addressbook/importexport/definitions/outlook_csv_finish.xml
@@ -12,9 +12,11 @@
export_contacts_csv
export
- -1
+ Default
+ TRUE
+ iso-8859-15
Tehtävänimike
Etunimi
@@ -51,7 +53,7 @@
Muistilaput
- 0
+ admin
diff --git a/addressbook/importexport/definitions/outlook_csv_french.xml b/addressbook/importexport/definitions/outlook_csv_french.xml
index ee2bcf96ef..d749048c57 100644
--- a/addressbook/importexport/definitions/outlook_csv_french.xml
+++ b/addressbook/importexport/definitions/outlook_csv_french.xml
@@ -12,9 +12,11 @@
export_contacts_csv
export
- -1
+ Default
+ TRUE
+ iso-8859-15
Fonction
Prénom
@@ -51,7 +53,7 @@
Notes
- 0
+ admin
diff --git a/addressbook/importexport/definitions/outlook_csv_german.xml b/addressbook/importexport/definitions/outlook_csv_german.xml
index 400cad3455..5ca71584a9 100644
--- a/addressbook/importexport/definitions/outlook_csv_german.xml
+++ b/addressbook/importexport/definitions/outlook_csv_german.xml
@@ -12,9 +12,11 @@
export_contacts_csv
export
- -1
+ Default
+ TRUE
+ iso-8859-15
Anrede
Vorname
@@ -52,7 +54,7 @@
Notizen
- 0
+ admin
Exportiert ausgewählte Kontakte zur Datenübernahme in die deutsche Version von MS Outlook
diff --git a/addressbook/importexport/definitions/outlook_csv_italian.xml b/addressbook/importexport/definitions/outlook_csv_italian.xml
index 706ef67438..432a7b1415 100644
--- a/addressbook/importexport/definitions/outlook_csv_italian.xml
+++ b/addressbook/importexport/definitions/outlook_csv_italian.xml
@@ -12,9 +12,11 @@
export_contacts_csv
export
- -1
+ Default
+ TRUE
+ iso-8859-15
Posizione
Titolo
@@ -52,7 +54,7 @@
Notes
- 0
+ admin