Bug 31274 - OPACSuggestionAutoFill must be 1 or 0
Summary: OPACSuggestionAutoFill must be 1 or 0
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Architecture, internals, and plumbing (show other bugs)
Version: unspecified
Hardware: All All
: P5 - low major (vote)
Assignee: Tomás Cohen Arazi
QA Contact: Testopia
URL:
Keywords:
Depends on: 14242
Blocks:
  Show dependency treegraph
 
Reported: 2022-08-01 13:19 UTC by Jonathan Druart
Modified: 2023-06-08 22:26 UTC (History)
5 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Trivial patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
22.11.00, 22.05.06


Attachments
Bug 31274: Make sure OPACSuggestionAutoFill is handled as a boolean everywhere (3.42 KB, patch)
2022-08-01 14:43 UTC, Tomás Cohen Arazi
Details | Diff | Splinter Review
Bug 31274: Make sure OPACSuggestionAutoFill is handled as a boolean everywhere (3.49 KB, patch)
2022-08-01 22:48 UTC, Aleisha Amohia
Details | Diff | Splinter Review
Bug 31274: Make sure OPACSuggestionAutoFill is handled as a boolean everywhere (3.55 KB, patch)
2022-08-02 05:01 UTC, Jonathan Druart
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Jonathan Druart 2022-08-01 13:19:52 UTC
It's "yes" or "no".
Comment 1 Jonathan Druart 2022-08-01 14:02:58 UTC
The pref must be 0 or 1 in DB. We need to adjust the pref file, sysprefs.sql and update the existing value

We shouldn't adjust the controllers.
Comment 2 Tomás Cohen Arazi 2022-08-01 14:43:14 UTC
Created attachment 138476 [details] [review]
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>
Comment 3 Aleisha Amohia 2022-08-01 22:48:30 UTC
Created attachment 138488 [details] [review]
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>
Comment 4 Jonathan Druart 2022-08-02 05:01:15 UTC
Created attachment 138492 [details] [review]
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>
Comment 5 Tomás Cohen Arazi 2022-08-02 12:43:52 UTC
Pushed to master for 22.11.

Nice work everyone, thanks!
Comment 6 Lucas Gass 2022-09-29 16:15:50 UTC
Backported to 22.05.x for 22.05.06
Comment 7 Arthur Suzuki 2022-10-12 13:14:11 UTC
Bug14242 not being present in 21.11.x, there is no reason to backport that one.
Won't backport unless specifically asked to.