From c8fa0a31e347e5ad3838cfa5b77112cc8930ad57 Mon Sep 17 00:00:00 2001 From: atif-shaikh Date: Thu, 4 Sep 2014 17:42:38 +0530 Subject: [PATCH 1/2] CRM-15182 - on behalf of: preloaded org is not preserved https://issues.civicrm.org/jira/browse/CRM-15182 --- CRM/Contribute/Form/Contribution/Confirm.php | 6 +++++- CRM/Contribute/Form/Contribution/OnBehalfOf.php | 4 +++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/CRM/Contribute/Form/Contribution/Confirm.php b/CRM/Contribute/Form/Contribution/Confirm.php index 8728e808afde..45b6b878fd31 100644 --- a/CRM/Contribute/Form/Contribution/Confirm.php +++ b/CRM/Contribute/Form/Contribution/Confirm.php @@ -268,10 +268,14 @@ public function preProcess() { } // if onbehalf-of-organization if (!empty($this->_params['hidden_onbehalf_profile'])) { - if (!empty($this->_params['org_option']) && !empty($this->_params['organization_id'])) { + // CRM-15182 + if (empty($this->_params['org_option']) && empty($this->_params['organization_id'])) { if (!empty($this->_params['onbehalfof_id'])) { $this->_params['organization_id'] = $this->_params['onbehalfof_id']; } + else { + $this->_params['organization_id'] = CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Contact', $this->_params['onbehalf']['organization_name'], 'id', 'display_name'); + } } $this->_params['organization_name'] = $this->_params['onbehalf']['organization_name']; diff --git a/CRM/Contribute/Form/Contribution/OnBehalfOf.php b/CRM/Contribute/Form/Contribution/OnBehalfOf.php index ea2d992564e7..e2c62f1b678e 100644 --- a/CRM/Contribute/Form/Contribution/OnBehalfOf.php +++ b/CRM/Contribute/Form/Contribution/OnBehalfOf.php @@ -97,7 +97,9 @@ static function preProcess(&$form) { $form->assign('locDataURL', $locDataURL); if (!empty($form->_submitValues['onbehalf'])) { - $form->assign('submittedOnBehalf', $form->_submitValues['onbehalfof_id']); + if (!empty($form->_submitValues['onbehalfof_id'])) { + $form->assign('submittedOnBehalf', $form->_submitValues['onbehalfof_id']); + } $form->assign('submittedOnBehalfInfo', json_encode($form->_submitValues['onbehalf'])); } } From 96904d4d0def50fd5681c4991d7746f98e82e0ea Mon Sep 17 00:00:00 2001 From: atif-shaikh Date: Thu, 4 Sep 2014 18:18:24 +0530 Subject: [PATCH 2/2] CRM-15182 enhancement - on behalf of: preloaded org is not preserved https://issues.civicrm.org/jira/browse/CRM-15182 --- CRM/Contribute/Form/Contribution/Confirm.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CRM/Contribute/Form/Contribution/Confirm.php b/CRM/Contribute/Form/Contribution/Confirm.php index 45b6b878fd31..0d3d55e0aad9 100644 --- a/CRM/Contribute/Form/Contribution/Confirm.php +++ b/CRM/Contribute/Form/Contribution/Confirm.php @@ -1533,7 +1533,7 @@ static function processOnBehalfOrganization(&$behalfOrganization, &$contactID, & $isCurrentEmployer = FALSE; $dupeIDs = array(); $orgID = NULL; - if (!empty($behalfOrganization['organization_id']) && !empty($behalfOrganization['org_option'])) { + if (!empty($behalfOrganization['organization_id']) && empty($behalfOrganization['org_option'])) { $orgID = $behalfOrganization['organization_id']; unset($behalfOrganization['organization_id']); $isCurrentEmployer = TRUE;