CsvImport: handle_cvars: CVars für das zu speichernde Objekt setzen.
authorBernd Bleßmann <bernd@kivitendo-premium.de>
Tue, 11 Apr 2017 19:07:17 +0000 (21:07 +0200)
committerBernd Bleßmann <bernd@kivitendo-premium.de>
Tue, 6 Apr 2021 14:19:30 +0000 (16:19 +0200)
SL/Controller/CsvImport/Base.pm

index 663be5e..4d7df74 100644 (file)
@@ -311,14 +311,15 @@ sub handle_cvars {
 
   # merge existing with new cvars. swap every existing with the imported one, push the rest
   if (@cvars) {
-    my @orig_cvars = ($entry->{object_to_save} || $entry->{object})->custom_variables;
+    my $object     = $entry->{object_to_save} || $entry->{object};
+    my @orig_cvars = $object->custom_variables;
     for (@orig_cvars) {
       $_ = $changed_cvars{ $_->config->name } if $changed_cvars{ $_->config->name };
       delete $changed_cvars{ $_->config->name };
     }
     push @orig_cvars, values %changed_cvars;
 
-    $entry->{object}->custom_variables(\@orig_cvars);
+    $object->custom_variables(\@orig_cvars);
   }
 }