From 298c519f4688d7c6c14f147e0dedf955576553a0 Mon Sep 17 00:00:00 2001 From: Eileen McNaughton Date: Sun, 24 Sep 2023 10:11:31 +1300 Subject: [PATCH] Remove always-same parameter from function signature This function is only ever called with the component event. Removing that parameter makes is clearer what (how little) it is doing --- CRM/Contribute/BAO/Contribution.php | 29 ++++++----------------------- 1 file changed, 6 insertions(+), 23 deletions(-) diff --git a/CRM/Contribute/BAO/Contribution.php b/CRM/Contribute/BAO/Contribution.php index 2a9eaccc6e..6520d22d5e 100644 --- a/CRM/Contribute/BAO/Contribution.php +++ b/CRM/Contribute/BAO/Contribution.php @@ -1714,35 +1714,18 @@ WHERE $condition * Online Event Registration or Online Membership signup. * * @param int $componentId - * Participant/membership id. - * @param string $componentName - * Event/Membership. + * Participant id. * * @return int * pending contribution id. */ - public static function checkOnlinePendingContribution($componentId, $componentName) { + public static function checkOnlinePendingContribution($componentId) { $contributionId = NULL; - if (!$componentId || - !in_array($componentName, ['Event', 'Membership']) - ) { - return $contributionId; - } - - if ($componentName === 'Event') { - $idName = 'participant_id'; - $componentTable = 'civicrm_participant'; - $paymentTable = 'civicrm_participant_payment'; - $source = ts('Online Event Registration'); - } - - if ($componentName === 'Membership') { - $idName = 'membership_id'; - $componentTable = 'civicrm_membership'; - $paymentTable = 'civicrm_membership_payment'; - $source = ts('Online Contribution'); - } + $idName = 'participant_id'; + $componentTable = 'civicrm_participant'; + $paymentTable = 'civicrm_participant_payment'; + $source = ts('Online Event Registration'); $pendingStatusId = array_search('Pending', CRM_Contribute_PseudoConstant::contributionStatus(NULL, 'name')); $query = " -- 2.25.1