3 # This file is part of Koha.
5 # Koha is free software; you can redistribute it and/or modify it
6 # under the terms of the GNU General Public License as published by
7 # the Free Software Foundation; either version 3 of the License, or
8 # (at your option) any later version.
10 # Koha is distributed in the hope that it will be useful, but
11 # WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
15 # You should have received a copy of the GNU General Public License
16 # along with Koha; if not, see <http://www.gnu.org/licenses>.
20 use Test::More tests => 58;
23 use DateTime::Duration;
37 use_ok('C4::Reserves');
40 # a very minimal mack of userenv for use by the test of DelItemCheck
41 *C4::Context::userenv = sub {
45 my $dbh = C4::Context->dbh;
48 $dbh->{AutoCommit} = 0;
49 $dbh->{RaiseError} = 1;
51 # Somewhat arbitrary field chosen for age restriction unit tests. Must be added to db before the framework is cached
52 $dbh->do("update marc_subfield_structure set kohafield='biblioitems.agerestriction' where tagfield='521' and tagsubfield='a'");
54 # Setup Test------------------------
56 # Add branches if not existing
57 foreach my $addbra ('CPL', 'FPL', 'RPL') {
58 $dbh->do("INSERT INTO branches (branchcode,branchname) VALUES (?,?)", undef, ($addbra,"$addbra branch")) unless GetBranchName($addbra);
61 # Add categories if not existing
62 foreach my $addcat ('S', 'PT') {
63 $dbh->do("INSERT INTO categories (categorycode,hidelostitems,category_type) VALUES (?,?,?)",undef,($addcat, 0, $addcat eq 'S'? 'S': 'A')) unless GetBorrowercategory($addcat);
66 # Create a helper biblio
67 my $bib = MARC::Record->new();
68 my $title = 'Silence in the library';
69 if( C4::Context->preference('marcflavour') eq 'UNIMARC' ) {
71 MARC::Field->new('600', '', '1', a => 'Moffat, Steven'),
72 MARC::Field->new('200', '', '', a => $title),
77 MARC::Field->new('100', '', '', a => 'Moffat, Steven'),
78 MARC::Field->new('245', '', '', a => $title),
81 my ($bibnum, $bibitemnum);
82 ($bibnum, $title, $bibitemnum) = AddBiblio($bib, '');
84 # Create a helper item instance for testing
85 my ($item_bibnum, $item_bibitemnum, $itemnumber) = AddItem({ homebranch => 'CPL', holdingbranch => 'CPL' } , $bibnum);
87 # Modify item; setting barcode.
88 my $testbarcode = '97531';
89 ModItem({ barcode => $testbarcode }, $bibnum, $itemnumber);
93 firstname => 'my firstname',
94 surname => 'my surname',
98 my $borrowernumber = AddMember(%data);
99 my $borrower = GetMember( borrowernumber => $borrowernumber );
100 my $biblionumber = $bibnum;
101 my $barcode = $testbarcode;
103 my $constraint = 'a';
109 my $checkitem = undef;
112 my @branches = GetBranchesLoop();
113 my $branch = $branches[0][0]{value};
115 AddReserve($branch, $borrowernumber, $biblionumber,
116 $constraint, $bibitems, $priority, $resdate, $expdate, $notes,
117 $title, $checkitem, $found);
119 my ($status, $reserve, $all_reserves) = CheckReserves($itemnumber, $barcode);
121 is($status, "Reserved", "CheckReserves Test 1");
123 ok(exists($reserve->{reserve_id}), 'CheckReserves() include reserve_id in its response');
125 ($status, $reserve, $all_reserves) = CheckReserves($itemnumber);
126 is($status, "Reserved", "CheckReserves Test 2");
128 ($status, $reserve, $all_reserves) = CheckReserves(undef, $barcode);
129 is($status, "Reserved", "CheckReserves Test 3");
131 my $ReservesControlBranch = C4::Context->preference('ReservesControlBranch');
132 C4::Context->set_preference( 'ReservesControlBranch', 'ItemHomeLibrary' );
134 'ItemHomeLib' eq GetReservesControlBranch(
135 { homebranch => 'ItemHomeLib' },
136 { branchcode => 'PatronHomeLib' }
137 ), "GetReservesControlBranch returns item home branch when set to ItemHomeLibrary"
139 C4::Context->set_preference( 'ReservesControlBranch', 'PatronLibrary' );
141 'PatronHomeLib' eq GetReservesControlBranch(
142 { homebranch => 'ItemHomeLib' },
143 { branchcode => 'PatronHomeLib' }
144 ), "GetReservesControlBranch returns patron home branch when set to PatronLibrary"
146 C4::Context->set_preference( 'ReservesControlBranch', $ReservesControlBranch );
149 ### Regression test for bug 10272
152 $requesters{'CPL'} = AddMember(
154 categorycode => 'PT',
155 surname => 'borrower from CPL',
157 $requesters{'FPL'} = AddMember(
159 categorycode => 'PT',
160 surname => 'borrower from FPL',
162 $requesters{'RPL'} = AddMember(
164 categorycode => 'PT',
165 surname => 'borrower from RPL',
168 # Configure rules so that CPL allows only CPL patrons
169 # to request its items, while FPL will allow its items
170 # to fill holds from anywhere.
172 $dbh->do('DELETE FROM issuingrules');
173 $dbh->do('DELETE FROM branch_item_rules');
174 $dbh->do('DELETE FROM branch_borrower_circ_rules');
175 $dbh->do('DELETE FROM default_borrower_circ_rules');
176 $dbh->do('DELETE FROM default_branch_item_rules');
177 $dbh->do('DELETE FROM default_branch_circ_rules');
178 $dbh->do('DELETE FROM default_circ_rules');
180 q{INSERT INTO issuingrules (categorycode, branchcode, itemtype, reservesallowed)
181 VALUES (?, ?, ?, ?)},
186 # CPL allows only its own patrons to request its items
188 q{INSERT INTO default_branch_circ_rules (branchcode, maxissueqty, holdallowed, returnbranch)
189 VALUES (?, ?, ?, ?)},
191 'CPL', 10, 1, 'homebranch',
194 # ... while FPL allows anybody to request its items
196 q{INSERT INTO default_branch_circ_rules (branchcode, maxissueqty, holdallowed, returnbranch)
197 VALUES (?, ?, ?, ?)},
199 'FPL', 10, 2, 'homebranch',
202 # helper biblio for the bug 10272 regression test
203 my $bib2 = MARC::Record->new();
204 $bib2->append_fields(
205 MARC::Field->new('100', ' ', ' ', a => 'Moffat, Steven'),
206 MARC::Field->new('245', ' ', ' ', a => $title),
209 # create one item belonging to FPL and one belonging to CPL
210 my ($bibnum2, $bibitemnum2) = AddBiblio($bib, '');
211 my ($itemnum_cpl, $itemnum_fpl);
212 (undef, undef, $itemnum_cpl) = AddItem({
214 holdingbranch => 'CPL',
215 barcode => 'bug10272_CPL'
217 (undef, undef, $itemnum_fpl) = AddItem({
219 holdingbranch => 'FPL',
220 barcode => 'bug10272_FPL'
223 # Ensure that priorities are numbered correcly when a hold is moved to waiting
225 $dbh->do("DELETE FROM reserves WHERE biblionumber=?",undef,($bibnum2));
226 AddReserve('RPL', $requesters{'RPL'}, $bibnum2,
227 $constraint, $bibitems, 1, $resdate, $expdate, $notes,
228 $title, $checkitem, $found);
229 AddReserve('FPL', $requesters{'FPL'}, $bibnum2,
230 $constraint, $bibitems, 2, $resdate, $expdate, $notes,
231 $title, $checkitem, $found);
232 AddReserve('CPL', $requesters{'CPL'}, $bibnum2,
233 $constraint, $bibitems, 3, $resdate, $expdate, $notes,
234 $title, $checkitem, $found);
235 ModReserveAffect($itemnum_cpl, $requesters{'RPL'}, 0);
237 # Now it should have different priorities.
238 my $title_reserves = GetReservesFromBiblionumber({biblionumber => $bibnum2});
239 # Sort by reserve number in case the database gives us oddly ordered results
240 my @reserves = sort { $a->{reserve_id} <=> $b->{reserve_id} } @$title_reserves;
241 is($reserves[0]{priority}, 0, 'Item is correctly waiting');
242 is($reserves[1]{priority}, 1, 'Item is correctly priority 1');
243 is($reserves[2]{priority}, 2, 'Item is correctly priority 2');
245 @reserves = Koha::Holds->search({ borrowernumber => $requesters{'RPL'} })->waiting();
246 is( @reserves, 1, 'GetWaiting got only the waiting reserve' );
247 is( $reserves[0]->borrowernumber(), $requesters{'RPL'}, 'GetWaiting got the reserve for the correct borrower' );
250 $dbh->do("DELETE FROM reserves WHERE biblionumber=?",undef,($bibnum2));
251 AddReserve('RPL', $requesters{'RPL'}, $bibnum2,
252 $constraint, $bibitems, 1, $resdate, $expdate, $notes,
253 $title, $checkitem, $found);
254 AddReserve('FPL', $requesters{'FPL'}, $bibnum2,
255 $constraint, $bibitems, 2, $resdate, $expdate, $notes,
256 $title, $checkitem, $found);
257 AddReserve('CPL', $requesters{'CPL'}, $bibnum2,
258 $constraint, $bibitems, 3, $resdate, $expdate, $notes,
259 $title, $checkitem, $found);
261 # Ensure that the item's home library controls hold policy lookup
262 C4::Context->set_preference( 'ReservesControlBranch', 'ItemHomeLibrary' );
265 # Return the CPL item at FPL. The hold that should be triggered is
266 # the one placed by the CPL patron, as the other two patron's hold
267 # requests cannot be filled by that item per policy.
268 (undef, $messages, undef, undef) = AddReturn('bug10272_CPL', 'FPL');
269 is( $messages->{ResFound}->{borrowernumber},
271 'restrictive library\'s items only fill requests by own patrons (bug 10272)');
273 # Return the FPL item at FPL. The hold that should be triggered is
274 # the one placed by the RPL patron, as that patron is first in line
275 # and RPL imposes no restrictions on whose holds its items can fill.
276 (undef, $messages, undef, undef) = AddReturn('bug10272_FPL', 'FPL');
277 is( $messages->{ResFound}->{borrowernumber},
279 'for generous library, its items fill first hold request in line (bug 10272)');
281 my $reserves = GetReservesFromBiblionumber({biblionumber => $biblionumber});
282 isa_ok($reserves, 'ARRAY');
283 is(scalar @$reserves, 1, "Only one reserves for this biblio");
284 my $reserve_id = $reserves->[0]->{reserve_id};
286 $reserve = GetReserve($reserve_id);
287 isa_ok($reserve, 'HASH', "GetReserve return");
288 is($reserve->{biblionumber}, $biblionumber);
290 $reserve = CancelReserve({reserve_id => $reserve_id});
291 isa_ok($reserve, 'HASH', "CancelReserve return");
292 is($reserve->{biblionumber}, $biblionumber);
294 $reserve = GetReserve($reserve_id);
295 is($reserve, undef, "GetReserve returns undef after deletion");
297 $reserve = CancelReserve({reserve_id => $reserve_id});
298 is($reserve, undef, "CancelReserve return undef if reserve does not exist");
301 # Tests for bug 9761 (ConfirmFutureHolds): new CheckReserves lookahead parameter, and corresponding change in AddReturn
302 # Note that CheckReserve uses its lookahead parameter and does not check ConfirmFutureHolds pref (it should be passed if needed like AddReturn does)
303 # Test 9761a: Add a reserve without date, CheckReserve should return it
304 $resdate= undef; #defaults to today in AddReserve
305 $expdate= undef; #no expdate
306 $dbh->do("DELETE FROM reserves WHERE biblionumber=?",undef,($bibnum));
307 AddReserve('CPL', $requesters{'CPL'}, $bibnum,
308 $constraint, $bibitems, 1, $resdate, $expdate, $notes,
309 $title, $checkitem, $found);
310 ($status)=CheckReserves($itemnumber,undef,undef);
311 is( $status, 'Reserved', 'CheckReserves returns reserve without lookahead');
312 ($status)=CheckReserves($itemnumber,undef,7);
313 is( $status, 'Reserved', 'CheckReserves also returns reserve with lookahead');
315 # Test 9761b: Add a reserve with future date, CheckReserve should not return it
316 $dbh->do("DELETE FROM reserves WHERE biblionumber=?",undef,($bibnum));
317 C4::Context->set_preference('AllowHoldDateInFuture', 1);
318 $resdate= dt_from_string();
319 $resdate->add_duration(DateTime::Duration->new(days => 4));
320 $resdate=output_pref($resdate);
321 $expdate= undef; #no expdate
322 AddReserve('CPL', $requesters{'CPL'}, $bibnum,
323 $constraint, $bibitems, 1, $resdate, $expdate, $notes,
324 $title, $checkitem, $found);
325 ($status)=CheckReserves($itemnumber,undef,undef);
326 is( $status, '', 'CheckReserves returns no future reserve without lookahead');
328 # Test 9761c: Add a reserve with future date, CheckReserve should return it if lookahead is high enough
329 ($status)=CheckReserves($itemnumber,undef,3);
330 is( $status, '', 'CheckReserves returns no future reserve with insufficient lookahead');
331 ($status)=CheckReserves($itemnumber,undef,4);
332 is( $status, 'Reserved', 'CheckReserves returns future reserve with sufficient lookahead');
334 # Test 9761d: Check ResFound message of AddReturn for future hold
335 # Note that AddReturn is in Circulation.pm, but this test really pertains to reserves; AddReturn uses the ConfirmFutureHolds pref when calling CheckReserves
336 # In this test we do not need an issued item; it is just a 'checkin'
337 C4::Context->set_preference('ConfirmFutureHolds', 0);
338 (my $doreturn, $messages)= AddReturn('97531','CPL');
339 is($messages->{ResFound}//'', '', 'AddReturn does not care about future reserve when ConfirmFutureHolds is off');
340 C4::Context->set_preference('ConfirmFutureHolds', 3);
341 ($doreturn, $messages)= AddReturn('97531','CPL');
342 is(exists $messages->{ResFound}?1:0, 0, 'AddReturn ignores future reserve beyond ConfirmFutureHolds days');
343 C4::Context->set_preference('ConfirmFutureHolds', 7);
344 ($doreturn, $messages)= AddReturn('97531','CPL');
345 is(exists $messages->{ResFound}?1:0, 1, 'AddReturn considers future reserve within ConfirmFutureHolds days');
347 # End of tests for bug 9761 (ConfirmFutureHolds)
349 # test marking a hold as captured
350 my $hold_notice_count = count_hold_print_messages();
351 ModReserveAffect($itemnumber, $requesters{'CPL'}, 0);
352 my $new_count = count_hold_print_messages();
353 is($new_count, $hold_notice_count + 1, 'patron notified when item set to waiting');
355 # test that duplicate notices aren't generated
356 ModReserveAffect($itemnumber, $requesters{'CPL'}, 0);
357 $new_count = count_hold_print_messages();
358 is($new_count, $hold_notice_count + 1, 'patron not notified a second time (bug 11445)');
360 # avoiding the not_same_branch error
361 t::lib::Mocks::mock_preference('IndependentBranches', 0);
363 DelItemCheck($dbh, $bibnum, $itemnumber),
365 'item that is captured to fill a hold cannot be deleted',
368 my $letter = ReserveSlip('CPL', $requesters{'CPL'}, $bibnum);
369 ok(defined($letter), 'can successfully generate hold slip (bug 10949)');
371 # Tests for bug 9788: Does GetReservesFromItemnumber return a future wait?
372 # 9788a: GetReservesFromItemnumber does not return future next available hold
373 $dbh->do("DELETE FROM reserves WHERE biblionumber=?",undef,($bibnum));
374 C4::Context->set_preference('ConfirmFutureHolds', 2);
375 C4::Context->set_preference('AllowHoldDateInFuture', 1);
376 $resdate= dt_from_string();
377 $resdate->add_duration(DateTime::Duration->new(days => 2));
378 $resdate=output_pref($resdate);
379 AddReserve('CPL', $requesters{'CPL'}, $bibnum,
380 $constraint, $bibitems, 1, $resdate, $expdate, $notes,
381 $title, $checkitem, $found);
382 my @results= GetReservesFromItemnumber($itemnumber);
383 is(defined $results[3]?1:0, 0, 'GetReservesFromItemnumber does not return a future next available hold');
384 # 9788b: GetReservesFromItemnumber does not return future item level hold
385 $dbh->do("DELETE FROM reserves WHERE biblionumber=?",undef,($bibnum));
386 AddReserve('CPL', $requesters{'CPL'}, $bibnum,
387 $constraint, $bibitems, 1, $resdate, $expdate, $notes,
388 $title, $itemnumber, $found); #item level hold
389 @results= GetReservesFromItemnumber($itemnumber);
390 is(defined $results[3]?1:0, 0, 'GetReservesFromItemnumber does not return a future item level hold');
391 # 9788c: GetReservesFromItemnumber returns future wait (confirmed future hold)
392 ModReserveAffect( $itemnumber, $requesters{'CPL'} , 0); #confirm hold
393 @results= GetReservesFromItemnumber($itemnumber);
394 is(defined $results[3]?1:0, 1, 'GetReservesFromItemnumber returns a future wait (confirmed future hold)');
395 # End of tests for bug 9788
397 # Tests for CalculatePriority (bug 8918)
398 my $p = C4::Reserves::CalculatePriority($bibnum2);
399 is($p, 4, 'CalculatePriority should now return priority 4');
401 AddReserve('CPL', $requesters{'CPL'}, $bibnum2,
402 $constraint, $bibitems, $p, $resdate, $expdate, $notes,
403 $title, $checkitem, $found);
404 $p = C4::Reserves::CalculatePriority($bibnum2);
405 is($p, 5, 'CalculatePriority should now return priority 5');
406 #some tests on bibnum
407 $dbh->do("DELETE FROM reserves WHERE biblionumber=?",undef,($bibnum));
408 $p = C4::Reserves::CalculatePriority($bibnum);
409 is($p, 1, 'CalculatePriority should now return priority 1');
410 #add a new reserve and confirm it to waiting
411 AddReserve('CPL', $requesters{'CPL'}, $bibnum,
412 $constraint, $bibitems, $p, $resdate, $expdate, $notes,
413 $title, $itemnumber, $found);
414 $p = C4::Reserves::CalculatePriority($bibnum);
415 is($p, 2, 'CalculatePriority should now return priority 2');
416 ModReserveAffect( $itemnumber, $requesters{'CPL'} , 0);
417 $p = C4::Reserves::CalculatePriority($bibnum);
418 is($p, 1, 'CalculatePriority should now return priority 1');
419 #add another biblio hold, no resdate
420 AddReserve('CPL', $requesters{'CPL'}, $bibnum,
421 $constraint, $bibitems, $p, $resdate, $expdate, $notes,
422 $title, $checkitem, $found);
423 $p = C4::Reserves::CalculatePriority($bibnum);
424 is($p, 2, 'CalculatePriority should now return priority 2');
425 #add another future hold
426 C4::Context->set_preference('AllowHoldDateInFuture', 1);
427 $resdate= dt_from_string();
428 $resdate->add_duration(DateTime::Duration->new(days => 1));
429 AddReserve('CPL', $requesters{'CPL'}, $bibnum,
430 $constraint, $bibitems, $p, output_pref($resdate), $expdate, $notes,
431 $title, $checkitem, $found);
432 $p = C4::Reserves::CalculatePriority($bibnum);
433 is($p, 2, 'CalculatePriority should now still return priority 2');
434 #calc priority with future resdate
435 $p = C4::Reserves::CalculatePriority($bibnum, $resdate);
436 is($p, 3, 'CalculatePriority should now return priority 3');
437 # End of tests for bug 8918
439 # Tests for cancel reserves by users from OPAC.
440 $dbh->do('DELETE FROM reserves', undef, ($bibnum));
441 AddReserve('CPL', $requesters{'CPL'}, $item_bibnum,
442 $constraint, $bibitems, 1, undef, $expdate, $notes,
443 $title, $checkitem, '');
444 my (undef, $canres, undef) = CheckReserves($itemnumber);
446 is( CanReserveBeCanceledFromOpac(), undef,
447 'CanReserveBeCanceledFromOpac should return undef if called without any parameter'
450 CanReserveBeCanceledFromOpac( $canres->{resserve_id} ),
452 'CanReserveBeCanceledFromOpac should return undef if called without the reserve_id'
455 CanReserveBeCanceledFromOpac( undef, $requesters{CPL} ),
457 'CanReserveBeCanceledFromOpac should return undef if called without borrowernumber'
460 my $cancancel = CanReserveBeCanceledFromOpac($canres->{reserve_id}, $requesters{'CPL'});
461 is($cancancel, 1, 'Can user cancel its own reserve');
463 $cancancel = CanReserveBeCanceledFromOpac($canres->{reserve_id}, $requesters{'FPL'});
464 is($cancancel, 0, 'Other user cant cancel reserve');
466 ModReserveAffect($itemnumber, $requesters{'CPL'}, 1);
467 $cancancel = CanReserveBeCanceledFromOpac($canres->{reserve_id}, $requesters{'CPL'});
468 is($cancancel, 0, 'Reserve in transfer status cant be canceled');
470 $dbh->do('DELETE FROM reserves', undef, ($bibnum));
471 AddReserve('CPL', $requesters{'CPL'}, $item_bibnum,
472 $constraint, $bibitems, 1, undef, $expdate, $notes,
473 $title, $checkitem, '');
474 (undef, $canres, undef) = CheckReserves($itemnumber);
476 ModReserveAffect($itemnumber, $requesters{'CPL'}, 0);
477 $cancancel = CanReserveBeCanceledFromOpac($canres->{reserve_id}, $requesters{'CPL'});
478 is($cancancel, 0, 'Reserve in waiting status cant be canceled');
480 # End of tests for bug 12876
483 ####### Testing Bug 13113 - Prevent juvenile/children from reserving ageRestricted material >>>
486 C4::Context->set_preference( 'AgeRestrictionMarker', 'FSK|PEGI|Age|K' );
488 #Reserving an not-agerestricted Biblio by a Borrower with no dateofbirth is tested previously.
490 #Set the ageRestriction for the Biblio
491 my $record = GetMarcBiblio( $bibnum );
492 my ( $ageres_tagid, $ageres_subfieldid ) = GetMarcFromKohaField( "biblioitems.agerestriction" );
493 $record->append_fields( MARC::Field->new($ageres_tagid, '', '', $ageres_subfieldid => 'PEGI 16') );
494 C4::Biblio::ModBiblio( $record, $bibnum, '' );
496 is( C4::Reserves::CanBookBeReserved($borrowernumber, $biblionumber) , 'OK', "Reserving an ageRestricted Biblio without a borrower dateofbirth succeeds" );
498 #Set the dateofbirth for the Borrower making him "too young".
499 my $now = DateTime->now();
500 C4::Members::SetAge( $borrower, '0015-00-00' );
501 C4::Members::ModMember( borrowernumber => $borrowernumber, dateofbirth => $borrower->{dateofbirth} );
503 is( C4::Reserves::CanBookBeReserved($borrowernumber, $biblionumber) , 'ageRestricted', "Reserving a 'PEGI 16' Biblio by a 15 year old borrower fails");
505 #Set the dateofbirth for the Borrower making him "too old".
506 C4::Members::SetAge( $borrower, '0030-00-00' );
507 C4::Members::ModMember( borrowernumber => $borrowernumber, dateofbirth => $borrower->{dateofbirth} );
509 is( C4::Reserves::CanBookBeReserved($borrowernumber, $biblionumber) , 'OK', "Reserving a 'PEGI 16' Biblio by a 30 year old borrower succeeds");
511 ####### EO Bug 13113 <<<
514 my $item = GetItem($itemnumber);
516 ok( C4::Reserves::IsAvailableForItemLevelRequest($item, $borrower), "Reserving a book on item level" );
518 my $itype = C4::Reserves::_get_itype($item);
519 my $categorycode = $borrower->{categorycode};
520 my $holdingbranch = $item->{holdingbranch};
521 my $rule = C4::Circulation::GetIssuingRule($categorycode, $itype, $holdingbranch);
524 "UPDATE issuingrules SET onshelfholds = 1 WHERE categorycode = ? AND itemtype= ? and branchcode = ?",
526 $rule->{categorycode}, $rule->{itemtype}, $rule->{branchcode}
528 ok( C4::Reserves::OnShelfHoldsAllowed($item, $borrower), "OnShelfHoldsAllowed() allowed" );
530 "UPDATE issuingrules SET onshelfholds = 0 WHERE categorycode = ? AND itemtype= ? and branchcode = ?",
532 $rule->{categorycode}, $rule->{itemtype}, $rule->{branchcode}
534 ok( !C4::Reserves::OnShelfHoldsAllowed($item, $borrower), "OnShelfHoldsAllowed() disallowed" );
538 sub count_hold_print_messages {
539 my $message_count = $dbh->selectall_arrayref(q{
542 WHERE letter_code = 'HOLD'
543 AND message_transport_type = 'print'
545 return $message_count->[0]->[0];