本文整理汇总了PHP中CRM_Price_BAO_PriceSet::getMembershipTypesFromPriceSet方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Price_BAO_PriceSet::getMembershipTypesFromPriceSet方法的具体用法?PHP CRM_Price_BAO_PriceSet::getMembershipTypesFromPriceSet怎么用?PHP CRM_Price_BAO_PriceSet::getMembershipTypesFromPriceSet使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Price_BAO_PriceSet
的用法示例。
在下文中一共展示了CRM_Price_BAO_PriceSet::getMembershipTypesFromPriceSet方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setRecurringMembershipParams
/**
* Determine if recurring parameters need to be added to the form parameters.
*
* - is_recur
* - frequency_interval
* - frequency_unit
*
* For membership this is based on the membership type.
*
* This needs to be done before processing the pre-approval redirect where relevant on the main page or before any payment processing.
*
* Arguably the form should start to build $this->_params in the pre-process main page & use that array consistently throughout.
*/
protected function setRecurringMembershipParams()
{
$selectedMembershipTypeID = CRM_Utils_Array::value('selectMembership', $this->_params);
if ($selectedMembershipTypeID) {
// @todo the price_x fields will ALWAYS allow us to determine the membership - so we should ignore
// 'selectMembership' and calculate from the price_x fields so we have one method that always works
// this is lazy & only catches when selectMembership is set, but the worst of all worlds would be to fix
// this with an else (calculate for price set).
$membershipTypes = CRM_Price_BAO_PriceSet::getMembershipTypesFromPriceSet($this->_priceSetId);
if (in_array($selectedMembershipTypeID, $membershipTypes['autorenew_required']) || in_array($selectedMembershipTypeID, $membershipTypes['autorenew_optional']) && !empty($this->_params['is_recur'])) {
$this->_params['auto_renew'] = TRUE;
}
}
if ((!empty($this->_params['selectMembership']) || !empty($this->_params['priceSetId'])) && !empty($this->_paymentProcessor['is_recur']) && CRM_Utils_Array::value('auto_renew', $this->_params) && empty($this->_params['is_recur']) && empty($this->_params['frequency_interval'])) {
$this->_params['is_recur'] = $this->_values['is_recur'] = 1;
// check if price set is not quick config
if (!empty($this->_params['priceSetId']) && !CRM_Core_DAO::getFieldValue('CRM_Price_DAO_PriceSet', $this->_params['priceSetId'], 'is_quick_config')) {
list($this->_params['frequency_interval'], $this->_params['frequency_unit']) = CRM_Price_BAO_PriceSet::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');
}
}
}