Skip to content

Commit

Permalink
Merge pull request #26022 from eileenmcnaughton/clarify_return
Browse files Browse the repository at this point in the history
Clarify return on `BAO_Activity::create`
  • Loading branch information
colemanw authored Apr 7, 2023
2 parents ef7302a + 954b0b8 commit 8322eeb
Showing 1 changed file with 2 additions and 9 deletions.
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

0 comments on commit 8322eeb

Please sign in to comment.