| Summary: | Warn from chargelostitem when no replacement cost set for item | ||
|---|---|---|---|
| Product: | Koha | Reporter: | Nick Clemens (kidclamp) <nick> |
| Component: | Architecture, internals, and plumbing | Assignee: | Nick Clemens (kidclamp) <nick> |
| Status: | CLOSED FIXED | QA Contact: | Joonas Kylmälä <joonas.kylmala> |
| Severity: | normal | ||
| Priority: | P5 - low | CC: | fridolin.somers, joonas.kylmala, lucas |
| Version: | Main | ||
| Hardware: | All | ||
| OS: | All | ||
| GIT URL: | Initiative type: | --- | |
| Sponsorship status: | --- | Comma delimited list of Sponsors: | |
| Crowdfunding goal: | 0 | Patch complexity: | --- |
| Documentation contact: | Documentation submission: | ||
| Text to go in the release notes: | Version(s) released in: |
22.11.00
|
|
| Circulation function: | |||
| Attachments: |
Bug 29184: Fix warn about undefined replacecost
Bug 29184: Fix warn about undefined replacecost Bug 29184: Fix warn about undefined replacecost Bug 29184: Fix warn about undefined replacecost Bug 29184: Fix warn about undefined replacecost |
||
Created attachment 125798 [details] [review] Bug 29184: Fix warn about undefined replacecost This patch simply sets the cost to 0 if undefined To test: 1 - Create a new item with no replacement cost set 2 - Check the item out to a patron 3 - Mark the item lost 4 - Note in plack-intranet-error.log: [2021/10/06 12:43:26] [WARN] Use of uninitialized value $replacementprice in numeric gt (>) at /kohadevbox/koha/C4/Accounts.pm line 114. 5 - Apply patch 6 - Repeat 7 - No warn We see in chargelostitem() :
if ($usedefaultreplacementcost && $amount == 0 && $defaultreplacecost){
Shouldn't we patch with :
$amount = $amount // 0
Items sql table contains :
`replacementprice` decimal(28,6) DEFAULT NULL
So indeed default in undef.
Created attachment 135076 [details] [review] Bug 29184: Fix warn about undefined replacecost This patch simply sets the cost to 0 if undefined To test: 1 - Create a new item with no replacement cost set 2 - Check the item out to a patron 3 - Mark the item lost 4 - Note in plack-intranet-error.log: [2021/10/06 12:43:26] [WARN] Use of uninitialized value $replacementprice in numeric gt (>) at /kohadevbox/koha/C4/Accounts.pm line 114. 5 - Apply patch 6 - Repeat 7 - No warn Doesn't apply anymore and I think we have a bug: $replacementprice is initialized twice (two my $replacementprice). Created attachment 140325 [details] [review] Bug 29184: Fix warn about undefined replacecost This patch simply sets the cost to 0 if undefined To test: 1 - Create a new item with no replacement cost set 2 - Check the item out to a patron 3 - Mark the item lost 4 - Note in plack-intranet-error.log: [2021/10/06 12:43:26] [WARN] Use of uninitialized value $replacementprice in numeric gt (>) at /kohadevbox/koha/C4/Accounts.pm line 114. 5 - Apply patch 6 - Repeat 7 - No warn Created attachment 140335 [details] [review] Bug 29184: Fix warn about undefined replacecost This patch simply sets the cost to 0 if undefined To test: 1 - Create a new item with no replacement cost set 2 - Check the item out to a patron 3 - Mark the item lost 4 - Note in plack-intranet-error.log: [2021/10/06 12:43:26] [WARN] Use of uninitialized value $replacementprice in numeric gt (>) at /kohadevbox/koha/C4/Accounts.pm line 114. 5 - Apply patch 6 - Repeat 7 - No warn Signed-off-by: David Nind <david@davidnind.com> Created attachment 140352 [details] [review] Bug 29184: Fix warn about undefined replacecost This patch simply sets the cost to 0 if undefined To test: 1 - Create a new item with no replacement cost set 2 - Check the item out to a patron 3 - Mark the item lost 4 - Note in plack-intranet-error.log: [2021/10/06 12:43:26] [WARN] Use of uninitialized value $replacementprice in numeric gt (>) at /kohadevbox/koha/C4/Accounts.pm line 114. 5 - Apply patch 6 - Repeat 7 - No warn Signed-off-by: David Nind <david@davidnind.com> Signed-off-by: Joonas Kylmälä <joonas.kylmala@iki.fi> Pushed to master for 22.11. Nice work everyone, thanks! Doesn't apply clean to 22.05.x, no backport |
To recreate: 1 - Create a new item with no replacement cost set 2 - Check the item out to a patron 3 - Mark the item lost 4 - Note in plack-intranet-error.log: [2021/10/06 12:43:26] [WARN] Use of uninitialized value $replacementprice in numeric gt (>) at /kohadevbox/koha/C4/Accounts.pm line 114.