Bug 28053

Summary: Warning in C4::Members::patronflags
Product: Koha Reporter: Martin Renvoize <martin.renvoize>
Component: Architecture, internals, and plumbingAssignee: Martin Renvoize <martin.renvoize>
Status: CLOSED FIXED QA Contact: Joonas Kylmälä <joonas.kylmala>
Severity: minor    
Priority: P5 - low CC: andrewfh, fridolin.somers, joonas.kylmala, victor
Version: masterKeywords: Academy
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: Trivial patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
21.05.00,20.11.05,20.05.11
Attachments: Bug 28053: Squash warning in C4::Members
Bug 28053: Squash warning in C4::Members
Bug 28053: Squash warning in C4::Members

Description Martin Renvoize 2021-03-30 11:15:06 UTC
We compare $guarantees_non_issues_charges without always giving it a value first in C4::Members::patronflags.

This can cause the code to throw a 'Use of uninitialized value $guarantees_non_issues_charges in numeric gt (>) at /home/martin/kohaclone/C4/Members.pm line 183.' warning in the logs, especially when running tests.
Comment 1 Martin Renvoize 2021-03-30 11:18:26 UTC
Created attachment 118989 [details] [review]
Bug 28053: Squash warning in C4::Members

This patch sets guarantess_non_issues_charges to '0' upon creation of
the variable and thus prevents 'Use of uninitialized value
$guarantees_non_issues_charges in numeric gt (>) at
/home/martin/kohaclone/C4/Members.pm line 183.' being thrown when the
patron has guaruntees without any charges.

Test plan
1. Run t/db_dependant/SIP/SIPServer.t and note the warning above is
   thrown at least once.
2. Apply the patch
3. Run the test again and note the warning has gone.
Comment 2 Peter Vashchuk 2021-03-30 11:57:37 UTC
Created attachment 118995 [details] [review]
Bug 28053: Squash warning in C4::Members

This patch sets guarantess_non_issues_charges to '0' upon creation of
the variable and thus prevents 'Use of uninitialized value
$guarantees_non_issues_charges in numeric gt (>) at
/home/martin/kohaclone/C4/Members.pm line 183.' being thrown when the
patron has guaruntees without any charges.

Test plan
1. Run t/db_dependent/SIP/SIPServer.t and note the warning above is
   thrown at least once.
2. Apply the patch
3. Run the test again and note the warning has gone.

Signed-off-by: Petro Vashchuk <stalkernoid@gmail.com>
Comment 3 Joonas Kylmälä 2021-04-01 07:57:00 UTC
Created attachment 119063 [details] [review]
Bug 28053: Squash warning in C4::Members

This patch sets guarantess_non_issues_charges to '0' upon creation of
the variable and thus prevents 'Use of uninitialized value
$guarantees_non_issues_charges in numeric gt (>) at
/home/martin/kohaclone/C4/Members.pm line 183.' being thrown when the
patron has guaruntees without any charges.

Test plan
1. Run t/db_dependant/SIP/SIPServer.t and note the warning above is
   thrown at least once.
2. Apply the patch
3. Run the test again and note the warning has gone.

Signed-off-by: Petro Vashchuk <stalkernoid@gmail.com>
Signed-off-by: Joonas Kylmälä <joonas.kylmala@helsinki.fi>
Comment 4 Joonas Kylmälä 2021-04-01 07:57:51 UTC
It was not mentioned in the test plan but NoIssuesChargeGuarantees needs to be defined for the warning to trigger. Passing QA.
Comment 5 Jonathan Druart 2021-04-01 16:55:50 UTC
Pushed to master for 21.05, thanks to everybody involved!
Comment 6 Fridolin Somers 2021-04-15 10:23:35 UTC
Pushed to 20.11.x for 20.11.05
Comment 7 Andrew Fuerste-Henry 2021-04-24 16:24:38 UTC
Pushed to 20.05.x for 20.05.11
Comment 8 Victor Grousset/tuxayo 2021-04-24 17:14:17 UTC
Not backported to oldoldstable (19.11.x). Feel free to ask if it's needed.