Lines 62-68
my $frameworkcode = q//;
Link Here
|
62 |
t::lib::Mocks::mock_preference('ReservesNeedReturns', 1); |
62 |
t::lib::Mocks::mock_preference('ReservesNeedReturns', 1); |
63 |
|
63 |
|
64 |
# Somewhat arbitrary field chosen for age restriction unit tests. Must be added to db before the framework is cached |
64 |
# Somewhat arbitrary field chosen for age restriction unit tests. Must be added to db before the framework is cached |
65 |
$dbh->do("update marc_subfield_structure set kohafield='biblioitems.agerestriction' where tagfield='521' and tagsubfield='a' and frameworkcode=?", undef, $frameworkcode); |
65 |
$dbh->do(q| |
|
|
66 |
INSERT INTO marc_subfield_structure (frameworkcode, tagfield, tagsubfield, kohafield) |
67 |
VALUES ('', '521', 'a', 'biblioitems.agerestriction') |
68 |
ON DUPLICATE KEY UPDATE kohafield = VALUES(kohafield) |
69 |
|); |
66 |
my $cache = Koha::Caches->get_instance; |
70 |
my $cache = Koha::Caches->get_instance; |
67 |
$cache->clear_from_cache("MarcStructure-0-$frameworkcode"); |
71 |
$cache->clear_from_cache("MarcStructure-0-$frameworkcode"); |
68 |
$cache->clear_from_cache("MarcStructure-1-$frameworkcode"); |
72 |
$cache->clear_from_cache("MarcStructure-1-$frameworkcode"); |
Lines 1192-1197
subtest 'AllowHoldOnPatronPossession test' => sub {
Link Here
|
1192 |
'Patron can place hold on an item loaned to itself'); |
1196 |
'Patron can place hold on an item loaned to itself'); |
1193 |
}; |
1197 |
}; |
1194 |
|
1198 |
|
|
|
1199 |
subtest 'check maxreserve test' => sub { |
1200 |
|
1201 |
plan tests => 2; |
1202 |
|
1203 |
t::lib::Mocks::mock_preference('maxreserves', 1); |
1204 |
# Create the items and patrons we need |
1205 |
my $biblio_1 = $builder->build_sample_biblio(); |
1206 |
my $biblio_2 = $builder->build_sample_biblio(); |
1207 |
my $itype = $builder->build_object({ class => "Koha::ItemTypes", value => { notforloan => 0 } }); |
1208 |
my $item_1 = $builder->build_sample_item({ biblionumber => $biblio_1->biblionumber,notforloan => 0, itype => $itype->itemtype }); |
1209 |
my $item_2 = $builder->build_sample_item({ biblionumber => $biblio_2->biblionumber, notforloan => 0, itype => $itype->itemtype }); |
1210 |
my $patron = $builder->build_object({ class => "Koha::Patrons", |
1211 |
value => { branchcode => $item_2->homebranch }}); |
1212 |
|
1213 |
|
1214 |
# Place a hold on the title for both patrons |
1215 |
my $reserve = AddReserve( |
1216 |
{ |
1217 |
branchcode => $item_1->homebranch, |
1218 |
borrowernumber => $patron->borrowernumber, |
1219 |
biblionumber => $biblio_1->biblionumber, |
1220 |
priority => 1, |
1221 |
itemnumber => $item_1->itemnumber, |
1222 |
} |
1223 |
); |
1224 |
|
1225 |
my $borrowernumber = $patron->borrowernumber; |
1226 |
|
1227 |
is( C4::Reserves::CanBookBeReserved($borrowernumber, $biblio_2->biblionumber)->{status} , 'tooManyReserves', "CanBookBeReserved: Reserving more than maxreserves is forbidden"); |
1228 |
is( C4::Reserves::CanItemBeReserved($borrowernumber, $item_2->itemnumber, $item_2->homebranch)->{status} , 'tooManyReserves', "CanItemBeReserved: Reserving more than maxreserves is forbidden"); |
1229 |
|
1230 |
}; |
1231 |
|
1195 |
subtest 'MergeHolds' => sub { |
1232 |
subtest 'MergeHolds' => sub { |
1196 |
|
1233 |
|
1197 |
plan tests => 1; |
1234 |
plan tests => 1; |
1198 |
- |
|
|