Bug 29139: Only pass the offsets for lines the credit was applied to
authorTomas Cohen Arazi <tomascohen@theke.io>
Thu, 30 Sep 2021 13:02:20 +0000 (10:02 -0300)
committerKyle Hall <kyle@bywatersolutions.com>
Fri, 8 Oct 2021 13:51:58 +0000 (09:51 -0400)
commit6870273c65799259b3b99e1609b4cc5ec75b0974
tree17a3f57acbd00977eae2c5cdd39262d6c50c6953
parent229a68144afd1de143bfb915694b0b00f45874cd
Bug 29139: Only pass the offsets for lines the credit was applied to

On writing the regression tests, I noticed the CREATE offset was added
to the template. The idea behind passing the offsets is that we can
print information about the lines that got the credit applied. Having
the CREATE offset is meaningless, and (worse) would require users to add
logic to skip it. And all the payment information is already passed in
the 'credit' variable anyway.

This patch filters the credit_offsets by type, leaving the APPLY ones
only.

To test:
1. Apply up to the regression tests
2. Run:
   $ kshell
  k$ prove t/db_dependent/Koha/Account.t
=> FAIL: 3 offsets, including the CREATE one, boo!
3. Apply this patch
4. Repeat 2
=> SUCCESS: Tests pass! Only the two APPLY offsets are returned!
5. Sign off :-D

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Koha/Account.pm