From 32709c885fdcc7f16968662d4256f04979516d99 Mon Sep 17 00:00:00 2001 From: Marcel de Rooy Date: Mon, 14 Nov 2016 15:15:49 +0100 Subject: [PATCH] Bug 17624: Hide not-for-loan items on search results' availability Content-Type: text/plain; charset=utf-8 Currently, not for loan items are listed as copies for reference on the OPAC XSLT search results. This reports add a preference to hide or show these not-for-loan items on the OPAC XSLT results view. It is: OPACXSLTResultsHideNFL. By default, it will still show them. So, no behavior change here. Note: This patch also removed a double line in the pref file that resulted in a small empty table row at the end of the Appearance section for OPAC preferences. Test plan: [1] Run the dbrev via the web installer. Verify that the pref is still off. This means that not-for-loans should be listed on the Availability line as "Copies available for reference". [2] Set the pref to Hide. [3] Verify that the not-for-loans are not shown in the search results. Note that you still see them in the details view (no problem: they are listed just as what they are: not for loan). [4] Set OpacItemLocation to Location. Look at the search results again. --- C4/XSLT.pm | 2 +- installer/data/mysql/atomicupdate/bug17624.perl | 9 +++++++++ installer/data/mysql/sysprefs.sql | 1 + .../intranet-tmpl/prog/en/modules/admin/preferences/opac.pref | 8 +++++++- .../opac-tmpl/bootstrap/en/xslt/MARC21slim2OPACResults.xsl | 11 ++++++----- 5 files changed, 24 insertions(+), 7 deletions(-) create mode 100644 installer/data/mysql/atomicupdate/bug17624.perl diff --git a/C4/XSLT.pm b/C4/XSLT.pm index 50ab8e6..24d5399 100644 --- a/C4/XSLT.pm +++ b/C4/XSLT.pm @@ -170,7 +170,7 @@ sub get_xslt_sysprefs { OPACItemLocation DisplayIconsXSLT AlternateHoldingsField AlternateHoldingsSeparator TrackClicks opacthemes IdRef OpacSuppression - OPACResultsLibrary / ) + OPACResultsLibrary OPACXSLTResultsHideNFL / ) { my $sp = C4::Context->preference( $syspref ); next unless defined($sp); diff --git a/installer/data/mysql/atomicupdate/bug17624.perl b/installer/data/mysql/atomicupdate/bug17624.perl new file mode 100644 index 0000000..bd8cd70 --- /dev/null +++ b/installer/data/mysql/atomicupdate/bug17624.perl @@ -0,0 +1,9 @@ +$DBversion = 'XXX'; # will be replaced by the RM +if( CheckVersion( $DBversion ) ) { + $dbh->do(q| +INSERT IGNORE INTO systempreferences (`variable`, `value`, `options`, `explanation`, `type`) VALUES ('OPACXSLTResultsHideNFL', '0', NULL, 'Hide not-for-loans in OPAC XSLT results view', 'YesNo')| + ); + + SetVersion( $DBversion ); + print "Upgrade to $DBversion done (Bug 17624 - Hide not-for-loans in OPAC XSLT results)\n"; +} diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql index 7c69940..c0f46ee 100644 --- a/installer/data/mysql/sysprefs.sql +++ b/installer/data/mysql/sysprefs.sql @@ -379,6 +379,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` ('OPACXSLTDetailsDisplay','default','','Enable XSL stylesheet control over details page display on OPAC','Free'), ('OPACXSLTListsDisplay','default','','Enable XSLT stylesheet control over lists pages display on OPAC','Free'), ('OPACXSLTResultsDisplay','default','','Enable XSL stylesheet control over results page display on OPAC','Free'), +('OPACXSLTResultsHideNFL','0',NULL,'Hide not-for-loans in OPAC XSLT results view','YesNo'), ('OpenLibraryCovers','0',NULL,'If ON Openlibrary book covers will be show','YesNo'), ('OpenLibrarySearch','0',NULL,'If Yes Open Library search results will show in OPAC','YesNo'), ('OrderPdfFormat','pdfformat::layout3pages','Controls what script is used for printing (basketgroups)','','free'), 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 62aaeff..46aaed7 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 @@ -61,7 +61,6 @@ OPAC: no: "Don't show" - "a warning that the OPAC is under maintenance, instead of the OPAC itself. Note: this shows the same warning as when the database needs to be upgraded, but unconditionally." - - - - "Show the following HTML when OpacMaintenance is enabled:" - pref: OpacMaintenanceNotice type: htmlarea @@ -343,6 +342,13 @@ OPAC: both: "both top and footer" top: "top" footer: "only footer" + - + - pref: OPACXSLTResultsHideNFL + default: 0 + choices: + 1: Hide + 0: Show + - not-for-loan items on the OPAC XSLT Results view. Features: - - pref: opacuserlogin diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slim2OPACResults.xsl b/koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slim2OPACResults.xsl index 353b08e..b1ea15f 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slim2OPACResults.xsl +++ b/koha-tmpl/opac-tmpl/bootstrap/en/xslt/MARC21slim2OPACResults.xsl @@ -21,6 +21,7 @@ + @@ -1147,7 +1148,7 @@ Availability: - + @@ -1223,7 +1224,7 @@ - + Items available for reference: @@ -1244,7 +1245,7 @@ - +
@@ -1294,7 +1295,7 @@
- + Location(s): @@ -1311,7 +1312,7 @@ - + -- 2.1.4