Bug 34279: Don't enforce overduefinescap unless it is greater than 0
authorKyle M Hall <kyle@bywatersolutions.com>
Fri, 14 Jul 2023 11:36:47 +0000 (07:36 -0400)
committerFridolin Somers <fridolin.somers@biblibre.com>
Tue, 8 Aug 2023 06:05:46 +0000 (20:05 -1000)
commit662da18be2ec7c6c9348a704d9ad8ac955292862
tree4ef493370e5f3ac81cc003ba41da463d0fe3e788
parent3e360c5637c1f910100e10f049823fda01f588d9
Bug 34279: Don't enforce overduefinescap unless it is greater than 0

When creating a circ rule, we can set overduefinescap to blank or 0 and no cap is enforced. If we edit that rule, the blank/0 is converted to "0.00" which perl considers true, thus zero-ing out any calculated fine.

Considering we've always ignored an overdue fines cap of 0, we should also ignore 0.00. However, perl is evaluating it as a string which makes it true instead of false as 0 is.

Test Plan:
1) Apply the first patch ( unit tests )
2) prove t/db_dependent/Circulation/CalcFine.t
3) Note the test fails
4) Apply the second patch as well
5) prove t/db_dependent/Circulation/CalcFine.t
6) Note the test passes

Test Plan 2:
1) Create an all/all/all rule with an overduefinescap of 0.00, with a
   daily fine. Enable CalculateFinesOnReturn
2) Backdate a checkout so it is overdue
3) Return this item, note the lack of a fine
4) Apply this patch set
5) Backdate a checkout and return it again
6) Note the fine is generated!

Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
(cherry picked from commit 1763b136d1dcd3348ee26bca8663823b5a05f07c)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
C4/Overdues.pm
t/db_dependent/Circulation/CalcFine.t