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

Clarify return on BAO_Activity::create #26022

Merged
merged 1 commit into from
Apr 7, 2023
Merged
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
11 changes: 2 additions & 9 deletions CRM/Activity/BAO/Activity.php
Original file line number Diff line number Diff line change
Expand Up @@ -255,11 +255,10 @@ public static function deleteActivityContact($activityId, $recordTypeID = NULL)
* @param array $params
* Associated array of the submitted values.
*
* @return CRM_Activity_DAO_Activity
* @throws CRM_Core_Exception
*
* @return CRM_Activity_BAO_Activity|null|object
*/
public static function create(&$params) {
public static function create(array &$params) {
// CRM-20958 - These fields are managed by MySQL triggers. Watch out for clients resaving stale timestamps.
unset($params['created_date']);
unset($params['modified_date']);
Expand Down Expand Up @@ -317,14 +316,8 @@ public static function create(&$params) {

// start transaction
$transaction = new CRM_Core_Transaction();

$result = $activity->save();

if (is_a($result, 'CRM_Core_Error')) {
$transaction->rollback();
return $result;
}

$activityId = $activity->id;
$activityRecordTypes = [
'source_contact_id' => CRM_Core_PseudoConstant::getKey('CRM_Activity_BAO_ActivityContact', 'record_type_id', 'Activity Source'),
Expand Down