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

(-)a/t/db_dependent/Circulation.t (-3 / +94 lines)
Lines 18-24 Link Here
18
use Modern::Perl;
18
use Modern::Perl;
19
use utf8;
19
use utf8;
20
20
21
use Test::More tests => 48;
21
use Test::More tests => 49;
22
use Test::Exception;
22
use Test::Exception;
23
use Test::MockModule;
23
use Test::MockModule;
24
use Test::Deep qw( cmp_deeply );
24
use Test::Deep qw( cmp_deeply );
Lines 2345-2351 subtest 'CanBookBeIssued + AutoReturnCheckedOutItems' => sub { Link Here
2345
2345
2346
2346
2347
subtest 'AddReturn | is_overdue' => sub {
2347
subtest 'AddReturn | is_overdue' => sub {
2348
    plan tests => 8;
2348
    plan tests => 9;
2349
2349
2350
    t::lib::Mocks::mock_preference('MarkLostItemsAsReturned', 'batchmod|moredetail|cronjob|additem|pendingreserves|onpayment');
2350
    t::lib::Mocks::mock_preference('MarkLostItemsAsReturned', 'batchmod|moredetail|cronjob|additem|pendingreserves|onpayment');
2351
    t::lib::Mocks::mock_preference('CalculateFinesOnReturn', 1);
2351
    t::lib::Mocks::mock_preference('CalculateFinesOnReturn', 1);
Lines 2658-2663 subtest 'AddReturn | is_overdue' => sub { Link Here
2658
        Koha::Account::Lines->search(
2658
        Koha::Account::Lines->search(
2659
            { borrowernumber => $patron->borrowernumber } )->delete;
2659
            { borrowernumber => $patron->borrowernumber } )->delete;
2660
    };
2660
    };
2661
2662
    subtest 'enh 23091 | Lost item return policies' => sub {
2663
        plan tests => 1;
2664
2665
        my $branchcode_false =
2666
          $builder->build( { source => 'Branch' } )->{branchcode};
2667
        my $specific_rule_false = $builder->build(
2668
            {
2669
                source => 'CirculationRule',
2670
                value  => {
2671
                    branchcode   => $branchcode_false,
2672
                    categorycode => undef,
2673
                    itemtype     => undef,
2674
                    rule_name    => 'lostreturn',
2675
                    rule_value   => 0
2676
                }
2677
            }
2678
        );
2679
        my $branchcode_refund =
2680
          $builder->build( { source => 'Branch' } )->{branchcode};
2681
        my $specific_rule_refund = $builder->build(
2682
            {
2683
                source => 'CirculationRule',
2684
                value  => {
2685
                    branchcode   => $branchcode_refund,
2686
                    categorycode => undef,
2687
                    itemtype     => undef,
2688
                    rule_name    => 'lostreturn',
2689
                    rule_value   => 'refund'
2690
                }
2691
            }
2692
        );
2693
        my $branchcode_restore =
2694
          $builder->build( { source => 'Branch' } )->{branchcode};
2695
        my $specific_rule_restore = $builder->build(
2696
            {
2697
                source => 'CirculationRule',
2698
                value  => {
2699
                    branchcode   => $branchcode_restore,
2700
                    categorycode => undef,
2701
                    itemtype     => undef,
2702
                    rule_name    => 'lostreturn',
2703
                    rule_value   => 'restore'
2704
                }
2705
            }
2706
        );
2707
        my $branchcode_charge =
2708
          $builder->build( { source => 'Branch' } )->{branchcode};
2709
        my $specific_rule_charge = $builder->build(
2710
            {
2711
                source => 'CirculationRule',
2712
                value  => {
2713
                    branchcode   => $branchcode_charge,
2714
                    categorycode => undef,
2715
                    itemtype     => undef,
2716
                    rule_name    => 'lostreturn',
2717
                    rule_value   => 'charge'
2718
                }
2719
            }
2720
        );
2721
2722
        t::lib::Mocks::mock_preference( 'BlockReturnOfLostItems', 0 );
2723
        t::lib::Mocks::mock_preference( 'RefundLostOnReturnControl', 'CheckinLibrary' );
2724
        t::lib::Mocks::mock_preference( 'NoRefundOnLostReturnedItemsAge', undef );
2725
2726
        # Do nothing
2727
        #
2728
        # Refund fee
2729
        ## Without fee
2730
        ## With fee
2731
        #
2732
        # Refund fee and restore fine
2733
        ## Without fee
2734
        ### Without fine
2735
        ### With fine (forgiven)
2736
        ### With fine (unforgiven)
2737
        ## With fee
2738
        ### Without fine
2739
        ### With fine (forgiven)
2740
        ### With fine (unforgiven)
2741
        #
2742
        # Refund fee and charge new fine
2743
        ## Without fee
2744
        ### Without fine
2745
        ### With fine (forgiven)
2746
        ### With fine (unforgiven)
2747
        ## With fee
2748
        ### Without fine
2749
        ### With fine (forgiven)
2750
        ### With fine (unforgiven)
2751
        ### Backdated return
2752
    };
2661
};
2753
};
2662
2754
2663
subtest '_RestoreOverdueForLostAndFound' => sub {
2755
subtest '_RestoreOverdueForLostAndFound' => sub {
2664
- 

Return to bug 23091