Bug 26593: Remove _get_discount_from_rule
authorNick Clemens <nick@bywatersolutions.com>
Thu, 19 Nov 2020 15:46:52 +0000 (15:46 +0000)
committerFridolin Somers <fridolin.somers@biblibre.com>
Thu, 14 Jan 2021 16:20:37 +0000 (17:20 +0100)
commit50ac537d92e4596451f1b673364b74df01ddc629
tree07b0cd03c00e76c8fa55379e048a2709c4639536
parentf6ef3c80d3cda7ddabd415b4377fc2b17a704747
Bug 26593: Remove _get_discount_from_rule

This patch remove the private sub used in GetIssuingCharges in favor
of get_effective_rule

It corrects the wrong precedence for rules and adds tests to cover this
subroutine

NOTE: the 'branch' for the discount will be determined by the signed in branch,
    this is a bug to be fixed in the future

To test:
1 - Define a rentalcharge for an itemtype
2 - Define a 10% discount for library A, category A, all itemtypes
3 - Define a 50% discount for all libraries, category A, same itemtype
4 - Attempt to checkout an item from library A of the matching itemtype
5 - The 50% discount is applied
6 - Apply patches
7 - Attempt to checkout an item from library A of the matching itemtype
8 - The 10% discount is applied

prove -v t/db_dependent/Circulation.t

Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
(cherry picked from commit c055685ac4f59b2a83730c67792c6fb3c81d2123)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
C4/Circulation.pm
t/db_dependent/Circulation.t