X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/mfinanz.git/blobdiff_plain/93dc3778a97299cd8b9dc4a35a9a927b5ba95306..2bb1c9616f0fe4c8c1d39574a99eff02a7ece42e:/SL/IR.pm diff --git a/SL/IR.pm b/SL/IR.pm index 7a7f57c4b..a87fca31b 100644 --- a/SL/IR.pm +++ b/SL/IR.pm @@ -369,6 +369,12 @@ sub post_invoice { next if $payments_only; + CVar->get_non_editable_ic_cvars(form => $form, + dbh => $dbh, + row => $i, + sub_module => 'invoice', + may_converted_from => ['delivery_order_items', 'orderitems', 'invoice']); + if (!$form->{"invoice_id_$i"}) { # there is no persistent id, therefore create one with all necessary constraints my $q_invoice_id = qq|SELECT nextval('invoiceid')|; @@ -410,9 +416,10 @@ SQL name_prefix => 'ic_', name_postfix => "_$i", dbh => $dbh); + # link previous items with invoice items See IS.pm (no credit note -> no invoice item) foreach (qw(delivery_order_items orderitems)) { - if ($form->{"converted_from_${_}_id_$i"}) { + if (!$form->{useasnew} && $form->{"converted_from_${_}_id_$i"}) { RecordLinks->create_links('dbh' => $dbh, 'mode' => 'ids', 'from_table' => $_, @@ -420,8 +427,8 @@ SQL 'to_table' => 'invoice', 'to_id' => $form->{"invoice_id_$i"}, ); - delete $form->{"converted_from_${_}_id_$i"}; } + delete $form->{"converted_from_${_}_id_$i"}; } } @@ -1640,5 +1647,4 @@ sub get_duedate { return $duedate; } - 1;