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

Record pledge payments different from scheduled amount and modify future pledge payment amounts

    Details

    • Type: New Feature
    • Status: Done/Fixed
    • Priority: Major
    • Resolution: Fixed/Completed
    • Affects Version/s: 3.2
    • Fix Version/s: 3.2.3
    • Component/s: CiviPledge
    • Labels:
      None

      Description

      This modification affects back-office (admin / staff) recording of pledge payments (both Record and "Submit Credit Card payment" modes). Currently, payment amount on the "Record Payment" form is read-only (holds the scheduled payment amount).

      1. Schema changes
      1.1 Add actual_amount paid to pledge payment table

      • Add 'actual_amount' column to civicrm_pledge_payment table to record the amount received. (This is a cache of the amount stored in the linked contribution record - and is being added to prevent performance issues while calculating 'Total Paid' for Pledge selectors and reporting.)
      • Post process is modified for the Contribution form, and for online pledge payments to always record the 'actual amount' in the new pledge_payment column.
      • Pledge selector query is modified to use actual_amount when calculated Total Paid column.
      • Pledge payment selector can be simplified to use actual_amount rather than joining on contribution record
      • If user edits contribution record which is linked to a pledge_payment and modifies the contribution amount, update pledge_payment.actual_amount so records are kept in synch

      1.2 Add original_installment_amount to pledge table
      This will allow us to accurately display the "original" pledge total and payment schedule on Pledge View and Pledge Edit screens regardless of whether subsequent payment adjustments / adjustments to pledged total have been made.

      • Display original pledge total on these screens as a status message if the original pledge total has been modified (screenshot attached).

      2. Adjust pledge payment when recording a payment

      • Add link next to Amount Field -> "adjust payment amount"
      • Clicking this link opens the amount field for input
      • User can enter a different amount (more or less than scheduled amount)
      • Contribution and pledge payment.actual_amount will be set to value entered.
      • If user enters a different amount, show a radio button with two options:
        • [o] Adjust Pledge Payment Schedule?" (default)
        • [ ] Adjust Total Pledge Amount?"
      • If "Adjust Pledge Payment Schedule" is selected - payment schedule is adjusted as follows:
        • If this is NOT the last scheduled payment: add or subtract the difference between expected and actual amount to the NEXT scheduled payment.
        • If this is the last scheduled payment, and payment is LESS than expected: insert one more pledge payment record for the remaining amount due, using the existing payment interval.
        • If this is the last scheduled payment, and payment is MORE than expected: set contribution and pledge payment to amount entered. Also adjust the Total Pledge Amount (civicrm_pledge.amount) to reflect the new total paid. NOTE: The calculated "Amount Paid" value for the pledge will automatically show the actual (larger) amount on pledge listings since it's the same a actual_amount rows.
      • If "Adjust Total Pledge Amount" is selected
        • Adjust the Total Pledge Amount (add or subtract) accordingly (civicrm_pledge.amount). The payment schedule (amounts / dates for future pending pledge payments) is not modified.

      3. Adjust pledge payment amount for scheduled (pending) payments

      • Change link on Pledge Payment selector from "Edit Schedule" to "Edit Scheduled Payment"
      • Add "Scheduled Amount" as an editable field to the '"Edit Pledge Payment" form (default is current scheduled_amount)
      • If user enters a different amount, show a radio button with two options:
        • [o] Adjust Pledge Payment Schedule?" (default)
        • [ ] Adjust Total Pledge Amount?"
      • Same post-process rules as above...

      4. Use buildForm hook to limit user options

      • If a site wants to force either the Yes or No behavior for "Adjust Total Pledge Amount" - they can implement a buildForm hook which replaces the radio button w/ a hidden field containing the desired option.

      5. Fix 'Pledge Acknowledgment' activity record to log original pledge amount

      • Currently we generate an activity record when a new pledge is recorded (activity type = Pledge Acknowledgment). However, we do not include basic Pledge info in the activity record (the Description column is empty). Modify this behavior to include pledge amount and schedule in activity.description:
        =====================
        Total Amount $ 600.00
        To be paid in 12 installments of $ 50.00 every 1 month(s) {info}

        =====================

        Attachments

          Activity

            People

            • Assignee:
              dgg David Greenberg
              Reporter:
              dgg David Greenberg
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: