CsvImport: Controller erzeugt temporäres Profil, nicht der Hintergrund-Job.
authorBernd Bleßmann <bernd@kivitendo-premium.de>
Mon, 20 Feb 2017 11:19:05 +0000 (12:19 +0100)
committerBernd Bleßmann <bernd@kivitendo-premium.de>
Fri, 3 Mar 2017 20:57:10 +0000 (21:57 +0100)
SL/BackgroundJob/CsvImport.pm
SL/Controller/CsvImport.pm

index 14ad336..1736721 100644 (file)
@@ -14,13 +14,8 @@ sub create_job {
   my $package       = ref($self_or_class) || $self_or_class;
   $package          =~ s/SL::BackgroundJob:://;
 
-  my $profile = delete $params{profile} || SL::DB::CsvImportProfile->new;
-  my $new_profile = $profile->clone_and_reset_deep;
-  $new_profile->save;
-
   my %data = (
     %params,
-    profile_id => $new_profile->id,
     session_id => $::auth->get_session_id,
   );
 
index 005fcd7..09b9703 100644 (file)
@@ -359,9 +359,12 @@ sub test_and_import_deferred {
     return $self->action_new;
   }
 
+  # save tempory profile
+  $self->profile($self->profile->clone_and_reset_deep)->save;
+
   $self->{background_job} = SL::BackgroundJob::CsvImport->create_job(
     file        => $self->csv_file_name,
-    profile     => $self->profile,
+    profile_id  => $self->profile->id,
     type        => $self->profile->type,
     test        => $params{test},
     employee_id => SL::DB::Manager::Employee->current->id,