|
Lines 926-932
subtest 'ChargeReserveFee tests' => sub {
Link Here
|
| 926 |
}; |
926 |
}; |
| 927 |
|
927 |
|
| 928 |
subtest 'reserves.item_level_hold' => sub { |
928 |
subtest 'reserves.item_level_hold' => sub { |
| 929 |
plan tests => 2; |
929 |
plan tests => 4; |
| 930 |
|
930 |
|
| 931 |
my $item = $builder->build_sample_item; |
931 |
my $item = $builder->build_sample_item; |
| 932 |
my $patron = $builder->build_object( |
932 |
my $patron = $builder->build_object( |
|
Lines 1029-1034
subtest 'reserves.item_level_hold' => sub {
Link Here
|
| 1029 |
$hold->delete; |
1029 |
$hold->delete; |
| 1030 |
}; |
1030 |
}; |
| 1031 |
|
1031 |
|
|
|
1032 |
subtest 'test opacitemholds rules' => sub { |
| 1033 |
plan tests => 6; |
| 1034 |
|
| 1035 |
Koha::CirculationRules->set_rules( |
| 1036 |
{ |
| 1037 |
branchcode => undef, |
| 1038 |
categorycode => undef, |
| 1039 |
itemtype => undef, |
| 1040 |
rules => { |
| 1041 |
reservesallowed => 25, |
| 1042 |
opacitemholds => 'F', |
| 1043 |
} |
| 1044 |
} |
| 1045 |
); |
| 1046 |
|
| 1047 |
my $canreserve = C4::Reserves::CanBookBeReserved( $patron->id, $item->biblionumber ); |
| 1048 |
|
| 1049 |
is( |
| 1050 |
$canreserve->{status}, |
| 1051 |
'recordHoldNotAllowed', |
| 1052 |
'record-level holds should not be possible with opacitemholds set to "Force"' |
| 1053 |
); |
| 1054 |
|
| 1055 |
$canreserve = C4::Reserves::CanItemBeReserved( $patron, $item ); |
| 1056 |
|
| 1057 |
is( |
| 1058 |
$canreserve->{status}, 'OK', |
| 1059 |
'item-level holds should be possible with opacitemholds set to "Force"' |
| 1060 |
); |
| 1061 |
|
| 1062 |
Koha::CirculationRules->set_rules( |
| 1063 |
{ |
| 1064 |
branchcode => undef, |
| 1065 |
categorycode => undef, |
| 1066 |
itemtype => undef, |
| 1067 |
rules => { |
| 1068 |
reservesallowed => 25, |
| 1069 |
opacitemholds => 'N', |
| 1070 |
} |
| 1071 |
} |
| 1072 |
); |
| 1073 |
|
| 1074 |
$canreserve = C4::Reserves::CanBookBeReserved( $patron->id, $item->biblionumber ); |
| 1075 |
|
| 1076 |
is( |
| 1077 |
$canreserve->{status}, 'OK', |
| 1078 |
'record-level holds should be possible with opacitemholds set to "No"' |
| 1079 |
); |
| 1080 |
|
| 1081 |
$canreserve = C4::Reserves::CanItemBeReserved( $patron, $item ); |
| 1082 |
|
| 1083 |
is( |
| 1084 |
$canreserve->{status}, 'recordHoldsOnly', |
| 1085 |
'item-level holds should not be possible with opacitemholds set to "No"' |
| 1086 |
); |
| 1087 |
|
| 1088 |
Koha::CirculationRules->set_rules( |
| 1089 |
{ |
| 1090 |
branchcode => undef, |
| 1091 |
categorycode => undef, |
| 1092 |
itemtype => undef, |
| 1093 |
rules => { |
| 1094 |
reservesallowed => 25, |
| 1095 |
opacitemholds => 'Y', |
| 1096 |
} |
| 1097 |
} |
| 1098 |
); |
| 1099 |
|
| 1100 |
$canreserve = C4::Reserves::CanBookBeReserved( $patron->id, $item->biblionumber ); |
| 1101 |
|
| 1102 |
is( |
| 1103 |
$canreserve->{status}, 'OK', |
| 1104 |
'record-level holds should be possible with opacitemholds set to "Yes"' |
| 1105 |
); |
| 1106 |
|
| 1107 |
$canreserve = C4::Reserves::CanItemBeReserved( $patron, $item ); |
| 1108 |
|
| 1109 |
is( |
| 1110 |
$canreserve->{status}, 'OK', |
| 1111 |
'item-level holds should be possible with opacitemholds set to "Yes"' |
| 1112 |
); |
| 1113 |
}; |
| 1114 |
|
| 1115 |
subtest 'test opacitemholds rules in staff context' => sub { |
| 1116 |
plan tests => 2; |
| 1117 |
|
| 1118 |
C4::Context->interface('intranet'); |
| 1119 |
Koha::CirculationRules->set_rules( |
| 1120 |
{ |
| 1121 |
branchcode => undef, |
| 1122 |
categorycode => undef, |
| 1123 |
itemtype => undef, |
| 1124 |
rules => { |
| 1125 |
reservesallowed => 25, |
| 1126 |
opacitemholds => 'N', |
| 1127 |
} |
| 1128 |
} |
| 1129 |
); |
| 1130 |
|
| 1131 |
my $canreserve = C4::Reserves::CanBookBeReserved( $patron->id, $item->biblionumber ); |
| 1132 |
|
| 1133 |
is( |
| 1134 |
$canreserve->{status}, 'OK', |
| 1135 |
'record-level holds should be possible with opacitemholds set to "No"' |
| 1136 |
); |
| 1137 |
|
| 1138 |
$canreserve = C4::Reserves::CanItemBeReserved( $patron, $item ); |
| 1139 |
|
| 1140 |
is( |
| 1141 |
$canreserve->{status}, 'OK', |
| 1142 |
'item-level holds should still be possible in staff context, even with opacitemholds set to "No"' |
| 1143 |
); |
| 1144 |
}; |
| 1145 |
|
| 1146 |
Koha::CirculationRules->set_rules( |
| 1147 |
{ |
| 1148 |
branchcode => undef, |
| 1149 |
categorycode => undef, |
| 1150 |
itemtype => undef, |
| 1151 |
rules => { |
| 1152 |
opacitemholds => undef, |
| 1153 |
} |
| 1154 |
} |
| 1155 |
); |
| 1032 |
}; |
1156 |
}; |
| 1033 |
|
1157 |
|
| 1034 |
subtest 'MoveReserve additional test' => sub { |
1158 |
subtest 'MoveReserve additional test' => sub { |
| 1035 |
- |
|
|