diff --git a/importexport/inc/class.importexport_helper_functions.inc.php b/importexport/inc/class.importexport_helper_functions.inc.php index 4fb1cea44a..5c0a9eb4d0 100755 --- a/importexport/inc/class.importexport_helper_functions.inc.php +++ b/importexport/inc/class.importexport_helper_functions.inc.php @@ -21,6 +21,11 @@ class importexport_helper_functions { */ const CACHE_EXPIRATION = 3600; + /** + * Make no changes (automatic category creation) + */ + public static $dry_run = false; + /** * Files known to cause problems, and will be skipped in a plugin scan * If you put appname => true, the whole app will be skipped. @@ -187,7 +192,7 @@ class importexport_helper_functions { foreach ( $cat_names as $cat_name ) { $cat_name = trim($cat_name); if ( $cat_name == '' ) continue; - if ( ( $cat_id = $cats->name2id( $cat_name ) ) == 0 ) { + if ( ( $cat_id = $cats->name2id( $cat_name ) ) == 0 && !self::$dry_run) { $cat_id = $cats->add( array( 'name' => $cat_name, 'parent' => $parent, diff --git a/importexport/inc/class.importexport_import_ui.inc.php b/importexport/inc/class.importexport_import_ui.inc.php index 748c4cdbe0..39d15a2539 100644 --- a/importexport/inc/class.importexport_import_ui.inc.php +++ b/importexport/inc/class.importexport_import_ui.inc.php @@ -97,6 +97,7 @@ { // Set this so plugin doesn't do any data changes $content['dry-run'] = true; + importexport_helper_functions::$dry_run = true; $this->message .= '' . lang('Import aborted').":
\n"; $definition_obj->plugin_options = (array)$definition_obj->plugin_options + array('dry_run' => true); } @@ -105,6 +106,10 @@ { echo $this->preview($plugin, $file, $definition_obj); } + else + { + importexport_helper_functions::$dry_run = false; + } $count = $plugin->import($file, $definition_obj); } else