From c8fa0a31e347e5ad3838cfa5b77112cc8930ad57 Mon Sep 17 00:00:00 2001 From: atif-shaikh Date: Thu, 4 Sep 2014 17:42:38 +0530 Subject: [PATCH] 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 8728e808af..45b6b878fd 100644 --- a/CRM/Contribute/Form/Contribution/Confirm.php +++ b/CRM/Contribute/Form/Contribution/Confirm.php @@ -268,10 +268,14 @@ class CRM_Contribute_Form_Contribution_Confirm extends CRM_Contribute_Form_Contr } // 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 ea2d992564..e2c62f1b67 100644 --- a/CRM/Contribute/Form/Contribution/OnBehalfOf.php +++ b/CRM/Contribute/Form/Contribution/OnBehalfOf.php @@ -97,7 +97,9 @@ class CRM_Contribute_Form_Contribution_OnBehalfOf { $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'])); } } -- 2.25.1