mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-07 08:34:42 +01:00
Implement new special linking fields
This commit is contained in:
parent
98ff5bbce2
commit
697d1cdbac
@ -102,7 +102,7 @@ class addressbook_egw_record implements importexport_iface_egw_record
|
||||
* @return string identifier of current record
|
||||
*/
|
||||
public function get_identifier() {
|
||||
return $this->identifier;
|
||||
return $this->identifier ? $this->identifier : $this->id;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -111,7 +111,8 @@ class addressbook_egw_record implements importexport_iface_egw_record
|
||||
* @return string identifier
|
||||
*/
|
||||
public function save ( $_dst_identifier ) {
|
||||
|
||||
// Not yet implemeted
|
||||
$this->identifier = $_dst_identifier;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -179,11 +179,11 @@ class addressbook_import_contacts_csv extends importexport_basic_import_csv {
|
||||
if ( !is_array( $record_array['cat_id'] ) ) $record->cat_id = explode( ',', $record->cat_id );
|
||||
$record->cat_id = implode( ',', array_unique( array_merge( $record->cat_id, $contact['cat_id'] ) ) );
|
||||
}
|
||||
$success = $this->action( $action['action'], $record->get_record_array(), $import_csv->get_current_position() );
|
||||
$success = $this->action( $action['action'], $record, $import_csv->get_current_position() );
|
||||
}
|
||||
} else {
|
||||
$action = $condition['false'];
|
||||
$success = ($this->action( $action['action'], $record->get_record_array(), $import_csv->get_current_position() ));
|
||||
$success = ($this->action( $action['action'], $record, $import_csv->get_current_position() ));
|
||||
}
|
||||
break;
|
||||
case 'equal':
|
||||
@ -193,13 +193,13 @@ class addressbook_import_contacts_csv extends importexport_basic_import_csv {
|
||||
{
|
||||
// Apply true action to any matching records found
|
||||
$action = $condition['true'];
|
||||
$success = ($this->action( $action['action'], $record->get_record_array(), $import_csv->get_current_position() ));
|
||||
$success = ($this->action( $action['action'], $record, $import_csv->get_current_position() ));
|
||||
}
|
||||
else
|
||||
{
|
||||
// Apply false action if no matching records found
|
||||
$action = $condition['false'];
|
||||
$success = ($this->action( $action['action'], $record->get_record_array(), $import_csv->get_current_position() ));
|
||||
$success = ($this->action( $action['action'], $record, $import_csv->get_current_position() ));
|
||||
}
|
||||
break;
|
||||
|
||||
@ -212,7 +212,7 @@ class addressbook_import_contacts_csv extends importexport_basic_import_csv {
|
||||
}
|
||||
} else {
|
||||
// unconditional insert
|
||||
$success = $this->action( 'insert', $record->get_record_array(), $import_csv->get_current_position() );
|
||||
$success = $this->action( 'insert', $record, $import_csv->get_current_position() );
|
||||
}
|
||||
return $success;
|
||||
}
|
||||
@ -221,10 +221,11 @@ class addressbook_import_contacts_csv extends importexport_basic_import_csv {
|
||||
* perform the required action
|
||||
*
|
||||
* @param int $_action one of $this->actions
|
||||
* @param array $_data contact data for the action
|
||||
* @param importexport_iface_egw_record $record contact data for the action
|
||||
* @return bool success or not
|
||||
*/
|
||||
protected function action ( $_action, Array $_data, $record_num = 0 ) {
|
||||
protected function action ( $_action, importexport_iface_egw_record &$record, $record_num = 0 ) {
|
||||
$_data = $record->get_record_array();
|
||||
switch ($_action) {
|
||||
case 'none' :
|
||||
return true;
|
||||
@ -296,6 +297,8 @@ class addressbook_import_contacts_csv extends importexport_basic_import_csv {
|
||||
$this->errors[$record_num] = $this->bocontacts->error;
|
||||
} else {
|
||||
$this->results[$_action]++;
|
||||
// This does nothing (yet?) but update the identifier
|
||||
$record->save($result);
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
@ -51,6 +51,9 @@ class addressbook_wizard_import_contacts_csv extends importexport_wizard_basic_i
|
||||
$this->mapping_fields['#'.$name] = $data['label'];
|
||||
}
|
||||
unset($this->mapping_fields['jpegphoto']); // can't cvs import that
|
||||
|
||||
// Add in special handled fields
|
||||
$this->mapping_fields[lang('Special')] = addressbook_import_contacts_csv::$special_fields;
|
||||
|
||||
// Actions
|
||||
$this->actions = array(
|
||||
|
Loading…
Reference in New Issue
Block a user