mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-25 17:33:49 +01:00
Changes for importexport
- Fix wizard so you can define import definitions - Change import so an update with no differences will not change anything
This commit is contained in:
parent
822230bf57
commit
c6a2c8bbcc
@ -46,14 +46,14 @@ class import_contacts_csv implements iface_import_plugin {
|
|||||||
/**
|
/**
|
||||||
* actions wich could be done to data entries
|
* actions wich could be done to data entries
|
||||||
*/
|
*/
|
||||||
private static $actions = array( 'none', 'update', 'insert', 'delete', );
|
protected static $actions = array( 'none', 'update', 'insert', 'delete', );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* conditions for actions
|
* conditions for actions
|
||||||
*
|
*
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
private static $conditions = array( 'exists', 'greater', 'greater or equal', );
|
protected static $conditions = array( 'exists', 'greater', 'greater or equal', );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var definition
|
* @var definition
|
||||||
@ -65,6 +65,11 @@ class import_contacts_csv implements iface_import_plugin {
|
|||||||
*/
|
*/
|
||||||
private $bocontacts;
|
private $bocontacts;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* For figuring out if a contact has changed
|
||||||
|
*/
|
||||||
|
protected $tracking;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var bool
|
* @var bool
|
||||||
*/
|
*/
|
||||||
@ -80,6 +85,11 @@ class import_contacts_csv implements iface_import_plugin {
|
|||||||
*/
|
*/
|
||||||
private $user = null;
|
private $user = null;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* List of import errors
|
||||||
|
*/
|
||||||
|
protected $errors = array();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* imports entries according to given definition object.
|
* imports entries according to given definition object.
|
||||||
* @param resource $_stream
|
* @param resource $_stream
|
||||||
@ -104,6 +114,9 @@ class import_contacts_csv implements iface_import_plugin {
|
|||||||
// fetch the addressbook bo
|
// fetch the addressbook bo
|
||||||
$this->bocontacts = new addressbook_bo();
|
$this->bocontacts = new addressbook_bo();
|
||||||
|
|
||||||
|
// Get the tracker for changes
|
||||||
|
$this->tracking = new addressbook_tracking($this->bocontacts);
|
||||||
|
|
||||||
// set FieldMapping.
|
// set FieldMapping.
|
||||||
$import_csv->mapping = $_definition->plugin_options['field_mapping'];
|
$import_csv->mapping = $_definition->plugin_options['field_mapping'];
|
||||||
|
|
||||||
@ -111,15 +124,25 @@ class import_contacts_csv implements iface_import_plugin {
|
|||||||
$import_csv->conversion = $_definition->plugin_options['field_conversion'];
|
$import_csv->conversion = $_definition->plugin_options['field_conversion'];
|
||||||
|
|
||||||
//check if file has a header lines
|
//check if file has a header lines
|
||||||
if ( isset( $_definition->plugin_options['num_header_lines'] ) ) {
|
if ( isset( $_definition->plugin_options['num_header_lines'] ) && $_definition->plugin_options['num_header_lines'] > 0) {
|
||||||
$import_csv->skip_records($_definition->plugin_options['num_header_lines']);
|
$import_csv->skip_records($_definition->plugin_options['num_header_lines']);
|
||||||
|
} elseif(isset($_definition->plugin_options['has_header_line']) && $_definition->plugin_options['has_header_line']) {
|
||||||
|
// First method is preferred
|
||||||
|
$import_csv->skip_records(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 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;
|
||||||
|
|
||||||
|
// Start counting successes
|
||||||
|
$count = 0;
|
||||||
|
|
||||||
|
// Failures
|
||||||
|
$this->errors = array();
|
||||||
|
|
||||||
while ( $record = $import_csv->get_record() ) {
|
while ( $record = $import_csv->get_record() ) {
|
||||||
|
$success = false;
|
||||||
|
|
||||||
// don't import empty contacts
|
// don't import empty contacts
|
||||||
if( count( array_unique( $record ) ) < 2 ) continue;
|
if( count( array_unique( $record ) ) < 2 ) continue;
|
||||||
@ -127,7 +150,6 @@ class import_contacts_csv implements iface_import_plugin {
|
|||||||
if ( $_definition->plugin_options['contact_owner'] != -1 ) {
|
if ( $_definition->plugin_options['contact_owner'] != -1 ) {
|
||||||
$record['owner'] = $_definition->plugin_options['contact_owner'];
|
$record['owner'] = $_definition->plugin_options['contact_owner'];
|
||||||
} else unset( $record['owner'] );
|
} else unset( $record['owner'] );
|
||||||
|
|
||||||
if ( $_definition->plugin_options['conditions'] ) {
|
if ( $_definition->plugin_options['conditions'] ) {
|
||||||
foreach ( $_definition->plugin_options['conditions'] as $condition ) {
|
foreach ( $_definition->plugin_options['conditions'] as $condition ) {
|
||||||
switch ( $condition['type'] ) {
|
switch ( $condition['type'] ) {
|
||||||
@ -148,11 +170,11 @@ class import_contacts_csv implements iface_import_plugin {
|
|||||||
if ( !is_array( $record['cat_id'] ) ) $record['cat_id'] = explode( ',', $record['cat_id'] );
|
if ( !is_array( $record['cat_id'] ) ) $record['cat_id'] = explode( ',', $record['cat_id'] );
|
||||||
$record['cat_id'] = implode( ',', array_unique( array_merge( $record['cat_id'], $contact['cat_id'] ) ) );
|
$record['cat_id'] = implode( ',', array_unique( array_merge( $record['cat_id'], $contact['cat_id'] ) ) );
|
||||||
}
|
}
|
||||||
$this->action( $action['action'], $record );
|
$success = $this->action( $action['action'], $record, $import_csv->get_current_position() );
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$action = $condition['false'];
|
$action = $condition['false'];
|
||||||
$this->action( $action['action'], $record );
|
$success = ($this->action( $action['action'], $record, $import_csv->get_current_position() ));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -165,9 +187,11 @@ class import_contacts_csv implements iface_import_plugin {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// unconditional insert
|
// unconditional insert
|
||||||
$this->action( 'insert', $record );
|
$success = $this->action( 'insert', $record, $import_csv->get_current_position() );
|
||||||
}
|
}
|
||||||
|
if($success) $count++;
|
||||||
}
|
}
|
||||||
|
return $count;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -177,16 +201,31 @@ class import_contacts_csv implements iface_import_plugin {
|
|||||||
* @param array $_data contact data for the action
|
* @param array $_data contact data for the action
|
||||||
* @return bool success or not
|
* @return bool success or not
|
||||||
*/
|
*/
|
||||||
private function action ( $_action, $_data ) {
|
private function action ( $_action, $_data, $record_num = 0 ) {
|
||||||
switch ($_action) {
|
switch ($_action) {
|
||||||
case 'none' :
|
case 'none' :
|
||||||
return true;
|
return true;
|
||||||
case 'update' :
|
case 'update' :
|
||||||
|
// Only update if there are changes
|
||||||
|
$old = $this->bocontacts->read($_data['id']);
|
||||||
|
|
||||||
|
// Merge to deal with fields not in import record
|
||||||
|
$_data = array_merge($old, $_data);
|
||||||
|
$changed = $this->tracking->changed_fields($_data, $old);
|
||||||
|
if(count($changed) == 0) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
// Fall through
|
||||||
case 'insert' :
|
case 'insert' :
|
||||||
if ( $this->dry_run ) {
|
if ( $this->dry_run ) {
|
||||||
print_r($_data);
|
print_r($_data);
|
||||||
|
return true;
|
||||||
} else {
|
} else {
|
||||||
return $this->bocontacts->save( $_data );
|
$result = $this->bocontacts->save( $_data, $this->is_admin);
|
||||||
|
if(!$result) {
|
||||||
|
$this->errors[$record_num] = $this->bocontacts->error;
|
||||||
|
}
|
||||||
|
return $result;
|
||||||
}
|
}
|
||||||
case 'delete' :
|
case 'delete' :
|
||||||
}
|
}
|
||||||
@ -198,7 +237,7 @@ class import_contacts_csv implements iface_import_plugin {
|
|||||||
* @return string name
|
* @return string name
|
||||||
*/
|
*/
|
||||||
public static function get_name() {
|
public static function get_name() {
|
||||||
return lang('Addressbook CSV export');
|
return lang('Addressbook CSV import');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -244,5 +283,16 @@ class import_contacts_csv implements iface_import_plugin {
|
|||||||
// lets do it!
|
// lets do it!
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns errors that were encountered during importing
|
||||||
|
* Maximum of one error message per record, but you can append if you need to
|
||||||
|
*
|
||||||
|
* @return Array (
|
||||||
|
* record_# => error message
|
||||||
|
* )
|
||||||
|
*/
|
||||||
|
public function get_errors() {
|
||||||
|
return $this->errors;
|
||||||
|
}
|
||||||
} // end of iface_export_plugin
|
} // end of iface_export_plugin
|
||||||
?>
|
?>
|
||||||
|
@ -9,9 +9,9 @@
|
|||||||
* @version $Id: $
|
* @version $Id: $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
require_once(EGW_INCLUDE_ROOT.'/addressbook/inc/class.addressbook_csv_import.inc.php');
|
require_once(EGW_INCLUDE_ROOT.'/addressbook/importexport/class.import_contacts_csv.inc.php');
|
||||||
|
|
||||||
class wizzard_addressbook_csv_import extends addressbook_csv_import
|
class wizzard_import_contacts_csv extends import_contacts_csv
|
||||||
{
|
{
|
||||||
|
|
||||||
var $steps;
|
var $steps;
|
||||||
@ -19,15 +19,15 @@ class wizzard_addressbook_csv_import extends addressbook_csv_import
|
|||||||
/**
|
/**
|
||||||
* constructor
|
* constructor
|
||||||
*/
|
*/
|
||||||
function wizzard_addressbook_csv_import()
|
function __construct()
|
||||||
{
|
{
|
||||||
$this->steps = array(
|
$this->steps = array(
|
||||||
'wizzard_step30' => lang('Load Sample file'),
|
'wizzard_step30' => lang('Load Sample file'),
|
||||||
'wizzard_step40' => lang('Choose seperator and charset'),
|
'wizzard_step40' => lang('Choose seperator and charset'),
|
||||||
'wizzard_step50' => lang('Manage mapping'),
|
'wizzard_step50' => lang('Manage mapping'),
|
||||||
|
'wizzard_step55' => lang('Edit conditions'),
|
||||||
'wizzard_step60' => lang('Choose owner of imported data'),
|
'wizzard_step60' => lang('Choose owner of imported data'),
|
||||||
);
|
);
|
||||||
$this->__construct();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function wizzard_step30(&$content, &$sel_options, &$readonlys, &$preserv)
|
function wizzard_step30(&$content, &$sel_options, &$readonlys, &$preserv)
|
||||||
@ -39,9 +39,13 @@ class wizzard_addressbook_csv_import extends addressbook_csv_import
|
|||||||
switch (array_search('pressed', $content['button']))
|
switch (array_search('pressed', $content['button']))
|
||||||
{
|
{
|
||||||
case 'next':
|
case 'next':
|
||||||
error_log(print_r($content,true));
|
// Move sample file to temp
|
||||||
$file = fopen ($content['file']['tmp_name'],'rb');
|
if($content['file']['tmp_name']) {
|
||||||
|
$csvfile = tempnam($GLOBALS['egw_info']['server']['temp_dir'],$content['plugin']."_");
|
||||||
|
move_uploaded_file($content['file']['tmp_name'], $csvfile);
|
||||||
|
$GLOBALS['egw']->session->appsession('csvfile','',$csvfile);
|
||||||
|
}
|
||||||
|
unset($content['file']);
|
||||||
return $GLOBALS['egw']->uidefinitions->get_step($content['step'],1);
|
return $GLOBALS['egw']->uidefinitions->get_step($content['step'],1);
|
||||||
case 'previous' :
|
case 'previous' :
|
||||||
return $GLOBALS['egw']->uidefinitions->get_step($content['step'],-1);
|
return $GLOBALS['egw']->uidefinitions->get_step($content['step'],-1);
|
||||||
@ -82,7 +86,15 @@ class wizzard_addressbook_csv_import extends addressbook_csv_import
|
|||||||
switch (array_search('pressed', $content['button']))
|
switch (array_search('pressed', $content['button']))
|
||||||
{
|
{
|
||||||
case 'next':
|
case 'next':
|
||||||
|
// Process sample file for fields
|
||||||
|
if (($handle = fopen($GLOBALS['egw']->session->appsession('csvfile'), "rb")) !== FALSE) {
|
||||||
|
$data = fgetcsv($handle, 8000, $content['fieldsep']);
|
||||||
|
$content['csv_fields'] = translation::convert($data,$content['charset']);
|
||||||
return $GLOBALS['egw']->uidefinitions->get_step($content['step'],1);
|
return $GLOBALS['egw']->uidefinitions->get_step($content['step'],1);
|
||||||
|
} elseif($content['plugin_options']['csv_fields']) {
|
||||||
|
$content['csv_fields'] = $content['plugin_options']['csv_fields'];
|
||||||
|
}
|
||||||
|
return $this->wizzard_step40($content,$sel_options,$readonlys,$preserv);
|
||||||
case 'previous' :
|
case 'previous' :
|
||||||
return $GLOBALS['egw']->uidefinitions->get_step($content['step'],-1);
|
return $GLOBALS['egw']->uidefinitions->get_step($content['step'],-1);
|
||||||
case 'finish':
|
case 'finish':
|
||||||
@ -96,6 +108,21 @@ class wizzard_addressbook_csv_import extends addressbook_csv_import
|
|||||||
{
|
{
|
||||||
$content['msg'] = $this->steps['wizzard_step40'];
|
$content['msg'] = $this->steps['wizzard_step40'];
|
||||||
$content['step'] = 'wizzard_step40';
|
$content['step'] = 'wizzard_step40';
|
||||||
|
|
||||||
|
// If editing an existing definition, these will be in plugin_options
|
||||||
|
if(!$content['fieldsep'] && $content['plugin_options']['fieldsep']) {
|
||||||
|
$content['fieldsep'] = $content['plugin_options']['fieldsep'];
|
||||||
|
}
|
||||||
|
if(!$content['charset'] && $content['plugin_options']['charset']) {
|
||||||
|
$content['charset'] = $content['plugin_options']['charset'];
|
||||||
|
}
|
||||||
|
if(!$content['has_header_line'] && $content['plugin_options']['has_header_line']) {
|
||||||
|
$content['num_header_lines'] = 1;
|
||||||
|
}
|
||||||
|
if(!$content['num_header_lines'] && $content['plugin_options']['num_header_lines']) {
|
||||||
|
$content['num_header_lines'] = $content['plugin_options']['num_header_lines'];
|
||||||
|
}
|
||||||
|
|
||||||
$sel_options['charset'] = $GLOBALS['egw']->translation->get_installed_charsets()+
|
$sel_options['charset'] = $GLOBALS['egw']->translation->get_installed_charsets()+
|
||||||
array('utf-8' => 'utf-8 (Unicode)');
|
array('utf-8' => 'utf-8 (Unicode)');
|
||||||
$preserv = $content;
|
$preserv = $content;
|
||||||
@ -112,9 +139,12 @@ class wizzard_addressbook_csv_import extends addressbook_csv_import
|
|||||||
if ($content['step'] == 'wizzard_step50')
|
if ($content['step'] == 'wizzard_step50')
|
||||||
{
|
{
|
||||||
array_shift($content['csv_fields']);
|
array_shift($content['csv_fields']);
|
||||||
//$content['csv_fields'] = array('csv_01','csv_02','csv_03','csv_04','csv_05','csv_06','csv_07','csv_08','csv_09','csv_10','csv_11','csv_12');
|
|
||||||
array_shift($content['field_mapping']);
|
array_shift($content['field_mapping']);
|
||||||
array_shift($content['field_translation']);
|
array_shift($content['field_conversion']);
|
||||||
|
|
||||||
|
foreach($content['field_conversion'] as $field => $convert) {
|
||||||
|
if(!trim($convert)) unset($content['field_conversion'][$field]);
|
||||||
|
}
|
||||||
|
|
||||||
switch (array_search('pressed', $content['button']))
|
switch (array_search('pressed', $content['button']))
|
||||||
{
|
{
|
||||||
@ -134,11 +164,15 @@ class wizzard_addressbook_csv_import extends addressbook_csv_import
|
|||||||
$content['msg'] = $this->steps['wizzard_step50'];
|
$content['msg'] = $this->steps['wizzard_step50'];
|
||||||
$content['step'] = 'wizzard_step50';
|
$content['step'] = 'wizzard_step50';
|
||||||
|
|
||||||
|
if(!$content['field_mapping'] && $content['plugin_options']) {
|
||||||
|
$content['field_mapping'] = $content['plugin_options']['field_mapping'];
|
||||||
|
$content['field_conversion'] = $content['plugin_options']['field_conversion'];
|
||||||
|
}
|
||||||
array_unshift($content['csv_fields'],array('row0'));
|
array_unshift($content['csv_fields'],array('row0'));
|
||||||
array_unshift($content['field_mapping'],array('row0'));
|
array_unshift($content['field_mapping'],array('row0'));
|
||||||
array_unshift($content['field_translation'],array('row0'));
|
array_unshift($content['field_conversion'],array('row0'));
|
||||||
|
|
||||||
$j = 0;
|
$j = 1;
|
||||||
foreach ($content['csv_fields'] as $field)
|
foreach ($content['csv_fields'] as $field)
|
||||||
{
|
{
|
||||||
if(strstr($field,'no_csv_')) $j++;
|
if(strstr($field,'no_csv_')) $j++;
|
||||||
@ -146,12 +180,16 @@ class wizzard_addressbook_csv_import extends addressbook_csv_import
|
|||||||
while ($j <= 3)
|
while ($j <= 3)
|
||||||
{
|
{
|
||||||
$content['csv_fields'][] = 'no_csv_'.$j;
|
$content['csv_fields'][] = 'no_csv_'.$j;
|
||||||
$content['field_mapping'][] = $content['field_translation'][] = '';
|
$content['field_mapping'][] = $content['field_conversion'][] = '';
|
||||||
$j++;
|
$j++;
|
||||||
}
|
}
|
||||||
$contact_fields = $this->bocontacts->get_contact_columns();
|
$bocontacts = new addressbook_bo();
|
||||||
$sel_options['field_mapping'] = array('' => lang('none')) + array_combine($contact_fields,$contact_fields);
|
$contact_fields = $bocontacts->contact_fields;
|
||||||
error_log(print_r($sel_options['field_mapping'],true));
|
foreach($bocontacts->customfields as $name => $data) {
|
||||||
|
$contact_fields['#'.$name] = $data['label'];
|
||||||
|
}
|
||||||
|
unset($addr_names['jpegphoto']); // can't cvs import that
|
||||||
|
$sel_options['field_mapping'] = array('' => lang('none')) + $contact_fields;
|
||||||
$preserv = $content;
|
$preserv = $content;
|
||||||
unset ($preserv['button']);
|
unset ($preserv['button']);
|
||||||
return 'addressbook.importexport_wizzard_fieldmaping';
|
return 'addressbook.importexport_wizzard_fieldmaping';
|
||||||
@ -159,6 +197,80 @@ class wizzard_addressbook_csv_import extends addressbook_csv_import
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Edit conditions
|
||||||
|
*/
|
||||||
|
function wizzard_step55(&$content, &$sel_options, &$readonlys, &$preserv)
|
||||||
|
{
|
||||||
|
if($this->debug) error_log('addressbook.wizzard_import_contacts_csv->$content '.print_r($content,true));
|
||||||
|
// return from step55
|
||||||
|
if ($content['step'] == 'wizzard_step55')
|
||||||
|
{
|
||||||
|
array_shift($content['conditions']);
|
||||||
|
|
||||||
|
foreach($content['conditions'] as $key => &$condition) {
|
||||||
|
// Clear empties
|
||||||
|
if($condition['string'] == '') {
|
||||||
|
unset($content['conditions'][$key]);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (array_search('pressed', $content['button']))
|
||||||
|
{
|
||||||
|
case 'next':
|
||||||
|
return $GLOBALS['egw']->uidefinitions->get_step($content['step'],1);
|
||||||
|
case 'previous' :
|
||||||
|
return $GLOBALS['egw']->uidefinitions->get_step($content['step'],-1);
|
||||||
|
case 'finish':
|
||||||
|
return 'wizzard_finish';
|
||||||
|
case 'add':
|
||||||
|
return $GLOBALS['egw']->uidefinitions->get_step($content['step'],0);
|
||||||
|
default :
|
||||||
|
return $this->wizzard_step55($content,$sel_options,$readonlys,$preserv);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// init step55
|
||||||
|
$content['msg'] = $this->steps['wizzard_step55'];
|
||||||
|
$content['step'] = 'wizzard_step55';
|
||||||
|
|
||||||
|
if(!$content['conditions'] && $content['plugin_options']['conditions']) {
|
||||||
|
$content['conditions'] = $content['plugin_options']['conditions'];
|
||||||
|
}
|
||||||
|
|
||||||
|
$bocontacts = new addressbook_bo();
|
||||||
|
$contact_fields = $bocontacts->contact_fields;
|
||||||
|
$sel_options['string'][''] = 'None';
|
||||||
|
foreach($bocontacts->customfields as $name => $data) {
|
||||||
|
$contact_fields['#'.$name] = $data['label'];
|
||||||
|
}
|
||||||
|
foreach($content['field_mapping'] as $field) {
|
||||||
|
$sel_options['string'][$field] = $contact_fields[$field];
|
||||||
|
}
|
||||||
|
$sel_options['type'] = array_combine(self::$conditions, self::$conditions);
|
||||||
|
$sel_options['action'] = array_combine(self::$actions, self::$actions);
|
||||||
|
|
||||||
|
// Make 3 empty conditions
|
||||||
|
$j = 1;
|
||||||
|
foreach ($content['conditions'] as $condition)
|
||||||
|
{
|
||||||
|
if(!$condition['string']) $j++;
|
||||||
|
}
|
||||||
|
while ($j <= 3)
|
||||||
|
{
|
||||||
|
$content['conditions'][] = array('string' => '');
|
||||||
|
$j++;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Leave room for heading
|
||||||
|
array_unshift($content['conditions'], false);
|
||||||
|
|
||||||
|
$preserv = $content;
|
||||||
|
unset ($preserv['button']);
|
||||||
|
return 'addressbook.importexport_wizzard_conditions';
|
||||||
|
}
|
||||||
|
|
||||||
function wizzard_step60(&$content, &$sel_options, &$readonlys, &$preserv)
|
function wizzard_step60(&$content, &$sel_options, &$readonlys, &$preserv)
|
||||||
{
|
{
|
||||||
if($this->debug) error_log('addressbook.importexport.addressbook_csv_import::wizzard_step60->$content '.print_r($content,true));
|
if($this->debug) error_log('addressbook.importexport.addressbook_csv_import::wizzard_step60->$content '.print_r($content,true));
|
||||||
@ -168,6 +280,7 @@ class wizzard_addressbook_csv_import extends addressbook_csv_import
|
|||||||
switch (array_search('pressed', $content['button']))
|
switch (array_search('pressed', $content['button']))
|
||||||
{
|
{
|
||||||
case 'next':
|
case 'next':
|
||||||
|
unset($content['csv_fields']);
|
||||||
return $GLOBALS['egw']->uidefinitions->get_step($content['step'],1);
|
return $GLOBALS['egw']->uidefinitions->get_step($content['step'],1);
|
||||||
case 'previous' :
|
case 'previous' :
|
||||||
return $GLOBALS['egw']->uidefinitions->get_step($content['step'],-1);
|
return $GLOBALS['egw']->uidefinitions->get_step($content['step'],-1);
|
||||||
@ -183,6 +296,13 @@ class wizzard_addressbook_csv_import extends addressbook_csv_import
|
|||||||
$content['msg'] = $this->steps['wizzard_step60'];
|
$content['msg'] = $this->steps['wizzard_step60'];
|
||||||
$content['step'] = 'wizzard_step60';
|
$content['step'] = 'wizzard_step60';
|
||||||
|
|
||||||
|
if(!$content['contact_owner'] && $content['plugin_options']) {
|
||||||
|
$content['contact_owner'] = $content['plugin_options']['contact_owner'];
|
||||||
|
}
|
||||||
|
|
||||||
|
$bocontacts = new addressbook_bo();
|
||||||
|
$sel_options['contact_owner'] = $bocontacts->get_addressbooks(EGW_ACL_ADD);
|
||||||
|
|
||||||
$preserv = $content;
|
$preserv = $content;
|
||||||
unset ($preserv['button']);
|
unset ($preserv['button']);
|
||||||
return 'addressbook.importexport_wizzard_chooseowner';
|
return 'addressbook.importexport_wizzard_chooseowner';
|
@ -2,7 +2,7 @@
|
|||||||
/**
|
/**
|
||||||
* eGroupWare - eTemplates for Application addressbook
|
* eGroupWare - eTemplates for Application addressbook
|
||||||
* http://www.egroupware.org
|
* http://www.egroupware.org
|
||||||
* generated by soetemplate::dump4setup() 2010-02-08 10:51
|
* generated by soetemplate::dump4setup() 2010-02-25 16:13
|
||||||
*
|
*
|
||||||
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
|
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
|
||||||
* @package addressbook
|
* @package addressbook
|
||||||
@ -66,13 +66,15 @@ $templ_data[] = array('name' => 'addressbook.email.rows','template' => '','lang'
|
|||||||
|
|
||||||
$templ_data[] = array('name' => 'addressbook.export_csv_options','template' => '','lang' => '','group' => '0','version' => '','data' => 'a:1:{i:0;a:4:{s:4:"type";s:4:"grid";s:4:"data";a:3:{i:0;a:0:{}i:1;a:2:{s:1:"A";a:2:{s:4:"type";s:5:"label";s:5:"label";s:9:"Seperator";}s:1:"B";a:3:{s:4:"type";s:4:"text";s:4:"size";s:1:"1";s:4:"name";s:9:"seperator";}}i:2;a:2:{s:1:"A";a:2:{s:4:"type";s:5:"label";s:5:"label";s:9:"Enclosure";}s:1:"B";a:3:{s:4:"type";s:4:"text";s:4:"size";s:1:"1";s:4:"name";s:9:"enclosure";}}}s:4:"rows";i:2;s:4:"cols";i:2;}}','size' => '','style' => '','modified' => '1160148382',);
|
$templ_data[] = array('name' => 'addressbook.export_csv_options','template' => '','lang' => '','group' => '0','version' => '','data' => 'a:1:{i:0;a:4:{s:4:"type";s:4:"grid";s:4:"data";a:3:{i:0;a:0:{}i:1;a:2:{s:1:"A";a:2:{s:4:"type";s:5:"label";s:5:"label";s:9:"Seperator";}s:1:"B";a:3:{s:4:"type";s:4:"text";s:4:"size";s:1:"1";s:4:"name";s:9:"seperator";}}i:2;a:2:{s:1:"A";a:2:{s:4:"type";s:5:"label";s:5:"label";s:9:"Enclosure";}s:1:"B";a:3:{s:4:"type";s:4:"text";s:4:"size";s:1:"1";s:4:"name";s:9:"enclosure";}}}s:4:"rows";i:2;s:4:"cols";i:2;}}','size' => '','style' => '','modified' => '1160148382',);
|
||||||
|
|
||||||
$templ_data[] = array('name' => 'addressbook.importexport_wizzard_chooseowner','template' => '','lang' => '','group' => '0','version' => '0.0.1','data' => 'a:1:{i:0;a:4:{s:4:"type";s:4:"grid";s:4:"data";a:3:{i:0;a:0:{}i:1;a:1:{s:1:"A";a:3:{s:4:"type";s:5:"label";s:4:"name";s:3:"msg";s:7:"no_lang";s:1:"1";}}i:2;a:1:{s:1:"A";a:3:{s:4:"type";s:14:"select-account";s:4:"name";s:5:"owner";s:4:"size";s:4:"none";}}}s:4:"rows";i:2;s:4:"cols";i:1;}}','size' => '','style' => '','modified' => '1146646360',);
|
$templ_data[] = array('name' => 'addressbook.importexport_wizzard_chooseowner','template' => '','lang' => '','group' => '0','version' => '0.0.1','data' => 'a:1:{i:0;a:4:{s:4:"type";s:4:"grid";s:4:"data";a:3:{i:0;a:0:{}i:1;a:1:{s:1:"A";a:3:{s:4:"type";s:5:"label";s:4:"name";s:3:"msg";s:7:"no_lang";s:1:"1";}}i:2;a:1:{s:1:"A";a:3:{s:4:"type";s:6:"select";s:4:"name";s:13:"contact_owner";s:4:"size";s:4:"None";}}}s:4:"rows";i:2;s:4:"cols";i:1;}}','size' => '','style' => '','modified' => '1146646360',);
|
||||||
|
|
||||||
$templ_data[] = array('name' => 'addressbook.importexport_wizzard_choosesepncharset','template' => '','lang' => '','group' => '0','version' => '0.0.1','data' => 'a:1:{i:0;a:4:{s:4:"type";s:4:"grid";s:4:"data";a:5:{i:0;a:1:{s:1:"B";s:5:"180px";}i:1;a:2:{s:1:"A";a:4:{s:4:"type";s:5:"label";s:7:"no_lang";s:1:"1";s:4:"name";s:3:"msg";s:4:"span";s:3:"all";}s:1:"B";a:1:{s:4:"type";s:5:"label";}}i:2;a:2:{s:1:"A";a:2:{s:4:"type";s:5:"label";s:5:"label";s:14:"Fieldseperator";}s:1:"B";a:4:{s:4:"type";s:4:"text";s:7:"no_lang";s:1:"1";s:4:"name";s:8:"fieldsep";s:4:"size";s:1:"1";}}i:3;a:2:{s:1:"A";a:2:{s:4:"type";s:5:"label";s:5:"label";s:7:"Charset";}s:1:"B";a:4:{s:4:"type";s:6:"select";s:7:"no_lang";s:1:"1";s:4:"name";s:7:"charset";s:4:"span";s:9:",width180";}}i:4;a:2:{s:1:"A";a:2:{s:4:"type";s:5:"label";s:5:"label";s:17:"Ignore first line";}s:1:"B";a:2:{s:4:"type";s:8:"checkbox";s:4:"name";s:15:"has_header_line";}}}s:4:"rows";i:4;s:4:"cols";i:2;}}','size' => '','style' => '.width180 select { width:150px;}','modified' => '1145979153',);
|
$templ_data[] = array('name' => 'addressbook.importexport_wizzard_choosesepncharset','template' => '','lang' => '','group' => '0','version' => '0.0.1','data' => 'a:1:{i:0;a:4:{s:4:"type";s:4:"grid";s:4:"data";a:5:{i:0;a:1:{s:1:"B";s:5:"180px";}i:1;a:2:{s:1:"A";a:4:{s:4:"type";s:5:"label";s:7:"no_lang";s:1:"1";s:4:"name";s:3:"msg";s:4:"span";s:3:"all";}s:1:"B";a:1:{s:4:"type";s:5:"label";}}i:2;a:2:{s:1:"A";a:2:{s:4:"type";s:5:"label";s:5:"label";s:14:"Fieldseperator";}s:1:"B";a:4:{s:4:"type";s:4:"text";s:7:"no_lang";s:1:"1";s:4:"name";s:8:"fieldsep";s:4:"size";s:1:"1";}}i:3;a:2:{s:1:"A";a:2:{s:4:"type";s:5:"label";s:5:"label";s:15:"Charset of file";}s:1:"B";a:4:{s:4:"type";s:6:"select";s:7:"no_lang";s:1:"1";s:4:"name";s:7:"charset";s:4:"span";s:9:",width180";}}i:4;a:2:{s:1:"A";a:2:{s:4:"type";s:5:"label";s:5:"label";s:20:"Header lines to skip";}s:1:"B";a:3:{s:4:"type";s:3:"int";s:4:"name";s:16:"num_header_lines";s:4:"size";s:1:"0";}}}s:4:"rows";i:4;s:4:"cols";i:2;}}','size' => '','style' => '.width180 select { width:150px;}','modified' => '1145979153',);
|
||||||
|
|
||||||
$templ_data[] = array('name' => 'addressbook.importexport_wizzard_choosetype','template' => '','lang' => '','group' => '0','version' => '0.0.1','data' => 'a:1:{i:0;a:4:{s:4:"type";s:4:"grid";s:4:"data";a:3:{i:0;a:0:{}i:1;a:1:{s:1:"A";a:3:{s:4:"type";s:5:"label";s:7:"no_lang";s:1:"1";s:4:"name";s:3:"msg";}}i:2;a:1:{s:1:"A";a:3:{s:4:"type";s:6:"select";s:7:"no_lang";s:1:"1";s:4:"name";s:11:"import_type";}}}s:4:"rows";i:2;s:4:"cols";i:1;}}','size' => '','style' => '','modified' => '1145977925',);
|
$templ_data[] = array('name' => 'addressbook.importexport_wizzard_choosetype','template' => '','lang' => '','group' => '0','version' => '0.0.1','data' => 'a:1:{i:0;a:4:{s:4:"type";s:4:"grid";s:4:"data";a:3:{i:0;a:0:{}i:1;a:1:{s:1:"A";a:3:{s:4:"type";s:5:"label";s:7:"no_lang";s:1:"1";s:4:"name";s:3:"msg";}}i:2;a:1:{s:1:"A";a:3:{s:4:"type";s:6:"select";s:7:"no_lang";s:1:"1";s:4:"name";s:11:"import_type";}}}s:4:"rows";i:2;s:4:"cols";i:1;}}','size' => '','style' => '','modified' => '1145977925',);
|
||||||
|
|
||||||
$templ_data[] = array('name' => 'addressbook.importexport_wizzard_fieldmaping','template' => '','lang' => '','group' => '0','version' => '0.0.1','data' => 'a:1:{i:0;a:4:{s:4:"type";s:4:"grid";s:4:"data";a:3:{i:0;a:0:{}i:1;a:1:{s:1:"A";a:4:{s:4:"type";s:5:"label";s:7:"no_lang";s:1:"1";s:4:"name";s:3:"msg";s:4:"span";s:3:"all";}}i:2;a:1:{s:1:"A";a:5:{s:4:"type";s:4:"grid";s:4:"data";a:3:{i:0;a:1:{s:2:"c1";s:2:"th";}i:1;a:3:{s:1:"A";a:2:{s:4:"type";s:5:"label";s:5:"label";s:9:"CSV Field";}s:1:"B";a:2:{s:4:"type";s:5:"label";s:5:"label";s:17:"Addressbook Field";}s:1:"C";a:2:{s:4:"type";s:5:"label";s:5:"label";s:11:"Translation";}}i:2;a:3:{s:1:"A";a:3:{s:4:"type";s:5:"label";s:4:"name";s:16:"csv_fields[$row]";s:7:"no_lang";s:1:"1";}s:1:"B";a:3:{s:4:"type";s:6:"select";s:7:"no_lang";s:1:"1";s:4:"name";s:19:"field_mapping[$row]";}s:1:"C";a:2:{s:4:"type";s:4:"text";s:4:"name";s:23:"field_translation[$row]";}}}s:4:"rows";i:2;s:4:"cols";i:3;s:7:"options";a:0:{}}}}s:4:"rows";i:2;s:4:"cols";i:1;}}','size' => '','style' => '','modified' => '1146036809',);
|
$templ_data[] = array('name' => 'addressbook.importexport_wizzard_conditions','template' => '','lang' => '','group' => '0','version' => '','data' => 'a:1:{i:0;a:7:{s:4:"type";s:4:"vbox";s:4:"data";a:2:{i:0;a:0:{}i:1;a:4:{s:1:"A";a:2:{s:4:"type";s:6:"select";s:4:"name";s:14:"${row}[string]";}s:1:"B";a:4:{s:4:"type";s:4:"hbox";s:4:"size";s:6:"2,,0,0";i:1;a:2:{s:4:"type";s:6:"select";s:4:"name";s:12:"${row}[type]";}i:2;a:2:{s:4:"type";s:4:"text";s:4:"name";s:12:"${row}[op_2]";}}s:1:"C";a:2:{s:4:"type";s:6:"select";s:4:"name";s:12:"${row}[true]";}s:1:"D";a:2:{s:4:"type";s:6:"select";s:4:"name";s:13:"${row}[false]";}}}s:4:"rows";i:1;s:4:"cols";i:4;s:4:"size";s:1:"2";i:1;a:6:{s:4:"type";s:4:"grid";s:4:"data";a:3:{i:0;a:1:{s:2:"c1";s:2:"th";}i:1;a:6:{s:1:"A";a:2:{s:4:"type";s:5:"label";s:5:"label";s:5:"Field";}s:1:"B";a:2:{s:4:"type";s:5:"label";s:5:"label";s:9:"Condition";}s:1:"C";a:5:{s:4:"type";s:4:"vbox";s:4:"size";s:1:"2";s:4:"span";s:1:"2";i:1;a:4:{s:4:"type";s:5:"label";s:4:"span";s:1:"2";s:5:"label";s:4:"True";s:5:"align";s:6:"center";}i:2;a:4:{s:4:"type";s:4:"hbox";s:4:"size";s:6:"2,,2,0";i:1;a:2:{s:4:"type";s:5:"label";s:5:"label";s:6:"Action";}i:2;a:3:{s:4:"type";s:5:"label";s:5:"label";s:4:"Stop";s:5:"align";s:5:"right";}}}s:1:"D";a:1:{s:4:"type";s:5:"label";}s:1:"E";a:5:{s:4:"type";s:4:"vbox";s:4:"size";s:1:"2";s:4:"span";s:1:"2";i:1;a:4:{s:4:"type";s:5:"label";s:4:"span";s:1:"2";s:5:"label";s:5:"False";s:5:"align";s:6:"center";}i:2;a:4:{s:4:"type";s:4:"hbox";s:4:"size";s:6:"2,,2,0";i:1;a:2:{s:4:"type";s:5:"label";s:5:"label";s:6:"Action";}i:2;a:3:{s:4:"type";s:5:"label";s:5:"label";s:4:"Stop";s:5:"align";s:5:"right";}}}s:1:"F";a:1:{s:4:"type";s:5:"label";}}i:2;a:6:{s:1:"A";a:2:{s:4:"type";s:6:"select";s:4:"name";s:14:"${row}[string]";}s:1:"B";a:4:{s:4:"type";s:4:"hbox";s:4:"size";s:6:"2,,0,0";i:1;a:2:{s:4:"type";s:6:"select";s:4:"name";s:12:"${row}[type]";}i:2;a:2:{s:4:"type";s:4:"text";s:4:"name";s:12:"${row}[op_2]";}}s:1:"C";a:2:{s:4:"type";s:6:"select";s:4:"name";s:20:"${row}[true][action]";}s:1:"D";a:3:{s:4:"type";s:8:"checkbox";s:5:"align";s:6:"center";s:4:"name";s:18:"${row}[true][stop]";}s:1:"E";a:2:{s:4:"type";s:6:"select";s:4:"name";s:21:"${row}[false][action]";}s:1:"F";a:3:{s:4:"type";s:8:"checkbox";s:5:"align";s:6:"center";s:4:"name";s:19:"${row}[false][stop]";}}}s:4:"rows";i:2;s:4:"cols";i:6;s:4:"name";s:10:"conditions";s:7:"options";a:0:{}}i:2;a:5:{s:4:"type";s:6:"button";s:4:"name";s:3:"add";s:5:"label";s:3:"add";s:4:"help";s:59:"This causes a segfault... haven\'t figured out how to fix it";s:8:"disabled";s:1:"1";}}}','size' => '','style' => '','modified' => '1266963791',);
|
||||||
|
|
||||||
|
$templ_data[] = array('name' => 'addressbook.importexport_wizzard_fieldmaping','template' => '','lang' => '','group' => '0','version' => '0.0.1','data' => 'a:1:{i:0;a:4:{s:4:"type";s:4:"grid";s:4:"data";a:3:{i:0;a:0:{}i:1;a:1:{s:1:"A";a:4:{s:4:"type";s:5:"label";s:7:"no_lang";s:1:"1";s:4:"name";s:3:"msg";s:4:"span";s:3:"all";}}i:2;a:1:{s:1:"A";a:5:{s:4:"type";s:4:"grid";s:4:"data";a:3:{i:0;a:1:{s:2:"c1";s:2:"th";}i:1;a:4:{s:1:"A";a:1:{s:4:"type";s:5:"label";}s:1:"B";a:2:{s:4:"type";s:5:"label";s:5:"label";s:9:"CSV Field";}s:1:"C";a:2:{s:4:"type";s:5:"label";s:5:"label";s:17:"Addressbook Field";}s:1:"D";a:2:{s:4:"type";s:5:"label";s:5:"label";s:11:"Translation";}}i:2;a:4:{s:1:"A";a:3:{s:4:"type";s:5:"label";s:5:"label";s:6:"${row}";s:7:"no_lang";s:1:"1";}s:1:"B";a:3:{s:4:"type";s:5:"label";s:4:"name";s:16:"csv_fields[$row]";s:7:"no_lang";s:1:"1";}s:1:"C";a:3:{s:4:"type";s:6:"select";s:7:"no_lang";s:1:"1";s:4:"name";s:19:"field_mapping[$row]";}s:1:"D";a:2:{s:4:"type";s:4:"text";s:4:"name";s:22:"field_conversion[$row]";}}}s:4:"rows";i:2;s:4:"cols";i:4;s:7:"options";a:0:{}}}}s:4:"rows";i:2;s:4:"cols";i:1;}}','size' => '','style' => '','modified' => '1146036809',);
|
||||||
|
|
||||||
$templ_data[] = array('name' => 'addressbook.importexport_wizzard_samplefile','template' => '','lang' => '','group' => '0','version' => '0.0.1','data' => 'a:1:{i:0;a:4:{s:4:"type";s:4:"grid";s:4:"data";a:3:{i:0;a:0:{}i:1;a:1:{s:1:"A";a:3:{s:4:"type";s:5:"label";s:4:"name";s:3:"msg";s:7:"no_lang";s:1:"1";}}i:2;a:1:{s:1:"A";a:2:{s:4:"type";s:4:"file";s:4:"name";s:4:"file";}}}s:4:"rows";i:2;s:4:"cols";i:1;}}','size' => '','style' => '','modified' => '1146650510',);
|
$templ_data[] = array('name' => 'addressbook.importexport_wizzard_samplefile','template' => '','lang' => '','group' => '0','version' => '0.0.1','data' => 'a:1:{i:0;a:4:{s:4:"type";s:4:"grid";s:4:"data";a:3:{i:0;a:0:{}i:1;a:1:{s:1:"A";a:3:{s:4:"type";s:5:"label";s:4:"name";s:3:"msg";s:7:"no_lang";s:1:"1";}}i:2;a:1:{s:1:"A";a:2:{s:4:"type";s:4:"file";s:4:"name";s:4:"file";}}}s:4:"rows";i:2;s:4:"cols";i:1;}}','size' => '','style' => '','modified' => '1146650510',);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user