From 894dd5016161e618ffbd5d67f898b1c942789c08 Mon Sep 17 00:00:00 2001
From: Agustin Moyano <agustinmoyano@theke.io>
Date: Tue, 23 Apr 2019 16:18:59 -0300
Subject: [PATCH] Bug 22284: (follow-up) Remove commented warn and address test
 failures

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
---
 Koha/Item.pm              |  2 --
 t/db_dependent/Holds.t    | 10 ++++++++++
 t/db_dependent/Reserves.t | 24 ++++++++++++------------
 3 files changed, 22 insertions(+), 14 deletions(-)

diff --git a/Koha/Item.pm b/Koha/Item.pm
index 09bfe8a0a8..5728c9fe16 100644
--- a/Koha/Item.pm
+++ b/Koha/Item.pm
@@ -302,8 +302,6 @@ sub pickup_locations {
     my $branch_control = C4::Context->preference('HomeOrHoldingBranch');
     my $library = $branch_control eq 'holdingbranch' ? $self->holding_branch : $self->home_branch;
 
-    #warn $branch_control.' '.$branchitemrule->{holdallowed}.' '.$library->branchcode.' '.$patron->branchcode;
-
     my @libs;
     if(defined $patron) {
         return @libs if $branchitemrule->{holdallowed} == 3 && !$library->validate_hold_sibling( {branchcode => $patron->branchcode} );
diff --git a/t/db_dependent/Holds.t b/t/db_dependent/Holds.t
index 2d17abaf5c..f83a9872db 100755
--- a/t/db_dependent/Holds.t
+++ b/t/db_dependent/Holds.t
@@ -243,7 +243,12 @@ is( $hold->priority, '6', "Test AlterPriority(), move to bottom" );
 my $foreign_biblio = $builder->build_sample_biblio({ itemtype => 'DUMMY' });
 my ($foreign_item_bibnum, $foreign_item_bibitemnum, $foreign_itemnumber)
   = AddItem({ homebranch => $branch_2, holdingbranch => $branch_2 } , $foreign_biblio->biblionumber);
+# Cleanup circulation rules
 $dbh->do('DELETE FROM issuingrules');
+$dbh->do('DELETE FROM branch_item_rules');
+$dbh->do('DELETE FROM default_branch_item_rules');
+$dbh->do('DELETE FROM default_branch_circ_rules');
+$dbh->do('DELETE FROM default_circ_rules');
 $dbh->do(
     q{INSERT INTO issuingrules (categorycode, branchcode, itemtype, reservesallowed, holds_per_record)
       VALUES (?, ?, ?, ?, ?)},
@@ -553,6 +558,11 @@ subtest 'CanItemBeReserved / holds_per_day tests' => sub {
 
     Koha::Holds->search->delete;
     $dbh->do('DELETE FROM issues');
+    $dbh->do('DELETE FROM issuingrules');
+    $dbh->do('DELETE FROM branch_item_rules');
+    $dbh->do('DELETE FROM default_branch_item_rules');
+    $dbh->do('DELETE FROM default_branch_circ_rules');
+    $dbh->do('DELETE FROM default_circ_rules');
     Koha::Items->search->delete;
     Koha::Biblios->search->delete;
 
diff --git a/t/db_dependent/Reserves.t b/t/db_dependent/Reserves.t
index 27b2701ab6..52c8928119 100755
--- a/t/db_dependent/Reserves.t
+++ b/t/db_dependent/Reserves.t
@@ -55,6 +55,18 @@ my $builder = t::lib::TestBuilder->new;
 
 my $frameworkcode = q//;
 
+# Cleanup circulation rules
+$dbh->do('DELETE FROM issuingrules');
+$dbh->do('DELETE FROM branch_item_rules');
+$dbh->do('DELETE FROM default_branch_item_rules');
+$dbh->do('DELETE FROM default_branch_circ_rules');
+$dbh->do('DELETE FROM default_circ_rules');
+$dbh->do(
+    q{INSERT INTO issuingrules (categorycode, branchcode, itemtype, reservesallowed)
+      VALUES (?, ?, ?, ?)},
+    {},
+    '*', '*', '*', 25
+);
 
 t::lib::Mocks::mock_preference('ReservesNeedReturns', 1);
 
@@ -187,18 +199,6 @@ $requesters{$branch_3} = Koha::Patron->new({
 # to request its items, while $branch_2 will allow its items
 # to fill holds from anywhere.
 
-$dbh->do('DELETE FROM issuingrules');
-$dbh->do('DELETE FROM branch_item_rules');
-$dbh->do('DELETE FROM default_branch_item_rules');
-$dbh->do('DELETE FROM default_branch_circ_rules');
-$dbh->do('DELETE FROM default_circ_rules');
-$dbh->do(
-    q{INSERT INTO issuingrules (categorycode, branchcode, itemtype, reservesallowed)
-      VALUES (?, ?, ?, ?)},
-    {},
-    '*', '*', '*', 25
-);
-
 # CPL allows only its own patrons to request its items
 $dbh->do(
     q{INSERT INTO default_branch_circ_rules (branchcode, holdallowed, returnbranch)
-- 
2.11.0