From 025854d6d499a169df6d4b4138cbfaa75d90eb6f Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Mon, 12 May 2014 06:58:34 -0400 Subject: [PATCH] Bug 7720: (follow-up) fix various issues [1] Fix capitalization [2] Move logic for getting the home library name URL to the Branches TT plugin Signed-off-by: Marcel de Rooy Signed-off-by: Galen Charlton --- 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 a252ba1e64..8573a51309 100644 --- a/C4/Items.pm +++ b/C4/Items.pm @@ -1323,14 +1323,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 ddf5f2f447..ff43a38494 100644 --- a/Koha/Template/Plugin/Branches.pm +++ b/Koha/Template/Plugin/Branches.pm @@ -44,4 +44,14 @@ sub GetLoggedInBranchcode { ''; } +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 2e3f1ad352..baaec0bc1f 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 ) %] @@ -1505,11 +1506,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 %] @@ -1562,10 +1563,10 @@ YAHOO.util.Event.onContentReady("furtherm", function () { - [% 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 %] -- 2.39.5