Bug 27676 - finesMode=off not correctly handled
Summary: finesMode=off not correctly handled
Status: RESOLVED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Architecture, internals, and plumbing (show other bugs)
Version: master
Hardware: All All
: P5 - low major (vote)
Assignee: Jonathan Druart
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks: 22824
  Show dependency treegraph
 
Reported: 2021-02-11 10:20 UTC by Jonathan Druart
Modified: 2021-06-14 21:34 UTC (History)
4 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Text to go in the release notes:
Version(s) released in:
21.05.00,20.11.03,20.05.09,19.11.15


Attachments
Bug 27676: Correct finesMode ne off condition (1.59 KB, patch)
2021-02-11 10:25 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 27676: Correct finesMode ne off condition (1.66 KB, patch)
2021-02-11 13:29 UTC, Martin Renvoize
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Jonathan Druart 2021-02-11 10:20:43 UTC
finesMode is 'off' by default (sysprefs.sql), but if you modify its value from the UI and set it to 'production' then back to 'off', the DB value becomes an empty string '', because of $YAML::Syck::ImplicitTyping
Comment 1 Jonathan Druart 2021-02-11 10:25:07 UTC
Created attachment 116700 [details] [review]
Bug 27676: Correct finesMode ne off condition

finesMode is 'off' by default (sysprefs.sql), but if you modify its value from
the UI and set it to 'production' then back to 'off', the DB value becomes an
empty string '', because of $YAML::Syck::ImplicitTyping

This has been found when working on on removing YAML::Syck (bug 22824),
so it's not perfect but the situation will be cleared in the follow-up
bug report.

Test plan:
0. Don't apply the patch
1. reset_all
=> finesMode eq 'off' in DB
2. Set the pref's value to production
3. Switch it back to 'off'
4. Value is '' in DB
5. Check an item in that should generate overdue charges
=> Charges are not generated
6. Apply the patch
7. Check an item in that should generate overdue charges
=> Charges are generated
Comment 2 Martin Renvoize 2021-02-11 13:29:49 UTC
Created attachment 116719 [details] [review]
Bug 27676: Correct finesMode ne off condition

finesMode is 'off' by default (sysprefs.sql), but if you modify its value from
the UI and set it to 'production' then back to 'off', the DB value becomes an
empty string '', because of $YAML::Syck::ImplicitTyping

This has been found when working on on removing YAML::Syck (bug 22824),
so it's not perfect but the situation will be cleared in the follow-up
bug report.

Test plan:
0. Don't apply the patch
1. reset_all
=> finesMode eq 'off' in DB
2. Set the pref's value to production
3. Switch it back to 'off'
4. Value is '' in DB
5. Check an item in that should generate overdue charges
=> Charges are not generated
6. Apply the patch
7. Check an item in that should generate overdue charges
=> Charges are generated

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 3 Martin Renvoize 2021-02-11 13:31:00 UTC
Good catch!

I've checked other occurrences of finesMode and none of them fail in this way.

Simple, trivial, patch that works as expected.

Going straight for QA here.

Passed.
Comment 4 Jonathan Druart 2021-02-12 11:19:04 UTC
Pushed to master for 21.05, thanks to everybody involved!
Comment 5 Fridolin Somers 2021-02-12 14:55:08 UTC
Pushed to 20.11.x for 20.11.03
Comment 6 Andrew Fuerste-Henry 2021-02-18 14:41:48 UTC
Correcting a typo in the test plan (charge behavior was backwards between 5 and 7):
Test plan:
0. Don't apply the patch
1. reset_all
=> finesMode eq 'off' in DB
2. Set the pref's value to production
3. Switch it back to 'off'
4. Value is '' in DB
5. Check an item in that should generate overdue charges
=> Charges are generated
6. Apply the patch
7. Check an item in that should generate overdue charges
=> Charges are not generated
Comment 7 Andrew Fuerste-Henry 2021-02-18 14:43:53 UTC
Pushed to 20.05.x for 20.05.09
Comment 8 Victor Grousset/tuxayo 2021-02-21 02:59:04 UTC
Backported: Pushed to 19.11.x branch for 19.11.15