$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;
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.'));
}
//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) {
}
//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);
}
*/
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);
);
$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',
$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']);
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;
/**
* 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) {
$stateCountryMap[$index] = array();
}
$stateCountryMap[$index][$prefixName] = $key;
+
+ if ($prefixName == "state_province") {
+ 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;
+ }
+ else {
+ if (count($this->_submitValues)) {
+ $locationTypeId = $field['location_type_id'];
+ if (array_key_exists("country-{$locationTypeId}", $fields) &&
+ array_key_exists("state_province-{$locationTypeId}", $fields) &&
+ !empty($this->_submitValues["country-{$locationTypeId}"])) {
+ $field['is_required'] =
+ CRM_Core_Payment_Form::checkRequiredStateProvince($this, "country-{$locationTypeId}");
+ }
+ }
+ }
+ }
}
- 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]);
*
* @access public
*
- * @return None
+ * @return void
*/
public function authenticatePledgeUser() {
//get the userChecksum and contact id