From c5a446a22ceb275de8b5ce91e81f6cd139e04cf4 Mon Sep 17 00:00:00 2001 From: Chris Cormack Date: Mon, 1 Oct 2012 10:58:06 +1300 Subject: [PATCH] Bug 8732: Allowing biblio level itemtypes to display instead of MARC ones If you switch BiblioItemtypeImage to Koha, you will see the Koha itemtypes, if it is Control you will get the ones generated from the MARC control fields. Squashed commit of the following: commit a36d5fdbfc484639ae7939f14e0363fda79b9323 Author: Chris Cormack Date: Mon Oct 1 10:56:47 2012 +1300 WR96747, Bug 8732 Finishing staff side commit feff903c77ffc0fcec9459ecffab6c2ee5b1349d Author: Chris Cormack Date: Mon Oct 1 09:47:07 2012 +1300 Bug 8732 : Now working for staff side too commit 641be286401cf1be54fddb3cc58a53566d80dcca Author: Chris Cormack Date: Mon Oct 1 09:10:27 2012 +1300 Bug 8732 - generalising syspref Signed-off-by: Chris Cormack commit c4ce95c12a773d84e6f8d0b05664649e170799d8 Author: Chris Cormack Date: Wed Sep 12 09:19:31 2012 +1200 Bug 8732 : Showing the images on the OPAC detail page commit 105acad0f76628536840577fa96fb0839f9f3e2f Author: Chris Cormack Date: Thu Sep 6 14:19:37 2012 +1200 Bug 8732 : Allowing biblio level itemtypes to display instead of MARC ones 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. --- C4/XSLT.pm | 2 +- catalogue/detail.pl | 2 +- installer/data/mysql/sysprefs.sql | 3 +- installer/data/mysql/updatedatabase.pl | 10 ++++ .../en/modules/admin/preferences/searching.pref | 6 +++ .../prog/en/modules/catalogue/detail.tt | 28 ++++++++++-- .../prog/en/xslt/MARC21slim2intranetDetail.xsl | 8 ++-- koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt | 18 ++++++-- .../opac-tmpl/prog/en/modules/opac-results.tt | 2 +- .../prog/en/xslt/MARC21slim2OPACDetail.xsl | 3 ++ .../prog/en/xslt/MARC21slim2OPACResults.xsl | 53 ++++++++++++---------- opac/opac-detail.pl | 1 + opac/opac-search.pl | 2 + 13 files changed, 100 insertions(+), 38 deletions(-) diff --git a/C4/XSLT.pm b/C4/XSLT.pm index d85b048..00b1c82 100644 --- a/C4/XSLT.pm +++ b/C4/XSLT.pm @@ -207,7 +207,7 @@ sub XSLTParse4Display { UseControlNumber IntranetBiblioDefaultView BiblioDefaultView singleBranchMode OPACItemLocation DisplayIconsXSLT AlternateHoldingsField AlternateHoldingsSeparator - TrackClicks / ) + TrackClicks BiblioItemtypeImage/ ) { my $sp = C4::Context->preference( $syspref ); next unless defined($sp); diff --git a/catalogue/detail.pl b/catalogue/detail.pl index 72258fd..7bfb8f6 100755 --- a/catalogue/detail.pl +++ b/catalogue/detail.pl @@ -398,7 +398,6 @@ if (C4::Context->preference('OPACBaseURL')){ } # Displaying tags - my $tag_quantity; if (C4::Context->preference('TagsEnabled') and $tag_quantity = C4::Context->preference('TagsShowOnDetail')) { $template->param( @@ -411,5 +410,6 @@ if (C4::Context->preference('TagsEnabled') and $tag_quantity = C4::Context->pref my ( $holdcount, $holds ) = C4::Reserves::GetReservesFromBiblionumber($biblionumber,1); $template->param( holdcount => $holdcount, holds => $holds ); +$template->{VARS}->{'BiblioItemtypeImage'} = C4::Context->preference('BiblioItemtypeImage'); output_html_with_http_headers $query, $cookie, $template->output; diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql index 4b0f364..cb73fcb 100644 --- a/installer/data/mysql/sysprefs.sql +++ b/installer/data/mysql/sysprefs.sql @@ -418,5 +418,6 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` ('XSLTResultsDisplay','default','','Enable XSL stylesheet control over results page display on intranet','Free'), ('yuipath','local','local|http://yui.yahooapis.com/2.5.1/build','Insert the path to YUI libraries, choose local if you use koha offline','Choice'), ('z3950AuthorAuthFields','701,702,700',NULL,'Define the MARC biblio fields for Personal Name Authorities to fill biblio.author','free'), -('z3950NormalizeAuthor','0','','If ON, Personal Name Authorities will replace authors in biblio.author','YesNo') +('z3950NormalizeAuthor','0','','If ON, Personal Name Authorities will replace authors in biblio.author','YesNo'), +('BiblioItemtypeImage','Control','Control which itemtype info displays for biblio level itemtypes','Control|Koha','Choice') ; diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index 9871cfd..d6314d9 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -7169,6 +7169,16 @@ if ( CheckVersion($DBversion) ) { SetVersion ($DBversion); } +$DBversion = "XXX"; +if ( CheckVersion($DBversion) ) { + $dbh->do( +"INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('BiblioItemtypeImage', 'Control','Control what biblio level itemtype image displays','Control|Koha','Choice')" + ); + print +"Upgrade to $DBversion done (Add new BiblioItemtypeImage to system preferences)"; + SetVersion($DBversion); +} + =head1 FUNCTIONS =head2 TableExists($table) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/searching.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/searching.pref index 29da64e..dc16682 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/searching.pref +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/searching.pref @@ -187,3 +187,9 @@ Searching: - Use the following text as separator for UNIMARC authors facets - pref: UNIMARCAuthorsFacetsSeparator class: short + - + - "Display " + - pref: BiblioItemtypeImage + choices: + Control: "Itemtype information from the MARC control fields" + Koha: "Itemtype information from the Koha biblio level itemtype" diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt index d5a006b..8a6727c 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt @@ -243,10 +243,22 @@ function verify_images() { [% END %] MARC Preview: Show + [% IF !item_level_itypes || BiblioItemtypeImage == 'Koha' %] + Itemtype: + [% IF ( description ) %] + [% description %] + [% ELSE %] + [% itemtype %] + [% END %] + + [% END %] [% IF ( holdcount ) %]Holds: [% holdcount %][% ELSE %][% END %] [% IF ( AmazonCoverImages ) %]
- [% END %] + + [% END %] + + [% ELSE %]

[% title |html %]

@@ -379,9 +391,19 @@ function verify_images() { [% END %] [% END %] - [% IF ( holdcount ) %]
  • Holds: [% holdcount %]
  • [% ELSE %][% END %] + [% IF ( holdcount ) %]
  • Holds: [% holdcount %]
  • [% ELSE %][% END %] + [% IF !item_level_itypes || BiblioItemtypeImage == 'Koha' %] +
  • Itemtype: + [% IF ( description ) %] + [% description %] + [% ELSE %] + [% itemtype %] + [% END %] +
  • + [% END %] - [% END %] + [% END %] +
    diff --git a/koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21slim2intranetDetail.xsl b/koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21slim2intranetDetail.xsl index 14ff809..ec5ea06 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21slim2intranetDetail.xsl +++ b/koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21slim2intranetDetail.xsl @@ -26,6 +26,7 @@ + { @@ -142,16 +143,17 @@ - - + + Type: /intranet-tmpl/prog/img/famfamfam/.png - + + diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt b/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt index e5d9c3c..c7accc0 100644 --- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt +++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt @@ -560,15 +560,15 @@ YAHOO.util.Event.onContentReady("furtherm", function () {

    [% title |html %][% IF ( subtitle ) %] [% FOREACH subtitl IN subtitle %][% subtitl.subfield |html %] [% END %][% END %]

    [% IF ( author ) %]
    by [% author |html %]
    [% END %] - [% UNLESS ( item_level_itypes ) %] - [ + + [% IF !item_level_itypes || BiblioItemtypeImage == 'Koha' %] [% IF ( description ) %] [% description %] [% ELSE %] [% itemtype %] [% END %] - ] [% END %] - [% IF ( unititle ) %], [% unititle %][% END %] + [% END %] + [% IF ( unititle ) %], [% unititle %][% END %] [% IF ( MARCAUTHORS ) %] @@ -779,6 +779,16 @@ YAHOO.util.Event.onContentReady("furtherm", function () { [% END %] [% END %] + [% IF !item_level_itypes || BiblioItemtypeImage == 'Koha' %] +
    Itemtype: + [% IF ( description ) %] + [% description %] + [% ELSE %] + [% itemtype %] + [% END %] +
    + [% END %] + [% IF ( LibraryThingForLibrariesID ) %] [% UNLESS ( LibraryThingForLibrariesTabbedView ) %] 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 9235b2b..042818c 100644 --- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-results.tt +++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-results.tt @@ -498,7 +498,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 || BiblioItemtypeImage == 'Koha' %] [% UNLESS ( noItemTypeImages ) %] diff --git a/koha-tmpl/opac-tmpl/prog/en/xslt/MARC21slim2OPACDetail.xsl b/koha-tmpl/opac-tmpl/prog/en/xslt/MARC21slim2OPACDetail.xsl index c3a846c..21dec57 100644 --- a/koha-tmpl/opac-tmpl/prog/en/xslt/MARC21slim2OPACDetail.xsl +++ b/koha-tmpl/opac-tmpl/prog/en/xslt/MARC21slim2OPACDetail.xsl @@ -29,6 +29,7 @@ + { @@ -169,12 +170,14 @@ + Type: /opac-tmpl/lib/famfamfam/.pngmaterialTypeLabelmaterialtype + diff --git a/koha-tmpl/opac-tmpl/prog/en/xslt/MARC21slim2OPACResults.xsl b/koha-tmpl/opac-tmpl/prog/en/xslt/MARC21slim2OPACResults.xsl index addc7de..5a0682d 100644 --- a/koha-tmpl/opac-tmpl/prog/en/xslt/MARC21slim2OPACResults.xsl +++ b/koha-tmpl/opac-tmpl/prog/en/xslt/MARC21slim2OPACResults.xsl @@ -2,34 +2,35 @@ ]> - - - - +xmlns:marc="http://www.loc.gov/MARC21/slim" +xmlns:items="http://www.koha-community.org/items" +xmlns:xsl="http://www.w3.org/1999/XSL/Transform" +exclude-result-prefixes="marc items"> + + + + - - - - + + + + - - + + - - - - - - - - - - + + + + + + + + + + + @@ -532,6 +533,9 @@ + + + Type: @@ -872,6 +876,7 @@ + diff --git a/opac/opac-detail.pl b/opac/opac-detail.pl index d805d66..94849da 100755 --- a/opac/opac-detail.pl +++ b/opac/opac-detail.pl @@ -1043,6 +1043,7 @@ my $defaulttab = @serialcollections > 0 ? 'serialcollection' : 'subscriptions'; $template->param('defaulttab' => $defaulttab); +$template->{VARS}->{'BiblioItemtypeImage'} = C4::Context->preference('BiblioItemtypeImage'); if (C4::Context->preference('OPACLocalCoverImages') == 1) { my @images = ListImagesForBiblio($biblionumber); diff --git a/opac/opac-search.pl b/opac/opac-search.pl index 2854da6..4d3cf30 100755 --- a/opac/opac-search.pl +++ b/opac/opac-search.pl @@ -3,6 +3,7 @@ # Copyright 2008 Garry Collum and the Koha Development team # Copyright 2010 BibLibre # Copyright 2011 KohaAloha, NZ +# Copyright 2012 Catalyst IT, NZ # # This file is part of Koha. # @@ -886,6 +887,7 @@ $template->{VARS}->{DidYouMean} = $template->{VARS}->{IDreamBooksReviews} = C4::Context->preference('IDreamBooksReviews'); $template->{VARS}->{IDreamBooksReadometer} = C4::Context->preference('IDreamBooksReadometer'); $template->{VARS}->{IDreamBooksResults} = C4::Context->preference('IDreamBooksResults'); +$template->{VARS}->{'BiblioItemtypeImage'} = C4::Context->preference('BiblioItemtypeImage'); if ($offset == 0 && IsOverDriveEnabled()) { $template->param(OverDriveEnabled => 1); -- 1.8.4.rc3