mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-22 06:30:59 +01:00
new option "trash_users_records" usefull to stay in sync with external manipulated data
This commit is contained in:
parent
a5b4b71d79
commit
225423eb7f
@ -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:
|
||||
@ -93,7 +94,7 @@ class import_events_csv implements iface_import_plugin {
|
||||
));
|
||||
|
||||
$this->definition = $_definition;
|
||||
|
||||
|
||||
// user, is admin ?
|
||||
$this->is_admin = isset( $GLOBALS['egw_info']['user']['apps']['admin'] ) && $GLOBALS['egw_info']['user']['apps']['admin'];
|
||||
$this->user = $GLOBALS['egw_info']['user']['account_id'];
|
||||
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user