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

soft credit relationship to contact builds incorrect relationship in views

    Details

    • Type: Bug
    • Status: Done/Fixed
    • Priority: Trivial
    • Resolution: Cannot Reproduce
    • Affects Version/s: 4.1.0
    • Fix Version/s: 4.4.0
    • Labels:
      None

      Description

      Thanks Jim for the great work on views integration.

      I was very pleased to see support for relationships from soft credit -> contacts. However, I had trouble getting it to work with Civi 4.1beta3, Drupal 7, and views 3.

      I don't quite understand why (since your code looks correct), however, when I try to build a relationship using the soft credit id -> Contact, views instead links the civicrm_contribution_soft.id -> civicrm_contact.id instead of civicrm_contribution_soft.contact_id -> civicrm_contact.id.

      This patch fixes it:

      — drupal/modules/views/components/civicrm.contribute.inc.orig 2011-12-02 14:28:40.000000000 -0500
      +++ drupal/modules/views/components/civicrm.contribute.inc 2012-01-31 11:30:50.000000000 -0500
      @@ -651,7 +651,7 @@

      'relationship' => array(
      'base' => 'civicrm_contact',

      • 'field' => 'id',
        + 'field' => 'contact_id',
        'handler' => 'views_handler_relationship',
        'label' => t('Soft Contribution -> Contact Record'),
        ),

      I didn't commit this change because I'm not sure whether this is a bug with views or a bug with the civicrm views contribution handler. It seems like we've already specified that we should use civicrm_contribution_soft.contact_id, so specifying it again here (where it seems appropriate to specify the field in the contact table, like you originally coded it) seems wrong, but in fact gives me the result I'm expecting.

      Any ideas?

      jamie

        Attachments

          Activity

            People

            • Assignee:
              jamie Jamie McClelland
              Reporter:
              jamie Jamie McClelland
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: