(This should be written as a patch for CiviCRM 4.4. It's an offshoot of
As a bit of background, note the main call-path for Activity.get API is:
For implementing the target_contact_id filter, one idea discussed tonight with Eileen on IRC:
- Modify _civicrm_api3_dao_set_filter() to call $dao->setApiFilter($params)
- Add CRM_Core_DAO::setApiFilter($params) – which does nothing
- Add CRM_Activity_BAO_Activity:setApiFilter($params) – which checks for $params['target_contact_id'] and calls $this->joinAdd() and $this->whereAdd()
- Add unit-tests to core for cases with (a) no matching activities, (b) a matching activity where the target_contact_id is the only target contact, (c) a matching activity with additional (irrelevant) target contacts.
- Make sure the unit-test api_v3_ActivityGetAbsencesTest::testGetTarget() passes