X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/mfinanz.git/blobdiff_plain/0ef6b519d07f99c8176f5edd59ea3158956cc7b3..991d16bbbc32c05e2e30e00711a42ba20207a8db:/SL/IS.pm diff --git a/SL/IS.pm b/SL/IS.pm index 36036188d..7c6aac74e 100644 --- a/SL/IS.pm +++ b/SL/IS.pm @@ -796,6 +796,19 @@ SQL name_postfix => "_$i", dbh => $dbh); } + # link previous items with invoice items + foreach (qw(delivery_order_items orderitems invoice)) { + if ($form->{"converted_from_${_}_id_$i"}) { + RecordLinks->create_links('dbh' => $dbh, + 'mode' => 'ids', + 'from_table' => $_, + 'from_ids' => $form->{"converted_from_${_}_id_$i"}, + 'to_table' => 'invoice', + 'to_id' => $form->{"invoice_id_$i"}, + ); + delete $form->{"converted_from_${_}_id_$i"}; + } + } } # total payments, don't move we need it here @@ -1193,14 +1206,16 @@ SQL } # Link this record to the records it was created from. - RecordLinks->create_links('dbh' => $dbh, - 'mode' => 'ids', - 'from_table' => 'oe', - 'from_ids' => $form->{convert_from_oe_ids}, - 'to_table' => 'ar', - 'to_id' => $form->{id}, - ); - delete $form->{convert_from_oe_ids}; + if ($form->{convert_from_oe_ids}) { + RecordLinks->create_links('dbh' => $dbh, + 'mode' => 'ids', + 'from_table' => 'oe', + 'from_ids' => $form->{convert_from_oe_ids}, + 'to_table' => 'ar', + 'to_id' => $form->{id}, + ); + delete $form->{convert_from_oe_ids}; + } my @convert_from_do_ids = map { $_ * 1 } grep { $_ } split m/\s+/, $form->{convert_from_do_ids};