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

(-)a/t/db_dependent/Accounts.t (-4 / +12 lines)
Lines 607-613 subtest "C4::Accounts::chargelostitem tests" => sub { Link Here
607
            value  => {
607
            value  => {
608
                rentalcharge       => 0,
608
                rentalcharge       => 0,
609
                defaultreplacecost => undef,
609
                defaultreplacecost => undef,
610
                processfee         => undef,
611
            }
610
            }
612
        }
611
        }
613
    );
612
    );
Lines 617-623 subtest "C4::Accounts::chargelostitem tests" => sub { Link Here
617
            value  => {
616
            value  => {
618
                rentalcharge       => 0,
617
                rentalcharge       => 0,
619
                defaultreplacecost => 16.32,
618
                defaultreplacecost => 16.32,
620
                processfee         => undef,
621
            }
619
            }
622
        }
620
        }
623
    );
621
    );
Lines 627-633 subtest "C4::Accounts::chargelostitem tests" => sub { Link Here
627
            value  => {
625
            value  => {
628
                rentalcharge       => 0,
626
                rentalcharge       => 0,
629
                defaultreplacecost => undef,
627
                defaultreplacecost => undef,
630
                processfee         => 8.16,
631
            }
628
            }
632
        }
629
        }
633
    );
630
    );
Lines 637-646 subtest "C4::Accounts::chargelostitem tests" => sub { Link Here
637
            value  => {
634
            value  => {
638
                rentalcharge       => 0,
635
                rentalcharge       => 0,
639
                defaultreplacecost => 4.08,
636
                defaultreplacecost => 4.08,
640
                processfee         => 2.04,
641
            }
637
            }
642
        }
638
        }
643
    );
639
    );
640
    my $one_rule = Koha::CirculationRules->set_rule(
641
        {
642
            itemtype  => $itype_no_replace_fee->{itemtype}, branchcode => undef, rule_value => 8.16,
643
            rule_name => 'lost_item_processing_fee'
644
        }
645
    );
646
    my $two_rule = Koha::CirculationRules->set_rule(
647
        {
648
            itemtype  => $itype_replace_fee->{itemtype}, branchcode => undef, rule_value => 2.04,
649
            rule_name => 'lost_item_processing_fee'
650
        }
651
    );
644
    my $cli_borrowernumber = $builder->build( { source => 'Borrower' } )->{'borrowernumber'};
652
    my $cli_borrowernumber = $builder->build( { source => 'Borrower' } )->{'borrowernumber'};
645
    my $cli_itemnumber1 = $builder->build_sample_item( { itype => $itype_no_replace_no_fee->{itemtype} } )->itemnumber;
653
    my $cli_itemnumber1 = $builder->build_sample_item( { itype => $itype_no_replace_no_fee->{itemtype} } )->itemnumber;
646
    my $cli_itemnumber2 = $builder->build_sample_item( { itype => $itype_replace_no_fee->{itemtype} } )->itemnumber;
654
    my $cli_itemnumber2 = $builder->build_sample_item( { itype => $itype_replace_no_fee->{itemtype} } )->itemnumber;
(-)a/t/db_dependent/Circulation.t (-11 / +10 lines)
Lines 156-162 my $itemtype = $builder->build( Link Here
156
            rentalcharge       => 0,
156
            rentalcharge       => 0,
157
            rentalcharge_daily => 0,
157
            rentalcharge_daily => 0,
158
            defaultreplacecost => undef,
158
            defaultreplacecost => undef,
159
            processfee         => undef
160
        }
159
        }
161
    }
160
    }
162
)->{itemtype};
161
)->{itemtype};
Lines 1185-1191 subtest "CanBookBeRenewed tests" => sub { Link Here
1185
        );
1184
        );
1186
1185
1187
        my $ten_days_before = dt_from_string->add( days => -10 );
1186
        my $ten_days_before = dt_from_string->add( days => -10 );
1188
        my $ten_days_ahead  = dt_from_string->add( days => 10 );
1187
        my $ten_days_ahead  = dt_from_string->add( days =>  10 );
1189
        my $issue           = AddIssue(
1188
        my $issue           = AddIssue(
1190
            $renewing_borrower_obj, $item_to_auto_renew->barcode, $ten_days_ahead, undef, $ten_days_before,
1189
            $renewing_borrower_obj, $item_to_auto_renew->barcode, $ten_days_ahead, undef, $ten_days_before,
1191
            undef, { auto_renew => 1 }
1190
            undef, { auto_renew => 1 }
Lines 1335-1341 subtest "CanBookBeRenewed tests" => sub { Link Here
1335
        );
1334
        );
1336
1335
1337
        my $ten_days_before = dt_from_string->add( days => -10 );
1336
        my $ten_days_before = dt_from_string->add( days => -10 );
1338
        my $ten_days_ahead  = dt_from_string->add( days => 10 );
1337
        my $ten_days_ahead  = dt_from_string->add( days =>  10 );
1339
        my $issue           = AddIssue(
1338
        my $issue           = AddIssue(
1340
            $renewing_borrower_obj, $item_to_auto_renew->barcode, $ten_days_ahead, undef, $ten_days_before,
1339
            $renewing_borrower_obj, $item_to_auto_renew->barcode, $ten_days_ahead, undef, $ten_days_before,
1341
            undef, { auto_renew => 1 }
1340
            undef, { auto_renew => 1 }
Lines 1445-1451 subtest "CanBookBeRenewed tests" => sub { Link Here
1445
        );
1444
        );
1446
1445
1447
        my $ten_days_before = dt_from_string->add( days => -10 );
1446
        my $ten_days_before = dt_from_string->add( days => -10 );
1448
        my $ten_days_ahead  = dt_from_string->add( days => 10 );
1447
        my $ten_days_ahead  = dt_from_string->add( days =>  10 );
1449
1448
1450
        # Patron is expired and BlockExpiredPatronOpacActions=''
1449
        # Patron is expired and BlockExpiredPatronOpacActions=''
1451
        # => auto renew is allowed
1450
        # => auto renew is allowed
Lines 1497-1503 subtest "CanBookBeRenewed tests" => sub { Link Here
1497
        );
1496
        );
1498
1497
1499
        my $ten_days_before = dt_from_string->add( days => -10 );
1498
        my $ten_days_before = dt_from_string->add( days => -10 );
1500
        my $ten_days_ahead  = dt_from_string->add( days => 10 );
1499
        my $ten_days_ahead  = dt_from_string->add( days =>  10 );
1501
        my $issue           = AddIssue(
1500
        my $issue           = AddIssue(
1502
            $renewing_borrower_obj, $item_to_auto_renew->barcode, $ten_days_ahead, undef, $ten_days_before,
1501
            $renewing_borrower_obj, $item_to_auto_renew->barcode, $ten_days_ahead, undef, $ten_days_before,
1503
            undef, { auto_renew => 1 }
1502
            undef, { auto_renew => 1 }
Lines 1618-1624 subtest "CanBookBeRenewed tests" => sub { Link Here
1618
        );
1617
        );
1619
1618
1620
        my $ten_days_before = dt_from_string->add( days => -10 );
1619
        my $ten_days_before = dt_from_string->add( days => -10 );
1621
        my $ten_days_ahead  = dt_from_string->add( days => 10 );
1620
        my $ten_days_ahead  = dt_from_string->add( days =>  10 );
1622
        my $issue           = AddIssue(
1621
        my $issue           = AddIssue(
1623
            $renewing_borrower_obj, $item_to_auto_renew->barcode, $ten_days_ahead, undef, $ten_days_before,
1622
            $renewing_borrower_obj, $item_to_auto_renew->barcode, $ten_days_ahead, undef, $ten_days_before,
1624
            undef, { auto_renew => 1 }
1623
            undef, { auto_renew => 1 }
Lines 2020-2026 subtest "GetUpcomingDueIssues" => sub { Link Here
2020
    my $a_borrower                = Koha::Patrons->find($a_borrower_borrowernumber);
2019
    my $a_borrower                = Koha::Patrons->find($a_borrower_borrowernumber);
2021
2020
2022
    my $yesterday      = DateTime->today( time_zone => C4::Context->tz() )->add( days => -1 );
2021
    my $yesterday      = DateTime->today( time_zone => C4::Context->tz() )->add( days => -1 );
2023
    my $two_days_ahead = DateTime->today( time_zone => C4::Context->tz() )->add( days => 2 );
2022
    my $two_days_ahead = DateTime->today( time_zone => C4::Context->tz() )->add( days =>  2 );
2024
    my $today          = DateTime->today( time_zone => C4::Context->tz() );
2023
    my $today          = DateTime->today( time_zone => C4::Context->tz() );
2025
2024
2026
    my $issue    = AddIssue( $a_borrower, $item_1->barcode, $yesterday );
2025
    my $issue    = AddIssue( $a_borrower, $item_1->barcode, $yesterday );
Lines 3932-3938 subtest 'AddReturn | is_overdue' => sub { Link Here
3932
        is( $line->status,                'RETURNED', "Overdue fine is fixed" );
3931
        is( $line->status,                'RETURNED', "Overdue fine is fixed" );
3933
        $line = $lines->next;
3932
        $line = $lines->next;
3934
        is( $line->amount + 0,            -2, "Original payment amount remains as 2" );
3933
        is( $line->amount + 0,            -2, "Original payment amount remains as 2" );
3935
        is( $line->amountoutstanding + 0, 0,  "Original payment remains applied" );
3934
        is( $line->amountoutstanding + 0,  0, "Original payment remains applied" );
3936
        $line = $lines->next;
3935
        $line = $lines->next;
3937
        is( $line->amount + 0,            -1, "Refund amount correctly set to 1" );
3936
        is( $line->amount + 0,            -1, "Refund amount correctly set to 1" );
3938
        is( $line->amountoutstanding + 0, -1, "Refund amount outstanding unspent" );
3937
        is( $line->amountoutstanding + 0, -1, "Refund amount outstanding unspent" );
Lines 4886-4892 subtest '_FixOverduesOnReturn' => sub { Link Here
4886
    my $credit = $offset->credit;
4885
    my $credit = $offset->credit;
4887
    is( ref $credit,                    "Koha::Account::Line", "Found matching credit for fine forgiveness" );
4886
    is( ref $credit,                    "Koha::Account::Line", "Found matching credit for fine forgiveness" );
4888
    is( $credit->amount + 0,            -99,                   "Credit amount is set correctly" );
4887
    is( $credit->amount + 0,            -99,                   "Credit amount is set correctly" );
4889
    is( $credit->amountoutstanding + 0, 0,                     "Credit amountoutstanding is correctly set to 0" );
4888
    is( $credit->amountoutstanding + 0,  0,                    "Credit amountoutstanding is correctly set to 0" );
4890
4889
4891
    # Bug 25417 - Only forgive fines where there is an amount outstanding to forgive
4890
    # Bug 25417 - Only forgive fines where there is an amount outstanding to forgive
4892
    $accountline->set(
4891
    $accountline->set(
Lines 7637-7643 subtest 'NoRefundOnLostFinesPaidAge' => sub { Link Here
7637
        {
7636
        {
7638
            borrowernumber    => $patron->id,
7637
            borrowernumber    => $patron->id,
7639
            date              => '1970-01-01 14:00:01',
7638
            date              => '1970-01-01 14:00:01',
7640
            amountoutstanding => 0,
7639
            amountoutstanding =>  0,
7641
            amount            => -5,
7640
            amount            => -5,
7642
            interface         => 'commandline',
7641
            interface         => 'commandline',
7643
            credit_type_code  => 'PAYMENT'
7642
            credit_type_code  => 'PAYMENT'
Lines 7693-7699 subtest 'NoRefundOnLostFinesPaidAge' => sub { Link Here
7693
            borrowernumber    => $patron2->id,
7692
            borrowernumber    => $patron2->id,
7694
            date              => '1970-01-01 14:00:01',
7693
            date              => '1970-01-01 14:00:01',
7695
            amount            => -5,
7694
            amount            => -5,
7696
            amountoutstanding => 0,
7695
            amountoutstanding =>  0,
7697
            interface         => 'commandline',
7696
            interface         => 'commandline',
7698
            credit_type_code  => 'PAYMENT'
7697
            credit_type_code  => 'PAYMENT'
7699
        }
7698
        }
(-)a/t/db_dependent/Koha/Charges/Fees.t (-1 lines)
Lines 68-74 my $itemtype = $builder->build_object( Link Here
68
            rentalcharge_hourly          => '0.00',
68
            rentalcharge_hourly          => '0.00',
69
            rentalcharge_hourly_calendar => 1,
69
            rentalcharge_hourly_calendar => 1,
70
            rentalcharge                 => '0.00',
70
            rentalcharge                 => '0.00',
71
            processfee                   => '0.00',
72
            defaultreplacecost           => '0.00',
71
            defaultreplacecost           => '0.00',
73
        },
72
        },
74
    }
73
    }
(-)a/t/db_dependent/Koha/Items.t (-6 / +6 lines)
Lines 465-475 subtest 'store' => sub { Link Here
465
                    notforloan         => 0,
465
                    notforloan         => 0,
466
                    rentalcharge       => 0,
466
                    rentalcharge       => 0,
467
                    defaultreplacecost => undef,
467
                    defaultreplacecost => undef,
468
                    processfee         => $processfee_amount,
469
                    rentalcharge_daily => 0,
468
                    rentalcharge_daily => 0,
470
                }
469
                }
471
            }
470
            }
472
        );
471
        );
472
        Koha::CirculationRules->set_rule(
473
            {
474
                itemtype  => $item_type->itemtype, branchcode => undef, rule_value => $processfee_amount,
475
                rule_name => 'lost_item_processing_fee'
476
            }
477
        );
473
        my $library = $builder->build_object( { class => 'Koha::Libraries' } );
478
        my $library = $builder->build_object( { class => 'Koha::Libraries' } );
474
479
475
        $biblio = $builder->build_sample_biblio( { author => 'Hall, Daria' } );
480
        $biblio = $builder->build_sample_biblio( { author => 'Hall, Daria' } );
Lines 1048-1054 subtest 'store' => sub { Link Here
1048
                        notforloan         => 0,
1053
                        notforloan         => 0,
1049
                        rentalcharge       => 0,
1054
                        rentalcharge       => 0,
1050
                        defaultreplacecost => undef,
1055
                        defaultreplacecost => undef,
1051
                        processfee         => 0,
1052
                        rentalcharge_daily => 0,
1056
                        rentalcharge_daily => 0,
1053
                    }
1057
                    }
1054
                }
1058
                }
Lines 1166-1172 subtest 'store' => sub { Link Here
1166
            my $patron             = $builder->build_object( { class => 'Koha::Patrons' } );
1170
            my $patron             = $builder->build_object( { class => 'Koha::Patrons' } );
1167
            my $barcode            = 'KD123456794';
1171
            my $barcode            = 'KD123456794';
1168
            my $replacement_amount = 100;
1172
            my $replacement_amount = 100;
1169
            my $processfee_amount  = 20;
1170
1173
1171
            my $item_type = $builder->build_object(
1174
            my $item_type = $builder->build_object(
1172
                {
1175
                {
Lines 1175-1181 subtest 'store' => sub { Link Here
1175
                        notforloan         => 0,
1178
                        notforloan         => 0,
1176
                        rentalcharge       => 0,
1179
                        rentalcharge       => 0,
1177
                        defaultreplacecost => undef,
1180
                        defaultreplacecost => undef,
1178
                        processfee         => 0,
1179
                        rentalcharge_daily => 0,
1181
                        rentalcharge_daily => 0,
1180
                    }
1182
                    }
1181
                }
1183
                }
Lines 1579-1585 subtest 'store' => sub { Link Here
1579
            my $patron             = $builder->build_object( { class => 'Koha::Patrons' } );
1581
            my $patron             = $builder->build_object( { class => 'Koha::Patrons' } );
1580
            my $barcode            = 'KD123456795';
1582
            my $barcode            = 'KD123456795';
1581
            my $replacement_amount = 100;
1583
            my $replacement_amount = 100;
1582
            my $processfee_amount  = 20;
1583
1584
1584
            my $item_type = $builder->build_object(
1585
            my $item_type = $builder->build_object(
1585
                {
1586
                {
Lines 1588-1594 subtest 'store' => sub { Link Here
1588
                        notforloan         => 0,
1589
                        notforloan         => 0,
1589
                        rentalcharge       => 0,
1590
                        rentalcharge       => 0,
1590
                        defaultreplacecost => undef,
1591
                        defaultreplacecost => undef,
1591
                        processfee         => 0,
1592
                        rentalcharge_daily => 0,
1592
                        rentalcharge_daily => 0,
1593
                    }
1593
                    }
1594
                }
1594
                }
(-)a/t/db_dependent/api/v1/item_types.t (-5 / +10 lines)
Lines 53-59 subtest 'list() tests' => sub { Link Here
53
                rentalcharge_hourly          => 0.60,
53
                rentalcharge_hourly          => 0.60,
54
                rentalcharge_hourly_calendar => 1,
54
                rentalcharge_hourly_calendar => 1,
55
                defaultreplacecost           => 1000.0,
55
                defaultreplacecost           => 1000.0,
56
                processfee                   => 20.0,
57
                notforloan                   => 0,
56
                notforloan                   => 0,
58
                imageurl          => 'https://upload.wikimedia.org/wikipedia/commons/1/1f/202208_test-tube-4.svg',
57
                imageurl          => 'https://upload.wikimedia.org/wikipedia/commons/1/1f/202208_test-tube-4.svg',
59
                summary           => 'An item type for testing',
58
                summary           => 'An item type for testing',
Lines 112-123 subtest 'list() tests' => sub { Link Here
112
111
113
    ## Authorized user tests
112
    ## Authorized user tests
114
    my $query = encode_json( { item_type_id => $item_type->id } );
113
    my $query = encode_json( { item_type_id => $item_type->id } );
115
    $t->get_ok("//$userid:$password@/api/v1/item_types?q=$query")->status_is(200)->json_has('/0')
114
    $t->get_ok("//$userid:$password@/api/v1/item_types?q=$query")
116
        ->json_is( '/0/description', $item_type->description )->json_hasnt('/0/translated_descriptions');
115
        ->status_is(200)
116
        ->json_has('/0')
117
        ->json_is( '/0/description', $item_type->description )
118
        ->json_hasnt('/0/translated_descriptions');
117
119
118
    $t->get_ok( "//$userid:$password@/api/v1/item_types?q=$query" => { 'x-koha-embed' => 'translated_descriptions' } )
120
    $t->get_ok( "//$userid:$password@/api/v1/item_types?q=$query" => { 'x-koha-embed' => 'translated_descriptions' } )
119
        ->status_is(200)->json_has('/0')->json_is( '/0/description', $item_type->description )
121
        ->status_is(200)
120
        ->json_has('/0/translated_descriptions')->json_is(
122
        ->json_has('/0')
123
        ->json_is( '/0/description', $item_type->description )
124
        ->json_has('/0/translated_descriptions')
125
        ->json_is(
121
        '/0/translated_descriptions',
126
        '/0/translated_descriptions',
122
        [
127
        [
123
            { lang => 'en',    translation => 'English word "test"' },
128
            { lang => 'en',    translation => 'English word "test"' },
(-)a/t/lib/TestBuilder.pm (-2 lines)
Lines 683-689 sub _gen_default_values { Link Here
683
            rentalcharge_daily  => 0,
683
            rentalcharge_daily  => 0,
684
            rentalcharge_hourly => 0,
684
            rentalcharge_hourly => 0,
685
            defaultreplacecost  => 0,
685
            defaultreplacecost  => 0,
686
            processfee          => 0,
687
            notforloan          => 0,
686
            notforloan          => 0,
688
            bookable            => 0,
687
            bookable            => 0,
689
        },
688
        },
690
- 

Return to bug 36506