|
Lines 12-18
use C4::Context;
Link Here
|
| 12 |
|
12 |
|
| 13 |
use Data::Dumper; |
13 |
use Data::Dumper; |
| 14 |
|
14 |
|
| 15 |
use Test::More tests => 21; |
15 |
use Test::More tests => 22; |
| 16 |
|
16 |
|
| 17 |
|
17 |
|
| 18 |
use C4::Branch; |
18 |
use C4::Branch; |
|
Lines 297-302
$holds_queue = $dbh->selectall_arrayref("SELECT * FROM tmp_holdsqueue", { Slice
Link Here
|
| 297 |
ok( @$holds_queue == 3, "Holds queue filling correct number for holds for default holds policy 'from any library'" ); |
297 |
ok( @$holds_queue == 3, "Holds queue filling correct number for holds for default holds policy 'from any library'" ); |
| 298 |
#warn "HOLDS QUEUE: " . Data::Dumper::Dumper( $holds_queue ); |
298 |
#warn "HOLDS QUEUE: " . Data::Dumper::Dumper( $holds_queue ); |
| 299 |
|
299 |
|
|
|
300 |
# Bug 14297 |
| 301 |
$borrowernumber = AddMember(%data); |
| 302 |
$borrower = GetMember( borrowernumber => $borrowernumber ); |
| 303 |
$borrower_branchcode = $borrower->{branchcode}; |
| 304 |
$itemtype = $item_types[0]->{itemtype}; |
| 305 |
my $library_A = 'CPL'; |
| 306 |
my $library_B = 'FFL'; |
| 307 |
my $library_C = 'MPL'; # Same as our borrower's home library |
| 308 |
$dbh->do("DELETE FROM reserves"); |
| 309 |
$dbh->do("DELETE FROM issues"); |
| 310 |
$dbh->do("DELETE FROM items"); |
| 311 |
$dbh->do("DELETE FROM biblio"); |
| 312 |
$dbh->do("DELETE FROM biblioitems"); |
| 313 |
$dbh->do("DELETE FROM transport_cost"); |
| 314 |
$dbh->do("DELETE FROM tmp_holdsqueue"); |
| 315 |
$dbh->do("DELETE FROM hold_fill_targets"); |
| 316 |
$dbh->do("DELETE FROM default_branch_circ_rules"); |
| 317 |
$dbh->do("DELETE FROM default_branch_item_rules"); |
| 318 |
$dbh->do("DELETE FROM default_circ_rules"); |
| 319 |
$dbh->do("DELETE FROM branch_item_rules"); |
| 320 |
|
| 321 |
$dbh->do(" |
| 322 |
INSERT INTO biblio (frameworkcode, author, title, datecreated) VALUES ('', 'Koha test', '$TITLE', '2011-02-01') |
| 323 |
"); |
| 324 |
|
| 325 |
$biblionumber = $dbh->selectrow_array("SELECT biblionumber FROM biblio WHERE title = '$TITLE'") |
| 326 |
or BAIL_OUT("Cannot find newly created biblio record"); |
| 327 |
|
| 328 |
$dbh->do("INSERT INTO biblioitems (biblionumber, marcxml, itemtype) VALUES ($biblionumber, '', '$itemtype')"); |
| 329 |
|
| 330 |
$biblioitemnumber = |
| 331 |
$dbh->selectrow_array("SELECT biblioitemnumber FROM biblioitems WHERE biblionumber = $biblionumber") |
| 332 |
or BAIL_OUT("Cannot find newly created biblioitems record"); |
| 333 |
|
| 334 |
$dbh->do(" |
| 335 |
INSERT INTO items (biblionumber, biblioitemnumber, homebranch, holdingbranch, notforloan, damaged, itemlost, withdrawn, onloan, itype) |
| 336 |
VALUES ($biblionumber, $biblioitemnumber, '$library_A', '$library_A', 0, 0, 0, 0, NULL, '$itemtype') |
| 337 |
"); |
| 338 |
|
| 339 |
$dbh->do(" |
| 340 |
INSERT INTO items (biblionumber, biblioitemnumber, homebranch, holdingbranch, notforloan, damaged, itemlost, withdrawn, onloan, itype) |
| 341 |
VALUES ($biblionumber, $biblioitemnumber, '$library_B', '$library_B', 0, 0, 0, 0, NULL, '$itemtype') |
| 342 |
"); |
| 343 |
|
| 344 |
$dbh->do(" |
| 345 |
INSERT INTO branch_item_rules ( branchcode, itemtype, holdallowed, returnbranch ) VALUES |
| 346 |
( '$library_A', '$itemtype', 2, 'homebranch' ), ( '$library_B', '$itemtype', 1, 'homebranch' ); |
| 347 |
"); |
| 348 |
|
| 349 |
$dbh->do( "UPDATE systempreferences SET value = ? WHERE variable = 'StaticHoldsQueueWeight'", |
| 350 |
undef, join( ',', $library_B, $library_A, $library_C ) ); |
| 351 |
$dbh->do( "UPDATE systempreferences SET value = 0 WHERE variable = 'RandomizeHoldsQueueWeight'" ); |
| 352 |
|
| 353 |
my $reserve_id = AddReserve ( $library_C, $borrowernumber, $biblionumber, '', 1 ); |
| 354 |
C4::HoldsQueue::CreateQueue(); |
| 355 |
$holds_queue = $dbh->selectall_arrayref("SELECT * FROM tmp_holdsqueue", { Slice => {} }); |
| 356 |
is( @$holds_queue, 1, "Bug 14297 - Holds Queue building ignoring holds where pickup & home branch don't match and item is not from least cost branch" ); |
| 357 |
# End Bug 14297 |
| 358 |
|
| 300 |
# Cleanup |
359 |
# Cleanup |
| 301 |
$dbh->rollback; |
360 |
$dbh->rollback; |
| 302 |
|
361 |
|
| 303 |
- |
|
|