X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=CRM%2FContribute%2FForm%2FContributionPage%2FSettings.php;h=d62d54edda1ee8c76290b5f2da222737d6fda194;hb=7d86179d7d8e91160bbb5e6643fa265198a99a2d;hp=60a074e41b43473dadf36aeb8f8baee7cc6d090b;hpb=a35832db94042b472bba3dc7d37593768483fd6b;p=civicrm-core.git diff --git a/CRM/Contribute/Form/ContributionPage/Settings.php b/CRM/Contribute/Form/ContributionPage/Settings.php index 60a074e41b..d62d54edda 100644 --- a/CRM/Contribute/Form/ContributionPage/Settings.php +++ b/CRM/Contribute/Form/ContributionPage/Settings.php @@ -139,18 +139,27 @@ class CRM_Contribute_Form_ContributionPage_Settings extends CRM_Contribute_Form_ // is on behalf of an organization ? $this->addElement('checkbox', 'is_organization', ts('Allow individuals to contribute and / or signup for membership on behalf of an organization?'), NULL, array('onclick' => "showHideByValue('is_organization',true,'for_org_text','table-row','radio',false);showHideByValue('is_organization',true,'for_org_option','table-row','radio',false);")); - $allowCoreTypes = array_merge(array( - 'Contact', - 'Organization' - ), CRM_Contact_BAO_ContactType::subTypes('Organization')); - $allowSubTypes = array(); - $entities = array( - array( - 'entity_name' => 'contact_1', - 'entity_type' => 'OrganizationModel', - ), + //CRM-15787 - If applicable, register 'membership_1' + $member = CRM_Member_BAO_Membership::getMembershipBlock($this->_id); + $coreTypes = array('Contact', 'Organization'); + + $entities[] = array( + 'entity_name' => array ('contact_1'), + 'entity_type' => 'OrganizationModel', ); + if ($member && $member['is_active']) { + $coreTypes[] = 'Membership'; + $entities[] = array( + 'entity_name' => array ('membership_1'), + 'entity_type' => 'MembershipModel', + ); + } + + $allowCoreTypes = array_merge($coreTypes, + CRM_Contact_BAO_ContactType::subTypes('Organization')); + $allowSubTypes = array(); + $this->addProfileSelector('onbehalf_profile_id', ts('Organization Profile'), $allowCoreTypes, $allowSubTypes, $entities); $options = array();