Skip to content

Commit

Permalink
refs #40710, fixes activity api update will remove status_id
Browse files Browse the repository at this point in the history
  • Loading branch information
jimyhuang committed Nov 14, 2024
1 parent 2540f97 commit 297607e
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions api/v3/Activity.php
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,18 @@ function civicrm_api3_activity_create($params) {
return civicrm_api3_create_error(ts("Unable to create new revision of case activity."), NULL, CRM_Core_DAO::$_nullObject);
}
}
elseif (!empty($params['id'])) {
// prefill activity value when update exists activity
$oldActivityValues = array();
$oldActivityParams = array('id' => $params['id']);
CRM_Activity_BAO_Activity::retrieve($oldActivityParams, $oldActivityValues);
if (!empty($oldActivityValues['status_id']) && empty($params['status_id'])) {
$params['status_id'] = $oldActivityValues['status_id'];
}
if (!empty($oldActivityValues['priority_id']) && empty($params['priority_id'])) {
$params['priority_id'] = $oldActivityValues['priority_id'];
}
}

// create activity
$activityBAO = CRM_Activity_BAO_Activity::create($params);
Expand Down

0 comments on commit 297607e

Please sign in to comment.