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

(-)a/t/db_dependent/HoldsQueue.t (-2 / +48 lines)
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 => 22;
15
use Test::More tests => 23;
16
16
17
use C4::Branch;
17
use C4::Branch;
18
use C4::ItemType;
18
use C4::ItemType;
Lines 364-369 $holds_queue = $dbh->selectall_arrayref("SELECT * FROM tmp_holdsqueue", { Slice Link Here
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");
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");
365
# End Bug 14297
365
# End Bug 14297
366
366
367
# Bug 15062
368
$itemtype = $item_types[0]->{itemtype};
369
$borrowernumber = $borrower2->{borrowernumber};
370
$library_A = $library1->{branchcode};
371
$library_B = $library2->{branchcode};
372
$dbh->do("DELETE FROM reserves");
373
$dbh->do("DELETE FROM issues");
374
$dbh->do("DELETE FROM items");
375
$dbh->do("DELETE FROM biblio");
376
$dbh->do("DELETE FROM biblioitems");
377
$dbh->do("DELETE FROM transport_cost");
378
$dbh->do("DELETE FROM tmp_holdsqueue");
379
$dbh->do("DELETE FROM hold_fill_targets");
380
$dbh->do("DELETE FROM default_branch_circ_rules");
381
$dbh->do("DELETE FROM default_branch_item_rules");
382
$dbh->do("DELETE FROM default_circ_rules");
383
$dbh->do("DELETE FROM branch_item_rules");
384
385
C4::Context->set_preference("UseTransportCostMatrix",1);
386
387
my $tc_rs = $schema->resultset('TransportCost');
388
$tc_rs->create({ frombranch => $library_A, tobranch => $library_B, cost => 0, disable_transfer => 1 });
389
$tc_rs->create({ frombranch => $library_B, tobranch => $library_A, cost => 0, disable_transfer => 1 });
390
391
$dbh->do("
392
    INSERT INTO biblio (frameworkcode, author, title, datecreated) VALUES ('', 'Koha test', '$TITLE', '2011-02-01')
393
");
394
395
$biblionumber = $dbh->selectrow_array("SELECT biblionumber FROM biblio WHERE title = '$TITLE'")
396
  or BAIL_OUT("Cannot find newly created biblio record");
397
398
$dbh->do("INSERT INTO biblioitems (biblionumber, marcxml, itemtype) VALUES ($biblionumber, '', '$itemtype')");
399
400
$biblioitemnumber =
401
  $dbh->selectrow_array("SELECT biblioitemnumber FROM biblioitems WHERE biblionumber = $biblionumber")
402
  or BAIL_OUT("Cannot find newly created biblioitems record");
403
404
$dbh->do("
405
    INSERT INTO items (biblionumber, biblioitemnumber, homebranch, holdingbranch, notforloan, damaged, itemlost, withdrawn, onloan, itype)
406
    VALUES ($biblionumber, $biblioitemnumber, '$library_A', '$library_A', 0, 0, 0, 0, NULL, '$itemtype')
407
");
408
409
$reserve_id = AddReserve ( $library_B, $borrowernumber, $biblionumber, '', 1 );
410
C4::HoldsQueue::CreateQueue();
411
$holds_queue = $dbh->selectall_arrayref("SELECT * FROM tmp_holdsqueue", { Slice => {} });
412
is( @$holds_queue, 0, "Bug 15062 - Holds queue with Transport Cost Matrix will transfer item even if transfers disabled");
413
# End Bug 15062
367
414
368
# Cleanup
415
# Cleanup
369
$schema->storage->txn_rollback;
416
$schema->storage->txn_rollback;
370
- 

Return to bug 15062