CiviCRM
  1. CiviCRM
  2. CRM-6082

Primary Email and Primary Phone Number at Different Locations (ie. Home and Work) causes duplicate Profile listings

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Won't Fix
    • Affects Version/s: 3.1.3
    • Fix Version/s: 4.3.0
    • Component/s: CiviCRM Profile
    • Labels:
      None

      Description

      Reproduced on the demo site:
      http://drupal.demo.civicrm.org/civicrm/profile/?gid=9&force=1&search=1&reset=1

      Per Dave Greenberg's suggestion, we should have non-duplication when a Contact has only one Primary Email and one Primary Phone, yet these two Primaries are at different locations (Home vs. Work).

      Here is an example contact:
      http://drupal.demo.civicrm.org/civicrm/contact/add?reset=1&action=update&cid=166

      A Contact could feasibly prefer to use their home email but their work phone number, this is reasonable. Can we prevent duplcates on the Profile listing?

        Activity

        Hide
        Stoob added a comment -
        dave's suggestion to file this as bug here:
        http://forum.civicrm.org/index.php/topic,11745.0.html
        Show
        Stoob added a comment - dave's suggestion to file this as bug here: http://forum.civicrm.org/index.php/topic,11745.0.html
        Hide
        Eileen McNaughton added a comment -
        Just a note to confirm the behaviour is 'one-per-type-that-is-primary' e.g

        phone location primary type is home
        email location primary type is home
        address location primary type is home

        1 record returned

        phone location primary type is billing
        email location primary type is home
        address location primary type is 'main

        3 records returned
        Show
        Eileen McNaughton added a comment - Just a note to confirm the behaviour is 'one-per-type-that-is-primary' e.g phone location primary type is home email location primary type is home address location primary type is home 1 record returned phone location primary type is billing email location primary type is home address location primary type is 'main 3 records returned
        Hide
        Dave Jenkins added a comment -
        Encountered this issue in 3.2.3. The attached file profile-search-duplicates-queries captures the relevant SQL queries with backtraces.

        The problem seems to be the join to civicrm_location_type here:

        LEFT JOIN civicrm_address `1-address` ON (`1-address`.contact_id = contact_a.id AND `1-address`.is_primary = 1)
        LEFT JOIN civicrm_phone `1-phone-1` ON contact_a.id = `1-phone-1`.contact_id AND `1-phone-1`.is_primary = 1 AND `1-phone-1`.phone_type_id = '1'
        LEFT JOIN civicrm_location_type `1-location_type` ON ( ( `1-address`.location_type_id = `1-location_type`.id ) OR ( `1-phone-1`.location_type_id = `1-location_type`.id ) )

        In the case discussed above, where the primary address & phone records are of different location types, the join to civicrm_location_type returns 2 rows, confirmed by examining the rows returned by the query: the duplicate rows are identical in all fields except for the ones from civicrm_location_type.

        Dave J
        Show
        Dave Jenkins added a comment - Encountered this issue in 3.2.3. The attached file profile-search-duplicates-queries captures the relevant SQL queries with backtraces. The problem seems to be the join to civicrm_location_type here: LEFT JOIN civicrm_address `1-address` ON (`1-address`.contact_id = contact_a.id AND `1-address`.is_primary = 1) LEFT JOIN civicrm_phone `1-phone-1` ON contact_a.id = `1-phone-1`.contact_id AND `1-phone-1`.is_primary = 1 AND `1-phone-1`.phone_type_id = '1' LEFT JOIN civicrm_location_type `1-location_type` ON ( ( `1-address`.location_type_id = `1-location_type`.id ) OR ( `1-phone-1`.location_type_id = `1-location_type`.id ) ) In the case discussed above, where the primary address & phone records are of different location types, the join to civicrm_location_type returns 2 rows, confirmed by examining the rows returned by the query: the duplicate rows are identical in all fields except for the ones from civicrm_location_type. Dave J
        Hide
        Donald A. Lobo added a comment -
        These 448 issues have not been worked on for the past 18 months.

        Doing a bulk close of old issues to make the issue queue more manageable. We should do this on a periodic basis.
        Show
        Donald A. Lobo added a comment - These 448 issues have not been worked on for the past 18 months. Doing a bulk close of old issues to make the issue queue more manageable. We should do this on a periodic basis.

          People

          • Assignee:
            Donald A. Lobo
            Reporter:
            Stoob
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development