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

CiviCRM Views: "CiviCRM Contacts: Drupal ID" fails for chained relationships. Fix attached.

    Details

      Description

      In CiviCRM View integration, there is a Views relationship, "CiviCRM Contacts: Drupal ID", that link the Drupal user table to the CiviCRM contact ID. This works properly if the base type of the View is "CiviCRM Contact", but it fails for chained relationships, such as: base type is "CiviCRM Recurring Contribution profile" (table civicrm_contribution_recur), plus a first relationship of "CiviCRM Recurring Contributions: Contact ID", plus a second relationship of "CiviCRM Contacts: Drupal ID" linked to the previous relationship. Setting up a View like this throws a "nonexistent column" db error, even without defining any fields based on the second relationship.

      This is due to a bug in file civicrm_handler_relationship_contact2users.inc, function query(), in which the final call to add_relationship() was linking back to the wrong table for chained relationships. There was no ill effect if this relationship was the first link in the chain, which is why it wasn't immediately noticeable.

      The attached patch fixes the issue for both D6 and D7.

      Robert

        Attachments

          Activity

            People

            • Assignee:
              lobo Donald A. Lobo
              Reporter:
              rjlang Robert J. Lang
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: