@@ -, +, @@ of MARC ones WR96747, Bug 8732 Finishing staff side Bug 8732 : Now working for staff side too Bug 8732 - generalising syspref Signed-off-by: Chris Cormack Bug 8732 : Showing the images on the OPAC detail page 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 | 4 ++- installer/data/mysql/sysprefs.sql | 1 + installer/data/mysql/updatedatabase.pl | 7 +++++ .../prog/en/modules/admin/preferences/opac.pref | 2 +- .../en/modules/admin/preferences/searching.pref | 7 +++++ .../prog/en/modules/catalogue/detail.tt | 28 +++++++++++++++++--- .../prog/en/xslt/MARC21slim2intranetDetail.xsl | 5 ++-- 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 | 5 ++++ opac/opac-detail.pl | 1 + opac/opac-search.pl | 2 ++ 14 files changed, 74 insertions(+), 13 deletions(-) --- a/C4/XSLT.pm +++ a/C4/XSLT.pm @@ -188,7 +188,7 @@ sub XSLTParse4Display { UseAuthoritiesForTracings TraceSubjectSubdivisions Display856uAsImage OPACDisplay856uAsImage UseControlNumber IntranetBiblioDefaultView BiblioDefaultView - singleBranchMode + singleBranchMode BiblioItemtypeImage AlternateHoldingsField AlternateHoldingsSeparator / ) { my $sp = C4::Context->preference( $syspref ); --- a/catalogue/detail.pl +++ a/catalogue/detail.pl @@ -364,7 +364,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( @@ -375,4 +374,7 @@ if (C4::Context->preference('TagsEnabled') and $tag_quantity = C4::Context->pref 'sort'=>'-weight', limit=>$tag_quantity})); } +$template->{VARS}->{'BiblioItemtypeImage'} = C4::Context->preference('BiblioItemtypeImage'); + + output_html_with_http_headers $query, $cookie, $template->output; --- a/installer/data/mysql/sysprefs.sql +++ a/installer/data/mysql/sysprefs.sql @@ -384,3 +384,4 @@ INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES(' INSERT IGNORE INTO systempreferences (variable,value,explanation,options,type) VALUES('AuthDisplayHierarchy','0','Display authority hierarchies','','YesNo'); INSERT INTO systempreferences (variable,value,explanation,type) VALUES('OPACdidyoumean',NULL,'Did you mean? configuration for the OPAC. Do not change, as this is controlled by /cgi-bin/koha/admin/didyoumean.pl.','Free'); INSERT INTO systempreferences (variable,value,explanation,type) VALUES('INTRAdidyoumean',NULL,'Did you mean? configuration for the Intranet. Do not change, as this is controlled by /cgi-bin/koha/admin/didyoumean.pl.','Free'); +INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('BiblioItemtypeImage','Control','Control which itemtype info displays for biblio level itemtypes','Control|Koha','Choice'); --- a/installer/data/mysql/updatedatabase.pl +++ a/installer/data/mysql/updatedatabase.pl @@ -5988,6 +5988,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('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) --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref @@ -520,4 +520,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." --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/searching.pref +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/searching.pref @@ -185,3 +185,10 @@ Searching: - pref: FacetLabelTruncationLength class: integer - characters, in OPAC/staff interface. + - + - "Display " + - pref: BiblioItemtypeImage + choices: + Control: "Itemtype information from the MARC control fields" + Koha: "Itemtype information from the Koha biblio level itemtype" + --- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt @@ -115,10 +115,22 @@ function verify_images() { [% END %] [% END %] + [% 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 %]

@@ -247,9 +259,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 %] +
    --- a/koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21slim2intranetDetail.xsl +++ a/koha-tmpl/intranet-tmpl/prog/en/xslt/MARC21slim2intranetDetail.xsl @@ -25,6 +25,7 @@ + { @@ -141,7 +142,7 @@ - + Type: /intranet-tmpl/prog/img/famfamfam/.png @@ -149,7 +150,7 @@ - + --- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt +++ a/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt @@ -347,15 +347,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 ) %] @@ -479,6 +479,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 ) %] --- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-results.tt +++ a/koha-tmpl/opac-tmpl/prog/en/modules/opac-results.tt @@ -427,7 +427,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 ) %] --- a/koha-tmpl/opac-tmpl/prog/en/xslt/MARC21slim2OPACDetail.xsl +++ a/koha-tmpl/opac-tmpl/prog/en/xslt/MARC21slim2OPACDetail.xsl @@ -26,6 +26,7 @@ + { @@ -149,12 +150,14 @@ + Type: /opac-tmpl/lib/famfamfam/.pngmaterialTypeLabelmaterialtype + --- a/koha-tmpl/opac-tmpl/prog/en/xslt/MARC21slim2OPACResults.xsl +++ a/koha-tmpl/opac-tmpl/prog/en/xslt/MARC21slim2OPACResults.xsl @@ -28,6 +28,7 @@ + @@ -530,6 +531,9 @@ + + + Type: @@ -870,6 +874,7 @@ + --- a/opac/opac-detail.pl +++ a/opac/opac-detail.pl @@ -964,6 +964,7 @@ my $defaulttab = @serialcollections > 0 ? 'serialcollection' : 'subscription'; $template->param('defaulttab' => $defaulttab); +$template->{VARS}->{'BiblioItemtypeImage'} = C4::Context->preference('BiblioItemtypeImage'); if (C4::Context->preference('OPACLocalCoverImages') == 1) { my @images = ListImagesForBiblio($biblionumber); --- a/opac/opac-search.pl +++ a/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. # @@ -824,6 +825,7 @@ if (C4::Context->preference('GoogleIndicTransliteration')) { } $template->{VARS}->{DidYouMean} = C4::Context->preference('OPACdidyoumean') =~ m/enable/; +$template->{VARS}->{'BiblioItemtypeImage'} = C4::Context->preference('BiblioItemtypeImage'); $template->param( borrowernumber => $borrowernumber); output_with_http_headers $cgi, $cookie, $template->output, $content_type; --