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

Link each payment instrument directly to an asset financial account

    Details

      Description

      Linking payment instruments to corresponding asset financial accounts allows the user to control where the payment funds are going for back office contributions.

      1. Remove the financial_account row with name = 'Checking Account'. This is an extra account which is not needed. (civicrm_data.tpl and upgrade change)

      2. Set is_default = 1 for the financial_account row with name = 'Deposit bank account'. (civicrm_data.tpl and upgrade change)
      NOTE: This account will be the default Asset account for financial_trxns when a payment instrument is not selected.

      3. Populate defaults by inserting a row in civicrm_entity_financial_account for each Payment Instrument option_value row (option_group = 'payment_instrument'). (civicrm_data.tpl and upgrade change)
      financial_account_id = the default Asset account (see #2 above)
      entity_table = 'civicrm_option_value'
      entity_id = option_value.id of payment instrument option
      account_relationship = 'Asset Account is'

      4. Extend the Payment Instrument form (CRM/Admin/Form/Options.php group=payment_instrument) to allow user to edit the asset financial account linked to that payment instrument
      4.1 New field - financial_account_id
      Label: "Financial Account"
      select includes financial accounts where financial_account_type is 'Asset' (field is optional)
      4.2 Post Process: if financial_account_id is set, insert or update row in civicrm_entity_financial_account

      5. Remove the civicrm_entity_financial_account rows linking financial types to their Asset Account.
      5.1 Remove the code below from 4.3.alpha1.mysql.tpl
      – Deposit Bank account
      INSERT INTO `civicrm_entity_financial_account`
      ( entity_table, entity_id, account_relationship, financial_account_id )
      SELECT 'civicrm_financial_type', ft.id, @option_value_rel_id_as, @financial_account_id_ar
      FROM `civicrm_financial_type` as ft;

      5.2 Remove the equivalent code from civicrm_data.tpl

      6. Modify offline contribution postProcess code where financial_trxn is created. Now we retrieve to_financial_account as follows:

      • If payment_instrument_id NOT NULL, retrieve linked financial account via civicrm_entity_financial_account
      • If payment_instrument_id IS NULL, retrieve default asset financial account (where financial_account_type_id is 'Asset' and is_default = 1).

        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: