Skip to content

Commit

Permalink
Merge pull request #11618 from jitendrapurohit/CRM-21730
Browse files Browse the repository at this point in the history
CRM-21730: postProcess() hook don't receive case id after submitting …
  • Loading branch information
colemanw authored Feb 3, 2018
2 parents 5fc836b + aec75ba commit 0738fdc
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
13 changes: 6 additions & 7 deletions CRM/Activity/BAO/Activity.php
Original file line number Diff line number Diff line change
Expand Up @@ -596,13 +596,6 @@ public static function create(&$params) {

CRM_Contact_BAO_GroupContactCache::opportunisticCacheFlush();

if (!empty($params['id'])) {
CRM_Utils_Hook::post('edit', 'Activity', $activity->id, $activity);
}
else {
CRM_Utils_Hook::post('create', 'Activity', $activity->id, $activity);
}

// if the subject contains a ‘[case #…]’ string, file that activity on the related case (CRM-5916)
$matches = array();
$subjectToMatch = CRM_Utils_Array::value('subject', $params);
Expand All @@ -626,6 +619,12 @@ public static function create(&$params) {
self::logActivityAction($activity, "Case details for {$matches[1]} not found while recording an activity on case.");
}
}
if (!empty($params['id'])) {
CRM_Utils_Hook::post('edit', 'Activity', $activity->id, $activity);
}
else {
CRM_Utils_Hook::post('create', 'Activity', $activity->id, $activity);
}

return $result;
}
Expand Down
2 changes: 1 addition & 1 deletion CRM/Case/Form/Case.php
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@ public function postProcess() {
$params['subject'] = $params['activity_subject'];
}
$caseObj = CRM_Case_BAO_Case::create($params);
$params['case_id'] = $caseObj->id;
$this->_caseId = $params['case_id'] = $caseObj->id;
// unset any ids, custom data
unset($params['id'], $params['custom']);

Expand Down

0 comments on commit 0738fdc

Please sign in to comment.