From: Bernd Bleßmann Date: Wed, 14 May 2014 10:52:50 +0000 (+0200) Subject: CsvImport Waren: Code-Vereinfachung X-Git-Tag: release-3.2.0beta~451 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=531aada2daa8be0b86a5426e3c576037ea560657;p=kivitendo-erp.git CsvImport Waren: Code-Vereinfachung --- 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) = @_;