From 6a58da7da2a3f72825d8b610961961a5f65f1af3 Mon Sep 17 00:00:00 2001 From: Owen Leonard Date: Fri, 12 Apr 2019 12:52:52 +0000 Subject: [PATCH] Bug 22695: Remove non-XSLT search results view from the staff client This patch removes the option to select non-XSLT search results in the staff client. The patch removes the markup from the template, updates the system preference options, and modifies Search.pm so that OPAC and staff client results XSLT functions are not tied together. To test, apply the patch and set the XSLTResultsDisplay to a blank value. Run the database update. The value of the XSLTResultsDisplay system preference should now be "default." Perform a catalog search in the staff client. The results should be shown using the XSLT view. Test that OPAC search results respect the OPACXSLTResultsDisplay preference when enabled and disabled. Signed-off-by: Pierre-Marc Thibault Signed-off-by: Bin Wen Signed-off-by: Chris Cormack Signed-off-by: Nick Clemens --- C4/Search.pm | 12 ++++-- .../bug_22695-remove-non-xslt-results.perl | 6 +++ .../admin/preferences/staff_client.pref | 4 +- .../prog/en/modules/catalogue/results.tt | 39 ------------------- 4 files changed, 17 insertions(+), 44 deletions(-) create mode 100644 installer/data/mysql/atomicupdate/bug_22695-remove-non-xslt-results.perl diff --git a/C4/Search.pm b/C4/Search.pm index ef81e19e7c..1a9f51b4e1 100644 --- a/C4/Search.pm +++ b/C4/Search.pm @@ -1910,9 +1910,15 @@ sub searchResults { my ($bibliotag,$bibliosubf)=GetMarcFromKohaField('biblio.biblionumber',''); # set stuff for XSLT processing here once, not later again for every record we retrieved - my $interface = $is_opac ? 'OPAC' : ''; - my $xslsyspref = $interface . "XSLTResultsDisplay"; - my $xslfile = C4::Context->preference($xslsyspref); + my $xslfile; + my $xslsyspref; + if( $is_opac ){ + $xslsyspref = "OPACXSLTResultsDisplay"; + $xslfile = C4::Context->preference( $xslsyspref ); + } else { + $xslsyspref = "XSLTResultsDisplay"; + $xslfile = C4::Context->preference( $xslsyspref ) || "default"; + } my $lang = $xslfile ? C4::Languages::getlanguage() : undef; my $sysxml = $xslfile ? C4::XSLT::get_xslt_sysprefs() : undef; diff --git a/installer/data/mysql/atomicupdate/bug_22695-remove-non-xslt-results.perl b/installer/data/mysql/atomicupdate/bug_22695-remove-non-xslt-results.perl new file mode 100644 index 0000000000..2e29877288 --- /dev/null +++ b/installer/data/mysql/atomicupdate/bug_22695-remove-non-xslt-results.perl @@ -0,0 +1,6 @@ +$DBversion = 'XXX'; # will be replaced by the RM +if( CheckVersion( $DBversion ) ) { + $dbh->do( "UPDATE systempreferences SET value = 'default' WHERE variable = 'XSLTResultsDisplay' AND value = ''" ); + SetVersion( $DBversion ); + print "Upgrade to $DBversion done (Bug 22695 - Remove non-XSLT search results view from the staff client)\n"; +} \ No newline at end of file diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/staff_client.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/staff_client.pref index 4ef153ae08..570c570982 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/staff_client.pref +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/staff_client.pref @@ -75,12 +75,12 @@ Staff Client: - 'Display results in the staff client using XSLT stylesheet at: ' - pref: XSLTResultsDisplay class: file - - '
Options:
  • Leave empty for "no xslt"
  • enter "default" for the default one
  • put a path to define a xslt file
  • put an URL for an external specific stylesheet.
{langcode} will be replaced with current interface language' + - '
Options:
  • Enter "default" for the default one
  • Put a path to define a xslt file
  • Put an URL for an external specific stylesheet.
{langcode} will be replaced with current interface language' - - 'Display details in the staff client using XSLT stylesheet at: ' - pref: XSLTDetailsDisplay class: file - - '
Options:
  • enter "default" for the default one
  • put a path to define a xslt file
  • put an URL for an external specific stylesheet.
{langcode} will be replaced with current interface language' + - '
Options:
  • Enter "default" for the default one
  • Put a path to define a xslt file
  • Put an URL for an external specific stylesheet.
{langcode} will be replaced with current interface language' - - pref: DisplayIconsXSLT choices: diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tt index 7f3cb6f3e4..ca3733f806 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tt @@ -400,48 +400,9 @@ [% END %] - [% IF ( SEARCH_RESULT.XSLTResultsRecord ) %] [% SEARCH_RESULT.result_number | html %]. [% SEARCH_RESULT.XSLTResultsRecord | $raw %] - [% ELSE %] -

[% SEARCH_RESULT.result_number | html %]. - [% biblionumber = SEARCH_RESULT.biblionumber %] - - [% INCLUDE 'biblio-default-view.inc' %] - [% IF ( SEARCH_RESULT.title ) %][% SEARCH_RESULT.title | html %][% ELSE %]No title[% END %] - - [% FOREACH subtitl IN SEARCH_RESULT.subtitle %], [% subtitl.subfield | html %][% END %] - [% IF ( SEARCH_RESULT.seriestitle ) %][% SEARCH_RESULT.seriestitle | html %][% END %] - [% IF ( SEARCH_RESULT.volume ) %][% SEARCH_RESULT.volume | html %][% END %] [% IF ( SEARCH_RESULT.volumeddesc ) %], [% SEARCH_RESULT.volumeddesc | html %][% END %] -

- [% IF ( SEARCH_RESULT.summary ) %] - [% IF ( SEARCH_RESULT.author ) %] - [% SEARCH_RESULT.author | html %] - [% ELSE %] -   - [% END %] -

[% SEARCH_RESULT.summary | html %]

- [% ELSE %] -

- [% IF ( SEARCH_RESULT.author ) %] - [% SEARCH_RESULT.author | html %] - [% ELSE %] -   - [% END %] - Description: - [% IF ( SEARCH_RESULT.place ) %][% SEARCH_RESULT.place | html %] [% END %] - [% IF ( SEARCH_RESULT.publishercode ) %][% SEARCH_RESULT.publishercode | html %][% END %] [% IF ( SEARCH_RESULT.publicationyear ) %] [% SEARCH_RESULT.publicationyear | html %] [% ELSIF ( SEARCH_RESULT.copyrightdate ) %] [% SEARCH_RESULT.copyrightdate | html %][% END %] - [% IF ( SEARCH_RESULT.edition ) %]Edition: [% SEARCH_RESULT.edition | html %][% END %] - [% IF ( SEARCH_RESULT.pages ) %]: [% SEARCH_RESULT.pages | html %][% END %] - [% IF ( SEARCH_RESULT.size ) %] ; [% SEARCH_RESULT.size | html %][% END %] [% IF ( SEARCH_RESULT.isbn ) %]ISBN: [% SEARCH_RESULT.isbn | replace('\s\|', ', ') | html %][% END %] - [% SEARCH_RESULT.description | html %] - [% IF ( SEARCH_RESULT.timestamp ) %] (modified on [% SEARCH_RESULT.timestamp | html %])[% END %] - [% IF ( SEARCH_RESULT.cn_class ) %][[% SEARCH_RESULT.cn_class | html %]][% END %] -

- [% IF ( SEARCH_RESULT.searchhighlightblob ) %]

[% SEARCH_RESULT.searchhighlightblob | html %]

[% END %] - [% END %] - [% END %]

[% IF ( SEARCH_RESULT.norequests ) %] -- 2.39.5