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