From e9aa447ad6f1234a6cfee15d030e60861a4807e6 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Fri, 15 Nov 2013 12:02:53 +0100 Subject: [PATCH] Bug 11256: Opac: Set a number of items to display on a biblio detail page. Currently, the number of items to display is hardcoded (50). But the perl script loads all items before to check if the number of items is oversized. This patch adds a new pref OpacMaxItemsToDisplay (default to 50). If the *total* number of items for a biblio is greater, no item is displayed and a link allows to display all items. Test plan: 1/ search a biblio with many items 2/ set the pref according the number of items you want to display 3/ verify the items are not displayed if the number of items is greater the pref value 4/ enable the OpacSeparateHoldings pref and verify the items are displayed in different tabs (if items have different locations). --- installer/data/mysql/sysprefs.sql | 1 + installer/data/mysql/updatedatabase.pl | 6 ++++++ .../prog/en/modules/admin/preferences/opac.pref | 6 ++++++ koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt | 20 +++++++----------- opac/opac-detail.pl | 22 +++++++++----------- 5 files changed, 30 insertions(+), 25 deletions(-) diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql index a07103a..8c8566a 100644 --- a/installer/data/mysql/sysprefs.sql +++ b/installer/data/mysql/sysprefs.sql @@ -239,6 +239,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` ('OpacMaintenance','0','','If ON, enables maintenance warning in OPAC','YesNo'), ('OpacMainUserBlock','Welcome to Koha...\r\n
','70|10','A user-defined block of HTML in the main content area of the opac main page','Textarea'), ('OpacMainUserBlockMobile','',NULL,'Show the following HTML in its own column on the main page of the OPAC (mobile version):','free'), +('OpacMaxItemsToDisplay','50','','Max items to display at the OPAC on a biblio detail','Integer'), ('OPACMobileUserCSS','',NULL,'Include the following CSS for the mobile view on all pages in the OPAC:','free'), ('OPACMySummaryHTML','','70|10','Enter the HTML that will appear in a column on the \'my summary\' and \'my reading history\' tabs when a user is logged in to the OPAC. Enter {BIBLIONUMBER}, {TITLE}, {AUTHOR}, or {ISBN} in place of their respective variables in the HTML. Leave blank to disable.','Textarea'), ('OpacNav','Important links here.','70|10','Use HTML tags to add navigational links to the left-hand navigational bar in OPAC','Textarea'), diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index db9bf95..5aa2050 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -7750,6 +7750,12 @@ if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) { SetVersion($DBversion); } +$DBversion = "3.13.00.XXX"; +if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) { + $dbh->do("INSERT IGNORE INTO systempreferences (variable,value,options,explanation,type) VALUES('OpacMaxItemsToDisplay','50','','Max items to display at the OPAC on a biblio detail','Integer')"); + print "Upgrade to $DBversion done (Bug 11256: Add system preference OpacMaxItemsToDisplay)\n"; + SetVersion($DBversion); +} =head1 FUNCTIONS 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 a75c7ef..5e19860 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 @@ -280,6 +280,12 @@ OPAC: homebranch: 'home library' holdingbranch: 'holding library' - "is the logged in user's library. The second tab will contain all other items." + - + - Display + - pref: OpacMaxItemsToDisplay + class: integer + - items on the biblio detail page (if the biblio has more items, a link allow to display all items). + Features: - - pref: opacuserlogin 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 05c4010..dfec4d0 100644 --- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt +++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-detail.tt @@ -938,7 +938,7 @@ YAHOO.util.Event.onContentReady("furtherm", function () {