Lines 923-929
subtest 'ChargeReserveFee tests' => sub {
Link Here
|
923 |
}; |
923 |
}; |
924 |
|
924 |
|
925 |
subtest 'reserves.item_level_hold' => sub { |
925 |
subtest 'reserves.item_level_hold' => sub { |
926 |
plan tests => 2; |
926 |
plan tests => 4; |
927 |
|
927 |
|
928 |
my $item = $builder->build_sample_item; |
928 |
my $item = $builder->build_sample_item; |
929 |
my $patron = $builder->build_object( |
929 |
my $patron = $builder->build_object( |
Lines 991-996
subtest 'reserves.item_level_hold' => sub {
Link Here
|
991 |
$hold->delete; |
991 |
$hold->delete; |
992 |
}; |
992 |
}; |
993 |
|
993 |
|
|
|
994 |
subtest 'test opacitemholds rules' => sub { |
995 |
plan tests => 6; |
996 |
|
997 |
Koha::CirculationRules->set_rules( |
998 |
{ |
999 |
branchcode => undef, |
1000 |
categorycode => undef, |
1001 |
itemtype => undef, |
1002 |
rules => { |
1003 |
reservesallowed => 25, |
1004 |
opacitemholds => 'F', |
1005 |
} |
1006 |
} |
1007 |
); |
1008 |
|
1009 |
my $canreserve = C4::Reserves::CanBookBeReserved( |
1010 |
$patron->borrowernumber, |
1011 |
$item->biblionumber, |
1012 |
); |
1013 |
|
1014 |
is( $canreserve->{status}, |
1015 |
'recordHoldNotAllowed', |
1016 |
'record-level holds should not be possible with opacitemholds set to "Force"' ); |
1017 |
|
1018 |
$canreserve = C4::Reserves::CanItemBeReserved( |
1019 |
$patron, |
1020 |
$item, |
1021 |
); |
1022 |
|
1023 |
is( $canreserve->{status}, 'OK', |
1024 |
'item-level holds should be possible with opacitemholds set to "Force"' ); |
1025 |
|
1026 |
Koha::CirculationRules->set_rules( |
1027 |
{ |
1028 |
branchcode => undef, |
1029 |
categorycode => undef, |
1030 |
itemtype => undef, |
1031 |
rules => { |
1032 |
reservesallowed => 25, |
1033 |
opacitemholds => 'N', |
1034 |
} |
1035 |
} |
1036 |
); |
1037 |
|
1038 |
$canreserve = C4::Reserves::CanBookBeReserved( |
1039 |
$patron->borrowernumber, |
1040 |
$item->biblionumber, |
1041 |
); |
1042 |
|
1043 |
is( $canreserve->{status}, 'OK', |
1044 |
'record-level holds should be possible with opacitemholds set to "No"' ); |
1045 |
|
1046 |
$canreserve = C4::Reserves::CanItemBeReserved( |
1047 |
$patron, |
1048 |
$item, |
1049 |
); |
1050 |
|
1051 |
is( $canreserve->{status}, 'recordHoldsOnly', |
1052 |
'item-level holds should not be possible with opacitemholds set to "No"' ); |
1053 |
|
1054 |
Koha::CirculationRules->set_rules( |
1055 |
{ |
1056 |
branchcode => undef, |
1057 |
categorycode => undef, |
1058 |
itemtype => undef, |
1059 |
rules => { |
1060 |
reservesallowed => 25, |
1061 |
opacitemholds => 'Y', |
1062 |
} |
1063 |
} |
1064 |
); |
1065 |
|
1066 |
$canreserve = C4::Reserves::CanBookBeReserved( |
1067 |
$patron->borrowernumber, |
1068 |
$item->biblionumber, |
1069 |
); |
1070 |
|
1071 |
is( $canreserve->{status}, 'OK', |
1072 |
'record-level holds should be possible with opacitemholds set to "Yes"' ); |
1073 |
|
1074 |
$canreserve = C4::Reserves::CanItemBeReserved( |
1075 |
$patron, |
1076 |
$item, |
1077 |
); |
1078 |
|
1079 |
is( $canreserve->{status}, 'OK', |
1080 |
'item-level holds should be possible with opacitemholds set to "Yes"' ); |
1081 |
}; |
1082 |
|
1083 |
subtest 'test opacitemholds rules in staff context' => sub { |
1084 |
plan tests => 2; |
1085 |
|
1086 |
C4::Context->interface('intranet'); |
1087 |
Koha::CirculationRules->set_rules( |
1088 |
{ |
1089 |
branchcode => undef, |
1090 |
categorycode => undef, |
1091 |
itemtype => undef, |
1092 |
rules => { |
1093 |
reservesallowed => 25, |
1094 |
opacitemholds => 'N', |
1095 |
} |
1096 |
} |
1097 |
); |
1098 |
|
1099 |
my $canreserve = C4::Reserves::CanBookBeReserved( |
1100 |
$patron->borrowernumber, |
1101 |
$item->biblionumber); |
1102 |
|
1103 |
is( $canreserve->{status}, 'OK', |
1104 |
'record-level holds should be possible with opacitemholds set to "No"' ); |
1105 |
|
1106 |
$canreserve = C4::Reserves::CanItemBeReserved( |
1107 |
$patron, |
1108 |
$item); |
1109 |
|
1110 |
is( $canreserve->{status}, 'OK', |
1111 |
'item-level holds should still be possible in staff context, even with opacitemholds set to "No"' ); |
1112 |
}; |
1113 |
|
1114 |
Koha::CirculationRules->set_rules( |
1115 |
{ |
1116 |
branchcode => undef, |
1117 |
categorycode => undef, |
1118 |
itemtype => undef, |
1119 |
rules => { |
1120 |
opacitemholds => undef, |
1121 |
} |
1122 |
} |
1123 |
); |
994 |
}; |
1124 |
}; |
995 |
|
1125 |
|
996 |
subtest 'MoveReserve additional test' => sub { |
1126 |
subtest 'MoveReserve additional test' => sub { |
997 |
- |
|
|