From 0b6157e266cfcee02eb7c8a127b1e502081aa119 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jan=20B=C3=BCren?= Date: Fri, 23 Jan 2015 08:53:11 +0100 Subject: [PATCH] =?utf8?q?Positionen=20verkn=C3=BCpfen=20Auftrag=20->=20Li?= =?utf8?q?eferschein?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit - from_table -> to_table (tabelleneintrag) i.O. - delete trigger i.O. - mittlere position löschen (vor speichern) i.O. - update sicher in form i.O. - mehrfach speichern i.O. --- SL/DO.pm | 11 +++++++++++ bin/mozilla/oe.pl | 4 ++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/SL/DO.pm b/SL/DO.pm index 8fad24ce0..5309c15a5 100644 --- a/SL/DO.pm +++ b/SL/DO.pm @@ -403,6 +403,17 @@ SQL name_prefix => 'ic_', name_postfix => "_$i", dbh => $dbh); + # link order items with doi + if ($form->{"converted_from_order_orderitems_id_$i"}) { + RecordLinks->create_links('dbh' => $dbh, + 'mode' => 'ids', + 'from_table' => 'orderitems', + 'from_ids' => $form->{"converted_from_order_orderitems_id_$i"}, + 'to_table' => 'delivery_order_items', + 'to_id' => $form->{"delivery_order_items_id_$i"}, + ); + delete $form->{"converted_from_order_orderitems_id_$i"}; + } } # 1. search for orphaned dois; processed_dois may be empty (no transfer) TODO: be supersafe and alter same statement for doi and oi diff --git a/bin/mozilla/oe.pl b/bin/mozilla/oe.pl index 9a1da4a39..09eb52af7 100644 --- a/bin/mozilla/oe.pl +++ b/bin/mozilla/oe.pl @@ -1893,11 +1893,11 @@ sub delivery_order { # reset delete @{$form}{qw(id subject message cc bcc printed emailed queued creditlimit creditremaining discount tradediscount oldinvtotal closed delivered)}; - delete $form->{"orderitems_id_$_"} for 1 .. $form->{"rowcount"}; for my $i (1 .. $form->{rowcount}) { map { $form->{"${_}_${i}"} = $form->parse_amount(\%myconfig, $form->{"${_}_${i}"}) if ($form->{"${_}_${i}"}) } qw(ship qty sellprice listprice lastcost basefactor discount); - $form->{"converted_from_order_orderitems_id_$_"} = $form->{"orderitems_id_$_"} for 1 .. $form->{"rowcount"}; + $form->{"converted_from_order_orderitems_id_$i"} = $form->{"orderitems_id_$i"}; + delete $form->{"orderitems_id_$i"}; # even if they don't exist in form. cvars checks them before display_row } my %old_values = map { $_ => $form->{$_} } qw(customer_id oldcustomer customer vendor_id oldvendor vendor shipto_id); -- 2.20.1