|
Lines 27-32
use t::lib::TestBuilder;
Link Here
|
| 27 |
use Koha::Account; |
27 |
use Koha::Account; |
| 28 |
use Koha::Account::Lines; |
28 |
use Koha::Account::Lines; |
| 29 |
use Koha::Account::Line; |
29 |
use Koha::Account::Line; |
|
|
30 |
use Koha::Account::Offsets; |
| 30 |
|
31 |
|
| 31 |
BEGIN { |
32 |
BEGIN { |
| 32 |
use_ok('C4::Accounts'); |
33 |
use_ok('C4::Accounts'); |
|
Lines 346-352
subtest "Koha::Account::pay writeoff tests" => sub {
Link Here
|
| 346 |
|
347 |
|
| 347 |
subtest "More Koha::Account::pay tests" => sub { |
348 |
subtest "More Koha::Account::pay tests" => sub { |
| 348 |
|
349 |
|
| 349 |
plan tests => 6; |
350 |
plan tests => 8; |
| 350 |
|
351 |
|
| 351 |
# Create a borrower |
352 |
# Create a borrower |
| 352 |
my $category = $builder->build({ source => 'Category' })->{ categorycode }; |
353 |
my $category = $builder->build({ source => 'Category' })->{ categorycode }; |
|
Lines 376-381
subtest "More Koha::Account::pay tests" => sub {
Link Here
|
| 376 |
# make the full payment |
377 |
# make the full payment |
| 377 |
$account->pay({ lines => [$line], amount => $amount, library_id => $branch, note => 'A payment note' }); |
378 |
$account->pay({ lines => [$line], amount => $amount, library_id => $branch, note => 'A payment note' }); |
| 378 |
|
379 |
|
|
|
380 |
my $offset = Koha::Account::Offsets->search({ debit_id => $accountline->{accountlines_id} })->next(); |
| 381 |
is( $offset->amount(), '-100.000000', 'Offset amount is -100.00' ); |
| 382 |
is( $offset->type(), 'Payment', 'Offset type is Payment' ); |
| 383 |
|
| 379 |
my $stat = $schema->resultset('Statistic')->search({ |
384 |
my $stat = $schema->resultset('Statistic')->search({ |
| 380 |
branch => $branch, |
385 |
branch => $branch, |
| 381 |
type => 'payment' |
386 |
type => 'payment' |
|
Lines 395-401
subtest "More Koha::Account::pay tests" => sub {
Link Here
|
| 395 |
|
400 |
|
| 396 |
subtest "Even more Koha::Account::pay tests" => sub { |
401 |
subtest "Even more Koha::Account::pay tests" => sub { |
| 397 |
|
402 |
|
| 398 |
plan tests => 6; |
403 |
plan tests => 8; |
| 399 |
|
404 |
|
| 400 |
# Create a borrower |
405 |
# Create a borrower |
| 401 |
my $category = $builder->build({ source => 'Category' })->{ categorycode }; |
406 |
my $category = $builder->build({ source => 'Category' })->{ categorycode }; |
|
Lines 426-431
subtest "Even more Koha::Account::pay tests" => sub {
Link Here
|
| 426 |
# make the full payment |
431 |
# make the full payment |
| 427 |
$account->pay({ lines => [$line], amount => $partialamount, library_id => $branch, note => 'A payment note' }); |
432 |
$account->pay({ lines => [$line], amount => $partialamount, library_id => $branch, note => 'A payment note' }); |
| 428 |
|
433 |
|
|
|
434 |
my $offset = Koha::Account::Offsets->search( { debit_id => $accountline->{ accountlines_id } } )->next(); |
| 435 |
is( $offset->amount, '-60.000000', 'Offset amount is -60.00' ); |
| 436 |
is( $offset->type, 'Payment', 'Offset type is payment' ); |
| 437 |
|
| 429 |
my $stat = $schema->resultset('Statistic')->search({ |
438 |
my $stat = $schema->resultset('Statistic')->search({ |
| 430 |
branch => $branch, |
439 |
branch => $branch, |
| 431 |
type => 'payment' |
440 |
type => 'payment' |