From 5557efed3c4d50bbab34ebaabc716e530c8c0d92 Mon Sep 17 00:00:00 2001 From: Tomas Cohen Arazi Date: Wed, 11 Feb 2015 00:07:28 -0300 Subject: [PATCH] Bug 10848: (QA followup) use the 'multiple' syspref type instead This patch makes the feature use the 'multiple' syspref type. It does so by changing the type in opac.pref and fixing the relevant files that are used to insert the data on the DB. It also changes opac-suggestions.pl to use ',0 as separator, as used by the 'multiple' syspref type. To test: - Verify there's no behaviour change besides the change in the sysprefs definition. Signed-off-by: Tomas Cohen Arazi --- installer/data/mysql/sysprefs.sql | 2 +- installer/data/mysql/updatedatabase.pl | 2 +- .../prog/en/modules/admin/preferences/opac.pref | 17 ++++++++++++----- opac/opac-suggestions.pl | 2 +- 4 files changed, 15 insertions(+), 8 deletions(-) diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql index 4959058..47bb6e8 100644 --- a/installer/data/mysql/sysprefs.sql +++ b/installer/data/mysql/sysprefs.sql @@ -305,7 +305,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` ('OPACShowUnusedAuthorities','1','','Show authorities that are not being used in the OPAC.','YesNo'), ('OpacStarRatings','all','disable|all|details',NULL,'Choice'), ('OpacSuggestionManagedBy',1,'','Show the name of the staff member who managed a suggestion in OPAC','YesNo'), -('OPACSuggestionMandatoryFields','',NULL,'Define the mandatory fields for a patron purchase suggestions made via OPAC.','free'), +('OPACSuggestionMandatoryFields','',NULL,'Define the mandatory fields for a patron purchase suggestions made via OPAC.','multiple'), ('OpacSuppression','0','','Turn ON the OPAC Suppression feature, requires further setup, ask your system administrator for details','YesNo'), ('OpacSuppressionByIPRange','','','Restrict the suppression to IP adresses outside of the IP range','free'), ('OpacSuppressionMessage','','Display this message on the redirect page for suppressed biblios','70|10','Textarea'), diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index f6340ab..9abc523 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -9761,7 +9761,7 @@ if ( CheckVersion($DBversion) ) { $DBversion = "3.19.00.XXX"; if (CheckVersion($DBversion)) { - $dbh->do("INSERT INTO systempreferences (variable,value,options,explanation,type) VALUES('OPACSuggestionMandatoryFields', '', 'NULL', 'Define the mandatory fields for a patron purchase suggestions made via OPAC.', 'Free');"); + $dbh->do("INSERT INTO systempreferences (variable,value,options,explanation,type) VALUES('OPACSuggestionMandatoryFields', '', 'NULL', 'Define the mandatory fields for a patron purchase suggestions made via OPAC.', 'multiple');"); print "Upgrade to $DBversion done (Bug 10848 - Allow configuration of mandatory/required fields on the suggestion form in OPAC)\n"; SetVersion($DBversion); } 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 2b0e0e1..14dafe2 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 @@ -535,12 +535,19 @@ OPAC: yes: Allow - patrons to select library when making a purchase suggestion - - - "Fields (separated with |) that should be mandatory for patron purchase suggestions:" + - "Fields that should be mandatory for patron purchase suggestions:" - pref: OPACSuggestionMandatoryFields - class: multi - - "
Field names you can set here as mandatory for OPAC suggestions include: author, copyrightdate," - - "isbn, publishercode, collectiontitle, place, note, itemtype and patronreason." - - "Note: title field would be always implicitly required, no need to enter it here." + multiple: + author: Author + copyrightdate: Copyright date + isbn: ISBN + publishercode: Publisher code + collectiontitle: Collection title + place: Place + note: Note + itemtype: Item type + patronreason: Patron reason + - "(Note: title field would be always implicitly required, no need to enter it here)." - - pref: OpacHiddenItems type: textarea diff --git a/opac/opac-suggestions.pl b/opac/opac-suggestions.pl index 86a38e6..565c46d 100755 --- a/opac/opac-suggestions.pl +++ b/opac/opac-suggestions.pl @@ -176,7 +176,7 @@ my $mandatoryfields = ''; }; my %fh = map { ($_ && $supported_rf->{$_})? ('"'.$_.'"', 1): (); - } (split(/\s*\|\s*/, $fldsreqsp)); + } (split(/\s*\,\s*/, $fldsreqsp)); $fh{'"title"'} = 1; $mandatoryfields = join(',', (sort keys %fh)); } -- 2.3.0