本文整理汇总了PHP中CRM_Price_BAO_PriceSet::getPriceFieldValueFromURL方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Price_BAO_PriceSet::getPriceFieldValueFromURL方法的具体用法?PHP CRM_Price_BAO_PriceSet::getPriceFieldValueFromURL怎么用?PHP CRM_Price_BAO_PriceSet::getPriceFieldValueFromURL使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Price_BAO_PriceSet
的用法示例。
在下文中一共展示了CRM_Price_BAO_PriceSet::getPriceFieldValueFromURL方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setDefaultValues
//.........这里部分代码省略.........
$paymentAmount = 0;
$duePayment = FALSE;
foreach ($pledgePayments as $payId => $value) {
if ($value['status'] == 'Overdue') {
$this->_defaults['pledge_amount'][$payId] = 1;
$paymentAmount += $value['scheduled_amount'];
} elseif (!$duePayment && $value['status'] == 'Pending') {
$this->_defaults['pledge_amount'][$payId] = 1;
$paymentAmount += $value['scheduled_amount'];
$duePayment = TRUE;
} elseif ($value['status'] == 'Completed' && $value['contribution_id']) {
$completedContributionIds[] = $value['contribution_id'];
}
}
$this->_defaults['price_' . $this->_priceSetId] = $paymentAmount;
if (count($completedContributionIds)) {
$softCredit = array();
foreach ($completedContributionIds as $id) {
$softCredit = CRM_Contribute_BAO_ContributionSoft::getSoftContribution($id);
}
if (isset($softCredit['soft_credit'])) {
$this->_defaults['soft_credit_type_id'] = $softCredit['soft_credit'][1]['soft_credit_type'];
//since honoree profile fieldname of fields are prefixed with 'honor'
//we need to reformat the fieldname to append prefix during setting default values
CRM_Core_BAO_UFGroup::setProfileDefaults($softCredit['soft_credit'][1]['contact_id'], CRM_Core_BAO_UFGroup::getFields($this->_honoreeProfileId), $defaults);
foreach ($defaults as $fieldName => $value) {
$this->_defaults['honor[' . $fieldName . ']'] = $value;
}
}
}
} elseif (!empty($this->_values['pledge_block_id'])) {
//set default to one time contribution.
$this->_defaults['is_pledge'] = 0;
}
// to process Custom data that are appended to URL
$getDefaults = CRM_Core_BAO_CustomGroup::extractGetParams($this, "'Contact', 'Individual', 'Contribution'");
$this->_defaults = array_merge($this->_defaults, $getDefaults);
$config = CRM_Core_Config::singleton();
// set default country from config if no country set
if (empty($this->_defaults["billing_country_id-{$this->_bltID}"])) {
$this->_defaults["billing_country_id-{$this->_bltID}"] = $config->defaultContactCountry;
}
// set default state/province from config if no state/province set
if (empty($this->_defaults["billing_state_province_id-{$this->_bltID}"])) {
$this->_defaults["billing_state_province_id-{$this->_bltID}"] = $config->defaultContactStateProvince;
}
$entityId = $memtypeID = NULL;
if ($this->_priceSetId) {
if ($this->_useForMember && !empty($this->_currentMemberships) || $this->_defaultMemTypeId) {
$selectedCurrentMemTypes = array();
foreach ($this->_priceSet['fields'] as $key => $val) {
foreach ($val['options'] as $keys => $values) {
$opMemTypeId = CRM_Utils_Array::value('membership_type_id', $values);
$priceFieldName = 'price_' . $values['price_field_id'];
$priceFieldValue = CRM_Price_BAO_PriceSet::getPriceFieldValueFromURL($this, $priceFieldName);
if (!empty($priceFieldValue)) {
CRM_Price_BAO_PriceSet::setDefaultPriceSetField($priceFieldName, $priceFieldValue, $val['html_type'], $this->_defaults);
// break here to prevent overwriting of default due to 'is_default'
// option configuration or setting of current membership or
// membership for related organization.
// The value sent via URL get's higher priority.
break;
} elseif ($opMemTypeId && in_array($opMemTypeId, $this->_currentMemberships) && !in_array($opMemTypeId, $selectedCurrentMemTypes)) {
CRM_Price_BAO_PriceSet::setDefaultPriceSetField($priceFieldName, $keys, $val['html_type'], $this->_defaults);
$memtypeID = $selectedCurrentMemTypes[] = $values['membership_type_id'];
} elseif (!empty($values['is_default']) && !$opMemTypeId && (!isset($this->_defaults[$priceFieldName]) || $val['html_type'] == 'CheckBox' && !isset($this->_defaults[$priceFieldName][$keys]))) {
CRM_Price_BAO_PriceSet::setDefaultPriceSetField($priceFieldName, $keys, $val['html_type'], $this->_defaults);
$memtypeID = CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceFieldValue', $this->_defaults[$priceFieldName], 'membership_type_id');
}
}
}
$entityId = CRM_Utils_Array::value('id', CRM_Member_BAO_Membership::getContactMembership($contactID, $memtypeID, NULL));
} else {
CRM_Price_BAO_PriceSet::setDefaultPriceSet($this, $this->_defaults);
}
}
//set custom field defaults set by admin if value is not set
if (!empty($this->_fields)) {
//load default campaign from page.
if (array_key_exists('contribution_campaign_id', $this->_fields)) {
$this->_defaults['contribution_campaign_id'] = CRM_Utils_Array::value('campaign_id', $this->_values);
}
//set custom field defaults
foreach ($this->_fields as $name => $field) {
if ($customFieldID = CRM_Core_BAO_CustomField::getKeyID($name)) {
if (!isset($this->_defaults[$name])) {
CRM_Core_BAO_CustomField::setProfileDefaults($customFieldID, $name, $this->_defaults, $entityId, CRM_Profile_Form::MODE_REGISTER);
}
}
}
}
if (!empty($this->_paymentProcessors)) {
foreach ($this->_paymentProcessors as $pid => $value) {
if (!empty($value['is_default'])) {
$this->_defaults['payment_processor_id'] = $pid;
}
}
}
return $this->_defaults;
}