本文整理汇总了PHP中CRM_Price_BAO_Set::getRecurDetails方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Price_BAO_Set::getRecurDetails方法的具体用法?PHP CRM_Price_BAO_Set::getRecurDetails怎么用?PHP CRM_Price_BAO_Set::getRecurDetails使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Price_BAO_Set
的用法示例。
在下文中一共展示了CRM_Price_BAO_Set::getRecurDetails方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: preProcess
//.........这里部分代码省略.........
list($field, $locType) = explode('-', $loc);
}
if (in_array($field, $addressBlocks)) {
if ($locType == 'Primary') {
require_once 'CRM/Core/BAO/LocationType.php';
$defaultLocationType = CRM_Core_BAO_LocationType::getDefault();
$locType = $defaultLocationType->id;
}
if ($field == 'country') {
$value = CRM_Core_PseudoConstant::countryIsoCode($value);
} elseif ($field == 'state_province') {
$value = CRM_Core_PseudoConstant::stateProvinceAbbreviation($value);
}
$isPrimary = 1;
if (isset($this->_params['onbehalf_location']['address']) && count($this->_params['onbehalf_location']['address']) > 0) {
$isPrimary = 0;
}
$this->_params['onbehalf_location']['address'][$locType][$field] = $value;
if (!CRM_Utils_Array::value('is_primary', $this->_params['onbehalf_location']['address'][$locType])) {
$this->_params['onbehalf_location']['address'][$locType]['is_primary'] = $isPrimary;
}
$this->_params['onbehalf_location']['address'][$locType]['location_type_id'] = $locType;
} elseif (in_array($field, $blocks)) {
if (!$typeId || is_numeric($typeId)) {
$blockName = $fieldName = $field;
$locationType = 'location_type_id';
if ($locType == 'Primary') {
$defaultLocationType = CRM_Core_BAO_LocationType::getDefault();
$locationValue = $defaultLocationType->id;
} else {
$locationValue = $locType;
}
$locTypeId = '';
if ($field == 'url') {
$blockName = 'website';
$locationType = 'website_type_id';
$locationValue = $this->_params['onbehalf']["{$loc}-website_type_id"];
} elseif ($field == 'im') {
$fieldName = 'name';
$locTypeId = 'provider_id';
$typeId = $this->_params['onbehalf']["{$loc}-provider_id"];
} elseif ($field == 'phone') {
list($field, $locType, $typeId) = explode('-', $loc);
$locTypeId = 'phone_type_id';
}
$isPrimary = 1;
if (isset($this->_params['onbehalf_location'][$blockName]) && count($this->_params['onbehalf_location'][$blockName]) > 0) {
$isPrimary = 0;
}
if (!$locTypeId) {
$this->_params['onbehalf_location'][$blockName][] = array($fieldName => $value, $locationType => $locationValue, 'is_primary' => $isPrimary);
} else {
$this->_params['onbehalf_location'][$blockName][] = array($fieldName => $value, $locationType => $locationValue, 'is_primary' => $isPrimary, $locTypeId => $typeId);
}
}
} elseif (strstr($loc, 'custom')) {
if ($value && isset($this->_params['onbehalf']["{$loc}_id"])) {
$value = $this->_params['onbehalf']["{$loc}_id"];
}
$this->_params['onbehalf_location']["{$loc}"] = $value;
} else {
if ($loc == 'contact_sub_type') {
$this->_params['onbehalf_location'][$loc] = $value;
} else {
$this->_params['onbehalf_location'][$field] = $value;
}
}
}
} elseif (CRM_Utils_Array::value('is_for_organization', $this->_values)) {
// no on behalf of an organization, CRM-5519
// so reset loc blocks from main params.
foreach (array('phone', 'email', 'address') as $blk) {
if (isset($this->_params[$blk])) {
unset($this->_params[$blk]);
}
}
}
// if auto renew checkbox is set, initiate a open-ended recurring membership
if ((CRM_Utils_Array::value('selectMembership', $this->_params) || CRM_Utils_Array::value('priceSetId', $this->_params)) && CRM_Utils_Array::value('is_recur', $this->_paymentProcessor) && CRM_Utils_Array::value('auto_renew', $this->_params) && !CRM_Utils_Array::value('is_recur', $this->_params) && !CRM_Utils_Array::value('frequency_interval', $this->_params)) {
$this->_params['is_recur'] = $this->_values['is_recur'] = 1;
// check if price set is not quick config
if (CRM_Utils_Array::value('priceSetId', $this->_params) && !$isQuickConfig) {
list($this->_params['frequency_interval'], $this->_params['frequency_unit']) = CRM_Price_BAO_Set::getRecurDetails($this->_params['priceSetId']);
} else {
// FIXME: set interval and unit based on selected membership type
$this->_params['frequency_interval'] = CRM_Core_DAO::getFieldValue('CRM_Member_DAO_MembershipType', $this->_params['selectMembership'], 'duration_interval');
$this->_params['frequency_unit'] = CRM_Core_DAO::getFieldValue('CRM_Member_DAO_MembershipType', $this->_params['selectMembership'], 'duration_unit');
}
}
if ($this->_pcpId) {
$params = $this->processPcp($this, $this->_params);
$this->_params = $params;
}
$this->_params['invoiceID'] = $this->get('invoiceID');
//carry campaign from profile.
if (array_key_exists('contribution_campaign_id', $this->_params)) {
$this->_params['campaign_id'] = $this->_params['contribution_campaign_id'];
}
$this->set('params', $this->_params);
}