diff --git a/addressbook/importexport/class.import_contacts_csv.inc.php b/addressbook/importexport/class.import_contacts_csv.inc.php index 3f910e7bb4..d39b2414df 100644 --- a/addressbook/importexport/class.import_contacts_csv.inc.php +++ b/addressbook/importexport/class.import_contacts_csv.inc.php @@ -62,11 +62,9 @@ class import_contacts_csv implements iface_import_plugin { private $bocontacts; /** - * constructor of import_contacts_csv - * - public function __construct() { - $this->bocontacts = CreateObject('addressbook.bocontacts'); - }*/ + * @var bool + */ + private $dry_run = false; /** * imports entries according to given definition object. @@ -80,6 +78,9 @@ class import_contacts_csv implements iface_import_plugin { 'charset' => $_definition->plugin_options['charset'], )); + // dry run? + $this->dry_run = isset( $_definition->plugin_options['dry_run'] ) ? $_definition->plugin_options['dry_run'] : false; + // fetch the addressbook bo $this->bocontacts = CreateObject('addressbook.bocontacts'); @@ -100,7 +101,6 @@ class import_contacts_csv implements iface_import_plugin { $record['contact_owner'] = $_definition->plugin_options['contact_owner']; } - // while ( $record = $import_csv->get_record() ) { // don't import empty contacts @@ -129,7 +129,7 @@ class import_contacts_csv implements iface_import_plugin { $this->action( $action['action'], $record ); } } else { - $action = $condition['true']; + $action = $condition['false']; $this->action( $action['action'], $record ); } break; @@ -161,7 +161,11 @@ class import_contacts_csv implements iface_import_plugin { return true; case 'update' : case 'insert' : - return $this->bocontacts->save( $_data ); + if ( $this->dry_run ) { + print_r($_data); + } else { + return $this->bocontacts->save( $_data ); + } case 'delete' : } }