Bug 29908 - Warning when empty ClaimReturnedWarningThreshold in patron_messages.inc
Summary: Warning when empty ClaimReturnedWarningThreshold in patron_messages.inc
Status: Pushed to stable
Alias: None
Product: Koha
Classification: Unclassified
Component: Patrons (show other bugs)
Version: Main
Hardware: All All
: P5 - low minor
Assignee: Fridolin Somers
QA Contact: Marcel de Rooy
URL:
Keywords:
Depends on: 14697
Blocks: 25790
  Show dependency treegraph
 
Reported: 2022-01-19 20:59 UTC by Fridolin Somers
Modified: 2025-11-25 16:30 UTC (History)
3 users (show)

See Also:
GIT URL:
Initiative type: ---
Sponsorship status: ---
Comma delimited list of Sponsors:
Crowdfunding goal: 0
Patch complexity: Trivial patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
25.11.00,25.05.06
Circulation function:


Attachments
Bug 29908: Remove warning when empty ClaimReturnedWarningThreshold in patron_messages.inc (3.83 KB, patch)
2025-10-14 10:04 UTC, Fridolin Somers
Details | Diff | Splinter Review
Bug 29908: Remove warning when empty ClaimReturnedWarningThreshold in patron_messages.inc (3.90 KB, patch)
2025-10-14 11:33 UTC, Kyle M Hall (khall)
Details | Diff | Splinter Review
Bug 29908: Remove warning when empty ClaimReturnedWarningThreshold in patron_messages.inc (3.98 KB, patch)
2025-11-04 13:18 UTC, Marcel de Rooy
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Fridolin Somers 2022-01-19 20:59:07 UTC
System preference ClaimReturnedWarningThreshold manages the display of a patron message in case of too many claims.
But this preference may be empty.
This generates a warning :

Argument "" isn't numeric in numeric gt (>) at /kohadevbox/koha/koha-tmpl/intranet-tmpl/prog/en/includes/patron_messages.inc line 128.

Default value should be considered has 0 or infinite ?

Before Bug 27873 code was in templates, bug still applies.
Comment 1 Fridolin Somers 2025-10-13 13:36:59 UTC
> Default value should be considered has 0 or infinite ?
OK I see it means 0.
Comment 2 Fridolin Somers 2025-10-14 10:04:23 UTC
Created attachment 187860 [details] [review]
Bug 29908: Remove warning when empty ClaimReturnedWarningThreshold in patron_messages.inc

System preference ClaimReturnedWarningThreshold manages the display of a patron message in case of too many claims.
But this preference may be empty. It is created empty in installer/data/mysql/mandatory/sysprefs.sql.

This generates a warning :
Argument "" isn't numeric in numeric gt (>) at /kohadevbox/koha/koha-tmpl/intranet-tmpl/prog/en/includes/patron_messages.inc line 128.

Test plan :
1) Set systempreference 'ClaimReturnedWarningThreshold' empty
2) Go to a patron details page
3) Check there is no warning in logs
4) Go to a patron check-out page
5) Check there is no warning in logs
6) Set systempreference 'ClaimReturnedWarningThreshold' with an integer (ie 5)
Repeat from 2)
Comment 3 Kyle M Hall (khall) 2025-10-14 11:33:58 UTC
Created attachment 187884 [details] [review]
Bug 29908: Remove warning when empty ClaimReturnedWarningThreshold in patron_messages.inc

System preference ClaimReturnedWarningThreshold manages the display of a patron message in case of too many claims.
But this preference may be empty. It is created empty in installer/data/mysql/mandatory/sysprefs.sql.

This generates a warning :
Argument "" isn't numeric in numeric gt (>) at /kohadevbox/koha/koha-tmpl/intranet-tmpl/prog/en/includes/patron_messages.inc line 128.

Test plan :
1) Set systempreference 'ClaimReturnedWarningThreshold' empty
2) Go to a patron details page
3) Check there is no warning in logs
4) Go to a patron check-out page
5) Check there is no warning in logs
6) Set systempreference 'ClaimReturnedWarningThreshold' with an integer (ie 5)
Repeat from 2)

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 4 Marcel de Rooy 2025-10-17 09:46:51 UTC
('ClaimReturnedWarningThreshold', '', '', 'Sets the number of return claims past which the librarian will be warned the patron has many return claims', 'Integer'),

Why not correct it and add a dbrev?
Comment 5 Fridolin Somers 2025-11-04 07:08:35 UTC
(In reply to Marcel de Rooy from comment #4)
> ('ClaimReturnedWarningThreshold', '', '', 'Sets the number of return claims
> past which the librarian will be warned the patron has many return claims',
> 'Integer'),
> 
> Why not correct it and add a dbrev?

I see there are several other system preferences type integer that starts with empty string.
('DefaultLongOverdueChargeValue', '', NULL, "Charge a lost item to the borrower's account when the LOST value of the item changes to n.", 'integer'),
('DefaultLongOverdueDays', '', NULL, "Set the LOST value of an item when the item has been overdue for more than n days.", 'integer'),
('DefaultLongOverdueLostValue', '', NULL, "Set the LOST value of an item to n when the item has been overdue for more than defaultlongoverduedays days.", 'integer'),

It allows to make a difference between unset preference and set with value 0.

In my opinion better create a strong code.
Comment 6 Marcel de Rooy 2025-11-04 13:16:09 UTC
(In reply to Fridolin Somers from comment #5)
> (In reply to Marcel de Rooy from comment #4)
> I see there are several other system preferences type integer that starts
> with empty string.
> ('DefaultLongOverdueChargeValue', '', NULL, "Charge a lost item to the
> borrower's account when the LOST value of the item changes to n.",
> 'integer'),
> ('DefaultLongOverdueDays', '', NULL, "Set the LOST value of an item when the
> item has been overdue for more than n days.", 'integer'),
> ('DefaultLongOverdueLostValue', '', NULL, "Set the LOST value of an item to
> n when the item has been overdue for more than defaultlongoverduedays
> days.", 'integer'),
> 
> It allows to make a difference between unset preference and set with value 0.

The examples above make a difference with empty string or NULL. But this pref does not.

But I will pass QA on it altogether. This does not need that much attention.
Comment 7 Marcel de Rooy 2025-11-04 13:18:05 UTC
Created attachment 189011 [details] [review]
Bug 29908: Remove warning when empty ClaimReturnedWarningThreshold in patron_messages.inc

System preference ClaimReturnedWarningThreshold manages the display of a patron message in case of too many claims.
But this preference may be empty. It is created empty in installer/data/mysql/mandatory/sysprefs.sql.

This generates a warning :
Argument "" isn't numeric in numeric gt (>) at /kohadevbox/koha/koha-tmpl/intranet-tmpl/prog/en/includes/patron_messages.inc line 128.

Test plan :
1) Set systempreference 'ClaimReturnedWarningThreshold' empty
2) Go to a patron details page
3) Check there is no warning in logs
4) Go to a patron check-out page
5) Check there is no warning in logs
6) Set systempreference 'ClaimReturnedWarningThreshold' with an integer (ie 5)
Repeat from 2)

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Comment 8 Lucas Gass (lukeg) 2025-11-07 17:55:30 UTC
Nice work everyone!

Pushed to main for 25.11
Comment 9 Paul Derscheid 2025-11-25 16:30:24 UTC
Nice work everyone!

Pushed to 25.05.x