@@ -, +, @@ --- 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(-) --- a/C4/Items.pm +++ a/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 --- a/Koha/Template/Plugin/Branches.pm +++ a/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; --- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt +++ a/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 %] --