Uploaded image for project: 'CiviCRM'
  1. CiviCRM
  2. CRM-11669 CRM_Core_BAO_Financial_Trxn::getFinancialTrxnIds() assumes only one financial_trxn linked to a contribution record
  3. CRM-11678

View Contribution: Received Into field displays incorrect to_financial_account for completed pay-later contributions

    Details

      Description

      If you enter a Pay Later contribution, and then update it to completed - when you view the contribution the 'Received Into' field shows 'Accounts Receivable' (rather than Deposit Bank Account or other asset account for a completed payment). This is a result of the fact that CRM_Core_BAO_FinancialTrxn::getFinancialTrxnIds is only grabbing a single financial transaction (and in this case it's grabbing the 1st one).

      We could decide to grab the 'latest' (highest ID) for this purpose (which i think is decent since user will see the latest dispensation .... OR return a list of to_financial_account titles - e.g.:

      Received Into: 'Accounts Receivable, Deposit Bank Account'

      ---- lines 68-73 ContributionView.php ------
      // get to_financial_type from civicrm_financial_trxn
      $financialTrxnId = CRM_Core_BAO_FinancialTrxn::getFinancialTrxnIds($values['contribution_id']);
      if (CRM_Utils_Array::value( 'financialTrxnId', $financialTrxnId))

      { $values['to_financial_account_id'] = CRM_Core_DAO::getFieldValue('CRM_Financial_DAO_FinancialTrxn', $financialTrxnId['financialTrxnId'], 'to_financial_account_id'); $values['to_financial_account'] = CRM_Contribute_PseudoConstant::financialAccount($values['to_financial_account_id']); }

        Attachments

          Activity

            People

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

              Dates

              • Created:
                Updated:
                Resolved: