From a823c1634bdcd8731cfb851052f0e9fcdef0360f Mon Sep 17 00:00:00 2001 From: Eileen McNaughton Date: Thu, 31 Aug 2023 08:51:29 +1200 Subject: [PATCH] Move no-longer-shared function back to it's form --- CRM/Contact/Form/Contact.php | 26 ++++++++++++++++++++++++-- CRM/Contact/Form/Location.php | 28 ---------------------------- 2 files changed, 24 insertions(+), 30 deletions(-) diff --git a/CRM/Contact/Form/Contact.php b/CRM/Contact/Form/Contact.php index e839389812..856877a178 100644 --- a/CRM/Contact/Form/Contact.php +++ b/CRM/Contact/Form/Contact.php @@ -312,8 +312,7 @@ class CRM_Contact_Form_Contact extends CRM_Core_Form { // also keep the convention. $this->assign('contactId', $this->_contactId); - // location blocks. - CRM_Contact_Form_Location::preProcess($this); + $this->preProcessLocation(); // retain the multiple count custom fields value if (!empty($_POST['hidden_custom'])) { @@ -375,6 +374,29 @@ class CRM_Contact_Form_Contact extends CRM_Core_Form { $this->assign('paramSubType', $paramSubType ?? ''); } + private function preProcessLocation() { + $this->_addBlockName = CRM_Utils_Request::retrieve('block', 'String'); + $additionalblockCount = CRM_Utils_Request::retrieve('count', 'Positive'); + + $this->assign('addBlock', FALSE); + if ($this->_addBlockName && $additionalblockCount) { + $this->assign('addBlock', TRUE); + $this->assign('blockName', $this->_addBlockName); + $this->assign('blockId', $additionalblockCount); + $this->set($this->_addBlockName . '_Block_Count', $additionalblockCount); + } + + $this->assign('blocks', $this->_blocks); + $this->assign('className', 'CRM_Contact_Form_Contact'); + + // get address sequence. + if (!$addressSequence = $this->get('addressSequence')) { + $addressSequence = CRM_Core_BAO_Address::addressSequence(); + $this->set('addressSequence', $addressSequence); + } + $this->assign('addressSequence', $addressSequence); + } + /** * Set default values for the form. * diff --git a/CRM/Contact/Form/Location.php b/CRM/Contact/Form/Location.php index 0a70e88020..8040a045f5 100644 --- a/CRM/Contact/Form/Location.php +++ b/CRM/Contact/Form/Location.php @@ -16,34 +16,6 @@ */ class CRM_Contact_Form_Location { - /** - * Set variables up before form is built. - * - * @param CRM_Core_Form $form - */ - public static function preProcess($form) { - $form->_addBlockName = CRM_Utils_Request::retrieve('block', 'String'); - $additionalblockCount = CRM_Utils_Request::retrieve('count', 'Positive'); - - $form->assign('addBlock', FALSE); - if ($form->_addBlockName && $additionalblockCount) { - $form->assign('addBlock', TRUE); - $form->assign('blockName', $form->_addBlockName); - $form->assign('blockId', $additionalblockCount); - $form->set($form->_addBlockName . '_Block_Count', $additionalblockCount); - } - - $form->assign('blocks', $form->_blocks); - $form->assign('className', CRM_Utils_System::getClassName($form)); - - // get address sequence. - if (!$addressSequence = $form->get('addressSequence')) { - $addressSequence = CRM_Core_BAO_Address::addressSequence(); - $form->set('addressSequence', $addressSequence); - } - $form->assign('addressSequence', $addressSequence); - } - /** * Build the form object. * -- 2.25.1