Bug 29755: Check each NoIssuesCharge separately
authorNick Clemens <nick@bywatersolutions.com>
Thu, 10 Feb 2022 14:30:02 +0000 (14:30 +0000)
committerFridolin Somers <fridolin.somers@biblibre.com>
Sat, 7 May 2022 01:58:13 +0000 (15:58 -1000)
commitf747d38aead414e77e5c367742c9e39a8042f689
treebb81a8f8b9e530c00bd72f829f6e2385d80541da
parenta36145eb8db0f1322fa87b8fef676971551932af
Bug 29755: Check each NoIssuesCharge separately

This patch updates SIP patron code to use account methods to calculate balances
over the patronflags returns. It also checks if patron should be blocked for each
'No Issues charge' preference

Tests are added for NoIssuesChargeGuarantees

To test:
 1 - Set noissuescharge preference to 5
 2 - Add a $10 charge to a patron
 3 - perl misc/sip_cli_emulator.pl -a localhost -p 6001 -su term1 -sp term1 -l CPL -m patron_information --patron BARCODE
 4 - Note the 64 message starts with Y's that mean patron is blocked
 5 - Set noissuescharge to 11
 6 - Repeat 3, patron is no longer blocked
 7 - Set NoIssuesChargeGuarantees to 8
 8 - Repeat 3, patron is blocked
 9 - Pay $3 on patron so they owe 7
10 - Repeat 3, patron is not blocked
11 - Add a child account with patron as guarantor
12 - Repeat 3, patron is not blocked
13 - Add a $4 charge to child
14 - Repeat 3, patron is blocked
15 - Repeat 3, but with child barcode, child is not blocked
16 - Set NoIssuesChargeGuarantorsWithGuarantees to 10
17 - Repeat 3, patron is blocked
18 - Repeat 3 with child barcode, child is blocked

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
C4/SIP/ILS/Patron.pm
t/db_dependent/SIP/Patron.t