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