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

Call hook_civicrm_post with op 'merge' after contacts are merged

    Details

    • Type: Improvement
    • Status: Done/Fixed
    • Priority: Minor
    • Resolution: Fixed/Completed
    • Affects Version/s: 4.5.4
    • Fix Version/s: 4.6
    • Component/s: Extension System
    • Labels:
    • Documentation Required?:
      Developer Doc

      Description

      When two contacts are merged, all related data is moved via SQL statements. This means that post-edit hooks are not called for any changes in the related information, such as contributions.

      As a developer using an extension to recalculate view-only custom fields when contributions change, I want to be able to recalculate the fields after the merge is complete.

      Hook civicrm_merge is not what I need, as that allows extensions to modify table lists and sql statements, but not to perform custom calculations. Currently after merging contacts, hook civicrm_post is called with 'trash' and then with 'delete' against the old contact, but no hook is called with the new contact after the merge is complete.

      I propose calling hook_civicrm_post with op='merge' and a reference to the target contact after the merge is complete, allowing extensions to recalculate view-only custom fields with the merged data.

        Attachments

          Activity

            People

            • Assignee:
              timotten Tim Otten
              Reporter:
              ejegg Elliott Eggleston
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: