From 1d460fbf63c0b291f41f0d5595468fa252df81d1 Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Thu, 19 Nov 2015 12:29:19 +0000 Subject: [PATCH] Bug 15062 [QA Followup] - Unit Test --- t/db_dependent/HoldsQueue.t | 31 +++++++++++-------------------- 1 file changed, 11 insertions(+), 20 deletions(-) diff --git a/t/db_dependent/HoldsQueue.t b/t/db_dependent/HoldsQueue.t index 1c07fa5..de5d715 100755 --- a/t/db_dependent/HoldsQueue.t +++ b/t/db_dependent/HoldsQueue.t @@ -307,12 +307,11 @@ $holds_queue = $dbh->selectall_arrayref("SELECT * FROM tmp_holdsqueue", { Slice is( @$holds_queue, 3, "Holds queue filling correct number for holds for default holds policy 'from any library'" ); #warn "HOLDS QUEUE: " . Data::Dumper::Dumper( $holds_queue ); -# Bug 14297 +# Bug 15062 $itemtype = $item_types[0]->{itemtype}; -$borrowernumber = $borrower3->{borrowernumber}; +$borrowernumber = $borrower2->{borrowernumber}; my $library_A = $library1->{branchcode}; my $library_B = $library2->{branchcode}; -my $library_C = $borrower3->{branchcode}; $dbh->do("DELETE FROM reserves"); $dbh->do("DELETE FROM issues"); $dbh->do("DELETE FROM items"); @@ -326,6 +325,12 @@ $dbh->do("DELETE FROM default_branch_item_rules"); $dbh->do("DELETE FROM default_circ_rules"); $dbh->do("DELETE FROM branch_item_rules"); +C4::Context->set_preference("UseTransportCostMatrix",1); + +my $tc_rs = $schema->resultset('TransportCost'); +$tc_rs->create({ frombranch => $library_A, tobranch => $library_B, cost => 0, disable_transfer => 1 }); +$tc_rs->create({ frombranch => $library_B, tobranch => $library_A, cost => 0, disable_transfer => 1 }); + $dbh->do(" INSERT INTO biblio (frameworkcode, author, title, datecreated) VALUES ('', 'Koha test', '$TITLE', '2011-02-01') "); @@ -344,25 +349,11 @@ $dbh->do(" VALUES ($biblionumber, $biblioitemnumber, '$library_A', '$library_A', 0, 0, 0, 0, NULL, '$itemtype') "); -$dbh->do(" - INSERT INTO items (biblionumber, biblioitemnumber, homebranch, holdingbranch, notforloan, damaged, itemlost, withdrawn, onloan, itype) - VALUES ($biblionumber, $biblioitemnumber, '$library_B', '$library_B', 0, 0, 0, 0, NULL, '$itemtype') -"); - -$dbh->do(" - INSERT INTO branch_item_rules ( branchcode, itemtype, holdallowed, returnbranch ) VALUES - ( '$library_A', '$itemtype', 2, 'homebranch' ), ( '$library_B', '$itemtype', 1, 'homebranch' ); -"); - -$dbh->do( "UPDATE systempreferences SET value = ? WHERE variable = 'StaticHoldsQueueWeight'", - undef, join( ',', $library_B, $library_A, $library_C ) ); -$dbh->do( "UPDATE systempreferences SET value = 0 WHERE variable = 'RandomizeHoldsQueueWeight'" ); - -my $reserve_id = AddReserve ( $library_C, $borrowernumber, $biblionumber, '', 1 ); +my $reserve_id = AddReserve ( $library_B, $borrowernumber, $biblionumber, '', 1 ); C4::HoldsQueue::CreateQueue(); $holds_queue = $dbh->selectall_arrayref("SELECT * FROM tmp_holdsqueue", { Slice => {} }); -is( @$holds_queue, 1, "Bug 14297 - Holds Queue building ignoring holds where pickup & home branch don't match and item is not from le"); -# End Bug 14297 +is( @$holds_queue, 0, "Bug 15062 - Holds queue with Transport Cost Matrix will transfer item even if transfers disabled"); +# End Bug 15062 # Cleanup -- 1.7.10.4