Bug 31274: Make sure OPACSuggestionAutoFill is handled as a boolean everywhere
authorTomas Cohen Arazi <tomascohen@theke.io>
Mon, 1 Aug 2022 14:38:01 +0000 (11:38 -0300)
committerTomas Cohen Arazi <tomascohen@theke.io>
Tue, 2 Aug 2022 12:29:08 +0000 (09:29 -0300)
commit1c0b7bf01fabe7dfa558b29a7549c39a6f627c18
tree59a0a09e4ae62bdbce4cbc017dd8e768d2d37830
parentbd268aa7d5ef8dd1a9183ad6567613c31bd9efb0
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>
installer/data/mysql/atomicupdate/bug_31274.pl [new file with mode: 0755]
koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref
koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-suggestions.tt