Lines 17-23
Link Here
|
17 |
|
17 |
|
18 |
use Modern::Perl; |
18 |
use Modern::Perl; |
19 |
|
19 |
|
20 |
use Test::More tests => 66; |
20 |
use Test::More tests => 67; |
21 |
use Test::MockModule; |
21 |
use Test::MockModule; |
22 |
use Test::Warn; |
22 |
use Test::Warn; |
23 |
|
23 |
|
Lines 187-192
Koha::CirculationRules->set_rules(
Link Here
|
187 |
rules => { |
187 |
rules => { |
188 |
reservesallowed => 25, |
188 |
reservesallowed => 25, |
189 |
holds_per_record => 1, |
189 |
holds_per_record => 1, |
|
|
190 |
onshelfholds => 1, |
190 |
} |
191 |
} |
191 |
} |
192 |
} |
192 |
); |
193 |
); |
Lines 985-991
subtest 'reserves.item_level_hold' => sub {
Link Here
|
985 |
|
986 |
|
986 |
$hold->delete; |
987 |
$hold->delete; |
987 |
}; |
988 |
}; |
|
|
989 |
}; |
990 |
|
991 |
subtest 'OnShelfHoldAllowed test' => sub { |
992 |
plan tests => 3; |
993 |
$dbh->do('DELETE FROM circulation_rules'); |
994 |
my $biblio = $builder->build_sample_biblio({frameworkcode => $frameworkcode})->biblionumber; |
995 |
|
996 |
# Create a helper item instance for testing |
997 |
my $item = $builder->build_sample_item({ biblionumber => $biblio, library => $branch_1, itype => $itemtype }); |
998 |
|
999 |
Koha::CirculationRules->set_rules( |
1000 |
{ |
1001 |
branchcode => undef, |
1002 |
categorycode => undef, |
1003 |
itemtype => undef, |
1004 |
rules => { |
1005 |
reservesallowed => 25, |
1006 |
opacitemholds => 'Y', |
1007 |
onshelfholds => 1, |
1008 |
} |
1009 |
} |
1010 |
); |
1011 |
|
1012 |
my $canreserve = C4::Reserves::CanItemBeReserved( |
1013 |
$patron->borrowernumber, |
1014 |
$item->itemnumber, |
1015 |
); |
1016 |
|
1017 |
is( $canreserve->{status}, 'OK', |
1018 |
'item-level holds should be possible with onshelfholdallowed set to "Yes"' ); |
1019 |
|
1020 |
Koha::CirculationRules->set_rules( |
1021 |
{ |
1022 |
branchcode => undef, |
1023 |
categorycode => undef, |
1024 |
itemtype => undef, |
1025 |
rules => { |
1026 |
reservesallowed => 25, |
1027 |
opacitemholds => 'Y', |
1028 |
onshelfholds => '0', |
1029 |
} |
1030 |
}); |
1031 |
|
1032 |
$canreserve = C4::Reserves::CanItemBeReserved( |
1033 |
$patron->borrowernumber, |
1034 |
$item->itemnumber, |
1035 |
); |
1036 |
|
1037 |
is( $canreserve->{status}, 'onShelfHoldsNotAllowed', |
1038 |
'item-level holds should not be possible with onshelfholdallowed set to "If any unavailable"' ); |
1039 |
|
1040 |
Koha::CirculationRules->set_rules( |
1041 |
{ |
1042 |
branchcode => undef, |
1043 |
categorycode => undef, |
1044 |
itemtype => undef, |
1045 |
rules => { |
1046 |
reservesallowed => 25, |
1047 |
opacitemholds => 'Y', |
1048 |
onshelfholds => '2', |
1049 |
} |
1050 |
}); |
988 |
|
1051 |
|
|
|
1052 |
$canreserve = C4::Reserves::CanItemBeReserved( |
1053 |
$patron->borrowernumber, |
1054 |
$item->itemnumber, |
1055 |
); |
1056 |
|
1057 |
is( $canreserve->{status}, 'onShelfHoldsNotAllowed', |
1058 |
'item-level holds should not be possible with onshelfholdallowed set to "If all unavailable"' ); |
989 |
}; |
1059 |
}; |
990 |
|
1060 |
|
991 |
subtest 'MoveReserve additional test' => sub { |
1061 |
subtest 'MoveReserve additional test' => sub { |
Lines 1163-1168
subtest 'AllowHoldOnPatronPossession test' => sub {
Link Here
|
1163 |
my $patron = $builder->build_object({ class => "Koha::Patrons", |
1233 |
my $patron = $builder->build_object({ class => "Koha::Patrons", |
1164 |
value => { branchcode => $item->homebranch }}); |
1234 |
value => { branchcode => $item->homebranch }}); |
1165 |
|
1235 |
|
|
|
1236 |
Koha::CirculationRules->set_rules( |
1237 |
{ |
1238 |
branchcode => undef, |
1239 |
categorycode => undef, |
1240 |
itemtype => undef, |
1241 |
rules => { |
1242 |
onshelfholds => 1, |
1243 |
} |
1244 |
} |
1245 |
); |
1246 |
|
1166 |
C4::Circulation::AddIssue($patron->unblessed, |
1247 |
C4::Circulation::AddIssue($patron->unblessed, |
1167 |
$item->barcode); |
1248 |
$item->barcode); |
1168 |
t::lib::Mocks::mock_preference('AllowHoldsOnPatronsPossessions', 0); |
1249 |
t::lib::Mocks::mock_preference('AllowHoldsOnPatronsPossessions', 0); |
1169 |
- |
|
|