Skip to content

Commit

Permalink
Move no-longer-shared function back to it's form
Browse files Browse the repository at this point in the history
  • Loading branch information
eileenmcnaughton committed Aug 30, 2023
1 parent 46413c0 commit b2cf791
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 30 deletions.
26 changes: 24 additions & 2 deletions CRM/Contact/Form/Contact.php
Original file line number Diff line number Diff line change
Expand Up @@ -312,8 +312,7 @@ public function preProcess() {
// 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'])) {
Expand Down Expand Up @@ -375,6 +374,29 @@ public function preProcess() {
$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.
*
Expand Down
28 changes: 0 additions & 28 deletions CRM/Contact/Form/Location.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*
Expand Down

0 comments on commit b2cf791

Please sign in to comment.