From df04742c66795725ec0e7aaf87db9643f28f2ba0 Mon Sep 17 00:00:00 2001 From: eileen Date: Mon, 14 Dec 2020 17:16:25 +1300 Subject: [PATCH] [REF] Move function to shared parent so MemberForm can use it too --- CRM/Member/Form.php | 23 +++++++++++++++++++++++ CRM/Member/Form/MembershipRenewal.php | 23 ----------------------- 2 files changed, 23 insertions(+), 23 deletions(-) diff --git a/CRM/Member/Form.php b/CRM/Member/Form.php index c2c4dfa871..07d99d2cd5 100644 --- a/CRM/Member/Form.php +++ b/CRM/Member/Form.php @@ -473,4 +473,27 @@ class CRM_Member_Form extends CRM_Contribute_Form_AbstractEditPayment { $this->submit(); } + /** + * Get order related params. + * + * In practice these are contribution params but later they cann be used with the Order api. + * + * @return array + * + * @throws \CiviCRM_API3_Exception + */ + protected function getOrderParams(): array { + $order = new CRM_Financial_BAO_Order(); + $order->setPriceSelectionFromUnfilteredInput($this->_params); + $order->setPriceSetID($this->getPriceSetID($this->_params)); + $order->setOverrideTotalAmount($this->_params['total_amount']); + $order->setOverrideFinancialTypeID((int) $this->_params['financial_type_id']); + return [ + 'lineItems' => [$this->_priceSetId => $order->getLineItems()], + // This is one of those weird & wonderful legacy params we aim to get rid of. + 'processPriceSet' => TRUE, + 'tax_amount' => $order->getTotalTaxAmount(), + ]; + } + } diff --git a/CRM/Member/Form/MembershipRenewal.php b/CRM/Member/Form/MembershipRenewal.php index 6abca4299d..cffc53edfc 100644 --- a/CRM/Member/Form/MembershipRenewal.php +++ b/CRM/Member/Form/MembershipRenewal.php @@ -770,27 +770,4 @@ class CRM_Member_Form_MembershipRenewal extends CRM_Member_Form { return $membership; } - /** - * Get order related params. - * - * In practice these are contribution params but later they cann be used with the Order api. - * - * @return array - * - * @throws \CiviCRM_API3_Exception - */ - protected function getOrderParams(): array { - $order = new CRM_Financial_BAO_Order(); - $order->setPriceSelectionFromUnfilteredInput($this->_params); - $order->setPriceSetID($this->getPriceSetID($this->_params)); - $order->setOverrideTotalAmount($this->_params['total_amount']); - $order->setOverrideFinancialTypeID((int) $this->_params['financial_type_id']); - return [ - 'lineItems' => [$this->_priceSetId => $order->getLineItems()], - // This is one of those weird & wonderful legacy params we aim to get rid of. - 'processPriceSet' => TRUE, - 'tax_amount' => $order->getTotalTaxAmount(), - ]; - } - } -- 2.25.1