Fix double loop on lineItems
authoreileen <emcnaughton@wikimedia.org>
Fri, 1 Nov 2019 02:54:12 +0000 (15:54 +1300)
committereileen <emcnaughton@wikimedia.org>
Tue, 5 Nov 2019 21:01:48 +0000 (10:01 +1300)
commitb40da3286172082342ace1a7b4940e73cdb22114
tree2b79a639b239b9bd972cad2e363c5e4f089f973d
parente02107dacf12faaa4d81df8e316be4c2648245a3
Fix double loop on lineItems

Historically the code followed 2 loops - one for the (very rare) situation when an array of
'line_item' was passed in - in fact this array is an array of arrays where each array represents
the id of a line item and the amount to allocate.

The other loop is the main loop that allocates according to a calculation.

This fixes it so that the allocation is correctly merged in if passed in in
getPayableLineItems and from that point we only need one loop.

This simplification is tested via the testCreatePaymentLineItems
which I cleaned up and made more robust. I was able to step through it and identify how
it was working
CRM/Financial/BAO/Payment.php