From 73ef51958f303e009bab3a2156855df557efc9cf Mon Sep 17 00:00:00 2001 From: tipaul Date: Thu, 27 Oct 2005 12:05:58 +0000 Subject: [PATCH] road to normalization : changing API = removing getbranchname, replaced by getbranchdetail (should be getbranch, but this sub already exists and I don't understand what it does...) --- C4/Koha.pm | 13 +++++++------ ISBDdetail.pl | 2 +- MARCdetail.pl | 2 +- opac/opac-ISBDdetail.pl | 2 +- opac/opac-MARCdetail.pl | 2 +- 5 files changed, 11 insertions(+), 10 deletions(-) diff --git a/C4/Koha.pm b/C4/Koha.pm index 9da807075c..8864435fea 100644 --- a/C4/Koha.pm +++ b/C4/Koha.pm @@ -55,7 +55,7 @@ Koha.pm provides many functions for Koha scripts. &borrowercategories &getborrowercategory ðnicitycategories &subfield_is_koha_internal_p - &getbranches &getbranch &getbranchname + &getbranches &getbranch &getbranchdetail &getprinters &getprinter &getitemtypes &getitemtypeinfo &getframeworks &getframeworkinfo @@ -468,26 +468,27 @@ sub getbranch ($$) { return $branch; } -=item getbranchname +=item getbranchdetail - $branchname = &getbranchname($branchcode); + $branchname = &getbranchdetail($branchcode); Given the branch code, the function returns the corresponding branch name for a comprehensive information display =cut -sub getbranchname +sub getbranchdetail { my ($branchcode) = @_; my $dbh = C4::Context->dbh; - my $sth = $dbh->prepare("SELECT branchname FROM branches WHERE branchcode = ?"); + my $sth = $dbh->prepare("SELECT * FROM branches WHERE branchcode = ?"); $sth->execute($branchcode); - my $branchname = $sth->fetchrow(); + my $branchname = $sth->fetchrow_hashref(); $sth->finish(); return $branchname; } # sub getbranchname + sub getprinter ($$) { my($query, $printers) = @_; # get printer for this query from printers my $printer = $query->param('printer'); diff --git a/ISBDdetail.pl b/ISBDdetail.pl index 473713ba2d..f51de6272d 100755 --- a/ISBDdetail.pl +++ b/ISBDdetail.pl @@ -132,7 +132,7 @@ sub get_authorised_value_desc ($$$$$) { #---- branch if ($tagslib->{$tag}->{$subfield}->{'authorised_value'} eq "branches" ) { - return getbranchname($value); + return getbranchdetail($value)->{branchname}; } #---- itemtypes diff --git a/MARCdetail.pl b/MARCdetail.pl index 5777ed63fa..25a24cdde5 100755 --- a/MARCdetail.pl +++ b/MARCdetail.pl @@ -235,7 +235,7 @@ sub get_authorised_value_desc ($$$$$) { #---- branch if ($tagslib->{$tag}->{$subfield}->{'authorised_value'} eq "branches" ) { - return getbranchname($value); + return getbranchdetail($value)->{branchname}; } #---- itemtypes diff --git a/opac/opac-ISBDdetail.pl b/opac/opac-ISBDdetail.pl index 51f84b5c9a..e10ec4d30b 100755 --- a/opac/opac-ISBDdetail.pl +++ b/opac/opac-ISBDdetail.pl @@ -148,7 +148,7 @@ sub get_authorised_value_desc ($$$$$) { #---- branch if ($tagslib->{$tag}->{$subfield}->{'authorised_value'} eq "branches" ) { - return getbranchname($value); + return getbranchdetail($value)->{branchname}; } #---- itemtypes diff --git a/opac/opac-MARCdetail.pl b/opac/opac-MARCdetail.pl index 49c1baf503..f7e0e47e1f 100755 --- a/opac/opac-MARCdetail.pl +++ b/opac/opac-MARCdetail.pl @@ -206,7 +206,7 @@ sub get_authorised_value_desc ($$$$$) { #---- branch if ($tagslib->{$tag}->{$subfield}->{'authorised_value'} eq "branches" ) { - return getbranchname($value); + return getbranchdetail($value)->{branchname}; } #---- itemtypes -- 2.39.5