View | Details | Raw Unified | Return to bug 15062
Collapse All | Expand All

(-)a/t/db_dependent/HoldsQueue.t (-21 / +11 lines)
Lines 307-318 $holds_queue = $dbh->selectall_arrayref("SELECT * FROM tmp_holdsqueue", { Slice Link Here
307
is( @$holds_queue, 3, "Holds queue filling correct number for holds for default holds policy 'from any library'" );
307
is( @$holds_queue, 3, "Holds queue filling correct number for holds for default holds policy 'from any library'" );
308
#warn "HOLDS QUEUE: " . Data::Dumper::Dumper( $holds_queue );
308
#warn "HOLDS QUEUE: " . Data::Dumper::Dumper( $holds_queue );
309
309
310
# Bug 14297
310
# Bug 15062
311
$itemtype = $item_types[0]->{itemtype};
311
$itemtype = $item_types[0]->{itemtype};
312
$borrowernumber = $borrower3->{borrowernumber};
312
$borrowernumber = $borrower2->{borrowernumber};
313
my $library_A = $library1->{branchcode};
313
my $library_A = $library1->{branchcode};
314
my $library_B = $library2->{branchcode};
314
my $library_B = $library2->{branchcode};
315
my $library_C = $borrower3->{branchcode};
316
$dbh->do("DELETE FROM reserves");
315
$dbh->do("DELETE FROM reserves");
317
$dbh->do("DELETE FROM issues");
316
$dbh->do("DELETE FROM issues");
318
$dbh->do("DELETE FROM items");
317
$dbh->do("DELETE FROM items");
Lines 326-331 $dbh->do("DELETE FROM default_branch_item_rules"); Link Here
326
$dbh->do("DELETE FROM default_circ_rules");
325
$dbh->do("DELETE FROM default_circ_rules");
327
$dbh->do("DELETE FROM branch_item_rules");
326
$dbh->do("DELETE FROM branch_item_rules");
328
327
328
C4::Context->set_preference("UseTransportCostMatrix",1);
329
330
my $tc_rs = $schema->resultset('TransportCost');
331
$tc_rs->create({ frombranch => $library_A, tobranch => $library_B, cost => 0, disable_transfer => 1 });
332
$tc_rs->create({ frombranch => $library_B, tobranch => $library_A, cost => 0, disable_transfer => 1 });
333
329
$dbh->do("
334
$dbh->do("
330
    INSERT INTO biblio (frameworkcode, author, title, datecreated) VALUES ('', 'Koha test', '$TITLE', '2011-02-01')
335
    INSERT INTO biblio (frameworkcode, author, title, datecreated) VALUES ('', 'Koha test', '$TITLE', '2011-02-01')
331
");
336
");
Lines 344-368 $dbh->do(" Link Here
344
    VALUES ($biblionumber, $biblioitemnumber, '$library_A', '$library_A', 0, 0, 0, 0, NULL, '$itemtype')
349
    VALUES ($biblionumber, $biblioitemnumber, '$library_A', '$library_A', 0, 0, 0, 0, NULL, '$itemtype')
345
");
350
");
346
351
347
$dbh->do("
352
my $reserve_id = AddReserve ( $library_B, $borrowernumber, $biblionumber, '', 1 );
348
    INSERT INTO items (biblionumber, biblioitemnumber, homebranch, holdingbranch, notforloan, damaged, itemlost, withdrawn, onloan, itype)
349
    VALUES ($biblionumber, $biblioitemnumber, '$library_B', '$library_B', 0, 0, 0, 0, NULL, '$itemtype')
350
");
351
352
$dbh->do("
353
    INSERT INTO branch_item_rules ( branchcode, itemtype, holdallowed, returnbranch ) VALUES
354
    ( '$library_A', '$itemtype', 2, 'homebranch' ), ( '$library_B', '$itemtype', 1, 'homebranch' );
355
");
356
357
$dbh->do( "UPDATE systempreferences SET value = ? WHERE variable = 'StaticHoldsQueueWeight'",
358
    undef, join( ',', $library_B, $library_A, $library_C ) );
359
$dbh->do( "UPDATE systempreferences SET value = 0 WHERE variable = 'RandomizeHoldsQueueWeight'" );
360
361
my $reserve_id = AddReserve ( $library_C, $borrowernumber, $biblionumber, '', 1 );
362
C4::HoldsQueue::CreateQueue();
353
C4::HoldsQueue::CreateQueue();
363
$holds_queue = $dbh->selectall_arrayref("SELECT * FROM tmp_holdsqueue", { Slice => {} });
354
$holds_queue = $dbh->selectall_arrayref("SELECT * FROM tmp_holdsqueue", { Slice => {} });
364
is( @$holds_queue, 1, "Bug 14297 - Holds Queue building ignoring holds where pickup & home branch don't match and item is not from le");
355
is( @$holds_queue, 0, "Bug 15062 - Holds queue with Transport Cost Matrix will transfer item even if transfers disabled");
365
# End Bug 14297
356
# End Bug 15062
366
357
367
358
368
# Cleanup
359
# Cleanup
369
- 

Return to bug 15062