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

(-)a/t/db_dependent/Reserves.t (-2 / +89 lines)
Lines 918-924 subtest 'ChargeReserveFee tests' => sub { Link Here
918
};
918
};
919
919
920
subtest 'reserves.item_level_hold' => sub {
920
subtest 'reserves.item_level_hold' => sub {
921
    plan tests => 2;
921
    plan tests => 3;
922
922
923
    my $item   = $builder->build_sample_item;
923
    my $item   = $builder->build_sample_item;
924
    my $patron = $builder->build_object(
924
    my $patron = $builder->build_object(
Lines 986-991 subtest 'reserves.item_level_hold' => sub { Link Here
986
        $hold->delete;
986
        $hold->delete;
987
    };
987
    };
988
988
989
    subtest 'test opacitemholds rules' => sub {
990
        plan tests => 6;
991
992
        Koha::CirculationRules->set_rules(
993
            {
994
                branchcode   => undef,
995
                categorycode => undef,
996
                itemtype     => undef,
997
                rules        => {
998
                    reservesallowed => 25,
999
                    opacitemholds => 'F',
1000
                }
1001
            }
1002
        );
1003
1004
        my $canreserve = C4::Reserves::CanBookBeReserved(
1005
            $patron->borrowernumber,
1006
            $item->biblionumber,
1007
           );
1008
1009
        is( $canreserve->{status},
1010
            'RecordHoldNotAllowed',
1011
            'record-level holds should not be possible with opacitemholds set to "Force"' );
1012
1013
        $canreserve = C4::Reserves::CanItemBeReserved(
1014
           $patron->borrowernumber,
1015
            $item->itemnumber,
1016
          );
1017
1018
        is( $canreserve->{status}, 'OK',
1019
            'item-level holds should be possible with opacitemholds set to "Force"' );
1020
1021
        Koha::CirculationRules->set_rules(
1022
            {
1023
                branchcode   => undef,
1024
                categorycode => undef,
1025
                itemtype     => undef,
1026
                rules        => {
1027
                    reservesallowed => 25,
1028
                    opacitemholds => 'N',
1029
                }
1030
            }
1031
            );
1032
1033
        $canreserve = C4::Reserves::CanBookBeReserved(
1034
            $patron->borrowernumber,
1035
            $item->biblionumber,
1036
            );
1037
1038
        is( $canreserve->{status}, 'OK',
1039
            'record-level holds should be possible with opacitemholds set to "No"' );
1040
1041
       $canreserve = C4::Reserves::CanItemBeReserved(
1042
            $patron->borrowernumber,
1043
            $item->itemnumber,
1044
            );
1045
1046
        is( $canreserve->{status}, 'notReservable',
1047
            'item-level holds should not be possible with opacitemholds set to "No"' );
1048
1049
        Koha::CirculationRules->set_rules(
1050
            {
1051
                branchcode   => undef,
1052
                categorycode => undef,
1053
                itemtype     => undef,
1054
                rules        => {
1055
                    reservesallowed => 25,
1056
                    opacitemholds => 'Y',
1057
                }
1058
            }
1059
            );
1060
1061
            $canreserve = C4::Reserves::CanBookBeReserved(
1062
            $patron->borrowernumber,
1063
            $item->biblionumber,
1064
            );
1065
1066
        is( $canreserve->{status}, 'OK',
1067
            'record-level holds should be possible with opacitemholds set to "Yes"' );
1068
1069
        $canreserve = C4::Reserves::CanItemBeReserved(
1070
            $patron->borrowernumber,
1071
            $item->itemnumber,
1072
            );
1073
1074
        is( $canreserve->{status}, 'OK',
1075
            'item-level holds should be possible with opacitemholds set to "Yes"' );
1076
    };
989
};
1077
};
990
1078
991
subtest 'MoveReserve additional test' => sub {
1079
subtest 'MoveReserve additional test' => sub {
992
- 

Return to bug 25408