X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=SL%2FController%2FCsvImport.pm;h=d924f07d98c80de81a85d7aff5aef48be1165126;hb=159dd37836728abbb2caca3cb25904428ed99859;hp=9cca6cd80f335d544ba4ebae0122135a2a031496;hpb=65e4c07fd92b11481265ab49f9bae88734832acf;p=kivitendo-erp.git diff --git a/SL/Controller/CsvImport.pm b/SL/Controller/CsvImport.pm index 9cca6cd80..d924f07d9 100644 --- a/SL/Controller/CsvImport.pm +++ b/SL/Controller/CsvImport.pm @@ -4,12 +4,14 @@ 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; use SL::Controller::CsvImport::CustomerVendor; use SL::Controller::CsvImport::Part; use SL::Controller::CsvImport::Shipto; +use SL::Controller::CsvImport::Project; use List::MoreUtils qw(none); @@ -17,7 +19,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 +86,7 @@ sub action_download_sample { $file->fh->close; - $self->send_file($file->file_name); + $self->send_file($file->file_name, name => $file_name); } # @@ -98,7 +100,7 @@ sub check_auth { sub check_type { my ($self) = @_; - die "Invalid CSV import type" if none { $_ eq $::form->{profile}->{type} } qw(parts customers_vendors addresses contacts); + die "Invalid CSV import type" if none { $_ eq $::form->{profile}->{type} } qw(parts customers_vendors addresses contacts projects); $self->type($::form->{profile}->{type}); } @@ -140,9 +142,13 @@ sub render_inputs { : $self->type eq 'addresses' ? $::locale->text('CSV import: shipping addresses') : $self->type eq 'contacts' ? $::locale->text('CSV import: contacts') : $self->type eq 'parts' ? $::locale->text('CSV import: parts and services') + : $self->type eq 'projects' ? $::locale->text('CSV import: projects') : 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; @@ -254,6 +260,7 @@ sub create_worker { : $self->{type} eq 'contacts' ? SL::Controller::CsvImport::Contact->new( controller => $self, file => $file) : $self->{type} eq 'addresses' ? SL::Controller::CsvImport::Shipto->new( controller => $self, file => $file) : $self->{type} eq 'parts' ? SL::Controller::CsvImport::Part->new( controller => $self, file => $file) + : $self->{type} eq 'projects' ? SL::Controller::CsvImport::Project->new( controller => $self, file => $file) : die "Program logic error"; }