From 4b943add3378e73aedac1aa459c56c75d1e32084 Mon Sep 17 00:00:00 2001 From: Chris Cormack Date: Thu, 6 Sep 2012 14:19:37 +1200 Subject: [PATCH] Bug 8732 : Allowing biblio level itemtypes to display instead of MARC ones Content-Type: text/plain; charset="utf-8" If you switch OpacResultsItemtypeImage to Koha, you will see the Koha itemtypes, if it is Control you will get the ones generated from the MARC control fields. Signed-off-by: Kyle M Hall --- C4/XSLT.pm | 2 +- installer/data/mysql/sysprefs.sql | 1 + installer/data/mysql/updatedatabase.pl | 7 +++++++ .../prog/en/modules/admin/preferences/opac.pref | 8 +++++++- .../opac-tmpl/prog/en/modules/opac-results.tt | 2 +- .../prog/en/xslt/MARC21slim2OPACResults.xsl | 5 +++++ opac/opac-search.pl | 2 ++ 7 files changed, 24 insertions(+), 3 deletions(-) diff --git a/C4/XSLT.pm b/C4/XSLT.pm index d17b828..c6909c2 100644 --- a/C4/XSLT.pm +++ b/C4/XSLT.pm @@ -188,7 +188,7 @@ sub XSLTParse4Display { UseAuthoritiesForTracings TraceSubjectSubdivisions Display856uAsImage OPACDisplay856uAsImage UseControlNumber IntranetBiblioDefaultView BiblioDefaultView - singleBranchMode + singleBranchMode OpacResultsItemtypeImage AlternateHoldingsField AlternateHoldingsSeparator / ) { my $sp = C4::Context->preference( $syspref ); diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql index 35f92cc..a333dbd 100644 --- a/installer/data/mysql/sysprefs.sql +++ b/installer/data/mysql/sysprefs.sql @@ -371,3 +371,4 @@ INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES(' INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES ('SubfieldsToUseWhenPrefill','','Define a list of subfields to use when prefilling items (separated by space)','','Free'); INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('AgeRestrictionMarker','','Markers for age restriction indication, e.g. FSK|PEGI|Age|',NULL,'free'); INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('AgeRestrictionOverride',0,'Allow staff to check out an item with age restriction.',NULL,'YesNo'); +INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('OpacResultsItemtypeImage','Control','Control which itemtype info displays on the Opac Results page','Control|Koha','Choice'); diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index 25cd367..78182b0 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -5696,6 +5696,13 @@ if (C4::Context->preference("Version") < TransformToNum($DBversion)) { SetVersion($DBversion); } +$DBversion = "XXX"; +if (C4::Context->preference("Version") < TransformToNum($DBversion)) { + $dbh->do("INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('OpacResultsItemtypeImage', 'Control','Control which itemtype info displays on the Opac Results page','Control|Koha','Choice')"); + print "Upgrade to $DBversion done (Add new OpacResultsItemtypeImage to system preferences)"; + SetVersion($DBversion); +} + =head1 FUNCTIONS =head2 TableExists($table) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref index 4df81b4..8f088c2 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref @@ -236,6 +236,12 @@ OPAC: - '
Note: Available options are: BIBTEX (bibtex), Dublin Core (dc),' - 'MARCXML (marcxml), MARC-8 encoded MARC (marc8), Unicode/UTF-8 encoded MARC (utf8),' - 'Unicode/UTF-8 encoded MARC without local use -9xx, x9x, xx9- fields and subfields (marcstd), MODS (mods), RIS (ris)' + - + - 'Display ' + - pref: OpacResultsItemtypeImage + choices: + Control: "Itemtype information from the MARC control fields" + Koha: "Itemtype information from the Koha biblio level itemtype" Features: - - pref: opacuserlogin @@ -498,4 +504,4 @@ OPAC: choices: yes: Use no: "Don't use" - - "the item collection code when finding items for the shelf browser." + - "the item collection code when finding items for the shelf browser." diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-results.tt b/koha-tmpl/opac-tmpl/prog/en/modules/opac-results.tt index 6191342..d869c01 100644 --- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-results.tt +++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-results.tt @@ -416,7 +416,7 @@ $(document).ready(function(){ [% IF ( RequestOnOpac ) %][% UNLESS ( SEARCH_RESULT.norequests ) %][% IF ( opacuserlogin ) %] [% END %][% END %][% END %][% END %][% END %] [% UNLESS suppress_result_number %][% SEARCH_RESULT.result_number %].[% END %] - [% UNLESS ( item_level_itypes ) %] + [% IF !item_level_itypes || OpacResultsItemtypeImage == 'Koha' %] [% UNLESS ( noItemTypeImages ) %] diff --git a/koha-tmpl/opac-tmpl/prog/en/xslt/MARC21slim2OPACResults.xsl b/koha-tmpl/opac-tmpl/prog/en/xslt/MARC21slim2OPACResults.xsl index 751c61a..4539c66 100644 --- a/koha-tmpl/opac-tmpl/prog/en/xslt/MARC21slim2OPACResults.xsl +++ b/koha-tmpl/opac-tmpl/prog/en/xslt/MARC21slim2OPACResults.xsl @@ -28,6 +28,7 @@ + @@ -530,6 +531,9 @@ + + + Type: @@ -870,6 +874,7 @@ + diff --git a/opac/opac-search.pl b/opac/opac-search.pl index 46cf105..41e52fc 100755 --- a/opac/opac-search.pl +++ b/opac/opac-search.pl @@ -826,5 +826,7 @@ if (C4::Context->preference('GoogleIndicTransliteration')) { $template->param('GoogleIndicTransliteration' => 1); } +$template->{VARS}->{'OpacResultsItemtypeImage'} = C4::Context->preference('OpacResultsItemtypeImage'); + $template->param( borrowernumber => $borrowernumber); output_with_http_headers $cgi, $cookie, $template->output, $content_type; -- 1.7.2.5