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

(-)a/t/db_dependent/Koha/Items.t (-14 / +13 lines)
Lines 351-357 subtest 'store' => sub { Link Here
351
351
352
            # Simulate item marked as found
352
            # Simulate item marked as found
353
            $item->itemlost(0)->store;
353
            $item->itemlost(0)->store;
354
            is( $item->{_refunded}, undef, 'No LOST_FOUND account line added' );
354
            is( scalar ( grep { $_->message eq 'lost_refunded' } @{$item->object_messages} ), 0, 'No LOST_FOUND account line added' );
355
355
356
            $lost_fee_line->discard_changes;    # reload from DB
356
            $lost_fee_line->discard_changes;    # reload from DB
357
            is( $lost_fee_line->amountoutstanding + 0,
357
            is( $lost_fee_line->amountoutstanding + 0,
Lines 434-440 subtest 'store' => sub { Link Here
434
434
435
            # Simulate item marked as found
435
            # Simulate item marked as found
436
            $item->itemlost(0)->store;
436
            $item->itemlost(0)->store;
437
            is( $item->{_refunded}, 1, 'Refund triggered' );
437
            is( scalar ( grep { $_->message eq 'lost_refunded' } @{$item->object_messages} ), 1, 'Refund triggered' );
438
438
439
            my $credit_return = Koha::Account::Lines->search(
439
            my $credit_return = Koha::Account::Lines->search(
440
                {
440
                {
Lines 524-530 subtest 'store' => sub { Link Here
524
524
525
            # Simulate item marked as found
525
            # Simulate item marked as found
526
            $item->itemlost(0)->store;
526
            $item->itemlost(0)->store;
527
            is( $item->{_refunded}, 1, 'Refund triggered' );
527
            is( scalar ( grep { $_->message eq 'lost_refunded' } @{$item->object_messages} ), 1, 'Refund triggered' );
528
528
529
            my $credit_return = Koha::Account::Lines->search(
529
            my $credit_return = Koha::Account::Lines->search(
530
                {
530
                {
Lines 704-710 subtest 'store' => sub { Link Here
704
704
705
            # Simulate item marked as found
705
            # Simulate item marked as found
706
            $item->itemlost(0)->store;
706
            $item->itemlost(0)->store;
707
            is( $item->{_refunded}, 1, 'Refund triggered' );
707
            is( scalar ( grep { $_->message eq 'lost_refunded' } @{$item->object_messages} ), 1, 'Refund triggered' );
708
708
709
            my $credit_return = Koha::Account::Lines->search(
709
            my $credit_return = Koha::Account::Lines->search(
710
                {
710
                {
Lines 842-848 subtest 'store' => sub { Link Here
842
842
843
            # Simulate item marked as found
843
            # Simulate item marked as found
844
            $item->itemlost(0)->store;
844
            $item->itemlost(0)->store;
845
            is( $item->{_refunded}, 1, 'Refund triggered' );
845
            is( scalar ( grep { $_->message eq 'lost_refunded' } @{$item->object_messages} ), 1, 'Refund triggered' );
846
846
847
            my $credit_return = Koha::Account::Lines->search(
847
            my $credit_return = Koha::Account::Lines->search(
848
                {
848
                {
Lines 917-923 subtest 'store' => sub { Link Here
917
917
918
            # Simulate item marked as found
918
            # Simulate item marked as found
919
            $item->itemlost(0)->store;
919
            $item->itemlost(0)->store;
920
            is( $item->{_refunded}, undef, 'No refund triggered' );
920
            is( scalar ( grep { $_->message eq 'lost_refunded' } @{$item->object_messages} ), 0, 'No refund triggered' );
921
921
922
        };
922
        };
923
923
Lines 1009-1016 subtest 'store' => sub { Link Here
1009
1009
1010
            # Simulate item marked as found
1010
            # Simulate item marked as found
1011
            $item->itemlost(0)->store;
1011
            $item->itemlost(0)->store;
1012
            is( $item->{_refunded}, 1, 'Refund triggered' );
1012
            is( scalar ( grep { $_->message eq 'lost_refunded' } @{$item->object_messages} ), 1, 'Refund triggered' );
1013
            is( $item->{_restored}, undef, 'Restore not triggered when there is no overdue fine found' );
1013
            is( scalar ( grep { $_->message eq 'lost_restored' } @{$item->object_messages} ), 0, 'Restore not triggered when there is no overdue fine found' );
1014
        };
1014
        };
1015
1015
1016
        subtest 'restore fine | unforgiven overdue' => sub {
1016
        subtest 'restore fine | unforgiven overdue' => sub {
Lines 1116-1123 subtest 'store' => sub { Link Here
1116
1116
1117
            # Simulate item marked as found
1117
            # Simulate item marked as found
1118
            $item->itemlost(0)->store;
1118
            $item->itemlost(0)->store;
1119
            is( $item->{_refunded}, 1, 'Refund triggered' );
1119
            is( scalar ( grep { $_->message eq 'lost_refunded' } @{$item->object_messages} ), 1, 'Refund triggered' );
1120
            is( $item->{_restored}, undef, 'Restore not triggered when overdue was not forgiven' );
1120
            is( scalar ( grep { $_->message eq 'lost_restored' } @{$item->object_messages} ), 0, 'Restore not triggered when overdue was not forgiven' );
1121
            $overdue->discard_changes;
1121
            $overdue->discard_changes;
1122
            is( $overdue->status, 'FOUND',
1122
            is( $overdue->status, 'FOUND',
1123
                'Overdue status updated to FOUND' );
1123
                'Overdue status updated to FOUND' );
Lines 1240-1247 subtest 'store' => sub { Link Here
1240
1240
1241
            # Simulate item marked as found
1241
            # Simulate item marked as found
1242
            $item->itemlost(0)->store;
1242
            $item->itemlost(0)->store;
1243
            is( $item->{_refunded}, 1, 'Refund triggered' );
1243
            is( scalar ( grep { $_->message eq 'lost_refunded' } @{$item->object_messages} ), 1, 'Refund triggered' );
1244
            is( $item->{_restored}, 1, 'Restore triggered when overdue was forgiven' );
1244
            is( scalar ( grep { $_->message eq 'lost_restored' } @{$item->object_messages} ), 1, 'Restore triggered when overdue was forgiven' );
1245
            $overdue->discard_changes;
1245
            $overdue->discard_changes;
1246
            is( $overdue->status, 'FOUND', 'Overdue status updated to FOUND' );
1246
            is( $overdue->status, 'FOUND', 'Overdue status updated to FOUND' );
1247
            is( $overdue->amountoutstanding, $overdue->amount, 'Overdue outstanding has been restored' );
1247
            is( $overdue->amountoutstanding, $overdue->amount, 'Overdue outstanding has been restored' );
Lines 1292-1298 subtest 'store' => sub { Link Here
1292
1292
1293
            # Simluate item marked as found
1293
            # Simluate item marked as found
1294
            $item->itemlost(0)->store;
1294
            $item->itemlost(0)->store;
1295
            is( $item->{_refunded}, 1, 'No refund triggered' );
1295
            is( scalar ( grep { $_->message eq 'lost_refunded' } @{$item->object_messages} ), 1, 'Refund triggered' );
1296
1296
1297
        };
1297
        };
1298
    };
1298
    };
1299
- 

Return to bug 26704