X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=SL%2FSEPA.pm;h=fc92bcf162ba65d29eddfad057f48ee3296155f4;hb=24d1656ebd75cc1125b15b1c9727cae0fb4417d1;hp=373711d47fe26889916cf83c1c04d814f1995418;hpb=60b170eb823d19d211db6412d2137129113e5c84;p=kivitendo-erp.git diff --git a/SL/SEPA.pm b/SL/SEPA.pm index 373711d47..fc92bcf16 100644 --- a/SL/SEPA.pm +++ b/SL/SEPA.pm @@ -29,13 +29,6 @@ sub retrieve_open_invoices { my $mandate = $params{vc} eq 'customer' ? " AND COALESCE(vc.mandator_id, '') <> '' AND vc.mandate_date_of_signature IS NOT NULL " : ''; - # in query: for customers, use payment terms from invoice, for vendors use - # payment terms from vendor settings - # currently there is no option in vendor invoices for setting payment terms, - # so the vendor settings are always used - - my $payment_term_type = $params{vc} eq 'customer' ? "${arap}" : 'vc'; - # open_amount is not the current open amount according to bookkeeping, but # the open amount minus the SEPA transfer amounts that haven't been closed yet my $query = @@ -63,7 +56,7 @@ sub retrieve_open_invoices { GROUP BY sei.${arap}_id) AS open_transfers ON (${arap}.id = open_transfers.${arap}_id) - LEFT JOIN payment_terms pt ON (${payment_term_type}.payment_id = pt.id) + LEFT JOIN payment_terms pt ON (${arap}.payment_id = pt.id) WHERE ${arap}.amount > (COALESCE(open_transfers.amount, 0) + ${arap}.paid) @@ -591,7 +584,3 @@ Returns undef if the deletion was successfully. Otherwise the function just dies with a short notice of the id. =cut - - - -