forked from extern/egroupware
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
|
* @return string identifier of current record
|
||||||
*/
|
*/
|
||||||
public function get_identifier() {
|
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
|
* @return string identifier
|
||||||
*/
|
*/
|
||||||
public function save ( $_dst_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 );
|
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'] ) ) );
|
$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 {
|
} else {
|
||||||
$action = $condition['false'];
|
$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;
|
break;
|
||||||
case 'equal':
|
case 'equal':
|
||||||
@ -193,13 +193,13 @@ class addressbook_import_contacts_csv extends importexport_basic_import_csv {
|
|||||||
{
|
{
|
||||||
// Apply true action to any matching records found
|
// Apply true action to any matching records found
|
||||||
$action = $condition['true'];
|
$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
|
else
|
||||||
{
|
{
|
||||||
// Apply false action if no matching records found
|
// Apply false action if no matching records found
|
||||||
$action = $condition['false'];
|
$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;
|
break;
|
||||||
|
|
||||||
@ -212,7 +212,7 @@ class addressbook_import_contacts_csv extends importexport_basic_import_csv {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// unconditional insert
|
// 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;
|
return $success;
|
||||||
}
|
}
|
||||||
@ -221,10 +221,11 @@ class addressbook_import_contacts_csv extends importexport_basic_import_csv {
|
|||||||
* perform the required action
|
* perform the required action
|
||||||
*
|
*
|
||||||
* @param int $_action one of $this->actions
|
* @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
|
* @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) {
|
switch ($_action) {
|
||||||
case 'none' :
|
case 'none' :
|
||||||
return true;
|
return true;
|
||||||
@ -296,6 +297,8 @@ class addressbook_import_contacts_csv extends importexport_basic_import_csv {
|
|||||||
$this->errors[$record_num] = $this->bocontacts->error;
|
$this->errors[$record_num] = $this->bocontacts->error;
|
||||||
} else {
|
} else {
|
||||||
$this->results[$_action]++;
|
$this->results[$_action]++;
|
||||||
|
// This does nothing (yet?) but update the identifier
|
||||||
|
$record->save($result);
|
||||||
}
|
}
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
@ -51,6 +51,9 @@ class addressbook_wizard_import_contacts_csv extends importexport_wizard_basic_i
|
|||||||
$this->mapping_fields['#'.$name] = $data['label'];
|
$this->mapping_fields['#'.$name] = $data['label'];
|
||||||
}
|
}
|
||||||
unset($this->mapping_fields['jpegphoto']); // can't cvs import that
|
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
|
// Actions
|
||||||
$this->actions = array(
|
$this->actions = array(
|
||||||
|
Loading…
Reference in New Issue
Block a user