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.
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
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>
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>
Trivial and clear fix, works as expected, no regressions found and QA scripts happy. PQA
Pushed to master for 22.05, thanks to everybody involved [U+1F984]
Pushed to 21.11.x for 21.11.06
Not backported to oldoldstable (21.05.x). Feel free to ask if it's needed.
Warning cleanup, no documentation change required.