Bug 21980

Summary: Add some new Exceptions for Koha::Account methods
Product: Koha Reporter: Martin Renvoize <martin.renvoize>
Component: Architecture, internals, and plumbingAssignee: Martin Renvoize <martin.renvoize>
Status: CLOSED FIXED QA Contact: Tomás Cohen Arazi <tomascohen>
Severity: enhancement    
Priority: P5 - low CC: nick, tomascohen
Version: master   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: Trivial patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Bug Depends on:    
Bug Blocks: 21002, 21727    
Attachments: Bug 21980: Add new excpetions for Koha::Account
Bug 21980: Add new excpetions for Koha::Account
Bug 21980: Add new excpetions for Koha::Account

Description Martin Renvoize 2018-12-10 11:51:35 UTC
We aren't validating as much as we should in the add_credit and upcoming add_debut and adjust methods in the Koha::Account classes.  This bug adds a couple of new exceptions for such cases.
Comment 1 Martin Renvoize 2018-12-10 12:04:55 UTC
Created attachment 83008 [details] [review]
Bug 21980: Add new excpetions for Koha::Account

He add two new exceptions here; One to be thrown when negative 'amount'
is passed into verious account methods that always expect positive
decimals and another to be thrown when a bad 'type' is passed into an
account method.
Comment 2 Martin Renvoize 2018-12-10 12:25:22 UTC
This patch was split out from bug 21002 to prevent 21002 from blocking bug 21727.  It is a trivial patch adding 2 new exceptions.
Comment 3 Tomás Cohen Arazi 2018-12-11 14:50:40 UTC
Created attachment 83046 [details] [review]
Bug 21980: Add new excpetions for Koha::Account

He add two new exceptions here; One to be thrown when negative 'amount'
is passed into verious account methods that always expect positive
decimals and another to be thrown when a bad 'type' is passed into an
account method.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Comment 4 Tomás Cohen Arazi 2018-12-11 14:53:42 UTC
This trivial enhancement can skip QA.
Comment 5 Martin Renvoize 2018-12-12 09:01:35 UTC
Created attachment 83085 [details] [review]
Bug 21980: Add new excpetions for Koha::Account

He add two new exceptions here; One to be thrown when negative 'amount'
is passed into verious account methods that always expect positive
decimals and another to be thrown when a bad 'type' is passed into an
account method.

Sponsored-by: PTFS Europe
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Comment 6 Nick Clemens 2019-01-09 01:17:10 UTC
Awesome work all!

Pushed to master for 19.05
Comment 7 Martin Renvoize 2019-01-14 14:00:42 UTC
Enhancement, this will not be backported for 18.11.x at the moment.