diff --git a/CRM/Member/Form.php b/CRM/Member/Form.php index 3ae6973ef52b..c2c4dfa871eb 100644 --- a/CRM/Member/Form.php +++ b/CRM/Member/Form.php @@ -416,7 +416,7 @@ protected function ensurePriceParamsAreSet(&$formValues) { * * @return array */ - protected static function getPriceSetDetails($params) { + protected function getPriceSetDetails(array $params): ?array { $priceSetID = $params['price_set_id'] ?? NULL; if ($priceSetID) { return CRM_Price_BAO_PriceSet::getSetDetail($priceSetID); @@ -436,10 +436,10 @@ protected static function getPriceSetDetails($params) { * * @return int */ - protected static function getPriceSetID($params) { + protected function getPriceSetID(array $params): int { $priceSetID = $params['price_set_id'] ?? NULL; if (!$priceSetID) { - $priceSetDetails = self::getPriceSetDetails($params); + $priceSetDetails = $this->getPriceSetDetails($params); return (int) key($priceSetDetails); } return (int) $priceSetID; @@ -452,9 +452,9 @@ protected static function getPriceSetID($params) { * * @return array */ - protected function setPriceSetParameters($formValues) { - $this->_priceSetId = self::getPriceSetID($formValues); - $priceSetDetails = self::getPriceSetDetails($formValues); + protected function setPriceSetParameters(array $formValues): array { + $this->_priceSetId = $this->getPriceSetID($formValues); + $priceSetDetails = $this->getPriceSetDetails($formValues); $this->_priceSet = $priceSetDetails[$this->_priceSetId]; // process price set and get total amount and line items. $this->ensurePriceParamsAreSet($formValues); diff --git a/CRM/Member/Form/Membership.php b/CRM/Member/Form/Membership.php index b5846d217778..642079722ab4 100644 --- a/CRM/Member/Form/Membership.php +++ b/CRM/Member/Form/Membership.php @@ -651,8 +651,8 @@ public function buildQuickForm() { public static function formRule($params, $files, $self) { $errors = []; - $priceSetId = self::getPriceSetID($params); - $priceSetDetails = self::getPriceSetDetails($params); + $priceSetId = $self->getPriceSetID($params); + $priceSetDetails = $self->getPriceSetDetails($params); $selectedMemberships = self::getSelectedMemberships($priceSetDetails[$priceSetId], $params); diff --git a/CRM/Member/Form/MembershipRenewal.php b/CRM/Member/Form/MembershipRenewal.php index dcf50ec085d8..6abca4299df2 100644 --- a/CRM/Member/Form/MembershipRenewal.php +++ b/CRM/Member/Form/MembershipRenewal.php @@ -782,7 +782,7 @@ public function processMembership($memParams, $changeToday, $numRenewTerms, $pen protected function getOrderParams(): array { $order = new CRM_Financial_BAO_Order(); $order->setPriceSelectionFromUnfilteredInput($this->_params); - $order->setPriceSetID(self::getPriceSetID($this->_params)); + $order->setPriceSetID($this->getPriceSetID($this->_params)); $order->setOverrideTotalAmount($this->_params['total_amount']); $order->setOverrideFinancialTypeID((int) $this->_params['financial_type_id']); return [