From fd840a7b95ace54ec5e865afea6ef806cb81c23d Mon Sep 17 00:00:00 2001 From: =?utf8?q?Bernd=20Ble=C3=9Fmann?= Date: Thu, 23 Mar 2017 23:37:59 +0100 Subject: [PATCH] =?utf8?q?CsvImport=20Auftr=C3=A4ge:=20Rabatt=20richtig=20?= =?utf8?q?f=C3=BCr=20Datenbank=20aufbereiten.?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit In der DB steht der Rabatt als Hundertstel. --- SL/Controller/CsvImport/Order.pm | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/SL/Controller/CsvImport/Order.pm b/SL/Controller/CsvImport/Order.pm index 484f5b87c..35f4fb40c 100644 --- a/SL/Controller/CsvImport/Order.pm +++ b/SL/Controller/CsvImport/Order.pm @@ -391,6 +391,7 @@ sub handle_item { $self->handle_unit($entry); $self->handle_sellprice($entry); + $self->handle_discount($entry); # copy from part if not given $object->description($part_obj->description) unless $object->description; @@ -398,7 +399,6 @@ sub handle_item { $object->lastcost($part_obj->lastcost) unless defined $object->lastcost; # set to 0 if not given - $object->discount(0) unless $object->discount; $object->ship(0) unless $object->ship; $self->check_project($entry, global => 0); @@ -448,6 +448,15 @@ sub handle_sellprice { } } +sub handle_discount { + my ($self, $entry) = @_; + + my $object = $entry->{object}; + + $object->discount($object->discount/100.0) if $object->discount; + $object->discount(0) unless $object->discount; +} + sub check_part { my ($self, $entry) = @_; -- 2.20.1