From 76cba1122df3bf891388e2e0dfd630218e5470c9 Mon Sep 17 00:00:00 2001 From: Srikanth Dhondi Date: Fri, 9 Nov 2012 15:51:53 +1300 Subject: [PATCH] Bug 9043 - Changes to the advanced search page Added system preferences to enable control of elements that are to be displayed on the advanced search page. * New system preferences were added to control the display of a) Publication date range b) Item type selection c) Language selection d) Location and Availability e) Sorting options f) Subtype limits elements. * This patch preserves the current default settings. --- installer/data/mysql/sysprefs.sql | 6 +++ installer/data/mysql/updatedatabase.pl | 12 ++++++ .../prog/en/modules/admin/preferences/opac.pref | 45 ++++++++++++++++++++ .../opac-tmpl/prog/en/modules/opac-advsearch.tt | 19 ++++++++- opac/opac-search.pl | 9 ++++ 5 files changed, 89 insertions(+), 2 deletions(-) diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql index 9032bfa..700b9ad 100644 --- a/installer/data/mysql/sysprefs.sql +++ b/installer/data/mysql/sysprefs.sql @@ -411,3 +411,9 @@ INSERT INTO systempreferences (variable,value,options,explanation,type) VALUES ( INSERT IGNORE INTO systempreferences (variable,value,explanation,options,type) VALUES('IDreamBooksReviews','0','Display book review snippets from IDreamBooks.com','','YesNo'); INSERT IGNORE INTO systempreferences (variable,value,explanation,options,type) VALUES('IDreamBooksReadometer','0','Display Readometer from IDreamBooks.com','','YesNo'); INSERT IGNORE INTO systempreferences (variable,value,explanation,options,type) VALUES('IDreamBooksResults','0','Display IDreamBooks.com rating in search results','','YesNo'); +INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('OpacAdvSearchItemType','both','Choose whether or not to show Item Type selection options on Fewer and More options pages','neither|moreonly|both','Choice'); +INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('OpacAdvSearchLanguage','both','Choose whether or not to show Langague selection options on Fewer and More options pages','neither|moreonly|both','Choice'); +INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('OpacAdvSearchLocation','both','Choose whether or not to show Location Availability selection options on Fewer and More options pages','neither|moreonly|both','Choice'); +INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('OpacAdvSearchPubDate','both','Choose whether or not to show Publication Date Range selection options on Fewer and More options pages','neither|moreonly|both','Choice'); +INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('OpacAdvSearchSorting','both','Choose whether or not to show the Sorting options on Fewer and More options pages','neither|moreonly|both','Choice'); +INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('OpacAdvSearchSubtype','moreonly','Choose whether or not to show the Subtype Limiting options on Fewer and More options pages','neither|moreonly|both','Choice'); diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index ed922b8..bad50e3 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -6400,6 +6400,18 @@ if ( CheckVersion($DBversion) ) { } +$DBversion = 'XXX'; +if (C4::Context->preference("Version") < TransformToNum($DBversion)) { + $dbh->do("INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('OpacAdvSearchItemType','both','Choose whether or not to show Item Type selection options on Fewer and More options pages','neither|moreonly|both','Choice');"); + $dbh->do("INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('OpacAdvSearchLanguage','both','Choose whether or not to show Langague selection options on Fewer and More options pages','neither|moreonly|both','Choice');"); + $dbh->do("INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('OpacAdvSearchLocation','both','Choose whether or not to show Location Availability selection options on Fewer and More options pages','neither|moreonly|both','Choice');"); + $dbh->do("INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('OpacAdvSearchPubDate','both','Choose whether or not to show Publication Date Range selection options on Fewer and More options pages','neither|moreonly|both','Choice');"); + $dbh->do("INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('OpacAdvSearchSorting','both','Choose whether or not to show the Sorting options on Fewer and More options pages','neither|moreonly|both','Choice');"); + $dbh->do("INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('OpacAdvSearchSubtype','moreonly','Choose whether or not to show the Subtype Limiting options on Fewer and More options pages','neither|moreonly|both','Choice');"); + print "Upgrade to $DBversion done (Add OpacAdvSearchItemType, OpacAdvSearchLanguage, OpacAdvSearchLocation, OpacAdvSearchPubDate, OpacAdvSeachSorting, and OpacAdvSeachSubtype to syspref)\n"; + SetVersion ($DBversion); +} + =head1 FUNCTIONS =head2 TableExists($table) 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 300c6e1..0d15f36 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 @@ -573,3 +573,48 @@ OPAC: - pref: PatronSelfRegistrationBorrowerUnwantedField class: multi - (separate columns with |) + - "the item collection code when finding items for the shelf browser." + + Advanced Search Options: + - + - "Show item type search options" + - pref: OpacAdvSearchItemType + choices: + neither: never + moreonly: only on More Options page + both: always + - + - "Show publication date range search options" + - pref: OpacAdvSearchPubDate + choices: + neither: never + moreonly: only on More Options page + both: always + - + - "Show language search options" + - pref: OpacAdvSearchLanguage + choices: + neither: never + moreonly: only on More Options page + both: always + - + - "Show location and availability search options" + - pref: OpacAdvSearchLocation + choices: + neither: never + moreonly: only on More Options page + both: always + - + - "Show sorting search options" + - pref: OpacAdvSearchSorting + choices: + neither: never + moreonly: only on More Options page + both: always + - + - "Show subtype search limits" + - pref: OpacAdvSearchSubtype + choices: + neither: never + moreonly: only on More Options page + both: always diff --git a/koha-tmpl/opac-tmpl/prog/en/modules/opac-advsearch.tt b/koha-tmpl/opac-tmpl/prog/en/modules/opac-advsearch.tt index be2a6f7..c78d216 100644 --- a/koha-tmpl/opac-tmpl/prog/en/modules/opac-advsearch.tt +++ b/koha-tmpl/opac-tmpl/prog/en/modules/opac-advsearch.tt @@ -129,6 +129,7 @@ [New search] +[% IF OpacAdvSearchPubDate == "both" || ( OpacAdvSearchPubDate == "moreonly" && expanded_options) %]
@@ -140,6 +141,9 @@
+[% END %] + +[% IF OpacAdvSearchItemType == "both" || (OpacAdvSearchItemType == "moreonly" && expanded_options) %]
    @@ -172,6 +176,9 @@
[% END %]
+ [% END %] + +[% IF OpacAdvSearchLanguage == "both" || ( OpacAdvSearchLanguage == "moreonly" && expanded_options) %]
Language @@ -189,7 +196,9 @@
-[% IF ( expanded_options ) %] + [% END %] + +[% IF OpacAdvSeachSubtype == "both" || ( OpacAdvSeachSubtype == "moreonly" && expanded_options) %] [% IF ( usmarc ) %]
@@ -261,9 +270,11 @@
[% INCLUDE 'subtypes_unimarc.inc' %]
[% END %] -[% END %] +[% END %]
+ +[% IF OpacAdvSearchLocation == "both" || ( OpacAdvSearchLocation == "moreonly" && expanded_options) %]
@@ -296,6 +307,9 @@ [% END %]
+[% END %] + +[% IF OpacAdvSeachSorting == "both" || ( OpacAdvSeachSorting == "moreonly" && expanded_options) %]
Sorting: @@ -305,6 +319,7 @@
+[% END %]
diff --git a/opac/opac-search.pl b/opac/opac-search.pl index 97a7bc4..bcfd5e4 100755 --- a/opac/opac-search.pl +++ b/opac/opac-search.pl @@ -128,6 +128,15 @@ $template->param( 'AllowOnShelfHolds' => C4::Context->preference('AllowOnShelfHo $template->param( 'OPACNoResultsFound' => C4::Context->preference('OPACNoResultsFound') ); $template->param( + 'OpacAdvSearchItemType' => C4::Context->preference('OpacAdvSearchItemType'), + 'OpacAdvSearchPubDate' => C4::Context->preference('OpacAdvSearchPubDate'), + 'OpacAdvSearchLanguage' => C4::Context->preference('OpacAdvSearchLanguage'), + 'OpacAdvSearchLocation' => C4::Context->preference('OpacAdvSearchLocation'), + 'OpacAdvSeachSorting' => C4::Context->preference('OpacAdvSearchSorting'), + 'OpacAdvSeachSubtype' => C4::Context->preference('OpacAdvSearchSubtype'), +); + +$template->param( OpacStarRatings => C4::Context->preference("OpacStarRatings") ); if (C4::Context->preference('BakerTaylorEnabled')) { -- 1.7.9.5