From: yashodha Date: Fri, 1 Apr 2016 13:26:03 +0000 (+0530) Subject: CRM-17878: on behalf still seems to be loading on thankyou page X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=2454bb63c3069cecff81686d9cfa57632e43a7e3;p=civicrm-core.git CRM-17878: on behalf still seems to be loading on thankyou page ---------------------------------------- * CRM-17878: If 'on behalf of organisation' is set to 'optional' and then not chosen, it creates contact with no name and adds the relationship https://issues.civicrm.org/jira/browse/CRM-17878 --- diff --git a/CRM/Contribute/Form/Contribution/ThankYou.php b/CRM/Contribute/Form/Contribution/ThankYou.php index 528b6efd3b..753d41c774 100644 --- a/CRM/Contribute/Form/Contribution/ThankYou.php +++ b/CRM/Contribute/Form/Contribution/ThankYou.php @@ -186,7 +186,12 @@ class CRM_Contribute_Form_Contribution_ThankYou extends CRM_Contribute_Form_Cont $this->buildCustom($this->_values['custom_pre_id'], 'customPre', TRUE); $this->buildCustom($this->_values['custom_post_id'], 'customPost', TRUE); - if (!empty($params['onbehalf'])) { + if (!empty($this->_values['onbehalf_profile_id']) && + !empty($params['onbehalf']) && + ($this->_values['is_for_organization'] == 2 || + !empty($params['is_for_organization']) + ) + ) { $fieldTypes = array('Contact', 'Organization'); $contactSubType = CRM_Contact_BAO_ContactType::subTypes('Organization'); $fieldTypes = array_merge($fieldTypes, $contactSubType);