Details
-
Type: Bug
-
Status: Done/Fixed
-
Priority: Major
-
Resolution: Cannot Reproduce
-
Affects Version/s: 4.5.6
-
Fix Version/s: 4.6.0
-
Component/s: CiviCRM API
-
Labels:None
-
Versioning Impact:Patch (backwards-compatible bug fixes)
-
Documentation Required?:None
-
Funding Source:Needs Funding
Description
somewhere along the way between 4.3.x and 4.5.x the api changed and it is no longer possible to get activities of a specific type that are connected to a specific cid
here is the code I have in place that worked until I did an upgrade to 4.5.x
// looks to see if activity already exists
$params_activity_check = array(
'version' => 3,
'sequential' => 1,
'activity_type_id' => 50,
'activity_date_time' => $visit_date,
'source_contact_id' => $school_cid,
);
$result_activity_check = civicrm_api('activity', 'get', $params_activity_check);
if ($result_activity_check['count'] ==0) {
// create the activity
it now brings back an array of every activity of that type, no matter what cid is associated.
this means that my code now needs to loop over the array which grows by thousands of activities each semester to find if the one I'm looking for exists. that seems very inefficient
the source_contact_id is still in the array returned, but can no longer be used in the get request. I hope this is a bug and not an intentional change.
based on the following unanswered issues in the forum, it seems I'm not the only one with this problem
http://forum.civicrm.org/index.php/topic,21685.msg90883.html#msg90883
http://forum.civicrm.org/index.php/topic,5548.msg24388.html#msg24388
http://forum.civicrm.org/index.php/topic,31672.msg135725.html#msg135725