From 531aada2daa8be0b86a5426e3c576037ea560657 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Bernd=20Ble=C3=9Fmann?= Date: Wed, 14 May 2014 12:52:50 +0200 Subject: [PATCH] CsvImport Waren: Code-Vereinfachung --- SL/Controller/CsvImport/Part.pm | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/SL/Controller/CsvImport/Part.pm b/SL/Controller/CsvImport/Part.pm index 79c1b9192..8b9cb1335 100644 --- a/SL/Controller/CsvImport/Part.pm +++ b/SL/Controller/CsvImport/Part.pm @@ -210,11 +210,8 @@ sub check_existing { ); } - if ($self->settings->{article_number_policy} eq 'update_prices') { - if ($object->partnumber && $self->parts_by->{partnumber}{$object->partnumber}) { - push @{ $entry->{information} }, $::locale->text('Updating prices of existing entry in database'); - } - if ($entry->{part}) { + if ($entry->{part}) { + if ($self->settings->{article_number_policy} eq 'update_prices') { map { $entry->{part}->$_( $object->$_ ) if defined $object->$_ } qw(sellprice listprice lastcost); # merge prices @@ -223,14 +220,15 @@ sub check_existing { push @{ $entry->{information} }, $::locale->text('Updating prices of existing entry in database'); $entry->{object_to_save} = $entry->{part}; + } elsif ( $self->settings->{article_number_policy} eq 'skip' ) { + push(@{$entry->{errors}}, $::locale->text('Skipping due to existing entry in database')); + } else { + $object->partnumber('####'); } - } elsif ( $self->settings->{article_number_policy} eq 'skip' ) { - push(@{$entry->{errors}}, $::locale->text('Skipping due to existing entry in database')) if ( $entry->{part} ); - } else { - $object->partnumber('####') if $entry->{part}; } } + sub handle_prices { my ($self, $entry) = @_; -- 2.20.1