X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/mfinanz.git/blobdiff_plain/bc40bcabc425b99f3b79a5544684a6fe8674adfe..4e0bef2d1ee1fa29e3fa85a97f34e707fe4e287d:/SL/IR.pm diff --git a/SL/IR.pm b/SL/IR.pm index aa2ed316e..90dbbab96 100644 --- a/SL/IR.pm +++ b/SL/IR.pm @@ -418,7 +418,7 @@ SQL dbh => $dbh); # link previous items with invoice items See IS.pm (no credit note -> no invoice item) - foreach (qw(delivery_order_items orderitems)) { + foreach (qw(delivery_order_items orderitems invoice)) { if (!$form->{useasnew} && $form->{"converted_from_${_}_id_$i"}) { RecordLinks->create_links('dbh' => $dbh, 'mode' => 'ids', @@ -758,16 +758,18 @@ SQL Common::webdav_folder($form); - # Link this record to the records it was created from. - 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' => 'ap', - 'to_id' => $form->{id}, + # Link this record to the records it was created from order or invoice (storno) + foreach (qw(oe ap)) { + if ($form->{"convert_from_${_}_ids"}) { + RecordLinks->create_links('dbh' => $dbh, + 'mode' => 'ids', + 'from_table' => $_, + 'from_ids' => $form->{"convert_from_${_}_ids"}, + 'to_table' => 'ap', + 'to_id' => $form->{id}, ); - delete $form->{convert_from_oe_ids}; + delete $form->{"convert_from_${_}_ids"}; + } } my @convert_from_do_ids = map { $_ * 1 } grep { $_ } split m/\s+/, $form->{convert_from_do_ids}; @@ -1463,8 +1465,8 @@ sub vendor_details { LIMIT 1|; my $ref = selectfirst_hashref_query($form, $dbh, $query, $form->{vendor_id}, @values); - # remove id and taxincluded before copy back - delete @$ref{qw(id taxincluded)}; + # remove id,notes (double of vendornotes) and taxincluded before copy back + delete @$ref{qw(id taxincluded notes)}; @wanted_vars = grep({ $_ } @wanted_vars); if (scalar(@wanted_vars) > 0) {