[Koha-patches] [PATCH] Fix for Bug 4359, noItemTypeImages not active in OPAC

Owen Leonard oleonard at myacpl.org
Tue Jul 6 16:48:41 CEST 2010


- Auth.pm put the noItemTypeImages preference under "intranet only."
  Moved it to "OPAC or intranet."
- Added check for the preference on the OPAC advanced search page.
- Improved logic for displaying images on the reading history page.
---
 C4/Auth.pm                                         |    2 +-
 .../opac-tmpl/prog/en/modules/opac-advsearch.tmpl  |    2 +-
 .../opac-tmpl/prog/en/modules/opac-detail.tmpl     |    2 +-
 .../prog/en/modules/opac-readingrecord.tmpl        |    4 ++--
 opac/opac-readingrecord.pl                         |    1 +
 5 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/C4/Auth.pm b/C4/Auth.pm
index 593f36e..9a599af 100644
--- a/C4/Auth.pm
+++ b/C4/Auth.pm
@@ -339,6 +339,7 @@ sub get_template_and_user {
             XSLTResultsDisplay           => C4::Context->preference("XSLTResultsDisplay"),
             BranchesLoop                 => GetBranchesLoop(),
             using_https                  => $in->{'query'}->https() ? 1 : 0,
+            noItemTypeImages            => C4::Context->preference("noItemTypeImages"),
     );
 
     if ( $in->{'type'} eq "intranet" ) {
@@ -364,7 +365,6 @@ sub get_template_and_user {
             intranetstylesheet          => C4::Context->preference("intranetstylesheet"),
             intranetuserjs              => C4::Context->preference("intranetuserjs"),
             intranetbookbag             => C4::Context->preference("intranetbookbag"),
-            noItemTypeImages            => C4::Context->preference("noItemTypeImages"),
             suggestion                  => C4::Context->preference("suggestion"),
             virtualshelves              => C4::Context->preference("virtualshelves"),
             StaffSerialIssueDisplayCount => C4::Context->preference("StaffSerialIssueDisplayCount"),
diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-advsearch.tmpl b/koha-tmpl/opac-tmpl/prog/en/modules/opac-advsearch.tmpl
index 52b00e7..2ba2629 100644
--- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-advsearch.tmpl
+++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-advsearch.tmpl
@@ -134,7 +134,7 @@
     <table>
         <tr>
     <!--TMPL_LOOP Name="itemtypeloop"-->
-        <td><input type="checkbox" id="<!-- TMPL_VAR NAME="ccl" -->-<!--TMPL_VAR Name="number" -->" name="limit" value="mc-<!-- TMPL_VAR NAME="ccl" -->:<!--TMPL_VAR Name="code" -->"/><label for="<!-- TMPL_VAR NAME="ccl" -->-<!--TMPL_VAR Name="number" -->"><!-- TMPL_IF name="imageurl"--><img border="0" src="<!--TMPL_VAR Name="imageurl" -->" alt="<!--TMPL_VAR Name="description" -->" /><!-- /TMPL_IF -->&nbsp;
+        <td><input type="checkbox" id="<!-- TMPL_VAR NAME="ccl" -->-<!--TMPL_VAR Name="number" -->" name="limit" value="mc-<!-- TMPL_VAR NAME="ccl" -->:<!--TMPL_VAR Name="code" -->"/><label for="<!-- TMPL_VAR NAME="ccl" -->-<!--TMPL_VAR Name="number" -->"><!-- TMPL_UNLESS NAME="noItemTypeImages" --><!-- TMPL_IF name="imageurl"--><img border="0" src="<!--TMPL_VAR Name="imageurl" -->" alt="<!--TMPL_VAR Name="description" -->" /><!-- /TMPL_IF -->&nbsp;<!-- /TMPL_UNLESS -->
         <!--TMPL_VAR Name="description" --></label></td>
         <!-- TMPL_UNLESS name="count5" --><!-- TMPL_UNLESS name="__last__" --></tr><tr><!-- /TMPL_UNLESS --><!-- /TMPL_UNLESS -->
     <!--/TMPL_LOOP-->
diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tmpl b/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tmpl
index b1fdf84..fe7239b 100644
--- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tmpl
+++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tmpl
@@ -395,7 +395,7 @@ YAHOO.util.Event.onContentReady("furtherm", function () {
 		<th>Date Due</th>
 	    </tr></thead>
 	    <tbody><!-- TMPL_LOOP NAME="ITEM_RESULTS" -->
-	    <tr><!-- TMPL_IF NAME="item-level_itypes" --><td><!-- TMPL_IF NAME="imageurl" --><img src="<!-- TMPL_VAR NAME="imageurl" -->" title="<!-- TMPL_VAR NAME="description" -->" alt="<!-- TMPL_VAR NAME="description" -->" /><!-- /TMPL_IF --> <!-- TMPL_VAR NAME="description" --></td><!-- /TMPL_IF -->
+	    <tr><!-- TMPL_IF NAME="item-level_itypes" --><td><!-- TMPL_UNLESS NAME="noItemTypeImages" --><!-- TMPL_IF NAME="imageurl" --><img src="<!-- TMPL_VAR NAME="imageurl" -->" title="<!-- TMPL_VAR NAME="description" -->" alt="<!-- TMPL_VAR NAME="description" -->" /><!-- /TMPL_IF --><!-- /TMPL_UNLESS --> <!-- TMPL_VAR NAME="description" --></td><!-- /TMPL_IF -->
 		<td><!-- TMPL_UNLESS NAME="singleBranchMode" --><!-- TMPL_IF name="branchurl" --><a href="<!-- TMPL_VAR NAME="branchurl" -->"><!-- TMPL_VAR NAME="branchname" --></a><!-- TMPL_ELSE --><!-- TMPL_VAR NAME="branchname" --><!-- /TMPL_IF --><!-- /TMPL_UNLESS --> <!-- TMPL_VAR NAME="location_description" --> </td>
 		<!-- TMPL_IF NAME="itemdata_ccode" --><td><!-- TMPL_VAR NAME="ccode" --></td><!-- /TMPL_IF -->
 		<td><!-- TMPL_IF NAME="itemcallnumber" --> <!-- TMPL_VAR NAME="itemcallnumber" --><!-- /TMPL_IF --> <!-- TMPL_IF NAME="OPACShelfBrowser" -->(<a href="/cgi-bin/koha/opac-detail.pl?biblionumber=<!-- TMPL_VAR NAME="biblionumber" -->&amp;shelfbrowse_itemnumber=<!-- TMPL_VAR NAME="itemnumber" -->#shelfbrowser">Browse Shelf</a>)<!-- /TMPL_IF --></td>
diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-readingrecord.tmpl b/koha-tmpl/opac-tmpl/prog/en/modules/opac-readingrecord.tmpl
index 250a77a..5f55177 100644
--- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-readingrecord.tmpl
+++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-readingrecord.tmpl
@@ -54,7 +54,7 @@ You have never borrowed anything from this library.
 <div class="ui-tabs-panel"><table id="readingrec">
 <tr>
 <th colspan="2">Title</th>
-<!-- TMPL_UNLESS NAME="item-level_itypes" --><th>Item Type</th><!-- /TMPL_UNLESS -->
+<!-- TMPL_UNLESS NAME="noItemTypeImages" --><th>Item Type</th><!-- /TMPL_UNLESS -->
 <th>Call No.</th>
 <th>Date</th>
 </tr>
@@ -80,7 +80,7 @@ You have never borrowed anything from this library.
                     <span class="item-details">
                         <!-- TMPL_VAR NAME="author" -->
                     </span></td>
-<!-- TMPL_UNLESS NAME="item-level_itypes" --><td><!-- TMPL_IF NAME="imageurl" --><img src="<!-- TMPL_VAR NAME="imageurl" -->" title="<!-- TMPL_VAR name="itypedescription" -->" alt="<!-- TMPL_VAR NAME="itypedescription" -->" /><!-- /TMPL_IF --> <!-- TMPL_VAR name="itypedescription" --></td><!-- /TMPL_UNLESS -->
+<!-- TMPL_UNLESS NAME="noItemTypeImages" --><td><!-- TMPL_IF NAME="imageurl" --><img src="<!-- TMPL_VAR NAME="imageurl" -->" alt="" /><!-- /TMPL_IF --> <!-- TMPL_VAR name="description" --></td><!-- /TMPL_UNLESS -->
 <td><!-- TMPL_VAR NAME="itemcallnumber" --></td>
 <td><!-- TMPL_IF NAME="returndate" --><!-- TMPL_VAR NAME="returndate" --><!-- TMPL_ELSE --><em>(Checked out)</em><!-- /TMPL_IF --></td>
 </tr>
diff --git a/opac/opac-readingrecord.pl b/opac/opac-readingrecord.pl
index 7a77f59..c9d5819 100755
--- a/opac/opac-readingrecord.pl
+++ b/opac/opac-readingrecord.pl
@@ -95,6 +95,7 @@ foreach my $issue (@{$issues} ) {
     $line{date_due}        = format_date( $issue->{'date_due'} );
     $line{returndate}      = format_date( $issue->{'returndate'} );
     $line{volumeddesc}     = $issue->{'volumeddesc'};
+    $issue->{'itemtype'}   = C4::Context->preference('item-level_itypes') ? $issue->{'itype'} : $issue->{'itemtype'};
     if($issue->{'itemtype'}) {
         $line{'description'}   = $itemtypes->{ $issue->{'itemtype'} }->{'description'};
         $line{imageurl}        = getitemtypeimagelocation( 'opac', $itemtypes->{ $issue->{'itemtype'}  }->{'imageurl'} );
-- 
1.7.0.4



More information about the Koha-patches mailing list