Uploaded image for project: 'CiviCRM'
  1. CiviCRM
  2. CRM-17281

Pledges miscalculate when total amount is not an integer and a payment is received that covers three installments

    Details

    • Type: Bug
    • Status: Done/Fixed
    • Priority: Minor
    • Resolution: Fixed/Completed
    • Affects Version/s: 4.4.7, 4.6.7, 4.6.9, 4.7.9
    • Fix Version/s: 4.7.25
    • Component/s: CiviPledge
    • Labels:
    • Versioning Impact:
      Patch (backwards-compatible bug fixes)
    • Documentation Required?:
      None
    • Sprint:
      4.7.10 Pledges, 4.7.14 Pledges
    • Funding Source:
      Contributed Code

      Description

      Hi again guys,

      Reproduced on the demo site - attached screen shots show progression.

      To reproduce:

      1. Create a pledge with a fractional dollar amount (e.g. 1618.80) for 12 installments
      2. Enter a payment that covers 3 installments
      3. Third installment shows $0 due in pending status against which a payment can be recorded (see pending_installment1)

      I played around with a few different sequences, payments that cover 1, 2, 4 and 5 installments all work as expected (completing all installments covered), it's just when you enter a payment that covers three installments that the pledge misbehaves if the total pledge is for a fractional dollar amount (see pending_installment2).

      I was about to test with a whole dollar pledge amount but the demo site went into maintenance mode, so I tested in our 4.6.7 dev environment - when the total amount of the pledge is an integer, the issue didn't occur (e.g. $1,200 in 12 monthly installments, first payment of $300 covered first 3 installments, all 3 were marked as completed as expected).

      That said, for our clients, fractional dollar amount pledges and receiving quarterly amounts for pledges set up for 10 or 12 installments are both very common occurrences.

      The client that reported this issue left the $0 pending installment untouched, and continued to report payments as they came in on subsequent expected installments - the $0 installment was eventually marked as overdue by the system, as was the entire pledge even though it was paid in full - you can record a $0 contribution against the $0 expected installment which will put things back in order, but this isn't intuitive.

      As I was recreating this scenario to provide you with a screen shot from our 4.6.7 dev environment, I stumbled upon something that I think is the cause of miscalculating pledges that has been plaguing us for quite some time, but I couldn't for the life of me figure out a pattern, until now!

      To reproduce:

      1. Create a pledge with a non-whole dollar amount (e.g. 1900.80) for 12 installments
      2. Enter a payment that covers 3 installments (e.g. 475.20)
      3. Third installment shows $0 due in pending status against which a payment can be recorded as previously explained
      4. Leaving the $0 pending installment untouched, continue to record individual payments (e.g. $158.40) against subsequent installments - they are marked completed as expected, while the $0 pending installment together with the pledge will eventually become overdue (see pending_installment3)
      5. Curious to see if any other multiples would cause the same issue, I recorded a payment that would cover 6 installments (e.g. $950.40), and the problem got bigger (see pending_installment4)
      6. The system applied the contribution to the pending/overdue $0 installment as one of the 6 installments being paid and marked it as completed, but left two pending installments (e.g. for a total of $316.80), while the total balance of $158.40 is calculated correctly on the pledge line.

      OK, I think I'm done for tonight! Look forward to hearing from you on this one....

      Thanks as always,
      Tamar

        Attachments

        1. pending_installment1.jpg
          151 kB
          Tamar Meir
        2. pending_installment2.jpg
          137 kB
          Tamar Meir
        3. pending_installment3.jpg
          158 kB
          Tamar Meir
        4. pending_installment4.jpg
          296 kB
          Tamar Meir

          Activity

            People

            • Assignee:
              mlutfy Mathieu Lutfy
              Reporter:
              tamar Tamar Meir
            • Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: