Skip to content
Snippets Groups Projects
Unverified Commit 139be6ab authored by Seamus Lee's avatar Seamus Lee Committed by GitHub
Browse files

Merge pull request #18445 from eileenmcnaughton/activity

[Ref] Code simplification - remove conditional chunk
parents d6155023 fba045e1
Branches
Tags
No related merge requests found
......@@ -1699,16 +1699,10 @@ WHERE activity.id IN ($activityIds)";
$params = []
) {
$date = date('YmdHis');
if ($activity->__table == 'civicrm_membership') {
$component = 'Membership';
if ($activity->__table === 'civicrm_participant' && $activityType !== 'Email') {
$activityType = 'Event Registration';
}
elseif ($activity->__table == 'civicrm_participant') {
if ($activityType != 'Email') {
$activityType = 'Event Registration';
}
$component = 'Event';
}
elseif ($activity->__table == 'civicrm_contribution') {
if ($activity->__table == 'civicrm_contribution') {
// create activity record only for Completed Contributions
$contributionCompletedStatusId = CRM_Core_PseudoConstant::getKey('CRM_Contribute_BAO_Contribution', 'contribution_status_id', 'Completed');
if ($activity->contribution_status_id != $contributionCompletedStatusId) {
......@@ -1718,7 +1712,7 @@ WHERE activity.id IN ($activityIds)";
}
$params['status_id'] = CRM_Core_PseudoConstant::getKey('CRM_Activity_BAO_Activity', 'activity_status_id', 'Scheduled');
}
$activityType = $component = 'Contribution';
$activityType = 'Contribution';
// retrieve existing activity based on source_record_id and activity_type
if (empty($params['id'])) {
......@@ -1772,7 +1766,7 @@ WHERE activity.id IN ($activityIds)";
// @todo - use api - remove lots of wrangling above. Remove deprecated fatal & let form layer
// deal with any exceptions.
if (is_a(self::create($activityParams), 'CRM_Core_Error')) {
throw new CRM_Core_Exception("Failed creating Activity for $component of id {$activity->id}");
throw new CRM_Core_Exception("Failed creating Activity of type $activityType for entity id {$activity->id}");
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment