From afe7df8b3ebf17140e0d008ebb9852a6e392c3f4 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Bernd=20Ble=C3=9Fmann?= Date: Fri, 17 Apr 2015 11:13:02 +0200 Subject: [PATCH] =?utf8?q?Beim=20Erzeugen=20einer=20Rechnung=20f=C3=BCr=20?= =?utf8?q?Mahngeb=C3=BChren=20taxzone=5Fid=20des=20Kunden=20eintragen.?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Ist notwendig geworden, da das Feld taxzone_id inzwischen not null ist. Behebt #54 (redmine). --- SL/DN.pm | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/SL/DN.pm b/SL/DN.pm index c9289e46f..55200835e 100644 --- a/SL/DN.pm +++ b/SL/DN.pm @@ -211,7 +211,7 @@ sub create_invoice_for_fees { $query = qq|INSERT INTO ar (id, invnumber, transdate, gldate, customer_id, taxincluded, amount, netamount, paid, duedate, - invoice, currency_id, notes, + invoice, currency_id, taxzone_id, notes, employee_id) VALUES ( ?, -- id @@ -232,6 +232,14 @@ sub create_invoice_for_fees { (SELECT duedate FROM dunning WHERE dunning_id = ? LIMIT 1), 'f', -- invoice (SELECT id FROM currencies WHERE name = ?), -- curr + --taxzone_id: + (SELECT taxzone_id FROM customer WHERE id = + (SELECT ar.customer_id + FROM dunning dn + LEFT JOIN ar ON (dn.trans_id = ar.id) + WHERE dn.dunning_id = ? + LIMIT 1) + ), ?, -- notes -- employee_id: (SELECT id FROM employee WHERE login = ?) @@ -243,6 +251,7 @@ sub create_invoice_for_fees { $amount, $dunning_id, # duedate $curr, # default currency + $dunning_id, # taxzone_id sprintf($main::locale->text('Automatically created invoice for fee and interest for dunning %s'), $dunning_id), # notes $::myconfig{login}); # employee_id do_query($form, $dbh, $query, @values); -- 2.20.1