Bug 15629: Koha::Libraries - Remove GetBranchesInCategory (3)
authorJonathan Druart <jonathan.druart@bugs.koha-community.org>
Wed, 20 Jan 2016 11:22:19 +0000 (11:22 +0000)
committerBrendan Gallagher <brendan@bywatersolutions.com>
Wed, 24 Feb 2016 03:55:06 +0000 (03:55 +0000)
C4::Branch::GetBranchesInCategory is not used anymore and can be
removed.

Test plan:
  git grep GetBranchesInCategory
should not return any result.

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Brendan Gallagher brendan@bywatersolutions.com
C4/Branch.pm
t/db_dependent/Branch.t

index ae2216a..057a043 100644 (file)
@@ -36,7 +36,6 @@ BEGIN {
                &GetBranchDetail
                &ModBranch
                &GetBranchInfo
-               &GetBranchesInCategory
                &mybranch
        );
     @EXPORT_OK = qw( &onlymine &mybranch );
@@ -310,27 +309,6 @@ sub GetBranchDetail {
     return $sth->fetchrow_hashref();
 }
 
-=head2 GetBranchesInCategory
-
-  my $branches = GetBranchesInCategory($categorycode);
-
-Returns a href:  keys %$branches eq (branchcode,branchname) .
-
-=cut
-
-sub GetBranchesInCategory {
-    my ($categorycode) = @_;
-       my @branches;
-       my $dbh = C4::Context->dbh();
-       my $sth=$dbh->prepare( "SELECT b.branchcode FROM branchrelations r, branches b 
-                                                       where r.branchcode=b.branchcode and r.categorycode=?");
-    $sth->execute($categorycode);
-       while (my $branch = $sth->fetchrow) {
-               push @branches, $branch;
-       }
-       return( \@branches );
-}
-
 =head2 GetBranchInfo
 
 $results = GetBranchInfo($branchcode);
index 7c7ed75..72a59d4 100644 (file)
@@ -21,7 +21,7 @@ use Modern::Perl;
 use C4::Context;
 use Data::Dumper;
 
-use Test::More tests => 23;
+use Test::More tests => 21;
 
 use C4::Branch;
 use Koha::Libraries;
@@ -41,7 +41,6 @@ can_ok(
       GetBranchDetail
       ModBranch
       GetBranchInfo
-      GetBranchesInCategory
       mybranch
       )
 );
@@ -249,38 +248,6 @@ $b2->{issuing}    = undef;
 $b2->{categories} = \@cat;
 is_deeply( @$b2info[0], $b2, 'BRB has the category CAT1 and CAT2' );
 
-#Test GetBranchesInCategory
-my $brCat1 = GetBranchesInCategory( $cat1->{categorycode} );
-my @b      = ( $b2->{branchcode} );
-is_deeply( $brCat1, \@b, 'CAT1 has branch BRB' );
-
-my $b3 = {
-    add            => 1,
-    branchcode     => 'BRC',
-    branchname     => 'BranchC',
-    branchaddress1 => 'adr1C',
-    branchaddress2 => 'adr2C',
-    branchaddress3 => 'adr3C',
-    branchzip      => 'zipC',
-    branchcity     => 'cityC',
-    branchstate    => 'stateC',
-    branchcountry  => 'countryC',
-    branchphone    => 'phoneC',
-    branchfax      => 'faxC',
-    branchemail    => 'emailC',
-    branchurl      => 'urlC',
-    branchip       => 'ipC',
-    branchprinter  => undef,
-    branchnotes    => 'noteC',
-    opac_info      => 'opacC',
-    CAT1           => 1,
-    CAT2           => 1
-};
-ModBranch($b3);
-$brCat1 = GetBranchesInCategory( $cat1->{categorycode} );
-push( @b, $b3->{branchcode} );
-is_deeply( $brCat1, \@b, 'CAT1 has branch BRB and BRC' );
-
 #TODO later: test mybranchine and onlymine
 # Actually we cannot mock C4::Context->userenv in unit tests