From b92af80720b2b5049a04e222e1ba395847b42d82 Mon Sep 17 00:00:00 2001 From: yashodha Date: Mon, 15 May 2017 13:31:14 +0530 Subject: [PATCH] CRM-20552 - code cleanup --- CRM/Contact/Form/Task/AddToHousehold.php | 15 +-------------- CRM/Contact/Form/Task/AddToIndividual.php | 14 +------------- CRM/Contact/Form/Task/AddToOrganization.php | 14 +------------- CRM/Contact/Form/Task/AddToParentClass.php | 19 +++++++++++++++++++ 4 files changed, 22 insertions(+), 40 deletions(-) diff --git a/CRM/Contact/Form/Task/AddToHousehold.php b/CRM/Contact/Form/Task/AddToHousehold.php index 8a46908383..7c2598bc8e 100644 --- a/CRM/Contact/Form/Task/AddToHousehold.php +++ b/CRM/Contact/Form/Task/AddToHousehold.php @@ -43,20 +43,7 @@ class CRM_Contact_Form_Task_AddToHousehold extends CRM_Contact_Form_Task_AddToPa * Process the form after the input has been submitted and validated. */ public function postProcess() { - - // store the submitted values in an array - $this->params = $this->controller->exportValues($this->_name); - - $this->set('searchDone', 0); - if (!empty($_POST['_qf_AddToHousehold_refresh'])) { - $searchParams['contact_type'] = 'Household'; - $searchParams['rel_contact'] = $this->params['name']; - $this->search($this, $searchParams); - $this->set('searchDone', 1); - return; - } - - $this->addRelationships(); + parent::postProcess(); } } diff --git a/CRM/Contact/Form/Task/AddToIndividual.php b/CRM/Contact/Form/Task/AddToIndividual.php index c008d6fb7d..ec029b873d 100644 --- a/CRM/Contact/Form/Task/AddToIndividual.php +++ b/CRM/Contact/Form/Task/AddToIndividual.php @@ -49,19 +49,7 @@ class CRM_Contact_Form_Task_AddToIndividual extends CRM_Contact_Form_Task_AddToP * Process the form after the input has been submitted and validated. */ public function postProcess() { - // store the submitted values in an array - $this->params = $this->controller->exportValues($this->_name); - - $this->set('searchDone', 0); - if (!empty($_POST['_qf_AddToIndividual_refresh'])) { - $searchParams['contact_type'] = 'Individual'; - $searchParams['rel_contact'] = $this->params['name']; - $this->search($this, $searchParams); - $this->set('searchDone', 1); - return; - } - - $this->addRelationships(); + parent::postProcess(); } } diff --git a/CRM/Contact/Form/Task/AddToOrganization.php b/CRM/Contact/Form/Task/AddToOrganization.php index af28efe4bc..45c40a1f7c 100644 --- a/CRM/Contact/Form/Task/AddToOrganization.php +++ b/CRM/Contact/Form/Task/AddToOrganization.php @@ -49,19 +49,7 @@ class CRM_Contact_Form_Task_AddToOrganization extends CRM_Contact_Form_Task_AddT * Process the form after the input has been submitted and validated. */ public function postProcess() { - // store the submitted values in an array - $this->params = $this->controller->exportValues($this->_name); - - $this->set('searchDone', 0); - if (!empty($_POST['_qf_AddToOrganization_refresh'])) { - $searchParams['contact_type'] = 'Organization'; - $searchParams['rel_contact'] = $this->params['name']; - $this->search($this, $searchParams); - $this->set('searchDone', 1); - return; - } - - $this->addRelationships(); + parent::postProcess(); } } diff --git a/CRM/Contact/Form/Task/AddToParentClass.php b/CRM/Contact/Form/Task/AddToParentClass.php index 8e84414d83..1cc73f2da2 100644 --- a/CRM/Contact/Form/Task/AddToParentClass.php +++ b/CRM/Contact/Form/Task/AddToParentClass.php @@ -262,4 +262,23 @@ class CRM_Contact_Form_Task_AddToParentClass extends CRM_Contact_Form_Task { } } + /** + * Process the form after the input has been submitted and validated. + */ + public function postProcess() { + // store the submitted values in an array + $this->params = $this->controller->exportValues($this->_name); + $this->set('searchDone', 0); + $contactType = $this->get('contactType'); + + if (!empty($_POST["_qf_AddTo{$contactType}_refresh"])) { + $searchParams['contact_type'] = $contactType; + $searchParams['rel_contact'] = $this->params['name']; + $this->search($this, $searchParams); + $this->set('searchDone', 1); + return; + } + $this->addRelationships(); + } + } -- 2.25.1