Bug 28053 - Warning in C4::Members::patronflags
Summary: Warning in C4::Members::patronflags
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Architecture, internals, and plumbing (show other bugs)
Version: Main
Hardware: All All
: P5 - low minor (vote)
Assignee: Martin Renvoize
QA Contact: Joonas Kylmälä
URL:
Keywords: Academy
Depends on:
Blocks:
 
Reported: 2021-03-30 11:15 UTC by Martin Renvoize
Modified: 2021-12-13 21:10 UTC (History)
4 users (show)

See Also:
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 (1.33 KB, patch)
2021-03-30 11:18 UTC, Martin Renvoize
Details | Diff | Splinter Review
Bug 28053: Squash warning in C4::Members (1.39 KB, patch)
2021-03-30 11:57 UTC, Peter Vashchuk
Details | Diff | Splinter Review
Bug 28053: Squash warning in C4::Members (1.53 KB, patch)
2021-04-01 07:57 UTC, Joonas Kylmälä
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
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.