From 6601aa5118631931a50dc5c28903ea2e1d24e9a6 Mon Sep 17 00:00:00 2001 From: Eileen McNaughton Date: Sat, 14 Aug 2021 08:29:39 +1200 Subject: [PATCH] Extract getMembershipParams --- CRM/Batch/Form/Entry.php | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/CRM/Batch/Form/Entry.php b/CRM/Batch/Form/Entry.php index 5959a2d0ff..cbc22ed6ce 100644 --- a/CRM/Batch/Form/Entry.php +++ b/CRM/Batch/Form/Entry.php @@ -820,12 +820,7 @@ class CRM_Batch_Form_Entry extends CRM_Core_Form { } // end of contribution related section - $membershipParams = [ - 'start_date' => $value['membership_start_date'] ?? NULL, - 'end_date' => $value['membership_end_date'] ?? NULL, - 'join_date' => $value['membership_join_date'] ?? NULL, - 'campaign_id' => $value['member_campaign_id'] ?? NULL, - ]; + $membershipParams = $this->getMembershipParams(); if ($this->currentRowIsRenew()) { // The following parameter setting may be obsolete. @@ -1207,4 +1202,18 @@ class CRM_Batch_Form_Entry extends CRM_Core_Form { return $this->currentRowExistingMembership; } + /** + * Get the params as related to the membership entity. + * + * @return array + */ + private function getMembershipParams(): array { + return [ + 'start_date' => $this->currentRow['membership_start_date'] ?? NULL, + 'end_date' => $this->currentRow['membership_end_date'] ?? NULL, + 'join_date' => $this->currentRow['membership_join_date'] ?? NULL, + 'campaign_id' => $this->currentRow['member_campaign_id'] ?? NULL, + ]; + } + } -- 2.25.1