Bug 31274: Make sure OPACSuggestionAutoFill is handled as a boolean everywhere
The YAML preference definition defines it as a string ('yes' or 'no' the
possible values). And the opac-suggestions.tt template has one occurence
of the variable being compared to a string.
This patch does:
- fix the template
- fixes opac.pref for 0|1
- adds an atomicupdate that takes care of moving 'yes' and 'no' to their
respective boolean values.
To test:
1. Change the syspref value to enable/disable
2. Check on the DB that the value is wrong:
$ koha-mysql kohadev
> SELECT value FROM systempreferences WHERE variable='OPACSuggestionAutoFill';
=> FAIL: It is either 'yes' or 'no' depending on what you choose.
3. Apply this patch
4. Run:
$ updatedatabase
5. Repeat 2
=> SUCCESS: Values are now 0 or 1
6. Sign off :-D
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Aleisha Amohia <aleishaamohia@hotmail.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 1c0b7bf01f)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
This commit is contained in:
parent
558ee09dd5
commit
44c7010fc1
|
|
@ -0,0 +1,20 @@
|
|||
use Modern::Perl;
|
||||
|
||||
return {
|
||||
bug_number => "31274",
|
||||
description => "OPACSuggestionAutoFill must be 1 or 0",
|
||||
up => sub {
|
||||
my ($args) = @_;
|
||||
my ($dbh, $out) = @$args{qw(dbh out)};
|
||||
|
||||
$dbh->do(q{
|
||||
UPDATE systempreferences
|
||||
SET value = CASE
|
||||
WHEN value='no' THEN 0
|
||||
WHEN value='yes' THEN 1
|
||||
ELSE value
|
||||
END
|
||||
WHERE variable='OPACSuggestionAutoFill';
|
||||
});
|
||||
},
|
||||
};
|
||||
|
|
@ -518,8 +518,8 @@ OPAC:
|
|||
- pref: OPACSuggestionAutoFill
|
||||
default: 0
|
||||
choices:
|
||||
yes: Enable
|
||||
no: Disable
|
||||
1: Enable
|
||||
0: Disable
|
||||
- OPAC suggestions form automatically filling with data from Google Books API.
|
||||
-
|
||||
- "Use the following as the OPAC ISBD template:"
|
||||
|
|
|
|||
|
|
@ -497,7 +497,7 @@
|
|||
|
||||
[% INCLUDE 'opac-bottom.inc' %]
|
||||
[% BLOCK jsinclude %]
|
||||
[% IF ( Koha.Preference("OPACSuggestionAutoFill") != 'no' ) %]
|
||||
[% IF Koha.Preference("OPACSuggestionAutoFill") %]
|
||||
[% Asset.js("js/autofill.js") | $raw %]
|
||||
[% END %]
|
||||
[% INCLUDE 'datatables.inc' %]
|
||||
|
|
|
|||
Loading…
Reference in New Issue