|
Lines 978-984
subtest 'ChargeReserveFee tests' => sub {
Link Here
|
| 978 |
}; |
978 |
}; |
| 979 |
|
979 |
|
| 980 |
subtest 'reserves.item_level_hold' => sub { |
980 |
subtest 'reserves.item_level_hold' => sub { |
| 981 |
plan tests => 2; |
981 |
plan tests => 4; |
| 982 |
|
982 |
|
| 983 |
my $item = $builder->build_sample_item; |
983 |
my $item = $builder->build_sample_item; |
| 984 |
my $patron = $builder->build_object( |
984 |
my $patron = $builder->build_object( |
|
Lines 1081-1086
subtest 'reserves.item_level_hold' => sub {
Link Here
|
| 1081 |
$hold->delete; |
1081 |
$hold->delete; |
| 1082 |
}; |
1082 |
}; |
| 1083 |
|
1083 |
|
|
|
1084 |
subtest 'test opacitemholds rules' => sub { |
| 1085 |
plan tests => 6; |
| 1086 |
|
| 1087 |
Koha::CirculationRules->set_rules( |
| 1088 |
{ |
| 1089 |
branchcode => undef, |
| 1090 |
categorycode => undef, |
| 1091 |
itemtype => undef, |
| 1092 |
rules => { |
| 1093 |
reservesallowed => 25, |
| 1094 |
opacitemholds => 'F', |
| 1095 |
} |
| 1096 |
} |
| 1097 |
); |
| 1098 |
|
| 1099 |
my $canreserve = C4::Reserves::CanBookBeReserved( $patron->id, $item->biblionumber ); |
| 1100 |
|
| 1101 |
is( |
| 1102 |
$canreserve->{status}, |
| 1103 |
'recordHoldNotAllowed', |
| 1104 |
'record-level holds should not be possible with opacitemholds set to "Force"' |
| 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 "Force"' |
| 1112 |
); |
| 1113 |
|
| 1114 |
Koha::CirculationRules->set_rules( |
| 1115 |
{ |
| 1116 |
branchcode => undef, |
| 1117 |
categorycode => undef, |
| 1118 |
itemtype => undef, |
| 1119 |
rules => { |
| 1120 |
reservesallowed => 25, |
| 1121 |
opacitemholds => 'N', |
| 1122 |
} |
| 1123 |
} |
| 1124 |
); |
| 1125 |
|
| 1126 |
$canreserve = C4::Reserves::CanBookBeReserved( $patron->id, $item->biblionumber ); |
| 1127 |
|
| 1128 |
is( |
| 1129 |
$canreserve->{status}, 'OK', |
| 1130 |
'record-level holds should be possible with opacitemholds set to "No"' |
| 1131 |
); |
| 1132 |
|
| 1133 |
$canreserve = C4::Reserves::CanItemBeReserved( $patron, $item ); |
| 1134 |
|
| 1135 |
is( |
| 1136 |
$canreserve->{status}, 'recordHoldsOnly', |
| 1137 |
'item-level holds should not be possible with opacitemholds set to "No"' |
| 1138 |
); |
| 1139 |
|
| 1140 |
Koha::CirculationRules->set_rules( |
| 1141 |
{ |
| 1142 |
branchcode => undef, |
| 1143 |
categorycode => undef, |
| 1144 |
itemtype => undef, |
| 1145 |
rules => { |
| 1146 |
reservesallowed => 25, |
| 1147 |
opacitemholds => 'Y', |
| 1148 |
} |
| 1149 |
} |
| 1150 |
); |
| 1151 |
|
| 1152 |
$canreserve = C4::Reserves::CanBookBeReserved( $patron->id, $item->biblionumber ); |
| 1153 |
|
| 1154 |
is( |
| 1155 |
$canreserve->{status}, 'OK', |
| 1156 |
'record-level holds should be possible with opacitemholds set to "Yes"' |
| 1157 |
); |
| 1158 |
|
| 1159 |
$canreserve = C4::Reserves::CanItemBeReserved( $patron, $item ); |
| 1160 |
|
| 1161 |
is( |
| 1162 |
$canreserve->{status}, 'OK', |
| 1163 |
'item-level holds should be possible with opacitemholds set to "Yes"' |
| 1164 |
); |
| 1165 |
}; |
| 1166 |
|
| 1167 |
subtest 'test opacitemholds rules in staff context' => sub { |
| 1168 |
plan tests => 2; |
| 1169 |
|
| 1170 |
C4::Context->interface('intranet'); |
| 1171 |
Koha::CirculationRules->set_rules( |
| 1172 |
{ |
| 1173 |
branchcode => undef, |
| 1174 |
categorycode => undef, |
| 1175 |
itemtype => undef, |
| 1176 |
rules => { |
| 1177 |
reservesallowed => 25, |
| 1178 |
opacitemholds => 'N', |
| 1179 |
} |
| 1180 |
} |
| 1181 |
); |
| 1182 |
|
| 1183 |
my $canreserve = C4::Reserves::CanBookBeReserved( $patron->id, $item->biblionumber ); |
| 1184 |
|
| 1185 |
is( |
| 1186 |
$canreserve->{status}, 'OK', |
| 1187 |
'record-level holds should be possible with opacitemholds set to "No"' |
| 1188 |
); |
| 1189 |
|
| 1190 |
$canreserve = C4::Reserves::CanItemBeReserved( $patron, $item ); |
| 1191 |
|
| 1192 |
is( |
| 1193 |
$canreserve->{status}, 'OK', |
| 1194 |
'item-level holds should still be possible in staff context, even with opacitemholds set to "No"' |
| 1195 |
); |
| 1196 |
}; |
| 1197 |
|
| 1198 |
Koha::CirculationRules->set_rules( |
| 1199 |
{ |
| 1200 |
branchcode => undef, |
| 1201 |
categorycode => undef, |
| 1202 |
itemtype => undef, |
| 1203 |
rules => { |
| 1204 |
opacitemholds => undef, |
| 1205 |
} |
| 1206 |
} |
| 1207 |
); |
| 1084 |
}; |
1208 |
}; |
| 1085 |
|
1209 |
|
| 1086 |
subtest 'MoveReserve additional test' => sub { |
1210 |
subtest 'MoveReserve additional test' => sub { |
| 1087 |
- |
|
|