From fa3a21d18897f341aae7f7c8623ca738b6da3c00 Mon Sep 17 00:00:00 2001 From: Paul Poulain Date: Fri, 16 Sep 2011 18:09:57 +0200 Subject: [PATCH] Bug 7034: de-nesting C4/Branch.pm 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 --- C4/Branch.pm | 29 ----------------------------- reserve/request.pl | 2 +- t/db_dependent/lib/KohaTest/Branch.pm | 1 - 3 files changed, 1 insertions(+), 31 deletions(-) diff --git a/C4/Branch.pm b/C4/Branch.pm index abcdbd6..7bd0326 100644 --- a/C4/Branch.pm +++ b/C4/Branch.pm @@ -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); diff --git a/reserve/request.pl b/reserve/request.pl index 06fd8a2..5d59e2f 100755 --- a/reserve/request.pl +++ b/reserve/request.pl @@ -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/; diff --git a/t/db_dependent/lib/KohaTest/Branch.pm b/t/db_dependent/lib/KohaTest/Branch.pm index ce7ff60..c526d99 100644 --- a/t/db_dependent/lib/KohaTest/Branch.pm +++ b/t/db_dependent/lib/KohaTest/Branch.pm @@ -20,7 +20,6 @@ sub methods : Test( 1 ) { GetCategoryTypes GetBranch GetBranchDetail - get_branchinfos_of GetBranchesInCategory GetBranchInfo DelBranch -- 1.7.4.1