mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-26 16:48:49 +01:00
- adopted export plugin to new interface
- extended outlook export definitions
This commit is contained in:
parent
7a3e571376
commit
e34fb944a5
@ -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 '<b>Selectors:</b>';
|
||||
}
|
||||
}
|
||||
|
@ -22,13 +22,10 @@ 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)
|
||||
'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;
|
||||
|
@ -12,9 +12,11 @@
|
||||
<entry type="string" name="plugin">export_contacts_csv</entry>
|
||||
<entry type="string" name="type">export</entry>
|
||||
<entry type="array" name="allowed_users">
|
||||
<entry type="string" name="0">-1</entry>
|
||||
<entry type="string" name="0">Default</entry>
|
||||
</entry>
|
||||
<entry type="array" name="plugin_options">
|
||||
<entry type="boolean" name="begin_with_fieldnames">TRUE</entry>
|
||||
<entry type="string" name="charset">iso-8859-15</entry>
|
||||
<entry type="array" name="mapping">
|
||||
<entry type="string" name="n_prefix">Title</entry>
|
||||
<entry type="string" name="n_given">First Name</entry>
|
||||
@ -52,7 +54,7 @@
|
||||
<entry type="string" name="note">Notes</entry>
|
||||
</entry>
|
||||
</entry>
|
||||
<entry type="string" name="owner">0</entry>
|
||||
<entry type="string" name="owner">admin</entry>
|
||||
<entry type="string" name="description">Exports selected contacts for english version of MS Outlook</entry>
|
||||
</entry>
|
||||
</entry>
|
||||
|
@ -12,9 +12,11 @@
|
||||
<entry type="string" name="plugin">export_contacts_csv</entry>
|
||||
<entry type="string" name="type">export</entry>
|
||||
<entry type="array" name="allowed_users">
|
||||
<entry type="string" name="0">-1</entry>
|
||||
<entry type="string" name="0">Default</entry>
|
||||
</entry>
|
||||
<entry type="array" name="plugin_options">
|
||||
<entry type="boolean" name="begin_with_fieldnames">TRUE</entry>
|
||||
<entry type="string" name="charset">iso-8859-15</entry>
|
||||
<entry type="array" name="mapping">
|
||||
<entry type="string" name="title">Tehtävänimike</entry>
|
||||
<entry type="string" name="n_given">Etunimi</entry>
|
||||
@ -51,7 +53,7 @@
|
||||
<entry type="string" name="Notes">Muistilaput</entry>
|
||||
</entry>
|
||||
</entry>
|
||||
<entry type="string" name="owner">0</entry>
|
||||
<entry type="string" name="owner">admin</entry>
|
||||
<entry type="NULL" name="description"/>
|
||||
</entry>
|
||||
</entry>
|
||||
|
@ -12,9 +12,11 @@
|
||||
<entry type="string" name="plugin">export_contacts_csv</entry>
|
||||
<entry type="string" name="type">export</entry>
|
||||
<entry type="array" name="allowed_users">
|
||||
<entry type="string" name="0">-1</entry>
|
||||
<entry type="string" name="0">Default</entry>
|
||||
</entry>
|
||||
<entry type="array" name="plugin_options">
|
||||
<entry type="boolean" name="begin_with_fieldnames">TRUE</entry>
|
||||
<entry type="string" name="charset">iso-8859-15</entry>
|
||||
<entry type="array" name="mapping">
|
||||
<entry type="string" name="title">Fonction</entry>
|
||||
<entry type="string" name="n_given">Prénom</entry>
|
||||
@ -51,7 +53,7 @@
|
||||
<entry type="string" name="note">Notes</entry>
|
||||
</entry>
|
||||
</entry>
|
||||
<entry type="string" name="owner">0</entry>
|
||||
<entry type="string" name="owner">admin</entry>
|
||||
<entry type="NULL" name="description"/>
|
||||
</entry>
|
||||
</entry>
|
||||
|
@ -12,9 +12,11 @@
|
||||
<entry type="string" name="plugin">export_contacts_csv</entry>
|
||||
<entry type="string" name="type">export</entry>
|
||||
<entry type="array" name="allowed_users">
|
||||
<entry type="string" name="0">-1</entry>
|
||||
<entry type="string" name="0">Default</entry>
|
||||
</entry>
|
||||
<entry type="array" name="plugin_options">
|
||||
<entry type="boolean" name="begin_with_fieldnames">TRUE</entry>
|
||||
<entry type="string" name="charset">iso-8859-15</entry>
|
||||
<entry type="array" name="mapping">
|
||||
<entry type="string" name="n_prefix">Anrede</entry>
|
||||
<entry type="string" name="n_given">Vorname</entry>
|
||||
@ -52,7 +54,7 @@
|
||||
<entry type="string" name="note">Notizen</entry>
|
||||
</entry>
|
||||
</entry>
|
||||
<entry type="string" name="owner">0</entry>
|
||||
<entry type="string" name="owner">admin</entry>
|
||||
<entry type="string" name="description">Exportiert ausgewählte Kontakte zur Datenübernahme in die deutsche Version von MS Outlook</entry>
|
||||
</entry>
|
||||
</entry>
|
||||
|
@ -12,9 +12,11 @@
|
||||
<entry type="string" name="plugin">export_contacts_csv</entry>
|
||||
<entry type="string" name="type">export</entry>
|
||||
<entry type="array" name="allowed_users">
|
||||
<entry type="string" name="0">-1</entry>
|
||||
<entry type="string" name="0">Default</entry>
|
||||
</entry>
|
||||
<entry type="array" name="plugin_options">
|
||||
<entry type="boolean" name="begin_with_fieldnames">TRUE</entry>
|
||||
<entry type="string" name="charset">iso-8859-15</entry>
|
||||
<entry type="array" name="mapping">
|
||||
<entry type="string" name="title">Posizione</entry>
|
||||
<entry type="string" name="n_prefix">Titolo</entry>
|
||||
@ -52,7 +54,7 @@
|
||||
<entry type="string" name="note">Notes</entry>
|
||||
</entry>
|
||||
</entry>
|
||||
<entry type="string" name="owner">0</entry>
|
||||
<entry type="string" name="owner">admin</entry>
|
||||
<entry type="NULL" name="description"/>
|
||||
</entry>
|
||||
</entry>
|
||||
|
Loading…
Reference in New Issue
Block a user