Merge branch 'master' of vc.linet-services.de:public/lx-office-erp
[kivitendo-erp.git] / SL / Controller / CsvImport / Base.pm
index eda921f..5aa6066 100644 (file)
@@ -15,7 +15,7 @@ use parent qw(Rose::Object);
 
 use Rose::Object::MakeMethods::Generic
 (
- scalar                  => [ qw(controller file csv) ],
+ scalar                  => [ qw(controller file csv save_with_cascade) ],
  'scalar --get_set_init' => [ qw(profile displayable_columns existing_objects class manager_class cvar_columns all_cvar_configs all_languages payment_terms_by all_vc vc_by) ],
 );
 
@@ -185,7 +185,7 @@ sub handle_cvars {
     my $value  = $entry->{raw_data}->{ "cvar_" . $config->name };
     my $column = $type_to_column{ $config->type } || die "Program logic error: unknown custom variable storage type";
 
-    push @cvars, SL::DB::CustomVariable->new(config_id => $config->id, $column => $value);
+    push @cvars, SL::DB::CustomVariable->new(config_id => $config->id, $column => $value, sub_module => '');
   }
 
   $entry->{object}->custom_variables(\@cvars);
@@ -305,7 +305,7 @@ sub save_objects {
 
     my $object = $entry->{object_to_save} || $entry->{object};
 
-    if (!$object->save) {
+    if ( !$object->save(cascade => !!$self->save_with_cascade()) ) {
       push @{ $entry->{errors} }, $::locale->text('Error when saving: #1', $entry->{object}->db->error);
     } else {
       $self->controller->num_imported($self->controller->num_imported + 1);