new option "trash_users_records" usefull to stay in sync with external manipulated data

This commit is contained in:
Cornelius Weiß 2007-07-06 10:49:24 +00:00
parent a5b4b71d79
commit 225423eb7f

View File

@ -28,6 +28,7 @@ class import_events_csv implements iface_import_plugin {
// with cat(s) from csv OR add the cat from
// csv file to exeisting cat(s) of record
'num_header_lines', // int number of header lines
'trash_users_records', // trashes all events of events owner before import
'field_conversion', // array( $csv_col_num => conversion)
'field_mapping', // array( $csv_col_num => adb_filed)
'conditions', /* => array containing condition arrays:
@ -119,6 +120,18 @@ class import_events_csv implements iface_import_plugin {
$_definition->plugin_options['events_owner'] = isset( $_definition->plugin_options['events_owner'] ) ?
$_definition->plugin_options['events_owner'] : $this->user;
// trash_users_records ?
if ( $_definition->plugin_options['trash_users_records'] === true ) {
if ( !$_definition->plugin_options['dry_run'] ) {
$socal = CreateObject( 'calendar.socal' );
$socal->change_delete_user( $_definition->plugin_options['events_owner'], false );
unset( $socal );
} else {
$lid = $GLOBALS['egw']->accounts->id2name( $_definition->plugin_options['events_owner'] );
echo "Attension: All Events of '$lid' would be deleted!\n";
}
}
while ( $record = $import_csv->get_record() ) {
// don't import empty events