From 2e7b37fba1c435f95b6385e0ef8ca7c5ebb0cb26 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Mon, 17 Nov 2014 16:55:26 +0100 Subject: [PATCH] [SIGNED-OFF] Bug 9043: The comma (,) should be kept to separate multi-valuated prefs Content-Type: text/plain; charset="utf-8" The prefs language and opaclanguages used the comma to separate the different values. The new prefs OpacAdvSearchMoreOptions and OpacAdvSearchOptions should do the same. To reproduce the issue: update the language pref (or opaclanguages) and refresh the page. => The pref values are not checked anymore and the language selection (bottom of the page) does not appear. Test plan: 1/ Verify that the behavior described above is fixed. 2/ Verify that the original test plan of bug 9043 still passes. Note: The 2 OpacAdvSearchMoreOptions and OpacAdvSearchOptions pref values are overwritten but the feature have just been pushed recently. It should not affect a production environment. Signed-off-by: Owen Leonard I was able to reproduce the issue and verify that this patch corrected the problem. Langage selection and OpacAdvSearchOptions worked correctly. --- admin/preferences.pl | 2 +- installer/data/mysql/sysprefs.sql | 4 ++-- installer/data/mysql/updatedatabase.pl | 14 ++++++++++++++ opac/opac-search.pl | 4 ++-- svc/config/systempreferences | 2 +- 5 files changed, 20 insertions(+), 6 deletions(-) diff --git a/admin/preferences.pl b/admin/preferences.pl index 00cf115..f791095 100755 --- a/admin/preferences.pl +++ b/admin/preferences.pl @@ -106,7 +106,7 @@ sub _get_chunk { keys %{ $options{'choices'} } ]; } elsif ( $options{'multiple'} ) { - my @values = split /\|/, $value; + my @values = split /,/, $value; $chunk->{type} = 'multiple'; $chunk->{CHOICES} = [ sort { $a->{'text'} cmp $b->{'text'} } diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql index 097f609..4fb8cbd 100644 --- a/installer/data/mysql/sysprefs.sql +++ b/installer/data/mysql/sysprefs.sql @@ -229,8 +229,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'), +('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 3542685..a4a4220 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -9505,6 +9505,20 @@ CREATE TABLE borrower_sync ( SetVersion($DBversion); } +$DBversion = "3.17.00.XXX"; +if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) { + $dbh->do(q{ + UPDATE systempreferences SET value = 'pubdate,itemtype,language,sorting,location' WHERE variable='OpacAdvSearchOptions' + }); + + $dbh->do(q{ + UPDATE systempreferences SET value = 'pubdate,itemtype,language,subtype,sorting,location' WHERE variable='OpacAdvSearchMoreOptions' + }); + + print "Upgrade to $DBversion done (Bug 9043 - Update the values for OpacAdvSearchOptions and OpacAdvSearchOptions)\n"; + SetVersion($DBversion); +} + =head1 FUNCTIONS =head2 TableExists($table) diff --git a/opac/opac-search.pl b/opac/opac-search.pl index 86d0a57..e01193a 100755 --- a/opac/opac-search.pl +++ b/opac/opac-search.pl @@ -307,8 +307,8 @@ if ( $template_type && $template_type eq 'advsearch' ) { } - my @advsearch_limits = split /\|/, C4::Context->preference('OpacAdvSearchOptions'); - my @advsearch_more_limits = split /\|/, + 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 diff --git a/svc/config/systempreferences b/svc/config/systempreferences index 6fceb97..deeca51 100755 --- a/svc/config/systempreferences +++ b/svc/config/systempreferences @@ -95,7 +95,7 @@ sub set_preferences { next if ( !defined( $pref ) ); - my $value = join( '|', $query->param( $param ) ); + my $value = join( ',', $query->param( $param ) ); C4::Context->set_preference( $pref, $value ); logaction( 'SYSTEMPREFERENCE', 'MODIFY', undef, $pref . " | " . $value ); -- 1.7.9.5