From: Bernd Bleßmann Date: Thu, 23 Mar 2017 15:43:03 +0000 (+0100) Subject: CsvImport Aufträge: Artikel auch nach EAN suchen X-Git-Tag: release-3.5.4~1173 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=f87214b22e4bf7a54f314d8248468529ad7019e0;p=kivitendo-erp.git CsvImport Aufträge: Artikel auch nach EAN suchen --- diff --git a/SL/Controller/CsvImport/Order.pm b/SL/Controller/CsvImport/Order.pm index 0d5494413..4393fd424 100644 --- a/SL/Controller/CsvImport/Order.pm +++ b/SL/Controller/CsvImport/Order.pm @@ -162,6 +162,7 @@ sub setup_displayable_columns { { name => 'cusordnumber', description => $::locale->text('Customer Order Number') }, { name => 'description', description => $::locale->text('Description') }, { name => 'discount', description => $::locale->text('Discount') }, + { name => 'ean', description => $::locale->text('EAN') }, { name => 'lastcost', description => $::locale->text('Lastcost') }, { name => 'longdescription', description => $::locale->text('Long Description') }, { name => 'marge_percent', description => $::locale->text('Margepercent') }, @@ -464,6 +465,17 @@ sub check_part { $object->parts_id($part->id); } + # Map ean to ID if given. + if (!$object->parts_id && $entry->{raw_data}->{ean}) { + my $part = $self->parts_by->{ean}->{ $entry->{raw_data}->{ean} }; + if (!$part) { + push @{ $entry->{errors} }, $::locale->text('Error: Invalid part'); + return 0; + } + + $object->parts_id($part->id); + } + if ($object->parts_id) { $entry->{info_data}->{partnumber} = $self->parts_by->{id}->{ $object->parts_id }->partnumber; } else {