Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove hurty free calls from campaign and case #13564

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion CRM/Campaign/BAO/Campaign.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,6 @@ public static function create(&$params) {
$dao->entity_id = $entityId;
$dao->group_type = 'Include';
$dao->save();
$dao->free();
}
}

Expand Down
1 change: 0 additions & 1 deletion CRM/Campaign/BAO/Survey.php
Original file line number Diff line number Diff line change
Expand Up @@ -504,7 +504,6 @@ public static function voterDetails($voterIds, $returnProperties = array()) {
);
$voterDetails[$contact->contactId]['contact_type'] = $image;
}
$contact->free();
}

return $voterDetails;
Expand Down
1 change: 0 additions & 1 deletion CRM/Campaign/Form/Task/Interview.php
Original file line number Diff line number Diff line change
Expand Up @@ -559,7 +559,6 @@ public static function registerInterview($params) {
//really this should use Activity BAO& not be here but refactoring will have to be later
//actually the whole ajax call could be done as an api ajax call & post hook would be sorted
CRM_Utils_Hook::post('edit', 'Activity', $activity->id, $activity);
$activity->free();

return $activityId;
}
Expand Down
17 changes: 0 additions & 17 deletions CRM/Case/BAO/Case.php
Original file line number Diff line number Diff line change
Expand Up @@ -2195,8 +2195,6 @@ public static function mergeCases(
}
}

$mainCase->free();

$mainCaseIds[] = $mainCaseId;
//insert record for case contact.
$otherCaseContact = new CRM_Case_DAO_CaseContact();
Expand All @@ -2213,9 +2211,7 @@ public static function mergeCases(
if (!$mainCaseContact->find(TRUE)) {
$mainCaseContact->save();
}
$mainCaseContact->free();
}
$otherCaseContact->free();
}
elseif (!$otherContactId) {
$otherContactId = $mainContactId;
Expand Down Expand Up @@ -2299,16 +2295,13 @@ public static function mergeCases(
// insert log of all activities
CRM_Activity_BAO_Activity::logActivityAction($mainActivity);

$otherActivity->free();
$mainActivity->free();
$copiedActivityIds[] = $otherActivityId;

//create case activity record.
$mainCaseActivity = new CRM_Case_DAO_CaseActivity();
$mainCaseActivity->case_id = $mainCaseId;
$mainCaseActivity->activity_id = $mainActivityId;
$mainCaseActivity->save();
$mainCaseActivity->free();

//migrate source activity.
$otherSourceActivity = new CRM_Activity_DAO_ActivityContact();
Expand All @@ -2327,9 +2320,7 @@ public static function mergeCases(
if (!$mainActivitySource->find(TRUE)) {
$mainActivitySource->save();
}
$mainActivitySource->free();
}
$otherSourceActivity->free();

//migrate target activities.
$otherTargetActivity = new CRM_Activity_DAO_ActivityContact();
Expand All @@ -2348,9 +2339,7 @@ public static function mergeCases(
if (!$mainActivityTarget->find(TRUE)) {
$mainActivityTarget->save();
}
$mainActivityTarget->free();
}
$otherTargetActivity->free();

//migrate assignee activities.
$otherAssigneeActivity = new CRM_Activity_DAO_ActivityContact();
Expand All @@ -2369,9 +2358,7 @@ public static function mergeCases(
if (!$mainAssigneeActivity->find(TRUE)) {
$mainAssigneeActivity->save();
}
$mainAssigneeActivity->free();
}
$otherAssigneeActivity->free();

// copy custom fields and attachments
$aparams = array(
Expand Down Expand Up @@ -2417,14 +2404,12 @@ public static function mergeCases(
if (!$mainRelationship->find(TRUE)) {
$mainRelationship->save();
}
$mainRelationship->free();

//get the other relationship ids to update end date.
if ($updateOtherRel) {
$otherRelationshipIds[$otherRelationship->id] = $otherRelationship->id;
}
}
$otherRelationship->free();

//update other relationships end dates
if (!empty($otherRelationshipIds)) {
Expand Down Expand Up @@ -2501,7 +2486,6 @@ public static function mergeCases(
if (!$mergeActivityId) {
continue;
}
$mergeActivity->free();

//connect merge activity to case.
$mergeCaseAct = array(
Expand Down Expand Up @@ -3116,7 +3100,6 @@ public static function addCaseRelationships($caseId, $contactId) {
if (!$newRelationship->find(TRUE)) {
$newRelationship->save();
}
$newRelationship->free();

// store relationship type of newly created relationship
$relationshipTypes[] = $caseRelationships->relationship_type_id;
Expand Down