From c3dcbcc6357835f8c46f613591f3e9931a9a2ff8 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. --- C4/Search.pm | 12 +++++-- .../bug_22695-remove-non-xslt-results.perl | 6 ++++ .../en/modules/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 ef81e19..1a9f51b 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 0000000..2e29877 --- /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 19ab866..c719f1a 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 @@ -71,12 +71,12 @@ Staff Client: - 'Display results in the staff client using XSLT stylesheet at: ' - pref: XSLTResultsDisplay class: file - - '
Options:{langcode} will be replaced with current interface language' + - '
Options:{langcode} will be replaced with current interface language' - - 'Display details in the staff client using XSLT stylesheet at: ' - pref: XSLTDetailsDisplay class: file - - '
Options:{langcode} will be replaced with current interface language' + - '
Options:{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 7f3cb6f..ca3733f 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.1.4