projects
/
kivitendo-erp.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
VERSION auf unstable gesetzt
[kivitendo-erp.git]
/
SL
/
BackgroundJob
/
CsvImport.pm
diff --git
a/SL/BackgroundJob/CsvImport.pm
b/SL/BackgroundJob/CsvImport.pm
index
1798d67
..
1736721
100644
(file)
--- a/
SL/BackgroundJob/CsvImport.pm
+++ b/
SL/BackgroundJob/CsvImport.pm
@@
-5,8
+5,8
@@
use strict;
use parent qw(SL::BackgroundJob::Base);
use YAML ();
use parent qw(SL::BackgroundJob::Base);
use YAML ();
+use SL::JSON;
use SL::DB::CsvImportProfile;
use SL::DB::CsvImportProfile;
-use SL::SessionFile::Random;
sub create_job {
my ($self_or_class, %params) = @_;
sub create_job {
my ($self_or_class, %params) = @_;
@@
-14,13
+14,8
@@
sub create_job {
my $package = ref($self_or_class) || $self_or_class;
$package =~ s/SL::BackgroundJob:://;
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,
my %data = (
%params,
- profile_id => $new_profile->id,
session_id => $::auth->get_session_id,
);
session_id => $::auth->get_session_id,
);
@@
-60,6
+55,7
@@
sub do_import {
my $job = $self->{db_obj};
$c->profile($self->profile);
my $job = $self->{db_obj};
$c->profile($self->profile);
+ $c->mappings(SL::JSON::from_json($self->profile->get('json_mappings'))) if $self->profile->get('json_mappings');
$c->type($job->data_as_hash->{type});
$c->{employee_id} = $job->data_as_hash->{employee_id};
$c->type($job->data_as_hash->{type});
$c->{employee_id} = $job->data_as_hash->{employee_id};
@@
-93,7
+89,7
@@
sub do_import {
$result = $::locale->text('Import finished with errors.');
} else {
$result = $::locale->text('Import finished with errors.');
} else {
- my $report_id = $c->save_report(session_id => $session_id);
+ my $report_id = $c->save_report(session_id => $session_id
, test => $test
);
$job->set_data(report_id => $report_id)->save;
$c->track_progress(finished => 1);
$job->set_data(report_id => $report_id)->save;
$c->track_progress(finished => 1);