Merge remote-tracking branch 'upstream/4.5' into 4.5-master-2015-01-12-16-09-32
authorkurund <kurund@civicrm.org>
Mon, 12 Jan 2015 10:51:26 +0000 (16:21 +0530)
committerkurund <kurund@civicrm.org>
Mon, 12 Jan 2015 10:51:26 +0000 (16:21 +0530)
Conflicts:
CRM/Contact/Page/AJAX.php
CRM/Contribute/Form/ContributionPage/Settings.php

1  2 
CRM/Contact/Page/AJAX.php
CRM/Contribute/Form/Contribution/Main.php
CRM/Contribute/Form/ContributionPage/Settings.php

index 9d1580f5c823c3e6c1de81fd9025366e794bd578,11a3202147deddf92f5311c60ef3e1028a6c42f1..5018815665a5896141f86af6a2e1ca378078dff5
@@@ -210,11 -196,11 +210,11 @@@ class CRM_Contact_Page_AJAX 
    }
  
    /**
 -   * Function to fetch PCP ID by PCP Supporter sort_name, also displays PCP title and associated Contribution Page title
 +   * Fetch PCP ID by PCP Supporter sort_name, also displays PCP title and associated Contribution Page title
     */
 -  static function getPCPList() {
 -    $name  = CRM_Utils_Array::value('term', $_GET);
 -    $name  = CRM_Utils_Type::escape($name, 'String');
 +  public static function getPCPList() {
-     $name = CRM_Utils_Array::value('s', $_GET);
++    $name = CRM_Utils_Array::value('term', $_GET);
 +    $name = CRM_Utils_Type::escape($name, 'String');
      $limit = '10';
  
      $where = ' AND pcp.page_id = cp.id AND pcp.contact_id = cc.id';
index 60a074e41b43473dadf36aeb8f8baee7cc6d090b,b20f5f2f5f5103808bef2a03b2cadf959271e8eb..d62d54edda1ee8c76290b5f2da222737d6fda194
@@@ -139,21 -144,28 +139,30 @@@ class CRM_Contribute_Form_ContributionP
      // 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',
      );
  
 -    $allowCoreTypes = array_merge($coreTypes, CRM_Contact_BAO_ContactType::subTypes('Organization'));
+     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();
 +    $options = array();
      $options[] = $this->createElement('radio', NULL, NULL, ts('Optional'), 1);
      $options[] = $this->createElement('radio', NULL, NULL, ts('Required'), 2);
      $this->addGroup($options, 'is_for_organization', ts(''));