From: G. Richardson Date: Tue, 18 Feb 2014 16:13:48 +0000 (+0100) Subject: Neuer SelfTest Testfall: verwaiste invoice Einträge X-Git-Tag: release-3.1.0rc1~15 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=ea8e8a6295c01df6520af9f48af61642b7c2895b;p=kivitendo-erp.git Neuer SelfTest Testfall: verwaiste invoice Einträge Suche nach verwaisten Einträgen in invoice, die weder mit ar noch mit ap verknüpft sind. --- diff --git a/SL/BackgroundJob/SelfTest/Transactions.pm b/SL/BackgroundJob/SelfTest/Transactions.pm index 9b5daed21..939c79571 100644 --- a/SL/BackgroundJob/SelfTest/Transactions.pm +++ b/SL/BackgroundJob/SelfTest/Transactions.pm @@ -15,12 +15,13 @@ sub run { $self->_setup; - $self->tester->plan(tests => 16); + $self->tester->plan(tests => 17); $self->check_konten_mit_saldo_nicht_in_guv; $self->check_bilanzkonten_mit_pos_eur; $self->check_balanced_individual_transactions; $self->check_verwaiste_acc_trans_eintraege; + $self->check_verwaiste_invoice_eintraege; $self->check_netamount_laut_invoice_ar; $self->check_invnumbers_unique; $self->check_summe_stornobuchungen; @@ -128,6 +129,23 @@ sub check_verwaiste_acc_trans_eintraege { } } +sub check_verwaiste_invoice_eintraege { + # taxincluded is null sollte nie passieren: + # select sum(sellprice*qty) from invoice i where trans_id in (select id from ar where taxincluded is null); + my ($self) = @_; + my $query = qq| + select * from invoice + where trans_id not in (select id from ar union select id from ap order by id) + and a.transdate >= ? and a.transdate <= ? ;|; + + my $verwaiste_invoice = selectall_hashref_query($::form, $self->dbh, $query, $self->fromdate, $self->todate); + if (@$verwaiste_invoice) { + $self->tester->ok(0, "Es gibt verwaiste invoice Einträge! (wo ar/ap-Eintrag fehlt)"); + $self->tester->diag($_) for @$verwaiste_acs; + } else { + $self->tester->ok(1, "Keine verwaisten invoice Einträge (wo ar/ap-Eintrag fehlt)"); } +} + sub check_netamount_laut_invoice_ar { my ($self) = @_; my $query = qq|