X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=SL%2FController%2FCsvImport.pm;h=e603faa407023b7b25b55eabfc60769c9a65b73f;hb=55049b816f1c78769b3bfe734f033340d5872900;hp=c30634b96384d07eda6649f15001caa3adac719c;hpb=72b340de2352eec7d3f99a00e2141a2df35f07f3;p=kivitendo-erp.git diff --git a/SL/Controller/CsvImport.pm b/SL/Controller/CsvImport.pm index c30634b96..e603faa40 100644 --- a/SL/Controller/CsvImport.pm +++ b/SL/Controller/CsvImport.pm @@ -4,6 +4,7 @@ use strict; use SL::DB::Buchungsgruppe; use SL::DB::CsvImportProfile; +use SL::DB::Unit; use SL::Helper::Flash; use SL::SessionFile; use SL::Controller::CsvImport::Contact; @@ -17,7 +18,7 @@ use parent qw(SL::Controller::Base); use Rose::Object::MakeMethods::Generic ( - scalar => [ qw(type profile file all_profiles all_charsets sep_char all_sep_chars quote_char all_quote_chars escape_char all_escape_chars all_buchungsgruppen + scalar => [ qw(type profile file all_profiles all_charsets sep_char all_sep_chars quote_char all_quote_chars escape_char all_escape_chars all_buchungsgruppen all_units import_status errors headers raw_data_headers info_headers data num_imported num_importable displayable_columns) ], ); @@ -84,7 +85,7 @@ sub action_download_sample { $file->fh->close; - $self->send_file($file->file_name); + $self->send_file($file->file_name, name => $file_name); } # @@ -142,7 +143,10 @@ sub render_inputs { : $self->type eq 'parts' ? $::locale->text('CSV import: parts and services') : die; - $self->all_buchungsgruppen(SL::DB::Manager::Buchungsgruppe->get_all_sorted); + if ($self->{type} eq 'parts') { + $self->all_buchungsgruppen(SL::DB::Manager::Buchungsgruppe->get_all_sorted); + $self->all_units(SL::DB::Manager::Unit->get_all_sorted); + } $self->setup_help; @@ -168,6 +172,8 @@ sub test_and_import { my $worker = $self->create_worker($file); $worker->run; + + $self->num_imported(0); $worker->save_objects if !$params{test}; $self->num_importable(scalar grep { !$_ } map { scalar @{ $_->{errors} } } @{ $self->data || [] });