From 39fa895d374f260293a35734b93ede881e4fed9e Mon Sep 17 00:00:00 2001 From: =?utf8?q?Bernd=20Ble=C3=9Fmann?= Date: Mon, 29 Oct 2018 15:48:06 +0100 Subject: [PATCH] =?utf8?q?Part-Controller:=20Als=20neu=20verwenden:=20neue?= =?utf8?q?=20Id=20f=C3=BCr=20Kunden-/Lieferanten-Art-Nr.?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit bzw. nicht die alte Id (MakeModel / PartCustomerPrice) für die neuen Objekte verwenden. Sonst gehen die Kunden-/Lieferanten-Art-Nr. beim Speichern im alten Artikel verloren. --- SL/Controller/Part.pm | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/SL/Controller/Part.pm b/SL/Controller/Part.pm index 4fbd0c82f..27a23daa8 100644 --- a/SL/Controller/Part.pm +++ b/SL/Controller/Part.pm @@ -796,8 +796,9 @@ sub parse_form_makemodels { $position++; my $vendor = SL::DB::Manager::Vendor->find_by(id => $makemodel->{make}) || die "Can't find vendor from make"; + my $id = $makemodels_map->{$makemodel->{id}} ? $makemodels_map->{$makemodel->{id}}->id : undef; my $mm = SL::DB::MakeModel->new( # parts_id => $self->part->id, # will be assigned by row add_makemodels - id => $makemodel->{id}, + id => $id, make => $makemodel->{make}, model => $makemodel->{model} || '', lastcost => $::form->parse_amount(\%::myconfig, $makemodel->{lastcost_as_number}), @@ -836,8 +837,9 @@ sub parse_form_customerprices { $position++; my $customer = SL::DB::Manager::Customer->find_by(id => $customerprice->{customer_id}) || die "Can't find customer from id"; + my $id = $customerprices_map->{$customerprice->{id}} ? $customerprices_map->{$customerprice->{id}}->id : undef; my $cu = SL::DB::PartCustomerPrice->new( # parts_id => $self->part->id, # will be assigned by row add_customerprices - id => $customerprice->{id}, + id => $id, customer_id => $customerprice->{customer_id}, customer_partnumber => $customerprice->{customer_partnumber} || '', price => $::form->parse_amount(\%::myconfig, $customerprice->{price_as_number}), -- 2.20.1