Bug 21607

Summary: Koha::Account::Line->apply should store credit offsets as negative amounts
Product: Koha Reporter: Tomás Cohen Arazi <tomascohen>
Component: Architecture, internals, and plumbingAssignee: Tomás Cohen Arazi <tomascohen>
Status: CLOSED FIXED QA Contact: Testopia <testopia>
Severity: major    
Priority: P5 - low CC: jonathan.druart, kyle, martin.renvoize, nick, tomascohen
Version: Main   
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: 20997    
Bug Blocks: 13098, 21646, 22837    
Attachments: Bug 21607: Make Koha::Account::Line->apply store credits as negative amounts
Bug 21607: Make Koha::Account::Line->apply store credits as negative amounts
Bug 21607: Make Koha::Account::Line->apply store credits as negative amounts
Bug 21621: Remove incorrect GROUP BY from tools/letter.pl

Description Tomás Cohen Arazi 2018-10-18 14:38:46 UTC
It incorrectly sets positive values, which are internally considered debits in Koha. This should be fixed ASAP so 18.11 doesn't include the bug (it is the first release to have this code).
Comment 1 Tomás Cohen Arazi 2018-10-18 14:41:30 UTC
Created attachment 80858 [details] [review]
Bug 21607: Make Koha::Account::Line->apply store credits as negative amounts

This is a trivial patch, that makes offsets have 'amount' stored as
negative values for applied credits.

The behaviour is changed on the tests and adjusted in the code. To test:
- Run
  $ kshell
 k$ prove t/db_dependent/Koha/Account/Lines.t
=> SUCCESS: Tests pass!
- Sign off :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Comment 2 Michal Denar 2018-10-18 18:42:27 UTC
Created attachment 80874 [details] [review]
Bug 21607: Make Koha::Account::Line->apply store credits as negative amounts

This is a trivial patch, that makes offsets have 'amount' stored as
negative values for applied credits.

The behaviour is changed on the tests and adjusted in the code. To test:
- Run
  $ kshell
 k$ prove t/db_dependent/Koha/Account/Lines.t
=> SUCCESS: Tests pass!
- Sign off :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Michal Denar <black23@gmail.com>
Comment 3 Martin Renvoize 2018-10-19 14:48:35 UTC
Created attachment 80938 [details] [review]
Bug 21607: Make Koha::Account::Line->apply store credits as negative amounts

This is a trivial patch, that makes offsets have 'amount' stored as
negative values for applied credits.

The behaviour is changed on the tests and adjusted in the code. To test:
- Run
  $ kshell
 k$ prove t/db_dependent/Koha/Account/Lines.t
=> SUCCESS: Tests pass!
- Sign off :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Michal Denar <black23@gmail.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 4 Martin Renvoize 2018-10-19 14:49:29 UTC
I concur.. passing qa
Comment 5 Nick Clemens 2018-10-19 17:42:26 UTC
Awesome work all!

Pushed to master for 18.11
Comment 6 Pierre-Marc Thibault 2018-10-19 18:07:20 UTC Comment hidden (obsolete)
Comment 7 Martin Renvoize 2018-10-24 11:42:47 UTC
Looks like this went to the wrong bug Pierre ;)
Comment 8 Martin Renvoize 2018-11-06 10:19:27 UTC
Bug not present in 18.05.x series.