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

Activity history search API does not honor the 'entity_id' parameter

    Details

    • Type: Bug
    • Status: Done/Fixed
    • Priority: Major
    • Resolution: Cannot Reproduce
    • Affects Version/s: 1.4
    • Fix Version/s: None
    • Labels:
      None

      Description

      Drupal 4.7.1
      CiviCRM rev5367M
      PHP 4.4.1 (cli) (built: Mar 5 2006 10:30:50)

      I am using the activity history API to search for history records for a specific user. here is the code:

      --------
      $params = array(
      'entity_id' => $crm_user->id,
      'entity_table' => 'civicrm_contact',
      'module' => 'civicontact',
      'activity_id' => $node->nid,
      );
      $params = array();
      $sort = array("activity_date" => "DESC");

      $activities = crm_get_activity_history($params, 0, 1, $sort);
      ------
      Expected behavior: For users with no history items of this type, this search should return no results.

      Actual Behavior: Returns an activity history for a different contact record.

      For example, if I hard code the code to behave like this:

      $params = array(
      'entity_id' => 104,
      'entity_table' => 'civicrm_contact',
      'module' => 'civicontact',
      'activity_id' => $node->nid,
      );
      $params = array();
      $sort = array("activity_date" => "DESC");

      $activities = crm_get_activity_history($params, 0, 1, $sort);
      dprint_r($activities);

      the debugging system will print out:

      Array
      (
      [771] => Array
      (
      [id] => 771
      [entity_table] => civicrm_contact
      [entity_id] => 24
      [activity_type] => Completed Campaign
      [module] => civicontact
      [callback] => civicontact_activity_callback
      [activity_id] => 10
      [activity_summary] => Completed the Candidate Survey 2006 campaign
      [activity_date] => 2006-05-26 15:03:48
      )

      )

      Note that the entity_id is totally wrong. I would guess that this parameter is just not being included in the SQL somewhere.

        Attachments

          Activity

            People

            • Assignee:
              lobo Donald A. Lobo
              Reporter:
              mfredrickson Mark Fredrickson
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: