Bug 31737

Summary: Undef warnings around unseen_renewals_allowed in smart-rules.pl
Product: Koha Reporter: Slava Shishkin <slavashishkin>
Component: CirculationAssignee: Slava Shishkin <slavashishkin>
Status: CLOSED FIXED QA Contact: Testopia <testopia>
Severity: enhancement    
Priority: P5 - low CC: gmcharlt, kevin.carnes, kyle.m.hall, nugged
Version: Main   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:
Bug Depends on: 29012    
Bug Blocks:    
Attachments: Bug 31737: Fix undef warnings around unseen_renewals_allowed in smart-rules.pl

Description Slava Shishkin 2022-10-11 15:53:57 UTC Comment hidden (obsolete)
Comment 1 Slava Shishkin 2022-10-11 15:59:05 UTC
When UnseenRenewals syspref is disabled, the form param is not passed at all when parsed it comes as undef, but the code tries directly to do strip_non_numeric call on it. Thus the 'undef' warnings:

[WARN] Use of uninitialized value $string in substitution (s///) at /kohadevbox/koha/admin/smart-rules.pl line 760.
[WARN] Use of uninitialized value $string in pattern match (m//) at /kohadevbox/koha/admin/smart-rules.pl line 761.
Comment 2 Slava Shishkin 2022-10-11 16:02:50 UTC
Created attachment 141611 [details] [review]
Bug 31737: Fix undef warnings around unseen_renewals_allowed in smart-rules.pl

Trivial fix.

To reproduce:
1. Create or edit a rule on /cgi-bin/koha/admin/smart-rules.pl - i.e. submit the form (make POST request)
2. Notice the mentioned above warning in plack-intranet-error.log
3. Apply the patch.
4. Repeat step 1.
5. That warning in log file should be no more.
Comment 3 Kevin Carnes 2022-10-14 09:31:26 UTC
Thanks for catching this. It's been decided I should update the patch since it hasn't been released yet. I went ahead and included your fix.