Bug 7034: de-nesting C4/Branch.pm
authorPaul Poulain <paul.poulain@biblibre.com>
Fri, 16 Sep 2011 16:09:57 +0000 (18:09 +0200)
committerChris Cormack <chrisc@catalyst.net.nz>
Tue, 18 Oct 2011 14:23:31 +0000 (03:23 +1300)
use C4::Koha was loaded only to call C4::Koha::get_infos_of in get_branchinfos_of

the sub get_branchinfos_of was used nowhere
(checked with "grep -R get_branchinfos_of *")
only one reference was made to get_branchinfos_of, in reserve/request.pl, but the sub was not used in fact (maybe removed previously & silently)

This patch removes sub get_branchinfos_of and use C4::Koha in C4::Branch, as well as the reference in request.pl and the t test

The patch doesn't remove use C4::Branch in reserve/request.pl, as it's still used for other subroutines.

Signed-off-by: Ian Walls <ian.walls@bywatersolutions.com>
Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
C4/Branch.pm
reserve/request.pl
t/db_dependent/lib/KohaTest/Branch.pm

index abcdbd6..7bd0326 100644 (file)
@@ -20,7 +20,6 @@ use strict;
 #use warnings; FIXME - Bug 2505
 require Exporter;
 use C4::Context;
-use C4::Koha;
 
 use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS);
 
@@ -408,34 +407,6 @@ sub GetBranchDetail {
     return $sth->fetchrow_hashref();
 }
 
-=head2 get_branchinfos_of
-
-  my $branchinfos_of = get_branchinfos_of(@branchcodes);
-
-Associates a list of branchcodes to the information of the branch, taken in
-branches table.
-
-Returns a href where keys are branchcodes and values are href where keys are
-branch information key.
-
-  print 'branchname is ', $branchinfos_of->{$code}->{branchname};
-
-=cut
-
-sub get_branchinfos_of {
-    my @branchcodes = @_;
-
-    my $query = '
-    SELECT branchcode,
-       branchname
-    FROM branches
-    WHERE branchcode IN ('
-      . join( ',', map( { "'" . $_ . "'" } @branchcodes ) ) . ')
-';
-    return C4::Koha::get_infos_of( $query, 'branchcode' );
-}
-
-
 =head2 GetBranchesInCategory
 
   my $branches = GetBranchesInCategory($categorycode);
index 06fd8a2..5d59e2f 100755 (executable)
@@ -28,7 +28,7 @@ script to place reserves/requests
 
 use strict;
 use warnings;
-use C4::Branch; # GetBranches get_branchinfos_of
+use C4::Branch;
 use CGI;
 use List::MoreUtils qw/uniq/;
 use Date::Calc qw/Date_to_Days/;
index ce7ff60..c526d99 100644 (file)
@@ -20,7 +20,6 @@ sub methods : Test( 1 ) {
                       GetCategoryTypes
                       GetBranch
                       GetBranchDetail
-                      get_branchinfos_of
                       GetBranchesInCategory
                       GetBranchInfo
                       DelBranch