From 15d6c8bee2e71c31229fcdcc17a51eef170ac4a5 Mon Sep 17 00:00:00 2001 From: eileen Date: Tue, 12 May 2020 19:30:04 +1200 Subject: [PATCH] [REF] Minor tidy up Removes a few old constructs like the value() function --- CRM/Member/Form/Membership.php | 22 ++++++---------------- 1 file changed, 6 insertions(+), 16 deletions(-) diff --git a/CRM/Member/Form/Membership.php b/CRM/Member/Form/Membership.php index 85ca268159..dd4d948daa 100644 --- a/CRM/Member/Form/Membership.php +++ b/CRM/Member/Form/Membership.php @@ -357,20 +357,12 @@ class CRM_Member_Form_Membership extends CRM_Member_Form { } $this->assign('alreadyAutoRenew', $alreadyAutoRenew); - $this->assign('member_is_test', CRM_Utils_Array::value('member_is_test', $defaults)); + $this->assign('member_is_test', $defaults['member_is_test'] ?? NULL); + $this->assign('membership_status_id', $defaults['status_id'] ?? NULL); + $this->assign('is_pay_later', !empty($defaults['is_pay_later'])); - $this->assign('membership_status_id', CRM_Utils_Array::value('status_id', $defaults)); - - if (!empty($defaults['is_pay_later'])) { - $this->assign('is_pay_later', TRUE); - } if ($this->_mode) { $defaults = $this->getBillingDefaults($defaults); - // hack to simplify credit card entry for testing - // $defaults['credit_card_type'] = 'Visa'; - // $defaults['credit_card_number'] = '4807731747657838'; - // $defaults['cvv2'] = '000'; - // $defaults['credit_card_exp_date'] = array( 'Y' => '2012', 'M' => '05' ); } //setting default join date if there is no join date @@ -1098,8 +1090,6 @@ class CRM_Member_Form_Membership extends CRM_Member_Form { $formValues['financial_type_id'] = $this->_priceSet['financial_type_id']; } - $config = CRM_Core_Config::singleton(); - $membershipTypeValues = []; foreach ($this->_memTypeSelected as $memType) { $membershipTypeValues[$memType]['membership_type_id'] = $memType; @@ -1335,7 +1325,7 @@ class CRM_Member_Form_Membership extends CRM_Member_Form { // add all the additional payment params we need $formValues['amount'] = $params['total_amount']; // @todo this is a candidate for beginPostProcessFunction. - $formValues['currencyID'] = $config->defaultCurrency; + $formValues['currencyID'] = CRM_Core_Config::singleton()->defaultCurrency; $formValues['description'] = ts("Contribution submitted by a staff person using member's credit card for signup"); $formValues['invoiceID'] = md5(uniqid(rand(), TRUE)); $formValues['financial_type_id'] = $params['financial_type_id']; @@ -1456,7 +1446,7 @@ class CRM_Member_Form_Membership extends CRM_Member_Form { $params['contribution_source'] = ts('%1 Membership Signup: Credit card or direct debit (by %2)', [1 => $membershipType, 2 => $userName] ); - $params['source'] = $formValues['source'] ? $formValues['source'] : $params['contribution_source']; + $params['source'] = $formValues['source'] ?: $params['contribution_source']; $params['trxn_id'] = $result['trxn_id'] ?? NULL; $params['is_test'] = ($this->_mode === 'live') ? 0 : 1; if (!empty($formValues['send_receipt'])) { @@ -1856,7 +1846,7 @@ class CRM_Member_Form_Membership extends CRM_Member_Form { ]); $membership = $createdMemberships[$memType]; - $memEndDate = ($membership->end_date) ? $membership->end_date : $endDate; + $memEndDate = $membership->end_date ?: $endDate; //get the end date from calculated dates. if (!$memEndDate && !$isRecur) { -- 2.25.1