CRM-15787 - QA Fix
authoratif-shaikh <shaikh388@gmail.com>
Fri, 9 Jan 2015 08:27:26 +0000 (13:57 +0530)
committeratif-shaikh <shaikh388@gmail.com>
Fri, 9 Jan 2015 08:27:26 +0000 (13:57 +0530)
----------------------------------------
* CRM-15787: Not possible to add contribution field in profile for on behalf membership
  https://issues.civicrm.org/jira/browse/CRM-15787

CRM/Contribute/Form/ContributionPage/Settings.php

index 8a8fa5f8f0dc5be53ff8d8246ff2a49f39e90a25..b20f5f2f5f5103808bef2a03b2cadf959271e8eb 100644 (file)
@@ -146,7 +146,7 @@ class CRM_Contribute_Form_ContributionPage_Settings extends CRM_Contribute_Form_
 
     //CRM-15787 - If applicable, register 'membership_1'
     $member = CRM_Member_BAO_Membership::getMembershipBlock($this->_id);
-    $allowMemberCoreTypes = '';
+    $coreTypes = array('Contact', 'Organization');
 
     $entities[] = array(
       'entity_name' => array ('contact_1'),
@@ -154,13 +154,13 @@ class CRM_Contribute_Form_ContributionPage_Settings extends CRM_Contribute_Form_
     );
 
     if ($member && $member['is_active']) {
-      $allowMemberCoreTypes = 'Membership';
+      $coreTypes[] = 'Membership';
       $entities[] = array(
         'entity_name' => array ('membership_1'),
         'entity_type' => 'MembershipModel',
       );
     }
-    $allowCoreTypes = array_merge(array('Contact', 'Organization', $allowMemberCoreTypes), CRM_Contact_BAO_ContactType::subTypes('Organization'));
+    $allowCoreTypes = array_merge($coreTypes, CRM_Contact_BAO_ContactType::subTypes('Organization'));
     $allowSubTypes = array();
 
     $this->addProfileSelector('onbehalf_profile_id', ts('Organization Profile'), $allowCoreTypes, $allowSubTypes, $entities);