Bug 7720: (follow-up) fix various issues
authorKyle M Hall <kyle@bywatersolutions.com>
Mon, 12 May 2014 10:58:34 +0000 (06:58 -0400)
committerGalen Charlton <gmc@esilibrary.com>
Mon, 26 May 2014 02:17:17 +0000 (02:17 +0000)
[1] Fix capitalization
[2] Move logic for getting the home library name URL to the
    Branches TT plugin

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>

C4/Items.pm
Koha/Template/Plugin/Branches.pm
koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt

index a252ba1..8573a51 100644 (file)
@@ -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
index ddf5f2f..ff43a38 100644 (file)
@@ -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;
index 2e3f1ad..baaec0b 100644 (file)
@@ -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 () {
         <thead><tr>
             [% IF ( item_level_itypes ) %]<th id="item_itemtype" class="itype">Item type</th>[% END %]
             [% IF ( OpacLocationBranchToDisplay == 'holding' || OpacLocationBranchToDisplay == 'both' || singleBranchMode ) %]
-                <th>Current Location</th>
+                <th>Current location</th>
             [% END %]
             [% UNLESS ( singleBranchMode ) %]
                 [% IF ( OpacLocationBranchToDisplay == 'home' || OpacLocationBranchToDisplay == 'both' ) %]
-                    <th>Home Library</th>
+                    <th>Home library</th>
                 [% END %]
             [% END %]
             [% IF ( itemdata_ccode ) %]<th id="item_ccode" class="collection">Collection</th>[% END %]
@@ -1562,10 +1563,10 @@ YAHOO.util.Event.onContentReady("furtherm", function () {
                             <link property="businessFunction" href="http://purl.org/goodrelations/v1#LeaseOut">
 
                             <span class="[% ITEM_RESULT.branch_opac_info ? 'branch-info-tooltip-trigger' : '' %]">
-                                    [% IF ( ITEM_RESULT.homebranchurl ) %]
-                                            <a href="[% ITEM_RESULT.homebranchurl %]">[% ITEM_RESULT.homebranchname %]</a>
+                                    [% IF ( Branches.GetURL( ITEM_RESULT.homebranch ) ) %]
+                                            <a href="[% Branches.GetURL( ITEM_RESULT.homebranch ) %]">[% Branches.GetName( ITEM_RESULT.homebranch ) %]</a>
                                     [% ELSE %]
-                                             [% ITEM_RESULT.homebranchname %]
+                                             [% Branches.GetName( ITEM_RESULT.homebranch ) %]
                                     [% END %]
                             </span>