Lines 303-309
subtest 'Keep account info when a patron is deleted' => sub {
Link Here
|
303 |
|
303 |
|
304 |
subtest 'adjust() tests' => sub { |
304 |
subtest 'adjust() tests' => sub { |
305 |
|
305 |
|
306 |
plan tests => 33; |
306 |
plan tests => 29; |
307 |
|
307 |
|
308 |
$schema->storage->txn_begin; |
308 |
$schema->storage->txn_begin; |
309 |
|
309 |
|
Lines 347-353
subtest 'adjust() tests' => sub {
Link Here
|
347 |
is( $debit_2->amount * 1, 150, 'Fine amount was updated in full' ); |
347 |
is( $debit_2->amount * 1, 150, 'Fine amount was updated in full' ); |
348 |
is( $debit_2->amountoutstanding * 1, 150, 'Fine amountoutstanding was update in full' ); |
348 |
is( $debit_2->amountoutstanding * 1, 150, 'Fine amountoutstanding was update in full' ); |
349 |
isnt( $debit_2->date, undef, 'Date has been set' ); |
349 |
isnt( $debit_2->date, undef, 'Date has been set' ); |
350 |
is( $debit_2->lastincrement * 1, 50, 'lastincrement is the to the right value' ); |
|
|
351 |
|
350 |
|
352 |
my $offsets = Koha::Account::Offsets->search( { debit_id => $debit_2->id } ); |
351 |
my $offsets = Koha::Account::Offsets->search( { debit_id => $debit_2->id } ); |
353 |
is( $offsets->count, 1, 'An offset is generated for the increment' ); |
352 |
is( $offsets->count, 1, 'An offset is generated for the increment' ); |
Lines 373-379
subtest 'adjust() tests' => sub {
Link Here
|
373 |
|
372 |
|
374 |
is( $debit_2->amount * 1, 160, 'Fine amount was updated in full' ); |
373 |
is( $debit_2->amount * 1, 160, 'Fine amount was updated in full' ); |
375 |
is( $debit_2->amountoutstanding * 1, 120, 'Fine amountoutstanding was updated by difference' ); |
374 |
is( $debit_2->amountoutstanding * 1, 120, 'Fine amountoutstanding was updated by difference' ); |
376 |
is( $debit_2->lastincrement * 1, 10, 'lastincrement is the to the right value' ); |
|
|
377 |
|
375 |
|
378 |
$offsets = Koha::Account::Offsets->search( { debit_id => $debit_2->id } ); |
376 |
$offsets = Koha::Account::Offsets->search( { debit_id => $debit_2->id } ); |
379 |
is( $offsets->count, 3, 'An offset is generated for the increment' ); |
377 |
is( $offsets->count, 3, 'An offset is generated for the increment' ); |
Lines 388-394
subtest 'adjust() tests' => sub {
Link Here
|
388 |
|
386 |
|
389 |
is( $debit_2->amount * 1, 50, 'Fine amount was updated in full' ); |
387 |
is( $debit_2->amount * 1, 50, 'Fine amount was updated in full' ); |
390 |
is( $debit_2->amountoutstanding * 1, 10, 'Fine amountoutstanding was updated by difference' ); |
388 |
is( $debit_2->amountoutstanding * 1, 10, 'Fine amountoutstanding was updated by difference' ); |
391 |
is( $debit_2->lastincrement * 1, -110, 'lastincrement is the to the right value' ); |
|
|
392 |
|
389 |
|
393 |
$offsets = Koha::Account::Offsets->search( { debit_id => $debit_2->id } ); |
390 |
$offsets = Koha::Account::Offsets->search( { debit_id => $debit_2->id } ); |
394 |
is( $offsets->count, 4, 'An offset is generated for the decrement' ); |
391 |
is( $offsets->count, 4, 'An offset is generated for the decrement' ); |
Lines 400-406
subtest 'adjust() tests' => sub {
Link Here
|
400 |
$debit_2->adjust( { amount => 30, type => 'fine_update' } )->discard_changes; |
397 |
$debit_2->adjust( { amount => 30, type => 'fine_update' } )->discard_changes; |
401 |
is( $debit_2->amount * 1, 30, 'Fine amount was updated in full' ); |
398 |
is( $debit_2->amount * 1, 30, 'Fine amount was updated in full' ); |
402 |
is( $debit_2->amountoutstanding * 1, 0, 'Fine amountoutstanding was zeroed (payment was 40)' ); |
399 |
is( $debit_2->amountoutstanding * 1, 0, 'Fine amountoutstanding was zeroed (payment was 40)' ); |
403 |
is( $debit_2->lastincrement * 1, -20, 'lastincrement is the to the right value' ); |
|
|
404 |
|
400 |
|
405 |
$offsets = Koha::Account::Offsets->search( { debit_id => $debit_2->id } ); |
401 |
$offsets = Koha::Account::Offsets->search( { debit_id => $debit_2->id } ); |
406 |
is( $offsets->count, 5, 'An offset is generated for the decrement' ); |
402 |
is( $offsets->count, 5, 'An offset is generated for the decrement' ); |
407 |
- |
|
|