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

When joining to phone table in a contact record view, duplicate records encountered

    Details

    • Type: Bug
    • Status: Done/Fixed
    • Priority: Minor
    • Resolution: Fixed/Completed
    • Affects Version/s: 3.4.4
    • Fix Version/s: 3.4.6
    • Component/s: None
    • Labels:
      None

      Description

      To reproduce:

      1. set up a contact record view
      2. make sure some of your contacts have multiple phone numbers
      3. add the phone field to the view

      When I did this, I got a number of duplicates for each record equal to the number of phone numbers that contact had, even if I set it to filter by primary only.

      After inspecting the actual query being run, I noticed that the civicrm_phone table was being joined to twice. I found the cause of this in civicrm_handler_field_phone.inc inside the ensure_my_table() method. I just commented it out and it fixed my problem. The line causing the issue is the one that says $join->extra ...

      It looks like this method override was designed to make the phone type field option work so I wouldn't recommend just deleting it like I did.

        Attachments

          Activity

            People

            • Assignee:
              jalama Jim Taylor
              Reporter:
              dpolant Dan Polant
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: