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) »
  • Developer Discussion (Moderator: Donald Lobo) »
  • New API replacement for crm_get_activity_history
Pages: [1]

Author Topic: New API replacement for crm_get_activity_history  (Read 1794 times)

barrylb

  • I’m new here
  • *
  • Posts: 19
  • Karma: 3
New API replacement for crm_get_activity_history
July 20, 2008, 05:34:42 am
I'm re-writing something that previously used crm_get_activity_history but there doesn't seem to be any equivalent in v2. Any chance we could add something? There is an API function civicrm_activities_get_contact but it doesn't take any parameters except the contact id, it doesn't return all the activity fields (eg missing activity_date_time), and doesn't allow for sort order.

I have resorted to writing an SQL query directly but I wonder (a) is there another way? (b) can we add something supported to the API codebase?

Here is the query I've used, based on getContactActivity in CRM/Activity/BAO/Activity.php:
Code: [Select]
  $query ="SELECT * FROM civicrm_activity activity, civicrm_activity_target target
             WHERE activity.id = target.activity_id
             AND target.target_contact_id = $contactId
             AND activity.activity_type_id = $activityTypeId
             ORDER BY activity_date_time DESC";
  $dao = CRM_Core_DAO::executeQuery( $query, CRM_Core_DAO::$_nullArray );


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: New API replacement for crm_get_activity_history
July 20, 2008, 03:31:55 pm

barry:

do you want to flush this out a bit more and write  code that implement civicrm_activity_get( &$params ). You might want to use the trunk version of api/v2/Activity.php (http://svn.civicrm.org/civicrm/trunk/api/v2/Activity.php)

Once done, please file an issue along with the code and we'll add it to the code base.

thanx

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

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion (Moderator: Donald Lobo) »
  • New API replacement for crm_get_activity_history

This forum was archived on 2017-11-26.