X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=CRM%2FContribute%2FForm%2FContributionBase.php;h=c78d4a412d4c60c355262457fc3bfffa2f14dc89;hb=8381af809c027065ceb28f18b5530ffb3a51ada3;hp=c4b48edab6c092f09e45468769ecd9e50b4aef62;hpb=15119aa5232489a8204ea9ecb5522d93c004bb54;p=civicrm-core.git diff --git a/CRM/Contribute/Form/ContributionBase.php b/CRM/Contribute/Form/ContributionBase.php index c4b48edab6..c78d4a412d 100644 --- a/CRM/Contribute/Form/ContributionBase.php +++ b/CRM/Contribute/Form/ContributionBase.php @@ -230,6 +230,9 @@ class CRM_Contribute_Form_ContributionBase extends CRM_Core_Form { $membershipType = new CRM_Member_BAO_MembershipType(); $membershipType->id = $membership->membership_type_id; if ($membershipType->find(TRUE)) { + // CRM-14051 - membership_type.relationship_type_id is a CTRL-A padded string w one or more ID values. + // Convert to commma separated list. + $inheritedRelTypes = implode(CRM_Utils_Array::explodePadded($membershipType->relationship_type_id), ','); $permContacts = CRM_Contact_BAO_Relationship::getPermissionedContacts($this->_userID, $membershipType->relationship_type_id); if (array_key_exists($membership->contact_id, $permContacts)) { $this->_membershipContactID = $membership->contact_id; @@ -277,7 +280,7 @@ class CRM_Contribute_Form_ContributionBase extends CRM_Core_Form { CRM_Contribute_BAO_ContributionPage::setValues($this->_id, $this->_values); // check if form is active - if (!CRM_Utils_Array::value('is_active', $this->_values)) { + if (empty($this->_values['is_active'])) { // form is inactive, die a fatal death CRM_Core_Error::fatal(ts('The page you requested is currently unavailable.')); } @@ -299,7 +302,7 @@ class CRM_Contribute_Form_ContributionBase extends CRM_Core_Form { //FIXME: to support multiple payment processors if ($isMonetary && - (!$isPayLater || CRM_Utils_Array::value('payment_processor', $this->_values)) + (!$isPayLater || !empty($this->_values['payment_processor'])) ) { $ppID = CRM_Utils_Array::value('payment_processor', $this->_values); if (!$ppID) { @@ -428,7 +431,7 @@ class CRM_Contribute_Form_ContributionBase extends CRM_Core_Form { } //set pledge block if block id is set - if (CRM_Utils_Array::value('pledge_block_id', $this->_values)) { + if (!empty($this->_values['pledge_block_id'])) { $this->assign('pledgeBlock', TRUE); } @@ -509,7 +512,7 @@ class CRM_Contribute_Form_ContributionBase extends CRM_Core_Form { */ function assignToTemplate() { $name = CRM_Utils_Array::value('billing_first_name', $this->_params); - if (CRM_Utils_Array::value('billing_middle_name', $this->_params)) { + if (!empty($this->_params['billing_middle_name'])) { $name .= " {$this->_params['billing_middle_name']}"; } $name .= ' ' . CRM_Utils_Array::value('billing_last_name', $this->_params); @@ -524,9 +527,7 @@ class CRM_Contribute_Form_ContributionBase extends CRM_Core_Form { ); $config = CRM_Core_Config::singleton(); - if (isset($this->_values['is_recur']) && - CRM_Utils_Array::value('is_recur', $this->_paymentProcessor) - ) { + if (isset($this->_values['is_recur']) && !empty($this->_paymentProcessor['is_recur'])) { $this->assign('is_recur_enabled', 1); $vars = array_merge($vars, array( 'is_recur', 'frequency_interval', 'frequency_unit', @@ -583,7 +584,7 @@ class CRM_Contribute_Form_ContributionBase extends CRM_Core_Form { $this->assign('address', CRM_Utils_Address::format($addressFields)); - if (CRM_Utils_Array::value('hidden_onbehalf_profile', $this->_params)) { + if (!empty($this->_params['hidden_onbehalf_profile'])) { $this->assign('onBehalfName', $this->_params['organization_name']); $locTypeId = array_keys($this->_params['onbehalf_location']['email']); $this->assign('onBehalfEmail', $this->_params['onbehalf_location']['email'][$locTypeId[0]]['email']); @@ -594,7 +595,7 @@ class CRM_Contribute_Form_ContributionBase extends CRM_Core_Form { if ($this->_amount > 0.0) { $assignCCInfo = TRUE; } - elseif (CRM_Utils_array::value('selectMembership', $this->_params)) { + elseif (!empty($this->_params['selectMembership'])) { $memFee = CRM_Core_DAO::getFieldValue('CRM_Member_DAO_MembershipType', $this->_params['selectMembership'], 'minimum_fee'); if ($memFee > 0.0) { $assignCCInfo = TRUE; @@ -634,10 +635,10 @@ class CRM_Contribute_Form_ContributionBase extends CRM_Core_Form { /** * Function to add the custom fields * - * @return None + * @return void * @access public */ - function buildCustom($id, $name, $viewOnly = FALSE, $onBehalf = FALSE, $fieldTypes = NULL) { + function buildCustom($id, $name, $viewOnly = FALSE, $profileContactType = NULL, $fieldTypes = NULL) { $stateCountryMap = array(); if ($id) { @@ -706,7 +707,7 @@ class CRM_Contribute_Form_ContributionBase extends CRM_Core_Form { $stateCountryMap[$index][$prefixName] = $key; if ($prefixName == "state_province") { - if ($onBehalf) { + if ($profileContactType == 'onbehalf') { //CRM-11881: Bypass required-ness check for state/province on Contribution Confirm page //as already done during Contribution registration via onBehalf's quickForm $field['is_required'] = FALSE; @@ -725,16 +726,23 @@ class CRM_Contribute_Form_ContributionBase extends CRM_Core_Form { } } - if ($onBehalf) { + if ($profileContactType) { + //Since we are showing honoree name separately so we are removing it from honoree profile just for display + $honoreeNamefields = array('prefix_id', 'first_name', 'last_name', 'suffix_id', 'organization_name', 'household_name'); + if ($profileContactType == 'honor' && in_array($field['name'], $honoreeNamefields)) { + unset($fields[$field['name']]); + continue; + } if (!empty($fieldTypes) && in_array($field['field_type'], $fieldTypes)) { CRM_Core_BAO_UFGroup::buildProfile( $this, $field, CRM_Profile_Form::MODE_CREATE, $contactID, - TRUE + TRUE, + $profileContactType ); - $this->_fields['onbehalf'][$key] = $field; + $this->_fields[$profileContactType][$key] = $field; } else { unset($fields[$key]); @@ -795,7 +803,7 @@ class CRM_Contribute_Form_ContributionBase extends CRM_Core_Form { * * @access public * - * @return None + * @return void */ public function authenticatePledgeUser() { //get the userChecksum and contact id