From 56e0744e2835cffe496531708ecfdaabc5b3bfee Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jan=20B=C3=BCren?= Date: Sun, 8 Jan 2017 17:03:22 +0100 Subject: [PATCH] SelfTests check_summe_stornobuchungen optimiert MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Die Summenprüfung der Stornobuchungen muss auch über den Jahreswechsel hinaus Buchungen berücksichtigen. --- SL/BackgroundJob/SelfTest/Transactions.pm | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/SL/BackgroundJob/SelfTest/Transactions.pm b/SL/BackgroundJob/SelfTest/Transactions.pm index d75a9a991..f0d6da9c1 100644 --- a/SL/BackgroundJob/SelfTest/Transactions.pm +++ b/SL/BackgroundJob/SelfTest/Transactions.pm @@ -206,14 +206,12 @@ sub check_summe_stornobuchungen { my $query = qq| select sum(amount) from ar a JOIN customer c ON (a.customer_id = c.id) - WHERE storno is true - AND a.transdate >= ? and a.transdate <= ?|; + WHERE a.id in (SELECT id from ap where storno is true AND a.transdate >= ? and a.transdate <= ?)|; my ($summe_stornobuchungen_ar) = selectfirst_array_query($::form, $self->dbh, $query, $self->fromdate, $self->todate); $query = qq| select sum(amount) from ap a JOIN vendor c ON (a.vendor_id = c.id) - WHERE storno is true - AND a.transdate >= ? and a.transdate <= ?|; + WHERE a.id in (SELECT id from ap where storno is true AND a.transdate >= ? and a.transdate <= ?)|; my ($summe_stornobuchungen_ap) = selectfirst_array_query($::form, $self->dbh, $query, $self->fromdate, $self->todate); $self->tester->ok($summe_stornobuchungen_ap == 0, 'Summe aller Einkaufsrechnungen (stornos + stornierte) soll 0 sein'); -- 2.20.1