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) »
  • Civi CRM Views and Activities
Pages: [1]

Author Topic: Civi CRM Views and Activities  (Read 1503 times)

co-operatives uk

  • I’m new here
  • *
  • Posts: 29
  • Karma: 0
  • CiviCRM version: 4.2.0
  • CMS version: Drupal 7.15
  • MySQL version: 5
  • PHP version: 5
Civi CRM Views and Activities
March 12, 2012, 05:43:41 pm
Having an odd one - set up an activity view and put a views relationship in to show the target contact id. However, instead of pulling the target_contact_id field from the civicrm_activity_target table, its just pulling through the activity id. This then means that I get the wrong contact data for the activity target. The SQL statement is below, but I can't work out which bit of the Drupal views integration code I need to be looking in to change the field name. Any ideas?

Code: [Select]
SELECT civicrm_activity.id AS id, civicrm_activity.source_contact_id AS civicrm_activity_source_contact_id, civicrm_activity.activity_type_id AS civicrm_activity_activity_type_id, civicrm_contact.display_name AS civicrm_contact_display_name, civicrm_contact.id AS civicrm_contact_id, civicrm_contact_civicrm_activity_target.id AS civicrm_contact_civicrm_activity_target_id, civicrm_contact_civicrm_activity_target.display_name AS civicrm_contact_civicrm_activity_target_display_name
FROM
{civicrm_activity} civicrm_activity
LEFT JOIN {civicrm_activity_target} civicrm_activity_target ON civicrm_activity.id = civicrm_activity_target.activity_id
LEFT JOIN {civicrm_contact} civicrm_contact_civicrm_activity_target ON civicrm_activity_target.id = civicrm_contact_civicrm_activity_target.id
LEFT JOIN {civicrm_contact} civicrm_contact ON civicrm_activity.source_contact_id = civicrm_contact.id
ORDER BY civicrm_contact_civicrm_activity_target_display_name ASC
LIMIT 10 OFFSET 80

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: Civi CRM Views and Activities
March 12, 2012, 07:16:25 pm

A bit tangential to your question, BUT

We are currently looking for someone to take over the maintenance and development of the views integration with civicrm module. So if anyone is interested and wants to move that further along, please contact us on IRC

lobo
A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

co-operatives uk

  • I’m new here
  • *
  • Posts: 29
  • Karma: 0
  • CiviCRM version: 4.2.0
  • CMS version: Drupal 7.15
  • MySQL version: 5
  • PHP version: 5
Re: Civi CRM Views and Activities
March 13, 2012, 01:55:28 am
OK, found it:

sites/all/modules/civicrm/drupal/modules/views/components/civicrm.core.inc

line 1902

- 'field' => 'id',

+ 'field' => 'target_contact_id',

Will now see if it breaks anything else!

pds

tonthon

  • I’m new here
  • *
  • Posts: 9
  • Karma: 0
    • Majerti is specialized in OpenSource technologies
  • CiviCRM version: 4
  • CMS version: drupal
  • MySQL version: it depends
  • PHP version: it depends
Re: Civi CRM Views and Activities
June 19, 2012, 01:47:04 am
Thanks, you saved my day  :).

Note : In my case, I had to configure at new my view to get it work
Gaston TJEBBES
Majerti
g.t [at] majerti.fr
http://www.majerti.fr
Audit/Conseil IT, Développement, Formation
+33 (0)6 32 70 70 00

ddunn

  • I’m new here
  • *
  • Posts: 24
  • Karma: 0
  • CiviCRM version: 4
  • CMS version: Drupal
  • MySQL version: 5.0.7-dev
  • PHP version: 5.3.4
Re: Civi CRM Views and Activities
June 19, 2012, 05:58:26 am
A similar fix required for source_record_id, to display the contact who created the activity:

Line 1508 of civicrm.core.inc

- 'field' => 'id',

+ 'field' => 'source_record_id',


torrance123

  • I post occasionally
  • **
  • Posts: 57
  • Karma: 3
  • CiviCRM version: 4.0
  • CMS version: Drupal 7
  • MySQL version: 5.0.91
  • PHP version: 5.3.3
Re: Civi CRM Views and Activities
June 20, 2012, 02:41:04 pm
co-operatives uk and ddunn, could you please create patches and open issues for those two fixes on Jira if you haven't already? Else I fear they won't be fixed.

Submit patches here: http://issues.civicrm.org/jira/secure/Dashboard.jspa

ddunn

  • I’m new here
  • *
  • Posts: 24
  • Karma: 0
  • CiviCRM version: 4
  • CMS version: Drupal
  • MySQL version: 5.0.7-dev
  • PHP version: 5.3.4
Re: Civi CRM Views and Activities
June 20, 2012, 02:50:03 pm
Hi torrance123,

I've never done that (submit a patch), and would be feeling a bit out of my depth, without a guiding hand.

Where should I start to look to learn how to do this?

D

co-operatives uk

  • I’m new here
  • *
  • Posts: 29
  • Karma: 0
  • CiviCRM version: 4.2.0
  • CMS version: Drupal 7.15
  • MySQL version: 5
  • PHP version: 5
Re: Civi CRM Views and Activities
June 21, 2012, 05:52:05 am
Same here - we're currently running on IIS so I'm not sure I could even apply a patch, let alone create one!

davej

  • Ask me questions
  • ****
  • Posts: 404
  • Karma: 21
Re: Civi CRM Views and Activities
June 25, 2012, 05:34:28 am
Hi,

I ran into the same issue (with target contact) but didn't find this post till after I'd fixed it! I've created issue http://issues.civicrm.org/jira/browse/CRM-10441 with a patch for both target_contact_id and source_record_id.

Dave J

GinkgoFJG

  • I post frequently
  • ***
  • Posts: 135
  • Karma: 4
    • Ginkgo Street Labs
Re: Civi CRM Views and Activities
June 26, 2012, 08:22:48 am
Thanks for the patch, Dave. I made some changes to it and committed it. This fix will be available in 4.2.
Are you a CiviVolunteer user? Join the CiviVolunteer 2.0 Matching Grant effort to help the project win $15,000 in grant funding.

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Drupal Modules (Moderator: Donald Lobo) »
  • Civi CRM Views and Activities

This forum was archived on 2017-11-26.