From: G. Richardson Date: Tue, 7 Jul 2020 15:47:05 +0000 (+0200) Subject: artransactions.t - Umstellung Konjunkturpaket X-Git-Tag: release-3.5.6.1~156 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=03007e57dd84ccebbc7f00a4480d64b54539b60b;p=kivitendo-erp.git artransactions.t - Umstellung Konjunkturpaket Tests, bei denen Salden abgefragt werden, auf 2019 umgestellt. --- diff --git a/t/controllers/csvimport/artransactions.t b/t/controllers/csvimport/artransactions.t index 670b5aba2..6c902c33e 100644 --- a/t/controllers/csvimport/artransactions.t +++ b/t/controllers/csvimport/artransactions.t @@ -26,11 +26,16 @@ use SL::DB::Chart; use SL::DB::AccTransaction; my ($customer, $currency_id, $employee, $taxzone, $project, $department); +my ($transdate, $transdate_string); sub reset_state { # Create test data my %params = @_; + $transdate = DateTime->today_local; + $transdate->set_year(2019) if $transdate->year == 2020; # hardcode for 2019 in 2020, because of tax rate change in Germany + $transdate_string = $transdate->to_kivitendo; + $params{$_} ||= {} for qw(buchungsgruppe customer tax); clear_up(); @@ -96,6 +101,7 @@ sub test_import { ##### manually create an ar transaction from scratch, testing the methods $::myconfig{numberformat} = '1000.00'; +$::myconfig{dateformat} = 'dd.mm.yyyy'; my $old_locale = $::locale; # set locale to en so we can match errors $::locale = Locale->new('en'); @@ -109,7 +115,7 @@ my $ar = SL::DB::Invoice->new( currency_id => $currency_id, taxincluded => 'f', customer_id => $customer->id, - transdate => DateTime->today, + transdate => $transdate, employee_id => SL::DB::Manager::Employee->current->id, transactions => [], ); @@ -138,7 +144,7 @@ is scalar @{$ar->transactions}, 3, 'manual invoice has 3 acc_trans entries'; $ar->pay_invoice( chart_id => SL::DB::Manager::Chart->find_by(accno => '1200')->id, # bank amount => $ar->open_amount, - transdate => DateTime->now->to_kivitendo, + transdate => $transdate, payment_type => 'without_skonto', # default if not specified ); $result = $ar->validate_acc_trans(debug => 0); @@ -152,10 +158,10 @@ my ($entries, $entry, $file); # to debug errors in certain tests, run after test_import: # die Dumper($entry->{errors}); ##### basic test -$file = \<{object}->amount, '189.78', 'ar amount tax not included is 189.78'; is $entry->{object}->netamount, '159.48', 'ar netamount tax not included is 159.48'; ##### test for duplicate invnumber -$file = \<{object}->validate_acc_trans; is $entry->{errors}->[0], 'Error: invnumber already exists', 'detects verify_amount differences'; ##### test for no invnumber given -$file = \<{object}->validate_acc_trans; is $entry->{object}->invnumber =~ /^\d+$/, 1, 'invnumber assigned automatically'; ##### basic test without amounts in Rechnung, only specified in AccTransaction -$file = \<round_amount($entry->{object}->transactions->[0]->amount, 2), '159.4 is $::form->round_amount($entry->{object}->transactions->[0]->amount, 2), 159.48, 'invoice 1 ar amount is 159.48'; ##### basic test: credit_note -$file = \<{object}->amount, '-189.78', 'credit note amount tax not included is is $entry->{object}->netamount, '-159.48', 'credit note netamount tax not included is 159.48'; #### verify_amount differs: max_amount_diff = 0.02, 189.80 is ok, 189.81 is not -$file = \<[0]; is $entry->{errors}->[0], 'Amounts differ too much', 'detects verify_amount differences'; ##### direct debit -$file = \<{object}->validate_acc_trans; is $entry->{object}->direct_debit, '1', 'direct debit'; #### tax included -$file = \<round_amount($entry->{object}->netamount, 2), '159.48', 'taxincluded is $::form->round_amount($entry->{object}->transactions->[0]->amount, 2), '159.48', 'taxincluded acc_trans netamount'; #### multiple tax included -$file = \<