Came across those calls in bug 20598 in _FixOverduesOnReturn Koha::Account::Offset->new( { debit_id => $accountline->id, type => 'Forgiven', amount => $amountoutstanding * -1, } ); This does nothing if you don't store data. Not sure about severity or component.
Created attachment 82397 [details] [review] Bug 21849: Two useless Koha::Account::Offset->new calls need attention Came across those calls in bug 20598 in _FixOverduesOnReturn Koha::Account::Offset->new( { debit_id => $accountline->id, type => 'Forgiven', amount => $amountoutstanding * -1, } ); This does nothing if you don't store data. Test Plan: 1) Apply this patch 2) Set up 2 items with overdue fines 3) Return one with dropbox mode 4) Note the dropbox account offset is created 5) Return one with full fine forgiveness 6) Note the forgiven account offset is created
THis is a good opportunity to have tests for this behaviour, in preparation to the replacement of manually adding the accountline and the offset, in favour of Koha::Account methods (add_credit, add_debit and adjust).
(In reply to Tomás Cohen Arazi from comment #2) > THis is a good opportunity to have tests for this behaviour, in preparation > to the replacement of manually adding the accountline and the offset, in > favour of Koha::Account methods (add_credit, add_debit and adjust). Good idea.
Created attachment 82404 [details] [review] Bug 21849: Add unit tests
Created attachment 82919 [details] [review] Bug 21849: Add unit tests Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Created attachment 82920 [details] [review] Bug 21849: Two useless Koha::Account::Offset->new calls need attention Came across those calls in bug 20598 in _FixOverduesOnReturn Koha::Account::Offset->new( { debit_id => $accountline->id, type => 'Forgiven', amount => $amountoutstanding * -1, } ); This does nothing if you don't store data. Test Plan: 1) Apply this patch 2) Set up 2 items with overdue fines 3) Return one with dropbox mode 4) Note the dropbox account offset is created 5) Return one with full fine forgiveness 6) Note the forgiven account offset is created Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Created attachment 82947 [details] [review] Bug 21849: Add unit tests Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Created attachment 82948 [details] [review] Bug 21849: Two useless Koha::Account::Offset->new calls need attention Came across those calls in bug 20598 in _FixOverduesOnReturn Koha::Account::Offset->new( { debit_id => $accountline->id, type => 'Forgiven', amount => $amountoutstanding * -1, } ); This does nothing if you don't store data. Test Plan: 1) Apply this patch 2) Set up 2 items with overdue fines 3) Return one with dropbox mode 4) Note the dropbox account offset is created 5) Return one with full fine forgiveness 6) Note the forgiven account offset is created Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Awesome work all! Pushed to master for 19.05
Pushed to 18.11.x for 18.11.01
backported to 18.05 for 18.05.07
Pushed to 17.11.x for 17.11.14