Bug 30366 - Warn when running automatic_item_modification_by_age.pl
Summary: Warn when running automatic_item_modification_by_age.pl
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Installation and upgrade (command-line installer) (show other bugs)
Version: master
Hardware: All All
: P5 - low minor (vote)
Assignee: Fridolin Somers
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks: 25790
  Show dependency treegraph
 
Reported: 2022-03-26 23:31 UTC by Katrin Fischer
Modified: 2023-06-08 22:26 UTC (History)
4 users (show)

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


Attachments
Bug 30366: Remove warn when running automatic_item_modification_by_age.pl (1.58 KB, patch)
2022-04-25 20:44 UTC, Fridolin Somers
Details | Diff | Splinter Review
Bug 30366: Remove warn when running automatic_item_modification_by_age.pl (1.63 KB, patch)
2022-04-26 13:44 UTC, Owen Leonard
Details | Diff | Splinter Review
Bug 30366: Remove warn when running automatic_item_modification_by_age.pl (1.69 KB, patch)
2022-04-26 13:56 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 Katrin Fischer 2022-03-26 23:31:25 UTC
When using the ./misc/cronjobs/automatic_item_modification_by_age.pl -v after setting up rules under tools > Automatic item modifications by age the script outputs several lines of warnings:

With patch from 22827:
Use of uninitialized value in string eq at /kohadevbox/koha/C4/Items.pm line 1856.

Master as of today:
Use of uninitialized value in string eq at /kohadevbox/koha/C4/Items.pm line 1852.
Comment 1 Fridolin Somers 2022-04-25 20:44:38 UTC
Created attachment 133844 [details] [review]
Bug 30366: Remove warn when running automatic_item_modification_by_age.pl

When using the ./misc/cronjobs/automatic_item_modification_by_age.pl -v
after setting up rules under Tools > Automatic item modifications by age
the script outputs several lines of warnings:
Use of uninitialized value in string eq at /kohadevbox/koha/C4/Items.pm line 1864.

This is because even when there is no condition defined, modification rule is stored with empty hash, like :
[{"substitutions":[{"field":"items.new_status","value":"0"}],"conditions":[{}],"age":"60","agefield":"items.dateaccessioned"}]

Test plan :
1) Go to Tools > Automatic item modifications by age
2) Create a rule with no conditions, just a substitution
3) Run misc/cronjobs/automatic_item_modification_by_age.pl -v
4) Check there is no warning
5) Edit the rule to add a condition
6) Run misc/cronjobs/automatic_item_modification_by_age.pl -v
7) Check the condition is applied
Comment 2 Owen Leonard 2022-04-26 13:44:17 UTC
Created attachment 133899 [details] [review]
Bug 30366: Remove warn when running automatic_item_modification_by_age.pl

When using the ./misc/cronjobs/automatic_item_modification_by_age.pl -v
after setting up rules under Tools > Automatic item modifications by
age the script outputs several lines of warnings:

Use of uninitialized value in string eq at /kohadevbox/koha/C4/Items.pm
line 1864.

This is because even when there is no condition defined, modification
rule is stored with empty hash, like :
[{"substitutions":[{"field":"items.new_status","value":"0"}],"conditions":[{}],"age":"60","agefield":"items.dateaccessioned"}]

Test plan :
1) Go to Tools > Automatic item modifications by age
2) Create a rule with no conditions, just a substitution
3) Run misc/cronjobs/automatic_item_modification_by_age.pl -v
4) Check there is no warning
5) Edit the rule to add a condition
6) Run misc/cronjobs/automatic_item_modification_by_age.pl -v
7) Check the condition is applied

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Comment 3 Martin Renvoize 2022-04-26 13:56:08 UTC
Created attachment 133901 [details] [review]
Bug 30366: Remove warn when running automatic_item_modification_by_age.pl

When using the ./misc/cronjobs/automatic_item_modification_by_age.pl -v
after setting up rules under Tools > Automatic item modifications by
age the script outputs several lines of warnings:

Use of uninitialized value in string eq at /kohadevbox/koha/C4/Items.pm
line 1864.

This is because even when there is no condition defined, modification
rule is stored with empty hash, like :
[{"substitutions":[{"field":"items.new_status","value":"0"}],"conditions":[{}],"age":"60","agefield":"items.dateaccessioned"}]

Test plan :
1) Go to Tools > Automatic item modifications by age
2) Create a rule with no conditions, just a substitution
3) Run misc/cronjobs/automatic_item_modification_by_age.pl -v
4) Check there is no warning
5) Edit the rule to add a condition
6) Run misc/cronjobs/automatic_item_modification_by_age.pl -v
7) Check the condition is applied

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 4 Martin Renvoize 2022-04-26 13:56:43 UTC
Trivial and clear fix, works as expected, no regressions found and QA scripts happy.

PQA
Comment 5 Fridolin Somers 2022-05-02 21:24:28 UTC
Pushed to master for 22.05, thanks to everybody involved 🦄
Comment 6 Kyle M Hall 2022-05-13 15:46:55 UTC
Pushed to 21.11.x for 21.11.06
Comment 7 Victor Grousset/tuxayo 2022-06-23 01:44:50 UTC
Not backported to oldoldstable (21.05.x). Feel free to ask if it's needed.
Comment 8 Martin Renvoize 2022-06-23 13:49:13 UTC
Warning cleanup, no documentation change required.