From 09eb9be26222ef399f27a273ca177f14548aba03 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 | 46 +++++++++++++++++++- .../opac-tmpl/prog/en/modules/opac-advsearch.tt | 19 +++++++- opac/opac-search.pl | 9 ++++ 5 files changed, 89 insertions(+), 3 deletions(-) diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql index a4e4102..5f7409f 100644 --- a/installer/data/mysql/sysprefs.sql +++ b/installer/data/mysql/sysprefs.sql @@ -386,3 +386,9 @@ INSERT INTO systempreferences (variable,value,explanation,type) VALUES('OPACdidy INSERT INTO systempreferences (variable,value,explanation,type) VALUES('INTRAdidyoumean',NULL,'Did you mean? configuration for the Intranet. Do not change, as this is controlled by /cgi-bin/koha/admin/didyoumean.pl.','Free'); INSERT INTO systempreferences (variable, value, options, explanation, type) VALUES ('BlockReturnOfWithdrawnItems', '1', '0', 'If enabled, items that are marked as withdrawn cannot be returned.', 'YesNo'); INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('HoldsToPullStartDate','2','Set the default start date for the Holds to pull list to this many days ago',NULL,'Integer'); +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('OpacAdvSeachSorting','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('OpacAdvSeachSubtype','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 f7e34eb..1184fc1 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -6049,6 +6049,18 @@ if (C4::Context->preference("Version") < TransformToNum($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('OpacAdvSeachSorting','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('OpacAdvSeachSubtype','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 1a9fa09..c043bb7 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 @@ -526,4 +526,48 @@ OPAC: choices: yes: Use no: "Don't use" - - "the item collection code when finding items for the shelf browser." + - "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: OpacAdvSeachSorting + choices: + neither: never + moreonly: only on More Options page + both: always + - + - "Show subtype search limits" + - pref: OpacAdvSeachSubtype + 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 55eea18..80e4766 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 ) %]
@@ -257,9 +266,11 @@
[% INCLUDE 'subtypes_unimarc.inc' %]
[% END %] -[% END %] +[% END %]
+ +[% IF OpacAdvSearchLocation == "both" || ( OpacAdvSearchLocation == "moreonly" && expanded_options) %]
@@ -292,6 +303,9 @@ [% END %]
+[% END %] + +[% IF OpacAdvSeachSorting == "both" || ( OpacAdvSeachSorting == "moreonly" && expanded_options) %]
Sorting: @@ -301,6 +315,7 @@
+[% END %]
diff --git a/opac/opac-search.pl b/opac/opac-search.pl index 7677d86..95a100c 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('OpacAdvSeachSorting'), + 'OpacAdvSeachSubtype' => C4::Context->preference('OpacAdvSeachSubtype'), +); + +$template->param( OpacStarRatings => C4::Context->preference("OpacStarRatings") ); if (C4::Context->preference('BakerTaylorEnabled')) { -- 1.7.9.5