Bugzilla – Attachment 138492 Details for
Bug 31274
OPACSuggestionAutoFill must be 1 or 0
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 31274: Make sure OPACSuggestionAutoFill is handled as a boolean everywhere
Bug-31274-Make-sure-OPACSuggestionAutoFill-is-hand.patch (text/plain), 3.55 KB, created by
Jonathan Druart
on 2022-08-02 05:01:15 UTC
(
hide
)
Description:
Bug 31274: Make sure OPACSuggestionAutoFill is handled as a boolean everywhere
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2022-08-02 05:01:15 UTC
Size:
3.55 KB
patch
obsolete
>From 48fa394c4f92961aa6b5497b21025a1e21f42e68 Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Mon, 1 Aug 2022 11:38:01 -0300 >Subject: [PATCH] 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> >--- > .../data/mysql/atomicupdate/bug_31274.pl | 20 +++++++++++++++++++ > .../en/modules/admin/preferences/opac.pref | 4 ++-- > .../bootstrap/en/modules/opac-suggestions.tt | 2 +- > 3 files changed, 23 insertions(+), 3 deletions(-) > create mode 100755 installer/data/mysql/atomicupdate/bug_31274.pl > >diff --git a/installer/data/mysql/atomicupdate/bug_31274.pl b/installer/data/mysql/atomicupdate/bug_31274.pl >new file mode 100755 >index 00000000000..0f2865dc60c >--- /dev/null >+++ b/installer/data/mysql/atomicupdate/bug_31274.pl >@@ -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'; >+ }); >+ }, >+}; >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 d7d1649a3f3..c9e25aa478e 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 >@@ -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:" >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-suggestions.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-suggestions.tt >index cdc7927a5c5..9cfd86c2f1d 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-suggestions.tt >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-suggestions.tt >@@ -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' %] >-- >2.25.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 31274
:
138476
|
138488
| 138492