[Koha-patches] [PATCH] Add system preference for maxItemsinSearchResults

Michael Hafen mdhafen at tech.washk12.org
Tue Feb 24 22:32:37 CET 2009


There is already code to implement this system preference.  I'm adding
it to the database and System Preferences page.
---
 C4/Search.pm                                   |    6 +-----
 admin/systempreferences.pl                     |    1 +
 installer/data/mysql/en/mandatory/sysprefs.sql |    1 +
 3 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/C4/Search.pm b/C4/Search.pm
index c3b715a..f1ba1cd 100644
--- a/C4/Search.pm
+++ b/C4/Search.pm
@@ -1359,10 +1359,6 @@ s/\[(.?.?.?.?)$tagsubf(.*?)]/$1$subfieldvalue$2\[$1$tagsubf$2]/g;
         my $item_in_transit_count = 0;
         my $can_place_holds       = 0;
         my $items_count           = scalar(@fields);
-        my $maxitems =
-          ( C4::Context->preference('maxItemsinSearchResults') )
-          ? C4::Context->preference('maxItemsinSearchResults') - 1
-          : 1;
 
         # loop through every item
         foreach my $field (@fields) {
@@ -1473,7 +1469,7 @@ s/\[(.?.?.?.?)$tagsubf(.*?)]/$1$subfieldvalue$2\[$1$tagsubf$2]/g;
             }
         }    # notforloan, item level and biblioitem level
         my ( $availableitemscount, $onloanitemscount, $otheritemscount );
-        $maxitems =
+        my $maxitems =
           ( C4::Context->preference('maxItemsinSearchResults') )
           ? C4::Context->preference('maxItemsinSearchResults') - 1
           : 1;
diff --git a/admin/systempreferences.pl b/admin/systempreferences.pl
index c9f6b35..a6352c5 100755
--- a/admin/systempreferences.pl
+++ b/admin/systempreferences.pl
@@ -202,6 +202,7 @@ $tabsysprefs{language}      = "I18N/L10N";
 $tabsysprefs{defaultSortField}        = "Searching";
 $tabsysprefs{defaultSortOrder}        = "Searching";
 $tabsysprefs{numSearchResults}        = "Searching";
+$tabsysprefs{maxItemsinSearchResults} = "Searching";
 $tabsysprefs{OPACdefaultSortField}    = "Searching";
 $tabsysprefs{OPACdefaultSortOrder}    = "Searching";
 $tabsysprefs{OPACItemsResultsDisplay} = "Searching";
diff --git a/installer/data/mysql/en/mandatory/sysprefs.sql b/installer/data/mysql/en/mandatory/sysprefs.sql
index 47a0c4b..929e05b 100644
--- a/installer/data/mysql/en/mandatory/sysprefs.sql
+++ b/installer/data/mysql/en/mandatory/sysprefs.sql
@@ -131,6 +131,7 @@ INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES
 INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('WebBasedSelfCheck',0,'If ON, enables the web-based self-check system',NULL,'YesNo');
 INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('numSearchResults',20,'Specify the maximum number of results to display on a page of results',NULL,'Integer');
 INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('OPACnumSearchResults',20,'Specify the maximum number of results to display on a page of results',NULL,'Integer');
+INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('maxItemsinSearchResult',2,'Specify the maximum number of grouped items to show per status on the search results pages.  Items are grouped by status, library, location, item type, and call number.',NULL,'Integer');
 INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('defaultSortField',NULL,'Specify the default field used for sorting','relevance|popularity|call_number|pubdate|acqdate|title|author','Choice');
 INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('defaultSortOrder',NULL,'Specify the default sort order','asc|dsc|az|za','Choice');
 INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('OPACdefaultSortField',NULL,'Specify the default field used for sorting','relevance|popularity|call_number|pubdate|acqdate|title|author','Choice');
-- 
1.5.6.3



More information about the Koha-patches mailing list