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