Revision a4353493
Von Bernd Bleßmann vor mehr als 1 Jahr hinzugefügt
SL/Controller/CsvImport/APTransaction.pm | ||
---|---|---|
250 | 250 |
|
251 | 251 |
$self->add_transactions_to_ap(); # go through all data entries again, adding payable entry to ap lines while calculating amount and netamount |
252 | 252 |
|
253 |
foreach my $entry (@{ $self->controller->data }) { |
|
254 |
next unless ($entry->{raw_data}->{datatype} eq $self->_ap_column); |
|
255 |
$self->check_verify_amounts($entry->{object}); |
|
256 |
}; |
|
253 |
$self->check_verify_amounts(); |
|
257 | 254 |
|
258 | 255 |
foreach my $entry (@{ $self->controller->data }) { |
259 | 256 |
next unless ($entry->{raw_data}->{datatype} eq $self->_ap_column); |
SL/Controller/CsvImport/ARTransaction.pm | ||
---|---|---|
181 | 181 |
|
182 | 182 |
$self->add_transactions_to_ar(); # go through all data entries again, adding receivable entry to ar lines while calculating amount and netamount |
183 | 183 |
|
184 |
foreach my $entry (@{ $self->controller->data }) { |
|
185 |
next unless ($entry->{raw_data}->{datatype} eq $self->_ar_column); |
|
186 |
$self->check_verify_amounts($entry->{object}); |
|
187 |
}; |
|
184 |
$self->check_verify_amounts(); |
|
188 | 185 |
|
189 | 186 |
foreach my $entry (@{ $self->controller->data }) { |
190 | 187 |
next unless ($entry->{raw_data}->{datatype} eq $self->_ar_column); |
t/controllers/csvimport/aptransactions.t | ||
---|---|---|
698 | 698 |
|
699 | 699 |
$saved_invoices++; |
700 | 700 |
|
701 |
##### verify amounts, error only once |
|
702 |
$file = \<<EOL; |
|
703 |
datatype,vendornumber,currency_id,invnumber,taxincluded,apchart,verify_netamount,verify_amount |
|
704 |
datatype,accno,amount,taxkey |
|
705 |
"Rechnung",2,1,"first invoice",f,1600,39.87,47.44 |
|
706 |
"AccTransaction",3400,39.87,9 |
|
707 |
"Rechnung",2,1,"second invoice",f,1600,39.78,78.39 |
|
708 |
"AccTransaction",3400,39.87,9 |
|
709 |
EOL |
|
710 |
|
|
711 |
$entries = test_import($file); |
|
712 |
|
|
713 |
$entry = $entries->[0]; |
|
714 |
is $entry->{errors}->[0], undef, 'verify amounts, error only once: no error in first invoice'; |
|
715 |
|
|
716 |
$entry = $entries->[2]; |
|
717 |
is $entry->{errors}->[0], "Amounts differ too much", 'verify amounts, error only once: amount differs'; |
|
718 |
is $entry->{errors}->[1], "Net amounts differ too much", 'verify amounts, error only once: netamount differs'; |
|
719 |
is $entry->{errors}->[2], undef, 'verify amounts, error only once: nothing else'; |
|
720 |
|
|
721 |
$saved_invoices++; |
|
722 |
|
|
701 | 723 |
##### |
702 | 724 |
my $number_of_imported_invoices = SL::DB::Manager::PurchaseInvoice->get_all_count; |
703 | 725 |
is $number_of_imported_invoices, $saved_invoices, 'All invoices saved'; |
t/controllers/csvimport/artransactions.t | ||
---|---|---|
1 |
use Test::More tests => 70;
|
|
1 |
use Test::More tests => 74;
|
|
2 | 2 |
|
3 | 3 |
use strict; |
4 | 4 |
|
... | ... | |
539 | 539 |
$entry = $entries->[0]; |
540 | 540 |
is $entry->{errors}->[0], "Error: ar transaction doesn't validate", 'detects invalid ar, maybe acc_trans entry missing'; |
541 | 541 |
|
542 |
# verify amounts, error only once |
|
543 |
$file = \<<EOL; |
|
544 |
datatype,customer_id,taxzone_id,currency_id,invnumber,taxincluded,archart,verify_netamount,verify_amount |
|
545 |
datatype,accno,amount,taxkey |
|
546 |
"Rechnung",960,4,1,"first invoice",f,1400,39.87,47.44 |
|
547 |
"AccTransaction",8400,39.87,3 |
|
548 |
"Rechnung",960,4,1,"second invoice",f,1400,39.78,78.39 |
|
549 |
"AccTransaction",8400,39.87,3 |
|
550 |
EOL |
|
551 |
$entries = test_import($file); |
|
552 |
|
|
553 |
$entry = $entries->[0]; |
|
554 |
is $entry->{errors}->[0], undef, 'verify amounts, error only once: no error in first invoice'; |
|
555 |
|
|
556 |
$entry = $entries->[2]; |
|
557 |
is $entry->{errors}->[0], "Amounts differ too much", 'verify amounts, error only once: amount differs'; |
|
558 |
is $entry->{errors}->[1], "Net amounts differ too much", 'verify amounts, error only once: netamount differs'; |
|
559 |
is $entry->{errors}->[2], undef, 'verify amounts, error only once: nothing else'; |
|
560 |
|
|
561 |
##### |
|
542 | 562 |
my $number_of_imported_invoices = SL::DB::Manager::Invoice->get_all_count; |
543 |
is $number_of_imported_invoices, 19, 'All invoices saved';
|
|
563 |
is $number_of_imported_invoices, 20, 'All invoices saved';
|
|
544 | 564 |
|
545 | 565 |
#### taxkey differs from active_taxkey |
546 | 566 |
$file = \<<EOL; |
Auch abrufbar als: Unified diff
CSV-Import Debitoren-/Kreditorenbuchungen: Beträge nur einmal verifizieren