From 2c139ad7f5c53e71edcef01552f2fab558fd3ebe Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Thu, 3 Mar 2011 09:43:47 +0100 Subject: [PATCH] Auf alle Fehler auf einmal testen und nicht beim ersten abbrechen --- SL/Controller/CsvImport/CustomerVendor.pm | 10 ++++++---- SL/Controller/CsvImport/Part.pm | 18 +++++++++--------- 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/SL/Controller/CsvImport/CustomerVendor.pm b/SL/Controller/CsvImport/CustomerVendor.pm index e8cfc367d..66a0f1bd0 100644 --- a/SL/Controller/CsvImport/CustomerVendor.pm +++ b/SL/Controller/CsvImport/CustomerVendor.pm @@ -52,12 +52,14 @@ sub check_objects { foreach my $entry (@{ $self->controller->data }) { my $object = $entry->{object}; - next unless $self->check_name($entry); - next unless $self->check_language($entry); - next unless $self->check_business($entry); - next unless $self->check_payment($entry); + $self->check_name($entry); + $self->check_language($entry); + $self->check_business($entry); + $self->check_payment($entry); $self->handle_cvars($entry); + next if @{ $entry->{errors} }; + if ($vcs_by_number{ $object->$numbercolumn }) { $entry->{object}->$numbercolumn('####'); } else { diff --git a/SL/Controller/CsvImport/Part.pm b/SL/Controller/CsvImport/Part.pm index 6de1a079b..4f1278ac4 100644 --- a/SL/Controller/CsvImport/Part.pm +++ b/SL/Controller/CsvImport/Part.pm @@ -103,14 +103,14 @@ sub check_objects { return unless @{ $self->controller->data }; foreach my $entry (@{ $self->controller->data }) { - next unless $self->check_buchungsgruppe($entry); - next unless $self->check_type($entry); - next unless $self->check_unit($entry); - next unless $self->check_price_factor($entry); - next unless $self->check_payment($entry); - next unless $self->check_packing_type($entry); - next unless $self->check_partsgroup($entry); - $self->check_existing($entry); + $self->check_buchungsgruppe($entry); + $self->check_type($entry); + $self->check_unit($entry); + $self->check_price_factor($entry); + $self->check_payment($entry); + $self->check_packing_type($entry); + $self->check_partsgroup($entry); + $self->check_existing($entry) unless @{ $entry->{errors} }; $self->handle_prices($entry) if $self->settings->{sellprice_adjustment}; $self->handle_shoparticle($entry); $self->handle_translations($entry); @@ -226,7 +226,7 @@ sub check_type { my ($self, $entry) = @_; my $bg = $self->bg_by->{id}->{ $entry->{object}->buchungsgruppen_id }; - die "Program logic error" if !$bg; + $bg ||= SL::DB::Buchungsgruppe->new(inventory_accno_id => 1, income_accno_id_0 => 1, expense_accno_id_0 => 1); my $type = $self->settings->{parts_type}; if ($type eq 'mixed') { -- 2.20.1