CRM-20750 Incorrect financial trxn entries when payment instrument is changed on backoffice Contribution edit form

    Details

    • Type: Bug
    • Status: Done/Fixed
    • Priority: Major
    • Resolution: Fixed/Completed
    • Affects Version/s: 4.7.0
    • Fix Version/s: 4.7.25
    • Component/s: CiviContribute
    • Labels:
    • Versioning Impact:
      Patch (backwards-compatible bug fixes)
    • Documentation Required?:
      None
    • Funding Source:
      Contributed Code
    • Verified?:
      Yes

      Description

      Steps to replicate:
      1. Create a contribution using Check as a payment instrument with check number say #123A
      2. Edit the contribution by changing the payment instrument to CC with last 4 digit card number and type as 3452 and MasterCard respectively.
      3. Submit

      After submission, wrong financial entries are created (especially the reversal trxn entiry). Please check the screenshot:

        Attachments

          Activity

          [CRM-20750] Incorrect financial trxn entries when payment instrument is changed on backoffice Contribution edit form
          Nicolas Ganivet added a comment -

          Monish Deb: we have encountered the same error with recurring credit card contributions. Sunil Pawar is working on this. You 2 might want to connect and see if you can pick each other's brains on this.

          Monish Deb added a comment -

          Hi Nicolas Ganivet , Sunil Pawar

          This is the PR https://github.com/civicrm/civicrm-core/pull/10920 which I think will resolve the error with recurring credit card contributions. Would you like to test the patch?

          Thanks!

          Sunil Pawar added a comment -

          Monish Deb i have applied patch , still having issue with recurring payment.

          1. Main contribution record payment instrument set to check instead of credit card
          2. still showing 3 record at least in recurring payment case.

          To fix this i have done following changes.

          additional change

          — a/CRM/Contribute/BAO/Contribution.php

          +++ b/CRM/Contribute/BAO/Contribution.php

          @@ -2201,6 +2201,15 @@ LEFT JOIN  civicrm_contribution contribution ON ( componentPayment.contribution_

                     // CRM-17718 the campaign id on the contribution recur record should get precedence.

                     $contributionParams['financial_type_id'] = $recurringContribution['financial_type_id'];

                   }

          +        if (!empty($recurringContribution['payment_instrument_id'])) {

          +          $contributionParams['payment_instrument_id'] = $recurringContribution['payment_instrument_id'];

          +        }

           

          changes in your patch

          — a/CRM/Contribute/BAO/Contribution.php
          +++ b/CRM/Contribute/BAO/Contribution.php

          protected static function isPaymentInstrumentChange(&$params, $pendingStatuses) {

          elseif ((!CRM_Utils_System::isNull($params['payment_instrument_id']) &&
          !CRM_Utils_System::isNull($params['prevContribution']->payment_instrument_id)) &&

          • $params['contribution']>payment_instrument_id != $params['prevContribution']>payment_instrument_id
            + $params['payment_instrument_id'] != $params['prevContribution']->payment_instrument_id
            ) {

           

          This resolve my issue at my side.

           

           

            People

            • Assignee:
              Monish Deb
              Reporter:
              Monish Deb

              Dates

              • Created:
                Updated:
                Resolved: