From f0ad214336550a429014c0e496511dada80be935 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jan=20B=C3=BCren?= Date: Fri, 23 Jan 2015 14:03:02 +0100 Subject: [PATCH] =?utf8?q?Weitere=20Positionen=20verkn=C3=BCpft?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Alle Workflows von Angebot bis Rechnung im Einkauf und Verkauf umgesetzt Offen: Gutschrift und Rückwartsverknüpfungen --- SL/DO.pm | 6 +++--- SL/IR.pm | 22 ++++++++++++++++++++++ SL/IS.pm | 22 ++++++++++++++++++++++ bin/mozilla/do.pl | 2 ++ bin/mozilla/io.pl | 7 +++---- bin/mozilla/oe.pl | 5 ++--- 6 files changed, 54 insertions(+), 10 deletions(-) diff --git a/SL/DO.pm b/SL/DO.pm index 5309c15a5..7659ffe60 100644 --- a/SL/DO.pm +++ b/SL/DO.pm @@ -404,15 +404,15 @@ SQL name_postfix => "_$i", dbh => $dbh); # link order items with doi - if ($form->{"converted_from_order_orderitems_id_$i"}) { + if ($form->{"converted_from_orderitems_id_$i"}) { RecordLinks->create_links('dbh' => $dbh, 'mode' => 'ids', 'from_table' => 'orderitems', - 'from_ids' => $form->{"converted_from_order_orderitems_id_$i"}, + 'from_ids' => $form->{"converted_from_orderitems_id_$i"}, 'to_table' => 'delivery_order_items', 'to_id' => $form->{"delivery_order_items_id_$i"}, ); - delete $form->{"converted_from_order_orderitems_id_$i"}; + delete $form->{"converted_from_orderitems_id_$i"}; } } diff --git a/SL/IR.pm b/SL/IR.pm index 98dcc86ff..457c48162 100644 --- a/SL/IR.pm +++ b/SL/IR.pm @@ -407,6 +407,28 @@ SQL name_prefix => 'ic_', name_postfix => "_$i", dbh => $dbh); + # link oe items with invoice + if ($form->{"converted_from_orderitems_id_$i"}) { + RecordLinks->create_links('dbh' => $dbh, + 'mode' => 'ids', + 'from_table' => 'orderitems', + 'from_ids' => $form->{"converted_from_orderitems_id_$i"}, + 'to_table' => 'invoice', + 'to_id' => $form->{"invoice_id_$i"}, + ); + delete $form->{"converted_from_orderitems_id_$i"}; + } + # link doi items with invoice + if ($form->{"converted_from_delivery_order_items_id_$i"}) { + RecordLinks->create_links('dbh' => $dbh, + 'mode' => 'ids', + 'from_table' => 'delivery_order_items', + 'from_ids' => $form->{"converted_from_delivery_order_items_id_$i"}, + 'to_table' => 'invoice', + 'to_id' => $form->{"invoice_id_$i"}, + ); + delete $form->{"converted_from_delivery_order_items_id_$i"}; + } } $h_item_unit->finish(); diff --git a/SL/IS.pm b/SL/IS.pm index 36036188d..e2358ea16 100644 --- a/SL/IS.pm +++ b/SL/IS.pm @@ -796,6 +796,28 @@ SQL name_postfix => "_$i", dbh => $dbh); } + # link oe items with invoice + if ($form->{"converted_from_orderitems_id_$i"}) { + RecordLinks->create_links('dbh' => $dbh, + 'mode' => 'ids', + 'from_table' => 'orderitems', + 'from_ids' => $form->{"converted_from_orderitems_id_$i"}, + 'to_table' => 'invoice', + 'to_id' => $form->{"invoice_id_$i"}, + ); + delete $form->{"converted_from_orderitems_id_$i"}; + } + # link doi items with invoice + if ($form->{"converted_from_delivery_order_items_id_$i"}) { + RecordLinks->create_links('dbh' => $dbh, + 'mode' => 'ids', + 'from_table' => 'delivery_order_items', + 'from_ids' => $form->{"converted_from_delivery_order_items_id_$i"}, + 'to_table' => 'invoice', + 'to_id' => $form->{"invoice_id_$i"}, + ); + delete $form->{"converted_from_delivery_order_items_id_$i"}; + } } # total payments, don't move we need it here diff --git a/bin/mozilla/do.pl b/bin/mozilla/do.pl index fd46ed745..d4fa8160f 100644 --- a/bin/mozilla/do.pl +++ b/bin/mozilla/do.pl @@ -785,6 +785,7 @@ sub invoice { } map { $form->{"${_}_${i}"} = $form->parse_amount(\%myconfig, $form->{"${_}_${i}"}) if $form->{"${_}_${i}"} } qw(ship qty sellprice listprice lastcost basefactor); $form->{"donumber_$i"} = $form->{donumber}; + $form->{"converted_from_delivery_order_items_id_$i"} = delete $form->{"delivery_order_items_id_$i"}; } $form->{type} = "invoice"; @@ -922,6 +923,7 @@ sub invoice_multi { $ref->{reqdate} ||= $ref->{dord_transdate}; # copy transdates into each invoice row map { $form->{"${_}_$form->{rowcount}"} = $ref->{$_} } keys %{ $ref }; map { $form->{"${_}_$form->{rowcount}"} = $form->format_amount(\%myconfig, $ref->{$_}) } qw(qty sellprice lastcost); + $form->{"converted_from_delivery_order_items_id_$form->{rowcount}"} = delete $form->{"delivery_order_items_id_$form->{rowcount}"}; if ($vc_discount){ # falls wir einen Lieferanten/Kundenrabatt haben # und keinen anderen discount wert an $i ... diff --git a/bin/mozilla/io.pl b/bin/mozilla/io.pl index 0b0d7723d..6a5556049 100644 --- a/bin/mozilla/io.pl +++ b/bin/mozilla/io.pl @@ -442,8 +442,7 @@ sub display_row { push @hidden_vars, qw(orderitems_id converted_from_quotation_orderitems_id); } if ($is_invoice) { - push @hidden_vars, qw(invoice_id converted_from_quotation_orderitems_id converted_from_order_orderitems_id - converted_from_delivery_order_items_id); + push @hidden_vars, qw(invoice_id converted_from_orderitems_id converted_from_delivery_order_items_id); } if ($::form->{type} =~ /credit_note/) { push @hidden_vars, qw(invoice_id converted_from_invoice_id); @@ -452,7 +451,7 @@ sub display_row { map { $form->{"${_}_${i}"} = $form->format_amount(\%myconfig, $form->{"${_}_${i}"}) } qw(sellprice discount lastcost); push @hidden_vars, grep { defined $form->{"${_}_${i}"} } qw(sellprice discount not_discountable price_factor_id lastcost); push @hidden_vars, "stock_${stock_in_out}_sum_qty", "stock_${stock_in_out}"; - push @hidden_vars, qw(delivery_order_items_id converted_from_order_orderitems_id); + push @hidden_vars, qw(delivery_order_items_id converted_from_orderitems_id); } my @HIDDENS = map { value => $_}, ( @@ -744,7 +743,7 @@ sub remove_emptied_rows { stock_out stock_in has_sernumber reqdate orderitems_id active_price_source active_discount_source delivery_order_items_id invoice_id converted_from_quotation_orderitems_id - converted_from_order_orderitems_id converted_from_delivery_order_items_id); + converted_from_orderitems_id converted_from_delivery_order_items_id); my $ic_cvar_configs = CVar->get_configs(module => 'IC'); push @flds, map { "ic_cvar_$_->{name}" } @{ $ic_cvar_configs }; diff --git a/bin/mozilla/oe.pl b/bin/mozilla/oe.pl index 09eb52af7..a313fb3cf 100644 --- a/bin/mozilla/oe.pl +++ b/bin/mozilla/oe.pl @@ -1423,6 +1423,7 @@ sub invoice { for (qw(ship qty sellprice listprice basefactor)) { $form->{"${_}_${i}"} = $form->parse_amount(\%myconfig, $form->{"${_}_${i}"}) if $form->{"${_}_${i}"}; } + $form->{"converted_from_orderitems_id_$i"} = delete $form->{"orderitems_id_$i"}; } my ($buysell, $orddate, $exchangerate); @@ -1472,7 +1473,6 @@ sub invoice { # bo creates the id, reset it map { delete $form->{$_} } qw(id subject message cc bcc printed emailed queued); - delete $form->{"orderitems_id_$_"} for 1 .. $form->{"rowcount"}; $form->{ $form->{vc} } =~ s/--.*//g; $form->{type} = "invoice"; @@ -1896,8 +1896,7 @@ sub delivery_order { 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_$i"} = $form->{"orderitems_id_$i"}; - delete $form->{"orderitems_id_$i"}; # even if they don't exist in form. cvars checks them before display_row + $form->{"converted_from_orderitems_id_$i"} = delete $form->{"orderitems_id_$i"}; } my %old_values = map { $_ => $form->{$_} } qw(customer_id oldcustomer customer vendor_id oldvendor vendor shipto_id); -- 2.20.1