Bug 8732: Allowing biblio level itemtypes to display instead of MARC ones
authorChris Cormack <chrisc@catalyst.net.nz>
Sun, 30 Sep 2012 21:58:06 +0000 (10:58 +1300)
committerJonathan Druart <jonathan.druart@bugs.koha-community.org>
Mon, 24 Aug 2020 10:10:53 +0000 (12:10 +0200)
This patchset adds a new syspref: BiblioItemtypeInfo

If you set BiblioItemtypeInfo to Koha, you will see the Koha
record level itemtype info. This info is also shown if item-level_itypes
is set to biblio

Display of icons are controlled by
noItemTypeImages/OpacnoItemTypeImages

Material type display is controlled by DisplayIconsXSLT/DisplayOPACIconsXSLT

To test:
 1 - Apply patch
 2 - Update database
 3 - Do an opac search and view results
 4 - Switch pref to 'Koha' and refresh
 5 - Note itemtypes appear
 6 - Click in to a record details
 7 - Note you see itemtype and icon
 8 - Switch the pref
 9 - Note you don't see record level itemtype and icon
10 - Repeat in staff interface

Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

catalogue/detail.pl
installer/data/mysql/sysprefs.sql
koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/searching.pref
koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt
koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tt
koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-detail.tt
koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-results.tt
koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slim2OPACResults.xsl
koha-tmpl/opac-tmpl/bootstrap/en/xslt/UNIMARCslim2OPACDetail.xsl

index 4a2aa3a..276f33c 100755 (executable)
@@ -512,7 +512,6 @@ if ( (C4::Context->preference("HTML5MediaEnabled") eq 'both') or (C4::Context->p
 }
 
 # Displaying tags
-
 my $tag_quantity;
 if (C4::Context->preference('TagsEnabled') and $tag_quantity = C4::Context->preference('TagsShowOnDetail')) {
     $template->param(
index 09564db..449ad36 100644 (file)
@@ -97,6 +97,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `
 ('BatchCheckoutsValidCategories','',NULL,'Patron categories allowed to checkout in a batch','Free'),
 ('BiblioAddsAuthorities','0',NULL,'If ON, adding a new biblio will check for an existing authority record and create one on the fly if one doesn\'t exist','YesNo'),
 ('BiblioDefaultView','normal','normal|marc|isbd','Choose the default detail view in the catalog; choose between normal, marc or isbd','Choice'),
+('BiblioItemtypeInfo','0','0','Control which itemtype info displays for biblio level itemtypes','YesNo'),
 ('BibtexExportAdditionalFields',  '', NULL ,  'Define additional BibTex tags to export from MARC records in YAML format as an associative array with either a marc tag/subfield combination as the value, or a list of tag/subfield combinations.',  'textarea'),
 ('BlockExpiredPatronOpacActions','1',NULL,'Set whether an expired patron can perform opac actions such as placing holds or renew books, can be overridden on a per patron-type basis','YesNo'),
 ('BlockReturnOfLostItems','0','0','If enabled, items that are marked as lost cannot be returned.','YesNo'),
index 9301c59..34c009f 100644 (file)
@@ -270,3 +270,9 @@ Searching:
             - LIBRIS base URL
             - pref: LibrisURL
             - "Please only change this if you are sure it needs changing."
+        -
+            - pref: BiblioItemtypeInfo
+              choices:
+                  yes: "Display"
+                  no: "Don't display"
+            - " Koha record level itemtype info on detail and result pages in the opac. This info also displays if item-level_itypes is set to bibliographic record."
index 0c7576a..db24627 100644 (file)
                     </span>
         [% END %]
         <span id="catalogue_detail_marc_preview" class="results_summary"><span class="label">MARC preview:</span> <a href="/cgi-bin/koha/catalogue/showmarc.pl?id=[% biblionumber | uri %]&amp;viewas=html" title="MARC" class="previewMARC">Show</a></span>
+        [% IF !item_level_itypes ||  Koha.Preference("BiblioItemtypeInfo") %]
+           <span class="results_summary itemtype"><span class="label">Itemtype:</span>
+          [% IF ( !noItemTypeImages && imageurl ) %]
+              <img src="[% imageurl | html %]" alt="" />
+          [% END %]
+          [% IF ( description ) %]
+            [% description | html %]
+          [% ELSE %]
+            [% itemtype | html %]
+          [% END %]
+          </span>
+        [% END %]
 
         [% IF ( holdcount ) %]
             <span class="results_summary">
@@ -825,7 +837,7 @@ Note that permanent location is a code, and location may be an authval.
 <div id="editions"><h4>Editions</h4>
 <table>
 [% FOREACH XISBN IN XISBNS %]<tr>[% IF ( AmazonCoverImages ) %]<td><a href="http://www.amazon.com/gp/reader/[% XISBN.normalized_isbn | uri %][% AmazonAssocTag | uri %]#reader-link"><img src="https://images-na.ssl-images-amazon.com/images/P/[% XISBN.normalized_isbn | html %].01._AA75_PU_PU-5_.jpg" /></a></td>[% END %]
-[% UNLESS ( item_level_itypes ) %]<td>[% IF ( noItemTypeImages ) %][% XISBN.description | html %][% ELSE %]<img src="[% XISBN.imageurl | html %]" alt="[% XISBN.description | html %]" title="[% XISBN.description | html %]">[% END %]</td>[% END %]
+[% IF ( !item_level_itypes || Koha.Preference('BiblioItemtypeInfo') ) %]<td>[% IF ( noItemTypeImages ) %][% XISBN.description | html %][% ELSE %]<img src="[% XISBN.imageurl | html %]" alt="[% XISBN.description | html %]" title="[% XISBN.description | html %]">[% END %]</td>[% END %]
 <td><a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% XISBN.biblionumber | uri %]">[% XISBN.title | html %]</a> by [% XISBN.author | html %] &copy;[% XISBN.copyrightdate | html %]
   [% IF ( XISBN.publishercode ) %]
 [% XISBN.publishercode | html %] [% IF ( XISBN.place ) %]([% XISBN.place | html %])[% END %] [% IF ( XISBN.publicationyear ) %], [% XISBN.publicationyear | html %][% END %] [% IF ( XISBN.editionstatement ) %][% XISBN.editionstatement | html %][% END %] [% IF ( XISBN.editionresponsibility ) %][% XISBN.editionresponsibility | html %][% END %]
index b8b45d6..912e3c8 100644 (file)
                                             </td>
 
                                             <td>
-                                                [% UNLESS ( item_level_itypes ) %]
+                                                [% IF ( !item_level_itypes ) || Koha.Preference('BiblioItemtypeInfo') %]
                                                     <div class="result-biblio-itemtype">
                                                         [% IF !noItemTypeImages && SEARCH_RESULT.imageurl %]
                                                             <img src="[% SEARCH_RESULT.imageurl | html %]" alt="[%  SEARCH_RESULT.description | html %]" />
index f8dce1e..4cd737c 100644 (file)
                         <h2 class="title">[% INCLUDE 'biblio-title.inc' %]</h2>
                         [% IF ( author ) %]<span class="results_summary author h3">by <a class="contributors" href="/cgi-bin/koha/opac-search.pl?q=au:[% author |url %]">[% author | html %]</a></span>[% END %]
 
-                        <span class="results_summary">[% UNLESS ( item_level_itypes ) %]
-                            [
-                            [% IF ( description ) %]
-                                [% description | html %]
-                            [% ELSE %]
-                                [% itemtype | html %]
-                            [% END %]
-                            ] [% END %]
-                            [% IF ( unititle ) %], [% unititle | html %][% END %]
-                        </span>
+                         <span class="results_summary">
+                             [% IF ( unititle ) %], [% unititle | html %][% END %]
+                         </span>
+
 
                         [% IF ( MARCAUTHORS ) %]
                             <div class="results_summary">
                             <span class="results_summary year"><span class="label">Year: </span>[% copyrightdate | html %]</span>
                         [% END %]
 
-                        [% UNLESS ( item_level_itypes ) %]
-                            [% IF ( imgeurl && !Koha.Preference('OpacNoItemTypeImages') ) %]
-                                <img src="[% imageurl | html %]" alt="" />
-                            [% END %]
+                        [% IF ( !item_level_itypes || Koha.Preference('BiblioItemtypeInfo') ) %]
                             <span class="results_summary itemtype"><span class="label">Item type: </span>
+                                [% IF ( imageurl && !Koha.Preference('OpacNoItemTypeImages') ) %]
+                                    <img src="[% imageurl | html %]" alt="" />
+                                [% END %]
                                 [% IF ( description ) %]
                                     [% description | html %]
                                 [% ELSE %]
index 8f8aa64..6403e67 100644 (file)
                                                     [% SEARCH_RESULT.result_number | html %].
                                                 [% END %]
                                             </td>
-
-                                            [% IF ( !item_level_itypes && !Koha.Preference('OpacNoItemTypeImages') ) %]
+                                            [% IF ( !item_level_itypes || Koha.Preference('BiblioItemtypeInfo') ) && !Koha.Preference('OpacNoItemTypeImages') %]
                                                 [% # Cell 3: Show item type image %]
                                                 <td class="itypecol">
                                                     [% IF ( SEARCH_RESULT.imageurl ) %]
index a0879f6..30ae2ba 100644 (file)
 
 <xsl:if test="$DisplayOPACiconsXSLT!='0'">
     <span class="results_summary type">
+
     <xsl:if test="$typeOf008!=''">
     <span class="results_material_type">
         <span class="label">Material type: </span>
index 5186823..5b91a5c 100644 (file)
@@ -19,7 +19,6 @@
   <xsl:variable name="leader6" select="substring($leader,7,1)"/>
   <xsl:variable name="leader7" select="substring($leader,8,1)"/>
   <xsl:variable name="biblionumber" select="marc:controlfield[@tag=001]"/>
-  <xsl:variable name="DisplayOPACiconsXSLT" select="marc:sysprefs/marc:syspref[@name='DisplayOPACiconsXSLT']"/>
   <xsl:variable name="OPACURLOpenInNewWindow" select="marc:sysprefs/marc:syspref[@name='OPACURLOpenInNewWindow']"/>
   <xsl:variable name="URLLinkText" select="marc:sysprefs/marc:syspref[@name='URLLinkText']"/>