From 5c12b57ca8d6a8d92fe6d6aa97f0d1cdd3f77bdf Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Fri, 9 Aug 2013 08:25:05 -0400 Subject: [PATCH] Bug 7720 - Ambiguity in OPAC Details location - QA Followup --- C4/Items.pm | 8 -------- Koha/Template/Plugin/Branches.pm | 10 ++++++++++ koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt | 11 ++++++----- 3 files changed, 16 insertions(+), 13 deletions(-) diff --git a/C4/Items.pm b/C4/Items.pm index e6ce0eb..218205e 100644 --- a/C4/Items.pm +++ b/C4/Items.pm @@ -1275,14 +1275,6 @@ sub GetItemsInfo { if ( my $bdata = $bsth->fetchrow_hashref ) { $data->{'branchname'} = $bdata->{'branchname'}; } - $bsth = $dbh->prepare( - "SELECT * FROM branches WHERE branchcode = ? - " - ); - $bsth->execute( $data->{'homebranch'} ); - if ( my $bdata = $bsth->fetchrow_hashref ) { - $data->{'homebranchname'} = $bdata->{'branchname'}; - } $data->{'datedue'} = $datedue; # get notforloan complete status if applicable diff --git a/Koha/Template/Plugin/Branches.pm b/Koha/Template/Plugin/Branches.pm index e9ff105..248ba95 100644 --- a/Koha/Template/Plugin/Branches.pm +++ b/Koha/Template/Plugin/Branches.pm @@ -35,4 +35,14 @@ sub GetName { return encode( 'UTF-8', $b->{'branchname'} ); } +sub GetURL { + my ( $self, $branchcode ) = @_; + + my $query = "SELECT branchurl FROM branches WHERE branchcode = ?"; + my $sth = C4::Context->dbh->prepare($query); + $sth->execute($branchcode); + my $b = $sth->fetchrow_hashref(); + return encode( 'UTF-8', $b->{'branchurl'} ); +} + 1; diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt b/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt index 9465fae..db882e0 100644 --- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt +++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt @@ -1,5 +1,6 @@ [% USE Koha %] [% USE KohaDates %] +[% USE Branches %] [% USE AuthorisedValues %] [% SET TagsShowEnabled = ( TagsEnabled && TagsShowOnDetail ) %] [% SET TagsInputEnabled = ( opacuserlogin && TagsEnabled && TagsInputOnDetail ) %] @@ -1476,11 +1477,11 @@ YAHOO.util.Event.onContentReady("furtherm", function () { [% IF ( item_level_itypes ) %]Item type[% END %] [% IF ( OpacLocationBranchToDisplay == 'holding' || OpacLocationBranchToDisplay == 'both' || singleBranchMode ) %] - Current Location + Current location [% END %] [% UNLESS ( singleBranchMode ) %] [% IF ( OpacLocationBranchToDisplay == 'home' || OpacLocationBranchToDisplay == 'both' ) %] - Home Library + Home library [% END %] [% END %] [% IF ( itemdata_ccode ) %]Collection[% END %] @@ -1524,10 +1525,10 @@ YAHOO.util.Event.onContentReady("furtherm", function () { [% IF ( OpacLocationBranchToDisplay == 'home' || OpacLocationBranchToDisplay == 'both' ) %] - [% IF ( ITEM_RESULT.homebranchurl ) %] - [% ITEM_RESULT.homebranchname %] + [% IF ( Branches.GetURL( ITEM_RESULT.homebranch ) ) %] + [% Branches.GetName( ITEM_RESULT.homebranch ) %] [% ELSE %] - [% ITEM_RESULT.homebranchname %] + [% Branches.GetName( ITEM_RESULT.homebranch ) %] [% END %] -- 1.7.2.5