View | Details | Raw Unified | Return to bug 24408
Collapse All | Expand All

(-)a/t/Prices.t (-10 / +10 lines)
Lines 56-70 for my $currency_format ( qw( US FR ) ) { Link Here
56
        my $order_0_0 = {
56
        my $order_0_0 = {
57
            biblionumber     => $biblionumber_0_0,
57
            biblionumber     => $biblionumber_0_0,
58
            quantity         => 2,
58
            quantity         => 2,
59
            listprice        => 82.000000,
59
            listprice        => 82,
60
            unitprice        => 73.80000,
60
            unitprice        => 73.80,
61
            quantityreceived => 2,
61
            quantityreceived => 2,
62
            basketno         => $basketno_0_0,
62
            basketno         => $basketno_0_0,
63
            invoiceid        => $invoiceid_0_0,
63
            invoiceid        => $invoiceid_0_0,
64
            rrp              => 82.00,
64
            rrp              => 82.00,
65
            ecost            => 73.80,
65
            ecost            => 73.80,
66
            tax_rate         => 0.0500,
66
            tax_rate         => 0.0500,
67
            discount         => 10.0000,
67
            discount         => 10,
68
            datereceived     => $today
68
            datereceived     => $today
69
        };
69
        };
70
        $order_0_0 = C4::Acquisition::populate_order_with_prices(
70
        $order_0_0 = C4::Acquisition::populate_order_with_prices(
Lines 157-171 for my $currency_format ( qw( US FR ) ) { Link Here
157
        my $order_1_1        = {
157
        my $order_1_1        = {
158
            biblionumber     => $biblionumber_1_1,
158
            biblionumber     => $biblionumber_1_1,
159
            quantity         => 2,
159
            quantity         => 2,
160
            listprice        => 82.000000,
160
            listprice        => 82,
161
            unitprice        => 73.800000,
161
            unitprice        => 73.80,
162
            quantityreceived => 2,
162
            quantityreceived => 2,
163
            basketno         => $basketno_1_1,
163
            basketno         => $basketno_1_1,
164
            invoiceid        => $invoiceid_1_1,
164
            invoiceid        => $invoiceid_1_1,
165
            rrp              => 82.00,
165
            rrp              => 82.00,
166
            ecost            => 73.80,
166
            ecost            => 73.80,
167
            tax_rate         => 0.0500,
167
            tax_rate         => 0.0500,
168
            discount         => 10.0000,
168
            discount         => 10,
169
            datereceived     => $today
169
            datereceived     => $today
170
        };
170
        };
171
171
Lines 259-265 for my $currency_format ( qw( US FR ) ) { Link Here
259
        my $order_1_0        = {
259
        my $order_1_0        = {
260
            biblionumber     => $biblionumber_1_0,
260
            biblionumber     => $biblionumber_1_0,
261
            quantity         => 2,
261
            quantity         => 2,
262
            listprice        => 82.000000,
262
            listprice        => 82,
263
            unitprice        => 0,
263
            unitprice        => 0,
264
            quantityreceived => 2,
264
            quantityreceived => 2,
265
            basketno         => $basketno_1_1,
265
            basketno         => $basketno_1_1,
Lines 267-273 for my $currency_format ( qw( US FR ) ) { Link Here
267
            rrp              => 82.00,
267
            rrp              => 82.00,
268
            ecost            => 73.80,
268
            ecost            => 73.80,
269
            tax_rate         => 0.0500,
269
            tax_rate         => 0.0500,
270
            discount         => 10.0000,
270
            discount         => 10,
271
            datereceived     => $today
271
            datereceived     => $today
272
        };
272
        };
273
273
Lines 380-386 for my $currency_format ( qw( US FR ) ) { Link Here
380
        my $order_0_1        = {
380
        my $order_0_1        = {
381
            biblionumber     => $biblionumber_0_1,
381
            biblionumber     => $biblionumber_0_1,
382
            quantity         => 2,
382
            quantity         => 2,
383
            listprice        => 82.000000,
383
            listprice        => 82,
384
            unitprice        => 0,
384
            unitprice        => 0,
385
            quantityreceived => 2,
385
            quantityreceived => 2,
386
            basketno         => $basketno_1_1,
386
            basketno         => $basketno_1_1,
Lines 388-394 for my $currency_format ( qw( US FR ) ) { Link Here
388
            rrp              => 82.00,
388
            rrp              => 82.00,
389
            ecost            => 73.80,
389
            ecost            => 73.80,
390
            tax_rate         => 0.0500,
390
            tax_rate         => 0.0500,
391
            discount         => 10.0000,
391
            discount         => 10,
392
            datereceived     => $today
392
            datereceived     => $today
393
        };
393
        };
394
394
(-)a/t/db_dependent/Accounts.t (-12 / +12 lines)
Lines 78-84 my $userenv_branchcode = $branchcode; Link Here
78
my $itemtype = $builder->build( { source => 'Itemtype' } );
78
my $itemtype = $builder->build( { source => 'Itemtype' } );
79
my $item   = $builder->build( { source => 'Item', value => { itype => $itemtype->{itemtype} } } );
79
my $item   = $builder->build( { source => 'Item', value => { itype => $itemtype->{itemtype} } } );
80
my $patron = $builder->build( { source => 'Borrower' } );
80
my $patron = $builder->build( { source => 'Borrower' } );
81
my $amount = '5.000000';
81
my $amount = 5;
82
my $description = "Test fee!";
82
my $description = "Test fee!";
83
my $type = 'LOST';
83
my $type = 'LOST';
84
my $note = 'Test note!';
84
my $note = 'Test note!';
Lines 94-100 my ($accountline) = Koha::Account::Lines->search( Link Here
94
    }
94
    }
95
);
95
);
96
is( $accountline->debit_type_code, $type, 'Debit type set correctly for manualinvoice' );
96
is( $accountline->debit_type_code, $type, 'Debit type set correctly for manualinvoice' );
97
is( $accountline->amount, $amount, 'Accountline amount set correctly for manualinvoice' );
97
is( $accountline->amount+0, $amount, 'Accountline amount set correctly for manualinvoice' );
98
ok( $accountline->description =~ /^$description/, 'Accountline description set correctly for manualinvoice' );
98
ok( $accountline->description =~ /^$description/, 'Accountline description set correctly for manualinvoice' );
99
is( $accountline->note, $note, 'Accountline note set correctly for manualinvoice' );
99
is( $accountline->note, $note, 'Accountline note set correctly for manualinvoice' );
100
is( $accountline->branchcode, $branchcode, 'Accountline branchcode set correctly for manualinvoice' );
100
is( $accountline->branchcode, $branchcode, 'Accountline branchcode set correctly for manualinvoice' );
Lines 296-304 subtest "Koha::Account::pay tests" => sub { Link Here
296
    my $line3 = $account->add_debit({ type => 'ACCOUNT', amount => 42, interface => 'commandline' });
296
    my $line3 = $account->add_debit({ type => 'ACCOUNT', amount => 42, interface => 'commandline' });
297
    my $payment_id = $account->pay( { lines => [$line3], amount => 42 } );
297
    my $payment_id = $account->pay( { lines => [$line3], amount => 42 } );
298
    my $payment = Koha::Account::Lines->find( $payment_id );
298
    my $payment = Koha::Account::Lines->find( $payment_id );
299
    is( $payment->amount(), '-42.000000', "Payment paid the specified fine" );
299
    is( $payment->amount()+0, -42, "Payment paid the specified fine" );
300
    $line3 = Koha::Account::Lines->find( $line3->id );
300
    $line3 = Koha::Account::Lines->find( $line3->id );
301
    is( $line3->amountoutstanding, '0.000000', "Specified fine is paid" );
301
    is( $line3->amountoutstanding+0, 0, "Specified fine is paid" );
302
    is( $payment->branchcode, undef, 'branchcode passed, then undef' );
302
    is( $payment->branchcode, undef, 'branchcode passed, then undef' );
303
};
303
};
304
304
Lines 338-350 subtest "Koha::Account::pay particular line tests" => sub { Link Here
338
    $_->_result->discard_changes foreach ( $line1, $line2, $line3, $line4 );
338
    $_->_result->discard_changes foreach ( $line1, $line2, $line3, $line4 );
339
339
340
    # Line1 is not paid at all, as it was not passed in the lines param
340
    # Line1 is not paid at all, as it was not passed in the lines param
341
    is( $line1->amountoutstanding, "1.000000", "Line 1 was not paid" );
341
    is( $line1->amountoutstanding+0, 1, "Line 1 was not paid" );
342
    # Line2 was paid in full, as it was the first in the lines list
342
    # Line2 was paid in full, as it was the first in the lines list
343
    is( $line2->amountoutstanding, "0.000000", "Line 2 was paid in full" );
343
    is( $line2->amountoutstanding+0, 0, "Line 2 was paid in full" );
344
    # Line3 was paid partially, as the remaining balance did not cover it entirely
344
    # Line3 was paid partially, as the remaining balance did not cover it entirely
345
    is( $line3->amountoutstanding, "1.000000", "Line 3 was paid to 1.00" );
345
    is( $line3->amountoutstanding+0, 1, "Line 3 was paid to 1.00" );
346
    # Line4 was not paid at all, as the payment was all used up by that point
346
    # Line4 was not paid at all, as the payment was all used up by that point
347
    is( $line4->amountoutstanding, "4.000000", "Line 4 was not paid" );
347
    is( $line4->amountoutstanding+0, 4, "Line 4 was not paid" );
348
};
348
};
349
349
350
subtest "Koha::Account::pay writeoff tests" => sub {
350
subtest "Koha::Account::pay writeoff tests" => sub {
Lines 380-392 subtest "Koha::Account::pay writeoff tests" => sub { Link Here
380
380
381
    $line->_result->discard_changes();
381
    $line->_result->discard_changes();
382
382
383
    is( $line->amountoutstanding, "0.000000", "Line was written off" );
383
    is( $line->amountoutstanding+0, 0, "Line was written off" );
384
384
385
    my $writeoff = Koha::Account::Lines->find( $id );
385
    my $writeoff = Koha::Account::Lines->find( $id );
386
386
387
    is( $writeoff->credit_type_code, 'WRITEOFF', 'Type is correct for WRITEOFF' );
387
    is( $writeoff->credit_type_code, 'WRITEOFF', 'Type is correct for WRITEOFF' );
388
    is( $writeoff->description, 'Writeoff', 'Description is correct' );
388
    is( $writeoff->description, 'Writeoff', 'Description is correct' );
389
    is( $writeoff->amount, '-42.000000', 'Amount is correct' );
389
    is( $writeoff->amount+0, -42, 'Amount is correct' );
390
};
390
};
391
391
392
subtest "More Koha::Account::pay tests" => sub {
392
subtest "More Koha::Account::pay tests" => sub {
Lines 428-434 subtest "More Koha::Account::pay tests" => sub { Link Here
428
    $account->pay({ lines => [$line], amount => $amount, library_id => $branch, note => 'A payment note' });
428
    $account->pay({ lines => [$line], amount => $amount, library_id => $branch, note => 'A payment note' });
429
429
430
    my $offset = Koha::Account::Offsets->search({ debit_id => $accountline->{accountlines_id} })->next();
430
    my $offset = Koha::Account::Offsets->search({ debit_id => $accountline->{accountlines_id} })->next();
431
    is( $offset->amount(), '-100.000000', 'Offset amount is -100.00' );
431
    is( $offset->amount+0, -100, 'Offset amount is -100.00' );
432
    is( $offset->type(), 'Payment', 'Offset type is Payment' );
432
    is( $offset->type(), 'Payment', 'Offset type is Payment' );
433
433
434
    my $stat = $schema->resultset('Statistic')->search({
434
    my $stat = $schema->resultset('Statistic')->search({
Lines 488-494 subtest "Even more Koha::Account::pay tests" => sub { Link Here
488
    $account->pay({ lines => [$line], amount => $partialamount, library_id => $branch, note => 'A payment note' });
488
    $account->pay({ lines => [$line], amount => $partialamount, library_id => $branch, note => 'A payment note' });
489
489
490
    my $offset = Koha::Account::Offsets->search( { debit_id => $accountline->{ accountlines_id } } )->next();
490
    my $offset = Koha::Account::Offsets->search( { debit_id => $accountline->{ accountlines_id } } )->next();
491
    is( $offset->amount, '-60.000000', 'Offset amount is -60.00' );
491
    is( $offset->amount+0, -60, 'Offset amount is -60.00' );
492
    is( $offset->type, 'Payment', 'Offset type is payment' );
492
    is( $offset->type, 'Payment', 'Offset type is payment' );
493
493
494
    my $stat = $schema->resultset('Statistic')->search({
494
    my $stat = $schema->resultset('Statistic')->search({
(-)a/t/db_dependent/Circulation.t (-22 / +22 lines)
Lines 934-946 subtest "CanBookBeRenewed tests" => sub { Link Here
934
    my $line = Koha::Account::Lines->search({ borrowernumber => $renewing_borrower->{borrowernumber} })->next();
934
    my $line = Koha::Account::Lines->search({ borrowernumber => $renewing_borrower->{borrowernumber} })->next();
935
    is( $line->debit_type_code, 'OVERDUE', 'Account line type is OVERDUE' );
935
    is( $line->debit_type_code, 'OVERDUE', 'Account line type is OVERDUE' );
936
    is( $line->status, 'UNRETURNED', 'Account line status is UNRETURNED' );
936
    is( $line->status, 'UNRETURNED', 'Account line status is UNRETURNED' );
937
    is( $line->amountoutstanding, '15.000000', 'Account line amount outstanding is 15.00' );
937
    is( $line->amountoutstanding+0, 15, 'Account line amount outstanding is 15.00' );
938
    is( $line->amount, '15.000000', 'Account line amount is 15.00' );
938
    is( $line->amount+0, 15, 'Account line amount is 15.00' );
939
    is( $line->issue_id, $issue->id, 'Account line issue id matches' );
939
    is( $line->issue_id, $issue->id, 'Account line issue id matches' );
940
940
941
    my $offset = Koha::Account::Offsets->search({ debit_id => $line->id })->next();
941
    my $offset = Koha::Account::Offsets->search({ debit_id => $line->id })->next();
942
    is( $offset->type, 'OVERDUE', 'Account offset type is Fine' );
942
    is( $offset->type, 'OVERDUE', 'Account offset type is Fine' );
943
    is( $offset->amount, '15.000000', 'Account offset amount is 15.00' );
943
    is( $offset->amount+0, 15, 'Account offset amount is 15.00' );
944
944
945
    t::lib::Mocks::mock_preference('WhenLostForgiveFine','0');
945
    t::lib::Mocks::mock_preference('WhenLostForgiveFine','0');
946
    t::lib::Mocks::mock_preference('WhenLostChargeReplacementFee','0');
946
    t::lib::Mocks::mock_preference('WhenLostChargeReplacementFee','0');
Lines 961-967 subtest "CanBookBeRenewed tests" => sub { Link Here
961
        undef, $renewing_borrower->{borrowernumber}
961
        undef, $renewing_borrower->{borrowernumber}
962
    );
962
    );
963
963
964
    is( $total_due, '15.000000', 'Borrower only charged replacement fee with both WhenLostForgiveFine and WhenLostChargeReplacementFee enabled' );
964
    is( $total_due+0, 15, 'Borrower only charged replacement fee with both WhenLostForgiveFine and WhenLostChargeReplacementFee enabled' );
965
965
966
    C4::Context->dbh->do("DELETE FROM accountlines");
966
    C4::Context->dbh->do("DELETE FROM accountlines");
967
967
Lines 2523-2529 subtest '_FixOverduesOnReturn' => sub { Link Here
2523
2523
2524
    $accountline->_result()->discard_changes();
2524
    $accountline->_result()->discard_changes();
2525
2525
2526
    is( $accountline->amountoutstanding, '99.000000', 'Fine has the same amount outstanding as previously' );
2526
    is( $accountline->amountoutstanding+0, 99, 'Fine has the same amount outstanding as previously' );
2527
    isnt( $accountline->status, 'UNRETURNED', 'Open fine ( account type OVERDUE ) has been closed out ( status not UNRETURNED )');
2527
    isnt( $accountline->status, 'UNRETURNED', 'Open fine ( account type OVERDUE ) has been closed out ( status not UNRETURNED )');
2528
    is( $accountline->status, 'RETURNED', 'Passed status has been used to set as RETURNED )');
2528
    is( $accountline->status, 'RETURNED', 'Passed status has been used to set as RETURNED )');
2529
2529
Lines 3119-3125 subtest 'Incremented fee tests' => sub { Link Here
3119
            value => {
3119
            value => {
3120
                notforloan         => undef,
3120
                notforloan         => undef,
3121
                rentalcharge       => 0,
3121
                rentalcharge       => 0,
3122
                rentalcharge_daily => 1.000000
3122
                rentalcharge_daily => 1,
3123
            }
3123
            }
3124
        }
3124
        }
3125
    )->store;
3125
    )->store;
Lines 3131-3138 subtest 'Incremented fee tests' => sub { Link Here
3131
        }
3131
        }
3132
    );
3132
    );
3133
3133
3134
    is( $itemtype->rentalcharge_daily,
3134
    is( $itemtype->rentalcharge_daily+0,
3135
        '1.000000', 'Daily rental charge stored and retreived correctly' );
3135
        1, 'Daily rental charge stored and retreived correctly' );
3136
    is( $item->effective_itemtype, $itemtype->id,
3136
    is( $item->effective_itemtype, $itemtype->id,
3137
        "Itemtype set correctly for item" );
3137
        "Itemtype set correctly for item" );
3138
3138
Lines 3145-3157 subtest 'Incremented fee tests' => sub { Link Here
3145
    my $issue =
3145
    my $issue =
3146
      AddIssue( $patron->unblessed, $item->barcode, $dt_to, undef, $dt_from );
3146
      AddIssue( $patron->unblessed, $item->barcode, $dt_to, undef, $dt_from );
3147
    my $accountline = Koha::Account::Lines->find( { itemnumber => $item->id } );
3147
    my $accountline = Koha::Account::Lines->find( { itemnumber => $item->id } );
3148
    is( $accountline->amount, '7.000000',
3148
    is( $accountline->amount+0, 7,
3149
"Daily rental charge calculated correctly with finesCalendar = ignoreCalendar"
3149
"Daily rental charge calculated correctly with finesCalendar = ignoreCalendar"
3150
    );
3150
    );
3151
    $accountline->delete();
3151
    $accountline->delete();
3152
    AddRenewal( $patron->id, $item->id, $library->id, $dt_to_renew, $dt_to );
3152
    AddRenewal( $patron->id, $item->id, $library->id, $dt_to_renew, $dt_to );
3153
    $accountline = Koha::Account::Lines->find( { itemnumber => $item->id } );
3153
    $accountline = Koha::Account::Lines->find( { itemnumber => $item->id } );
3154
    is( $accountline->amount, '6.000000',
3154
    is( $accountline->amount+0, 6,
3155
"Daily rental charge calculated correctly with finesCalendar = ignoreCalendar, for renewal"
3155
"Daily rental charge calculated correctly with finesCalendar = ignoreCalendar, for renewal"
3156
    );
3156
    );
3157
    $accountline->delete();
3157
    $accountline->delete();
Lines 3161-3173 subtest 'Incremented fee tests' => sub { Link Here
3161
    $issue =
3161
    $issue =
3162
      AddIssue( $patron->unblessed, $item->barcode, $dt_to, undef, $dt_from );
3162
      AddIssue( $patron->unblessed, $item->barcode, $dt_to, undef, $dt_from );
3163
    $accountline = Koha::Account::Lines->find( { itemnumber => $item->id } );
3163
    $accountline = Koha::Account::Lines->find( { itemnumber => $item->id } );
3164
    is( $accountline->amount, '7.000000',
3164
    is( $accountline->amount+0, 7,
3165
"Daily rental charge calculated correctly with finesCalendar = noFinesWhenClosed"
3165
"Daily rental charge calculated correctly with finesCalendar = noFinesWhenClosed"
3166
    );
3166
    );
3167
    $accountline->delete();
3167
    $accountline->delete();
3168
    AddRenewal( $patron->id, $item->id, $library->id, $dt_to_renew, $dt_to );
3168
    AddRenewal( $patron->id, $item->id, $library->id, $dt_to_renew, $dt_to );
3169
    $accountline = Koha::Account::Lines->find( { itemnumber => $item->id } );
3169
    $accountline = Koha::Account::Lines->find( { itemnumber => $item->id } );
3170
    is( $accountline->amount, '6.000000',
3170
    is( $accountline->amount+0, 6,
3171
"Daily rental charge calculated correctly with finesCalendar = noFinesWhenClosed, for renewal"
3171
"Daily rental charge calculated correctly with finesCalendar = noFinesWhenClosed, for renewal"
3172
    );
3172
    );
3173
    $accountline->delete();
3173
    $accountline->delete();
Lines 3188-3207 subtest 'Incremented fee tests' => sub { Link Here
3188
    $issue =
3188
    $issue =
3189
      AddIssue( $patron->unblessed, $item->barcode, $dt_to, undef, $dt_from );
3189
      AddIssue( $patron->unblessed, $item->barcode, $dt_to, undef, $dt_from );
3190
    $accountline = Koha::Account::Lines->find( { itemnumber => $item->id } );
3190
    $accountline = Koha::Account::Lines->find( { itemnumber => $item->id } );
3191
    is( $accountline->amount, '6.000000',
3191
    is( $accountline->amount+0, 6,
3192
"Daily rental charge calculated correctly with finesCalendar = noFinesWhenClosed and closed $closed_day_name"
3192
"Daily rental charge calculated correctly with finesCalendar = noFinesWhenClosed and closed $closed_day_name"
3193
    );
3193
    );
3194
    $accountline->delete();
3194
    $accountline->delete();
3195
    AddRenewal( $patron->id, $item->id, $library->id, $dt_to_renew, $dt_to );
3195
    AddRenewal( $patron->id, $item->id, $library->id, $dt_to_renew, $dt_to );
3196
    $accountline = Koha::Account::Lines->find( { itemnumber => $item->id } );
3196
    $accountline = Koha::Account::Lines->find( { itemnumber => $item->id } );
3197
    is( $accountline->amount, '5.000000',
3197
    is( $accountline->amount+0, 5,
3198
"Daily rental charge calculated correctly with finesCalendar = noFinesWhenClosed and closed $closed_day_name, for renewal"
3198
"Daily rental charge calculated correctly with finesCalendar = noFinesWhenClosed and closed $closed_day_name, for renewal"
3199
    );
3199
    );
3200
    $accountline->delete();
3200
    $accountline->delete();
3201
    $issue->delete();
3201
    $issue->delete();
3202
3202
3203
    $itemtype->rentalcharge('2.000000')->store;
3203
    $itemtype->rentalcharge(2)->store;
3204
    is( $itemtype->rentalcharge, '2.000000',
3204
    is( $itemtype->rentalcharge+0, 2,
3205
        'Rental charge updated and retreived correctly' );
3205
        'Rental charge updated and retreived correctly' );
3206
    $issue =
3206
    $issue =
3207
      AddIssue( $patron->unblessed, $item->barcode, $dt_to, undef, $dt_from );
3207
      AddIssue( $patron->unblessed, $item->barcode, $dt_to, undef, $dt_from );
Lines 3216-3223 subtest 'Incremented fee tests' => sub { Link Here
3216
        "Fixed charge and accrued charge recorded distinctly, for renewal" );
3216
        "Fixed charge and accrued charge recorded distinctly, for renewal" );
3217
    $accountlines->delete();
3217
    $accountlines->delete();
3218
    $issue->delete();
3218
    $issue->delete();
3219
    $itemtype->rentalcharge('00.000000')->store;
3219
    $itemtype->rentalcharge(0)->store;
3220
    is( $itemtype->rentalcharge, '00.000000',
3220
    is( $itemtype->rentalcharge+0, 0,
3221
        'Rental charge reset and retreived correctly' );
3221
        'Rental charge reset and retreived correctly' );
3222
3222
3223
    # Hourly
3223
    # Hourly
Lines 3331-3341 subtest 'CanBookBeIssued & RentalFeesCheckoutConfirmation' => sub { Link Here
3331
    my $dt_from = dt_from_string();
3331
    my $dt_from = dt_from_string();
3332
    my $dt_due = dt_from_string()->add( days => 3 );
3332
    my $dt_due = dt_from_string()->add( days => 3 );
3333
3333
3334
    $itemtype->rentalcharge('1.000000')->store;
3334
    $itemtype->rentalcharge(1)->store;
3335
    ( $issuingimpossible, $needsconfirmation ) = CanBookBeIssued( $patron, $item->barcode, $dt_due, undef, undef, undef );
3335
    ( $issuingimpossible, $needsconfirmation ) = CanBookBeIssued( $patron, $item->barcode, $dt_due, undef, undef, undef );
3336
    is_deeply( $needsconfirmation, { RENTALCHARGE => '1.00' }, 'Item needs rentalcharge confirmation to be issued' );
3336
    is_deeply( $needsconfirmation, { RENTALCHARGE => '1.00' }, 'Item needs rentalcharge confirmation to be issued' );
3337
    $itemtype->rentalcharge('0')->store;
3337
    $itemtype->rentalcharge('0')->store;
3338
    $itemtype->rentalcharge_daily('1.000000')->store;
3338
    $itemtype->rentalcharge_daily(1)->store;
3339
    ( $issuingimpossible, $needsconfirmation ) = CanBookBeIssued( $patron, $item->barcode, $dt_due, undef, undef, undef );
3339
    ( $issuingimpossible, $needsconfirmation ) = CanBookBeIssued( $patron, $item->barcode, $dt_due, undef, undef, undef );
3340
    is_deeply( $needsconfirmation, { RENTALCHARGE => '3' }, 'Item needs rentalcharge confirmation to be issued, increment' );
3340
    is_deeply( $needsconfirmation, { RENTALCHARGE => '3' }, 'Item needs rentalcharge confirmation to be issued, increment' );
3341
    $itemtype->rentalcharge_daily('0')->store;
3341
    $itemtype->rentalcharge_daily('0')->store;
Lines 3380-3387 subtest "Test Backdating of Returns" => sub { Link Here
3380
    my ( undef, $message ) = AddReturn( $item->barcode, $branch, undef, $due_date );
3380
    my ( undef, $message ) = AddReturn( $item->barcode, $branch, undef, $due_date );
3381
3381
3382
    my $accountline = Koha::Account::Lines->find( { issue_id => $issue->id } );
3382
    my $accountline = Koha::Account::Lines->find( { issue_id => $issue->id } );
3383
    is( $accountline->amountoutstanding, '0.000000', 'Fee amount outstanding was reduced to 0' );
3383
    is( $accountline->amountoutstanding+0, 0, 'Fee amount outstanding was reduced to 0' );
3384
    is( $accountline->amount, '0.000000', 'Fee amount was reduced to 0' );
3384
    is( $accountline->amount+0, 0, 'Fee amount was reduced to 0' );
3385
};
3385
};
3386
3386
3387
$schema->storage->txn_rollback;
3387
$schema->storage->txn_rollback;
(-)a/t/db_dependent/Circulation/GetHardDueDate.t (-4 / +4 lines)
Lines 113-119 my $default = { Link Here
113
113
114
#Test GetIssuingRule
114
#Test GetIssuingRule
115
my $sampleissuingrule1 = {
115
my $sampleissuingrule1 = {
116
    reservecharge      => '0.000000',
116
    reservecharge      => 0,
117
    restrictedtype     => 0,
117
    restrictedtype     => 0,
118
    accountsent        => 0,
118
    accountsent        => 0,
119
    finedays           => 0,
119
    finedays           => 0,
Lines 124-136 my $sampleissuingrule1 = { Link Here
124
    issuelength        => 5,
124
    issuelength        => 5,
125
    chargeperiod       => 0,
125
    chargeperiod       => 0,
126
    chargeperiod_charge_at => 0,
126
    chargeperiod_charge_at => 0,
127
    rentaldiscount     => '2.000000',
127
    rentaldiscount     => 2,
128
    reservesallowed    => 0,
128
    reservesallowed    => 0,
129
    hardduedate        => '2013-01-01',
129
    hardduedate        => '2013-01-01',
130
    branchcode         => $samplebranch1->{branchcode},
130
    branchcode         => $samplebranch1->{branchcode},
131
    fine               => '0.000000',
131
    fine               => 0,
132
    hardduedatecompare => 0,
132
    hardduedatecompare => 0,
133
    overduefinescap    => '0.000000',
133
    overduefinescap    => 0,
134
    renewalsallowed    => 0,
134
    renewalsallowed    => 0,
135
    firstremind        => 0,
135
    firstremind        => 0,
136
    itemtype           => 'BOOK',
136
    itemtype           => 'BOOK',
(-)a/t/db_dependent/Circulation/NoIssuesChargeGuarantees.t (-2 / +2 lines)
Lines 86-97 $account->add_debit({ amount => 10.00, type => 'LOST', interface => 'test' }); Link Here
86
is( $issuingimpossible->{DEBT_GUARANTEES} + 0, '10.00' + 0, "Patron cannot check out item due to debt for guarantee" );
86
is( $issuingimpossible->{DEBT_GUARANTEES} + 0, '10.00' + 0, "Patron cannot check out item due to debt for guarantee" );
87
87
88
my $accountline = Koha::Account::Lines->search({ borrowernumber => $guarantee->id })->next();
88
my $accountline = Koha::Account::Lines->search({ borrowernumber => $guarantee->id })->next();
89
is( $accountline->amountoutstanding, "10.000000", "Found 10.00 amount outstanding" );
89
is( $accountline->amountoutstanding+0, 10, "Found 10.00 amount outstanding" );
90
is( $accountline->debit_type_code, "LOST", "Debit type is LOST" );
90
is( $accountline->debit_type_code, "LOST", "Debit type is LOST" );
91
91
92
my $offset = Koha::Account::Offsets->search({ debit_id => $accountline->id })->next();
92
my $offset = Koha::Account::Offsets->search({ debit_id => $accountline->id })->next();
93
is( $offset->type, 'Lost Item', 'Got correct offset type' );
93
is( $offset->type, 'Lost Item', 'Got correct offset type' );
94
is( $offset->amount, '10.000000', 'Got amount of $10.00' );
94
is( $offset->amount+0, 10, 'Got amount of $10.00' );
95
95
96
$schema->storage->txn_rollback;
96
$schema->storage->txn_rollback;
97
97
(-)a/t/db_dependent/Koha/Account.t (-14 / +14 lines)
Lines 754-781 subtest 'pay() handles lost items when paying a specific lost fee' => sub { Link Here
754
754
755
    $account->pay(
755
    $account->pay(
756
        {
756
        {
757
            amount     => "0.500000",
757
            amount     => .5,
758
            library_id => $library->id,
758
            library_id => $library->id,
759
            lines      => [$accountline],
759
            lines      => [$accountline],
760
        }
760
        }
761
    );
761
    );
762
762
763
    $accountline = Koha::Account::Lines->find( $accountline->id );
763
    $accountline = Koha::Account::Lines->find( $accountline->id );
764
    is( $accountline->amountoutstanding, '0.500000', 'Account line was paid down by half' );
764
    is( $accountline->amountoutstanding+0, .5, 'Account line was paid down by half' );
765
765
766
    $checkout = Koha::Checkouts->find( $checkout->id );
766
    $checkout = Koha::Checkouts->find( $checkout->id );
767
    ok( $checkout, 'Item still checked out to patron' );
767
    ok( $checkout, 'Item still checked out to patron' );
768
768
769
    $account->pay(
769
    $account->pay(
770
        {
770
        {
771
            amount     => "0.500000",
771
            amount     => 0.5,
772
            library_id => $library->id,
772
            library_id => $library->id,
773
            lines      => [$accountline],
773
            lines      => [$accountline],
774
        }
774
        }
775
    );
775
    );
776
776
777
    $accountline = Koha::Account::Lines->find( $accountline->id );
777
    $accountline = Koha::Account::Lines->find( $accountline->id );
778
    is( $accountline->amountoutstanding, '0.000000', 'Account line was paid down by half' );
778
    is( $accountline->amountoutstanding+0, 0, 'Account line was paid down by half' );
779
779
780
    $checkout = Koha::Checkouts->find( $checkout->id );
780
    $checkout = Koha::Checkouts->find( $checkout->id );
781
    ok( !$checkout, 'Item was removed from patron account' );
781
    ok( !$checkout, 'Item was removed from patron account' );
Lines 827-852 subtest 'pay() handles lost items when paying by amount ( not specifying the los Link Here
827
827
828
    $account->pay(
828
    $account->pay(
829
        {
829
        {
830
            amount     => "0.500000",
830
            amount     => .5,
831
            library_id => $library->id,
831
            library_id => $library->id,
832
        }
832
        }
833
    );
833
    );
834
834
835
    $accountline = Koha::Account::Lines->find( $accountline->id );
835
    $accountline = Koha::Account::Lines->find( $accountline->id );
836
    is( $accountline->amountoutstanding, '0.500000', 'Account line was paid down by half' );
836
    is( $accountline->amountoutstanding+0, .5, 'Account line was paid down by half' );
837
837
838
    $checkout = Koha::Checkouts->find( $checkout->id );
838
    $checkout = Koha::Checkouts->find( $checkout->id );
839
    ok( $checkout, 'Item still checked out to patron' );
839
    ok( $checkout, 'Item still checked out to patron' );
840
840
841
    $account->pay(
841
    $account->pay(
842
        {
842
        {
843
            amount     => "0.500000",
843
            amount     => .5,,
844
            library_id => $library->id,
844
            library_id => $library->id,
845
        }
845
        }
846
    );
846
    );
847
847
848
    $accountline = Koha::Account::Lines->find( $accountline->id );
848
    $accountline = Koha::Account::Lines->find( $accountline->id );
849
    is( $accountline->amountoutstanding, '0.000000', 'Account line was paid down by half' );
849
    is( $accountline->amountoutstanding+0, 0, 'Account line was paid down by half' );
850
850
851
    $checkout = Koha::Checkouts->find( $checkout->id );
851
    $checkout = Koha::Checkouts->find( $checkout->id );
852
    ok( !$checkout, 'Item was removed from patron account' );
852
    ok( !$checkout, 'Item was removed from patron account' );
Lines 900-907 subtest 'Koha::Account::Line::apply() handles lost items' => sub { Link Here
900
        {
900
        {
901
            borrowernumber    => $patron->id,
901
            borrowernumber    => $patron->id,
902
            date              => '1900-01-01',
902
            date              => '1900-01-01',
903
            amount            => "-0.500000",
903
            amount            => -.5,
904
            amountoutstanding => "-0.500000",
904
            amountoutstanding => -.5,
905
            interface         => 'commandline',
905
            interface         => 'commandline',
906
            credit_type_code  => 'PAYMENT'
906
            credit_type_code  => 'PAYMENT'
907
        }
907
        }
Lines 910-916 subtest 'Koha::Account::Line::apply() handles lost items' => sub { Link Here
910
    $credit->apply({ debits => [ $debits->as_list ] });
910
    $credit->apply({ debits => [ $debits->as_list ] });
911
911
912
    $debit = Koha::Account::Lines->find( $debit->id );
912
    $debit = Koha::Account::Lines->find( $debit->id );
913
    is( $debit->amountoutstanding, '0.500000', 'Account line was paid down by half' );
913
    is( $debit->amountoutstanding+0, .5, 'Account line was paid down by half' );
914
914
915
    $checkout = Koha::Checkouts->find( $checkout->id );
915
    $checkout = Koha::Checkouts->find( $checkout->id );
916
    ok( $checkout, 'Item still checked out to patron' );
916
    ok( $checkout, 'Item still checked out to patron' );
Lines 919-926 subtest 'Koha::Account::Line::apply() handles lost items' => sub { Link Here
919
        {
919
        {
920
            borrowernumber    => $patron->id,
920
            borrowernumber    => $patron->id,
921
            date              => '1900-01-01',
921
            date              => '1900-01-01',
922
            amount            => "-0.500000",
922
            amount            => -.5,
923
            amountoutstanding => "-0.500000",
923
            amountoutstanding => -.5,
924
            interface         => 'commandline',
924
            interface         => 'commandline',
925
            credit_type_code  => 'PAYMENT'
925
            credit_type_code  => 'PAYMENT'
926
        }
926
        }
Lines 929-935 subtest 'Koha::Account::Line::apply() handles lost items' => sub { Link Here
929
    $credit->apply({ debits => [ $debits->as_list ] });
929
    $credit->apply({ debits => [ $debits->as_list ] });
930
930
931
    $debit = Koha::Account::Lines->find( $debit->id );
931
    $debit = Koha::Account::Lines->find( $debit->id );
932
    is( $debit->amountoutstanding, '0.000000', 'Account line was paid down by half' );
932
    is( $debit->amountoutstanding+0, 0, 'Account line was paid down by half' );
933
933
934
    $checkout = Koha::Checkouts->find( $checkout->id );
934
    $checkout = Koha::Checkouts->find( $checkout->id );
935
    ok( !$checkout, 'Item was removed from patron account' );
935
    ok( !$checkout, 'Item was removed from patron account' );
(-)a/t/db_dependent/Koha/ItemTypes.t (-2 / +2 lines)
Lines 113-119 my $type = Koha::ItemTypes->find('type1'); Link Here
113
ok( defined($type), 'first result' );
113
ok( defined($type), 'first result' );
114
is( $type->itemtype,       'type1',          'itemtype/code' );
114
is( $type->itemtype,       'type1',          'itemtype/code' );
115
is( $type->description,    'description',    'description' );
115
is( $type->description,    'description',    'description' );
116
is( $type->rentalcharge,   '0.000000',       'rentalcharge' );
116
is( $type->rentalcharge+0, 0,                'rentalcharge' );
117
is( $type->imageurl,       'imageurl',       'imageurl' );
117
is( $type->imageurl,       'imageurl',       'imageurl' );
118
is( $type->summary,        'summary',        'summary' );
118
is( $type->summary,        'summary',        'summary' );
119
is( $type->checkinmsg,     'checkinmsg',     'checkinmsg' );
119
is( $type->checkinmsg,     'checkinmsg',     'checkinmsg' );
Lines 123-129 $type = Koha::ItemTypes->find('type2'); Link Here
123
ok( defined($type), 'second result' );
123
ok( defined($type), 'second result' );
124
is( $type->itemtype,       'type2',          'itemtype/code' );
124
is( $type->itemtype,       'type2',          'itemtype/code' );
125
is( $type->description,    'description',    'description' );
125
is( $type->description,    'description',    'description' );
126
is( $type->rentalcharge,   '0.000000',       'rentalcharge' );
126
is( $type->rentalcharge+0, 0,                'rentalcharge' );
127
is( $type->imageurl,       'imageurl',       'imageurl' );
127
is( $type->imageurl,       'imageurl',       'imageurl' );
128
is( $type->summary,        'summary',        'summary' );
128
is( $type->summary,        'summary',        'summary' );
129
is( $type->checkinmsg,     'checkinmsg',     'checkinmsg' );
129
is( $type->checkinmsg,     'checkinmsg',     'checkinmsg' );
(-)a/t/db_dependent/Overdues.t (-36 / +33 lines)
Lines 186-193 subtest 'UpdateFine tests' => sub { Link Here
186
        { borrowernumber => $patron->borrowernumber } );
186
        { borrowernumber => $patron->borrowernumber } );
187
    is( $fines->count, 1, "Fine added when amount is greater than 0" );
187
    is( $fines->count, 1, "Fine added when amount is greater than 0" );
188
    my $fine = $fines->next;
188
    my $fine = $fines->next;
189
    is( $fine->amount, '50.000000', "Fine amount correctly set to 50" );
189
    is( $fine->amount+0, 50, "Fine amount correctly set to 50" );
190
    is( $fine->amountoutstanding, '50.000000', "Fine amountoutstanding correctly set to 50" );
190
    is( $fine->amountoutstanding+0, 50, "Fine amountoutstanding correctly set to 50" );
191
    is( $fine->issue_id, $checkout1->issue_id, "Fine is associated with the correct issue" );
191
    is( $fine->issue_id, $checkout1->issue_id, "Fine is associated with the correct issue" );
192
    is( $fine->itemnumber, $checkout1->itemnumber, "Fine is associated with the correct item" );
192
    is( $fine->itemnumber, $checkout1->itemnumber, "Fine is associated with the correct item" );
193
    # Total : Outstanding : MaxFine
193
    # Total : Outstanding : MaxFine
Lines 208-215 subtest 'UpdateFine tests' => sub { Link Here
208
        { borrowernumber => $patron->borrowernumber } );
208
        { borrowernumber => $patron->borrowernumber } );
209
    is( $fines->count, 1, "Existing fine updated" );
209
    is( $fines->count, 1, "Existing fine updated" );
210
    $fine = $fines->next;
210
    $fine = $fines->next;
211
    is( $fine->amount, '80.000000', "Fine amount correctly updated to 80" );
211
    is( $fine->amount+0, 80, "Fine amount correctly updated to 80" );
212
    is( $fine->amountoutstanding, '80.000000', "Fine amountoutstanding correctly updated to 80" );
212
    is( $fine->amountoutstanding+0, 80, "Fine amountoutstanding correctly updated to 80" );
213
    # Total : Outstanding : MaxFine
213
    # Total : Outstanding : MaxFine
214
    #  80   :     80      :   100
214
    #  80   :     80      :   100
215
215
Lines 230-240 subtest 'UpdateFine tests' => sub { Link Here
230
    );
230
    );
231
    is( $fines->count,        2,    "New fine added for second checkout" );
231
    is( $fines->count,        2,    "New fine added for second checkout" );
232
    $fine = $fines->next;
232
    $fine = $fines->next;
233
    is( $fine->amount, '80.000000', "First fine amount unchanged" );
233
    is( $fine->amount+0, 80, "First fine amount unchanged" );
234
    is( $fine->amountoutstanding, '80.000000', "First fine amountoutstanding unchanged" );
234
    is( $fine->amountoutstanding+0, 80, "First fine amountoutstanding unchanged" );
235
    my $fine2 = $fines->next;
235
    my $fine2 = $fines->next;
236
    is( $fine2->amount, '20.000000', "Second fine capped at '20' by MaxFine" );
236
    is( $fine2->amount+0, 20, "Second fine capped at '20' by MaxFine" );
237
    is( $fine2->amountoutstanding, '20.000000', "Second fine amountoutstanding capped at '20' by MaxFine" );
237
    is( $fine2->amountoutstanding+0, 20, "Second fine amountoutstanding capped at '20' by MaxFine" );
238
    is( $fine2->issue_id, $checkout2->issue_id, "Second fine is associated with the correct issue" );
238
    is( $fine2->issue_id, $checkout2->issue_id, "Second fine is associated with the correct issue" );
239
    is( $fine2->itemnumber, $checkout2->itemnumber, "Second fine is associated with the correct item" );
239
    is( $fine2->itemnumber, $checkout2->itemnumber, "Second fine is associated with the correct item" );
240
    is( $fine->amount + $fine2->amount, '100', "Total fines = 100" );
240
    is( $fine->amount + $fine2->amount, '100', "Total fines = 100" );
Lines 243-249 subtest 'UpdateFine tests' => sub { Link Here
243
    #  100  :     100     :   100
243
    #  100  :     100     :   100
244
244
245
    # Partial pay fine 1
245
    # Partial pay fine 1
246
    $fine->amountoutstanding('50.000000')->store;
246
    $fine->amountoutstanding(50)->store;
247
    # Total : Outstanding : MaxFine
247
    # Total : Outstanding : MaxFine
248
    #  100  :     50      :   100
248
    #  100  :     50      :   100
249
249
Lines 264-274 subtest 'UpdateFine tests' => sub { Link Here
264
    );
264
    );
265
    is( $fines->count,        2,    "Still two fines after second checkout update" );
265
    is( $fines->count,        2,    "Still two fines after second checkout update" );
266
    $fine = $fines->next;
266
    $fine = $fines->next;
267
    is( $fine->amount, '80.000000', "First fine amount unchanged" );
267
    is( $fine->amount+0, 80, "First fine amount unchanged" );
268
    is( $fine->amountoutstanding, '50.000000', "First fine amountoutstanding unchanged" );
268
    is( $fine->amountoutstanding+0, 50, "First fine amountoutstanding unchanged" );
269
    $fine2 = $fines->next;
269
    $fine2 = $fines->next;
270
    is( $fine2->amount, '30.000000', "Second fine increased after partial payment of first" );
270
    is( $fine2->amount+0, 30, "Second fine increased after partial payment of first" );
271
    is( $fine2->amountoutstanding, '30.000000', "Second fine amountoutstanding increased after partial payment of first" );
271
    is( $fine2->amountoutstanding+0, 30, "Second fine amountoutstanding increased after partial payment of first" );
272
    is( $fine->amount + $fine2->amount, '110', "Total fines = 100" );
272
    is( $fine->amount + $fine2->amount, '110', "Total fines = 100" );
273
    is( $fine->amountoutstanding + $fine2->amountoutstanding, '80', "Total outstanding = 80" );
273
    is( $fine->amountoutstanding + $fine2->amountoutstanding, '80', "Total outstanding = 80" );
274
    # Total : Outstanding : MaxFine
274
    # Total : Outstanding : MaxFine
Lines 294-307 subtest 'UpdateFine tests' => sub { Link Here
294
    );
294
    );
295
    is( $fines->count,        3,    "Third fine added for overdue renewal" );
295
    is( $fines->count,        3,    "Third fine added for overdue renewal" );
296
    $fine = $fines->next;
296
    $fine = $fines->next;
297
    is( $fine->amount, '80.000000', "First fine amount unchanged" );
297
    is( $fine->amount+0, 80, "First fine amount unchanged" );
298
    is( $fine->amountoutstanding, '50.000000', "First fine amountoutstanding unchanged" );
298
    is( $fine->amountoutstanding+0, 50, "First fine amountoutstanding unchanged" );
299
    $fine2 = $fines->next;
299
    $fine2 = $fines->next;
300
    is( $fine2->amount, '30.000000', "Second fine amount unchanged" );
300
    is( $fine2->amount+0, 30, "Second fine amount unchanged" );
301
    is( $fine2->amountoutstanding, '30.000000', "Second fine amountoutstanding unchanged" );
301
    is( $fine2->amountoutstanding+0, 30, "Second fine amountoutstanding unchanged" );
302
    my $fine3 = $fines->next;
302
    my $fine3 = $fines->next;
303
    is( $fine3->amount, '20.000000', "Third fine amount capped due to MaxFine" );
303
    is( $fine3->amount+0, 20, "Third fine amount capped due to MaxFine" );
304
    is( $fine3->amountoutstanding, '20.000000', "Third fine amountoutstanding capped at '20' by MaxFine" );
304
    is( $fine3->amountoutstanding+0, 20, "Third fine amountoutstanding capped at '20' by MaxFine" );
305
    is( $fine3->issue_id, $checkout1->issue_id, "Third fine is associated with the correct issue" );
305
    is( $fine3->issue_id, $checkout1->issue_id, "Third fine is associated with the correct issue" );
306
    is( $fine3->itemnumber, $checkout1->itemnumber, "Third fine is associated with the correct item" );
306
    is( $fine3->itemnumber, $checkout1->itemnumber, "Third fine is associated with the correct item" );
307
    is( $fine->amount + $fine2->amount + $fine3->amount, '130', "Total fines = 130" );
307
    is( $fine->amount + $fine2->amount + $fine3->amount, '130', "Total fines = 130" );
Lines 333-346 subtest 'UpdateFine tests' => sub { Link Here
333
    );
333
    );
334
    is( $fines->count,        3,    "Still three fines after third checkout update" );
334
    is( $fines->count,        3,    "Still three fines after third checkout update" );
335
    $fine = $fines->next;
335
    $fine = $fines->next;
336
    is( $fine->amount, '80.000000', "First fine amount unchanged" );
336
    is( $fine->amount+0, 80, "First fine amount unchanged" );
337
    is( $fine->amountoutstanding, '50.000000', "First fine amountoutstanding unchanged" );
337
    is( $fine->amountoutstanding+0, 50, "First fine amountoutstanding unchanged" );
338
    $fine2 = $fines->next;
338
    $fine2 = $fines->next;
339
    is( $fine2->amount, '30.000000', "Second fine amount unchanged" );
339
    is( $fine2->amount+0, 30, "Second fine amount unchanged" );
340
    is( $fine2->amountoutstanding, '30.000000', "Second fine amountoutstanding unchanged" );
340
    is( $fine2->amountoutstanding+0, 30, "Second fine amountoutstanding unchanged" );
341
    $fine3 = $fines->next;
341
    $fine3 = $fines->next;
342
    is( $fine3->amount, '40.000000', "Third fine amount capped due to MaxFine" );
342
    is( $fine3->amount+0, 40, "Third fine amount capped due to MaxFine" );
343
    is( $fine3->amountoutstanding, '20.000000', "Third fine amountoutstanding increased ..." );
343
    is( $fine3->amountoutstanding+0, 20, "Third fine amountoutstanding increased ..." );
344
    is( $fine3->issue_id, $checkout1->issue_id, "Third fine is associated with the correct issue" );
344
    is( $fine3->issue_id, $checkout1->issue_id, "Third fine is associated with the correct issue" );
345
    is( $fine3->itemnumber, $checkout1->itemnumber, "Third fine is associated with the correct item" );
345
    is( $fine3->itemnumber, $checkout1->itemnumber, "Third fine is associated with the correct item" );
346
    is( $fine->amount + $fine2->amount + $fine3->amount, '150', "Total fines = 150" );
346
    is( $fine->amount + $fine2->amount + $fine3->amount, '150', "Total fines = 150" );
Lines 369-380 subtest 'UpdateFine tests' => sub { Link Here
369
    );
369
    );
370
    is( $fines->count,        3,    "Still only three fines after MaxFine cap removed" );
370
    is( $fines->count,        3,    "Still only three fines after MaxFine cap removed" );
371
    $fine = $fines->next;
371
    $fine = $fines->next;
372
    is( $fine->amount, '80.000000', "First fine amount unchanged" );
372
    is( $fine->amount+0, 80, "First fine amount unchanged" );
373
    $fine2 = $fines->next;
373
    $fine2 = $fines->next;
374
    is( $fine2->amount, '30.000000', "Second fine amount unchanged" );
374
    is( $fine2->amount+0, 30, "Second fine amount unchanged" );
375
    $fine3 = $fines->next;
375
    $fine3 = $fines->next;
376
    is( $fine3->amount, '50.000000', "Third fine increased now MaxFine cap is disabled" );
376
    is( $fine3->amount+0, 50, "Third fine increased now MaxFine cap is disabled" );
377
    is( $fine3->amountoutstanding, '30.000000', "Third fine increased now MaxFine cap is disabled" );
377
    is( $fine3->amountoutstanding+0, 30, "Third fine increased now MaxFine cap is disabled" );
378
378
379
    # If somehow the fine should be reduced, we changed rules or checkout date or something
379
    # If somehow the fine should be reduced, we changed rules or checkout date or something
380
    UpdateFine(
380
    UpdateFine(
Lines 393-406 subtest 'UpdateFine tests' => sub { Link Here
393
    );
393
    );
394
    is( $fines->count,        3,    "Still only three fines after MaxFine cap removed and third fine altered" );
394
    is( $fines->count,        3,    "Still only three fines after MaxFine cap removed and third fine altered" );
395
    $fine = $fines->next;
395
    $fine = $fines->next;
396
    is( $fine->amount, '80.000000', "First fine amount unchanged" );
396
    is( $fine->amount+0, 80, "First fine amount unchanged" );
397
    $fine2 = $fines->next;
397
    $fine2 = $fines->next;
398
    is( $fine2->amount, '30.000000', "Second fine amount unchanged" );
398
    is( $fine2->amount+0, 30, "Second fine amount unchanged" );
399
    $fine3 = $fines->next;
399
    $fine3 = $fines->next;
400
    is( $fine3->amount, '30.000000', "Third fine reduced" );
400
    is( $fine3->amount+0, 30, "Third fine reduced" );
401
    is( $fine3->amountoutstanding, '10.000000', "Third fine amount outstanding is reduced" );
401
    is( $fine3->amountoutstanding+0, 10, "Third fine amount outstanding is reduced" );
402
403
404
402
405
    $schema->storage->txn_rollback;
403
    $schema->storage->txn_rollback;
406
};
404
};
407
- 

Return to bug 24408