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

Duplicate email addresses created when merging in 4.7

    Details

    • Type: Bug
    • Status: Done/Fixed
    • Priority: Major
    • Resolution: Fixed/Completed
    • Affects Version/s: 4.7.7
    • Fix Version/s: 4.7.8
    • Component/s: None
    • Documentation Required?:
      Developer Doc
    • Sprint:
      MergeSprint1
    • Funding Source:
      Contributed Code

      Description

      This is a 4.7 regression issue

      In the process of reviewing https://issues.civicrm.org/jira/browse/CRM-18455 I became aware that where 2 contacts with identical email addresses were merged the email address was being transferred over as a duplicate.

      There is specific code to prevent this from happening - but it was being ignored due to a change in https://github.com/civicrm/civicrm-core/commit/63ef778e5b40866ad4a89140a31ccba5553ab729 - where Deepak ported a lot of changes written against 4.5 to core for 4.7. It's worth noting that 4.7 also had substantive changes by John Kingsworth & I think the process of porting (always fairly risky) became more error prone due to the fact the code had undergone notable change. I suspect that is what is behind this.

      I have written a test that covers this but am unable to submit that until another regression introduced in the same codeset is resolved : https://issues.civicrm.org/jira/browse/CRM-18517 - since Tim is unreasonably unsympathetic about tests bringing down the test server,

      My proposed change has a direct impact on the hook which will need to be announced - prior to 4.7 it passed out

      $migrationData = array(
      'old_migration_info' => $originalMigrationInfo,
      'mode' => $mode,
      'fields_in_conflict' => $conflicts,
      'merge_mode' => $mode,
      );

      old_migration_info is the migration_info that enters the function, prior to address wrangling & that info was passed to the hook for consideration.

      Prior to 4.7 changing old_migration_info had no impact, but it might be used for calculating confilcts.

      In 4.7 & could be changed in the hook & old_migration_data was used going forwards (ie. the wrangled data was actually thrown away in favour of it).

      My change makes it such that the hook receives

      $migrationData = array(
      'old_migration_info' => $originalMigrationInfo,
      'mode' => $mode,
      'fields_in_conflict' => $conflicts,
      'merge_mode' => $mode,
      'migration_info' => $migrationInfo,
      );

      This returns us to the situation where old_migration_info is informational only but
      'migration_info' can be altered in the hook.

      This could affect people who have implemented the hook & needs some announcement. (Probably very few affected & I will directly advise Veda)

        Attachments

          Activity

            People

            • Assignee:
              eileen Eileen McNaughton
              Reporter:
              eileen Eileen McNaughton
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: