Bug 18344

Summary: Overdue fines 'cap at replacement price' and 'cap by amount' should work together
Product: Koha Reporter: Kyle M Hall (khall) <kyle>
Component: CirculationAssignee: Kyle M Hall (khall) <kyle>
Status: CLOSED FIXED QA Contact: Marcel de Rooy <m.de.rooy>
Severity: minor    
Priority: P5 - low CC: fridolin.somers, gmcharlt, kyle.m.hall, lucas, m.de.rooy, martin.renvoize, mfuerst, nick, sandboxes, techservspec, wizzyrea
Version: Main   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: Small patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
19.11.00,19.05.01
Circulation function:
Attachments: Bug 18344 - Allow overdue fines cap at replacement price, and cap by amount to work together
Bug 18344 - Allow overdue fines cap at replacement price, and cap by amount to work together
Bug 18344 - Allow overdue fines cap at replacement price, and cap by amount to work together
Bug 18344 - Allow overdue fines cap at replacement price, and cap by amount to work together
Bug 18344 - Unit tests
Bug 18344: Allow overdue fines cap at replacement price, and cap by amount to work together
Bug 18344: Add unit tests

Description Kyle M Hall (khall) 2017-03-28 11:04:51 UTC
There is no reason that a library shouldn't be able to use the monetary fines cap and the replacement price cap at the same time. The code is written in such a way that they already work harmoniously. We have librarians who wish to use both so they can set a high cap of $10.00 but also use the replacement price cap so that a $20.00 book would only get a fine of $10.00, but a $5.00 paperback will only get a fine of $5.00
Comment 1 Kyle M Hall (khall) 2017-03-28 11:08:41 UTC
Created attachment 61658 [details] [review]
Bug 18344 - Allow overdue fines cap at replacement price, and cap by amount to work together

There is no reason that a library shouldn't be able to use the monetary
fines cap and the replacement price cap at the same time. The code is
written in such a way that they already work harmoniously. We have
librarians who wish to use both so they can set a high cap of $10.00 but
also use the replacement price cap so that a $20.00 book would only get
a fine of $10.00, but a $5.00 paperback will only get a fine of $5.00

Test Plan:
1) Apply this patch
2) Create a rule with a fines cap of $10, *and* a cap at replacement price, and a daily fine of $1
3) Create two items, one with a replacement price of $5 and one with a
   replacement price of $15
4) Check out these items to a patron, backdate the checkouts so they are
   already overdue by a couple months
5) Check the items in ( make sure calc fine at checkin is enabled for
    you )
6) Note the one item has a fine of $5 and the other has a fine of $10!
Comment 2 Biblibre Sandboxes 2017-04-15 19:26:11 UTC
Patch tested with a sandbox, by David Kuhn <techservspec@gmail.com>
Comment 3 Biblibre Sandboxes 2017-04-15 19:26:31 UTC
Created attachment 62190 [details] [review]
Bug 18344 - Allow overdue fines cap at replacement price, and cap by amount to work together

There is no reason that a library shouldn't be able to use the monetary
fines cap and the replacement price cap at the same time. The code is
written in such a way that they already work harmoniously. We have
librarians who wish to use both so they can set a high cap of $10.00 but
also use the replacement price cap so that a $20.00 book would only get
a fine of $10.00, but a $5.00 paperback will only get a fine of $5.00

Test Plan:
1) Apply this patch
2) Create a rule with a fines cap of $10, *and* a cap at replacement price, and a daily fine of $1
3) Create two items, one with a replacement price of $5 and one with a
   replacement price of $15
4) Check out these items to a patron, backdate the checkouts so they are
   already overdue by a couple months
5) Check the items in ( make sure calc fine at checkin is enabled for
    you )
6) Note the one item has a fine of $5 and the other has a fine of $10!

Signed-off-by: David Kuhn <techservspec@gmail.com>
Comment 4 Marcel de Rooy 2017-08-04 07:37:43 UTC
Created attachment 65493 [details] [review]
Bug 18344 - Allow overdue fines cap at replacement price, and cap by amount to work together

There is no reason that a library shouldn't be able to use the monetary
fines cap and the replacement price cap at the same time. The code is
written in such a way that they already work harmoniously. We have
librarians who wish to use both so they can set a high cap of $10.00 but
also use the replacement price cap so that a $20.00 book would only get
a fine of $10.00, but a $5.00 paperback will only get a fine of $5.00

Test Plan:
1) Apply this patch
2) Create a rule with a fines cap of $10, *and* a cap at replacement price, and a daily fine of $1
3) Create two items, one with a replacement price of $5 and one with a
   replacement price of $15
4) Check out these items to a patron, backdate the checkouts so they are
   already overdue by a couple months
5) Check the items in ( make sure calc fine at checkin is enabled for
    you )
6) Note the one item has a fine of $5 and the other has a fine of $10!

Signed-off-by: David Kuhn <techservspec@gmail.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Comment 5 Marcel de Rooy 2017-08-04 07:39:11 UTC
Looks good to me.
But I do like to see a test like the one in your test plan added to CalcFine.t too.
Comment 6 Liz Rea 2019-03-25 15:15:05 UTC
*sadface* doesn't apply anymore
Comment 7 Kyle M Hall (khall) 2019-03-25 17:55:59 UTC
Created attachment 86988 [details] [review]
Bug 18344 - Allow overdue fines cap at replacement price, and cap by amount to work together

There is no reason that a library shouldn't be able to use the monetary
fines cap and the replacement price cap at the same time. The code is
written in such a way that they already work harmoniously. We have
librarians who wish to use both so they can set a high cap of $10.00 but
also use the replacement price cap so that a $20.00 book would only get
a fine of $10.00, but a $5.00 paperback will only get a fine of $5.00

Test Plan:
1) Apply this patch
2) Create a rule with a fines cap of $10, *and* a cap at replacement price, and a daily fine of $1
3) Create two items, one with a replacement price of $5 and one with a
   replacement price of $15
4) Check out these items to a patron, backdate the checkouts so they are
   already overdue by a couple months
5) Check the items in ( make sure calc fine at checkin is enabled for
    you )
6) Note the one item has a fine of $5 and the other has a fine of $10!

Signed-off-by: David Kuhn <techservspec@gmail.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Comment 8 Kyle M Hall (khall) 2019-03-25 17:56:10 UTC
Created attachment 86989 [details] [review]
Bug 18344 - Unit tests
Comment 9 Katrin Fischer 2019-05-11 13:41:50 UTC
This is actually a much simpler change than I thought when I had started - it just removed a little bit of JavaScript and adds some tests.
Comment 10 Katrin Fischer 2019-05-11 13:43:51 UTC
Created attachment 89607 [details] [review]
Bug 18344: Allow overdue fines cap at replacement price, and cap by amount to work together

There is no reason that a library shouldn't be able to use the monetary
fines cap and the replacement price cap at the same time. The code is
written in such a way that they already work harmoniously. We have
librarians who wish to use both so they can set a high cap of $10.00 but
also use the replacement price cap so that a $20.00 book would only get
a fine of $10.00, but a $5.00 paperback will only get a fine of $5.00

Test Plan:
1) Apply this patch
2) Create a rule with a fines cap of $10, *and* a cap at replacement price, and a daily fine of $1
3) Create two items, one with a replacement price of $5 and one with a
   replacement price of $15
4) Check out these items to a patron, backdate the checkouts so they are
   already overdue by a couple months
5) Check the items in ( make sure calc fine at checkin is enabled for
    you )
6) Note the one item has a fine of $5 and the other has a fine of $10!

Signed-off-by: David Kuhn <techservspec@gmail.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 11 Katrin Fischer 2019-05-11 13:43:55 UTC
Created attachment 89608 [details] [review]
Bug 18344: Add unit tests

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 12 Martin Renvoize (ashimema) 2019-06-11 09:24:09 UTC
Nice work!

Pushed to master for 19.11.00
Comment 13 Fridolin Somers 2019-06-11 15:30:22 UTC
Pushed to 19.05.x for 19.05.01
Comment 14 Lucas Gass (lukeg) 2019-06-19 19:25:38 UTC
backported to 18.11.x for 18.11.07