]> git.koha-community.org Git - koha.git/commit
Bug 20942: Split debit and credit lines
authorTomas Cohen Arazi <tomascohen@theke.io>
Mon, 25 Jun 2018 17:55:30 +0000 (14:55 -0300)
committerMartin Renvoize <martin.renvoize@ptfs-europe.com>
Thu, 2 Aug 2018 17:03:36 +0000 (18:03 +0100)
commit66faf4dd1c0397e7873985a446f536e36694716f
tree00dea3f95dc99a4b10d7dd475f6e020f6d97f2f0
parent477cee1ae93307a0257001514d8f2d693fe2dcdd
Bug 20942: Split debit and credit lines

This patch splits the balance to match this object schema:

{
    balance             => #,
    outstanding_credits => {
        total => #,
        lines => [ credit_line_1, ..., credit_line_n ]
    },
    outstanding_debits  => {
        total => #,
        lines => [ debit_line_1, ..., debit_line_m ]
    }
}

This change is made to ease usage from the UI. Also because the
outstanding credits need to be applied to outstanding debits in order to
the balance value to make sense. So we still need to have each total.

Tests are added for this change, and the schema files are adjusted as
well.

To test:
- Apply this patch
- Run:
  $ kshell
 k$ prove t/db_dependent/api/v1/patrons_accounts.t
=> SUCCESS: Tests pass!
- Sign off :-D

staff_id is changed into user_id as voted on the dev meeting the RFC got
approved.

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
(cherry picked from commit bb7c908dc06697a4ebbf8633897d24e26798cb6d)
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Koha/REST/V1/Patrons/Account.pm
api/v1/swagger/definitions/account_line.json
api/v1/swagger/definitions/patron_balance.json
t/db_dependent/api/v1/patrons_accounts.t