diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql index 75750504b1..ff276081c8 100644 --- a/installer/data/mysql/sysprefs.sql +++ b/installer/data/mysql/sysprefs.sql @@ -223,6 +223,8 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` ('OCLCAffiliateID','','','Use with FRBRizeEditions and XISBN. You can sign up for an AffiliateID here: http://www.worldcat.org/wcpa/do/AffiliateUserServices?method=initSelfRegister','free'), ('OPACAcquisitionDetails','0','','Show the acquisition details at the OPAC','YesNo'), ('OpacAddMastheadLibraryPulldown','0','','Adds a pulldown menu to select the library to search on the opac masthead.','YesNo'), +('OpacAdvSearchMoreOptions','pubdate|itemtype|language|subtype|sorting|location','Show search options for the expanded view (More options)','pubdate|itemtype|language|subtype|sorting|location','multiple'), +('OpacAdvSearchOptions','pubdate|itemtype|language|sorting|location','Show search options','pubdate|itemtype|language|subtype|sorting|location','multiple'), ('OPACAllowHoldDateInFuture','0','','If set, along with the AllowHoldDateInFuture system preference, OPAC users can set the date of a hold to be in the future.','YesNo'), ('OpacAllowPublicListCreation','1',NULL,'If set, allows opac users to create public lists','YesNo'), ('OpacAllowSharingPrivateLists','0',NULL,'If set, allows opac users to share private lists with other patrons','YesNo'), diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index 05ecbbb630..d9b363d046 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -9425,6 +9425,19 @@ if ( CheckVersion($DBversion) ) { SetVersion($DBversion); } +$DBversion = "3.17.00.XXX"; +if ( CheckVersion($DBversion) ) { + $dbh->do(q{ + INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('OpacAdvSearchOptions','pubdate|itemtype|language|sorting|location','Show search options','pubdate|itemtype|language|subtype|sorting|location','multiple'); + }); + + $dbh->do(q{ + INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('OpacAdvSearchMoreOptions','pubdate|itemtype|language|subtype|sorting|location','Show search options for the expanded view (More options)','pubdate|itemtype|language|subtype|sorting|location','multiple'); + }); + print "Upgrade to $DBversion done (Bug 9043: Add system preference OpacAdvSearchOptions and OpacAdvSearchMoreOptions)\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 48fc5c7adc..75791b500a 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 @@ -663,3 +663,24 @@ OPAC: - pref: PatronSelfRegistrationAdditionalInstructions type: textarea class: html + Advanced Search Options: + - + - Show search options + - pref: OpacAdvSearchOptions + multiple: + pubdate: Publication date + itemtype: Item types + language: Language + subtype: Subtypes + sorting: Sorting + location: Location and availability + - + - Show search options for the expanded view + - pref: OpacAdvSearchMoreOptions + multiple: + pubdate: Publication date + itemtype: Item types + language: Language + subtype: Subtypes + sorting: Sorting + location: Location and availability diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-advsearch.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-advsearch.tt index 5beacf4b5c..af9b11134c 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-advsearch.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-advsearch.tt @@ -111,6 +111,7 @@
+ [% IF ( ( OpacAdvSearchOptions.grep('itemtype').size > 0 and not expanded_options ) or ( OpacAdvSearchMoreOptions.grep('itemtype').size > 0 and expanded_options ) ) %]
    @@ -141,8 +142,10 @@ [% END # / FOREACH advancedsearchesloop %]
+ [% END %]
+ [% IF ( ( OpacAdvSearchOptions.grep('pubdate').size > 0 and not expanded_options ) or ( OpacAdvSearchMoreOptions.grep('pubdate').size > 0 and expanded_options ) ) %]
@@ -155,7 +158,9 @@
+ [% END %] + [% IF ( ( OpacAdvSearchOptions.grep('language').size > 0 and not expanded_options ) or ( OpacAdvSearchMoreOptions.grep('language').size > 0 and expanded_options ) ) %]
@@ -178,7 +183,9 @@
+ [% END %] + [% IF ( ( OpacAdvSearchOptions.grep('location').size > 0 and not expanded_options ) or ( OpacAdvSearchMoreOptions.grep('location').size > 0 and expanded_options ) ) %] [% UNLESS ( singleBranchMode ) %]
@@ -214,7 +221,9 @@
[% END # / UNLESS singleBranchMode %] + [% END %] + [% IF ( ( OpacAdvSearchOptions.grep('sorting').size > 0 and not expanded_options ) or ( OpacAdvSearchMoreOptions.grep('sorting').size > 0 and expanded_options ) ) %]
@@ -228,9 +237,10 @@
+ [% END %]
- [% IF ( expanded_options ) %] + [% IF ( ( OpacAdvSearchOptions.grep('subtype').size > 0 and not expanded_options ) or ( OpacAdvSearchMoreOptions.grep('subtype').size > 0 and expanded_options ) ) %]
[% IF ( usmarc ) %] @@ -330,6 +340,7 @@ [% END # / IF expanded_options %]
+ [% IF ( OpacAdvSearchMoreOptions.size > 0 and expanded_options ) or ( OpacAdvSearchOptions.size > 0 and not expanded_options ) %]
@@ -339,7 +350,7 @@
-
+ [% END %] @@ -347,11 +358,13 @@ [% BLOCK searchbuttons %]

- [% IF ( expanded_options ) %] + + [% IF expanded_options %] Fewer options - [% ELSE %] + [% ELSIF not expanded_options %] More options [% END %] + New search

[% END %] diff --git a/opac/opac-search.pl b/opac/opac-search.pl index 0374e1ad29..86d0a57fa4 100755 --- a/opac/opac-search.pl +++ b/opac/opac-search.pl @@ -306,9 +306,17 @@ if ( $template_type && $template_type eq 'advsearch' ) { } } - $template->param(uc( C4::Context->preference("marcflavour")) => 1, # we already did this for UNIMARC - advsearch => 1, - search_boxes_loop => \@search_boxes_array); + + my @advsearch_limits = split /\|/, C4::Context->preference('OpacAdvSearchOptions'); + my @advsearch_more_limits = split /\|/, + C4::Context->preference('OpacAdvSearchMoreOptions'); + $template->param( + uc( C4::Context->preference("marcflavour") ) => 1, # we already did this for UNIMARC + advsearch => 1, + search_boxes_loop => \@search_boxes_array, + OpacAdvSearchOptions => \@advsearch_limits, + OpacAdvSearchMoreOptions => \@advsearch_more_limits, + ); # use the global setting by default if ( C4::Context->preference("expandedSearchOption") == 1 ) {