CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Drupal Modules (Moderator: Donald Lobo) »
  • Drupal Views Activity -> Campaign linkage fix found
Pages: [1]

Author Topic: Drupal Views Activity -> Campaign linkage fix found  (Read 2281 times)

Denim

  • I’m new here
  • *
  • Posts: 4
  • Karma: 2
  • CiviCRM version: 4.5.0
  • CMS version: Drupal 7.23
  • MySQL version: 5.5.37
  • PHP version: 5.4.6
Drupal Views Activity -> Campaign linkage fix found
August 17, 2013, 10:27:26 pm
The SQL generated when a Relationship (the Views kind, not the Civi kind) is added to a Campaign within a Activity-based View is incorrect:
LEFT JOIN {civicrm_campaign} civicrm_campaign_civicrm_activity ON civicrm_activity.id = civicrm_campaign_civicrm_activity.id
It should be:
LEFT JOIN {civicrm_campaign} civicrm_campaign_civicrm_activity ON civicrm_activity.campaign_id = civicrm_campaign_civicrm_activity.id
That is, the civicrm_activity field that links to civicrm_campaign should be "campaign_id" and not "id".
The problem comes from 
civicrm/drupal/modules/views/components/civicrm.core.inc line 1701 (the $data['civicrm_activity']['campaign_id']['relationship'] array).  Changing:
'field' => 'id',
to
'field' => 'campaign_id',
produced the expected SQL, and allowed the View to display the correct campaign information associated with an activity.
This required clearing the Drupal cache in order for the change to be picked up by Views.
(Drupal 7.23, Civi 4.3.4)
« Last Edit: August 17, 2013, 10:33:23 pm by Denim »

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Drupal Modules (Moderator: Donald Lobo) »
  • Drupal Views Activity -> Campaign linkage fix found

This forum was archived on 2017-11-26.