From 5a5ec009b3d3bd4d24b65dba4f61c23f69a51770 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jan=20B=C3=BCren?= Date: Wed, 23 Mar 2022 08:26:27 +0100 Subject: [PATCH] Testfall bank_transactions angepasst MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit - Payment-Helper keine uninit params - skonto steuerkorrektur macht zwei weitere acc_trans verknüpfungen --- SL/DB/Helper/Payment.pm | 4 ++++ t/bank/bank_transactions.t | 9 +++++---- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/SL/DB/Helper/Payment.pm b/SL/DB/Helper/Payment.pm index aee932097..e2ea53c06 100644 --- a/SL/DB/Helper/Payment.pm +++ b/SL/DB/Helper/Payment.pm @@ -583,6 +583,10 @@ sub _skonto_charts_and_tax_correction { croak "no banktransaction.id passed to skonto_charts" unless $params{bt_id}; croak "no banktransaction.transdate passed to skonto_charts" unless ref $params{transdate_obj} eq 'DateTime'; + $params{memo} //= ''; + $params{source} //= ''; + + my $is_sales = $self->is_sales; my (@skonto_charts, $inv_calc, $total_skonto_rounded); diff --git a/t/bank/bank_transactions.t b/t/bank/bank_transactions.t index e79429b8c..92f9362e6 100644 --- a/t/bank/bank_transactions.t +++ b/t/bank/bank_transactions.t @@ -1,4 +1,4 @@ -use Test::More tests => 291; +use Test::More tests => 293; use strict; @@ -177,7 +177,7 @@ sub reset_state { sub test_ar_transaction { my (%params) = @_; - my $netamount = $params{amount} || 100; + my $netamount = $::form->round_amount($params{amount}, 2) || 100; my $amount = $::form->round_amount($netamount * 1.19,2); my $invoice = SL::DB::Invoice->new( invoice => 0, @@ -335,7 +335,8 @@ sub test_bt_error { $::form->{invoice_skontos} = { $bt->id => [ 'with_skonto_pt' ] }; - + is($ar_transaction->netamount, $::form->round_amount(168.58/1.19, 2), "$testname: Net Amount assigned"); + is($ar_transaction->amount, 168.58, "$testname: Amount assigned"); is($ar_transaction->paid , '0' , "$testname: salesinv is not paid"); # generate an error for testing rollback mechanism @@ -626,7 +627,7 @@ sub test_full_workflow_ar_multiple_inv_skonto_reconciliate_and_undo { is($bt->invoice_amount , '299.29000' , "$testname: bt invoice amount was assigned partially paid amount"); is($bt->amount , '299.29000' , "$testname: bt amount is stil there"); is(scalar @{ SL::DB::Manager::BankTransactionAccTrans->get_all(where => [bank_transaction_id => $bt->id ] )}, - 7, "$testname 7 acc_trans entries created"); + 9, "$testname 9 acc_trans entries created"); # same loop as above, but only for the 3rd ar_id foreach my $acc_trans_id_entry (@{ SL::DB::Manager::BankTransactionAccTrans->get_all(where => [ar_id => $ar_transaction_skonto->id ] )}) { -- 2.20.1