本文整理汇总了PHP中CRM_Core_PseudoConstant::billingMode方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Core_PseudoConstant::billingMode方法的具体用法?PHP CRM_Core_PseudoConstant::billingMode怎么用?PHP CRM_Core_PseudoConstant::billingMode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Core_PseudoConstant
的用法示例。
在下文中一共展示了CRM_Core_PseudoConstant::billingMode方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: create
/**
* Function to add the payment-processor type in the db
*
* @param array $params (reference ) an assoc array of name/value pairs
* @param array $ids the array that holds all the db ids
*
* @return object CRM_Core_DAO_PaymentProcessorType
* @access public
* @static
*
*/
static function create(&$params)
{
$paymentProcessorType = new CRM_Core_DAO_PaymentProcessorType();
$paymentProcessorType->copyValues($params);
/*
// adapted from CRM_Core_Extensions_Payment::install
foreach (array(
'class_name',
'title',
'name',
'description',
'user_name_label',
'password_label',
'signature_label',
'subject_label',
'url_site_default',
'url_api_default',
'url_recur_default',
'url_site_test_default',
'url_api_test_default',
'url_recur_test_default',
'url_button_default',
'url_button_test_default',
'billing_mode',
'is_recur',
'payment_type'
) as $trimmable) {
if (isset($paymentProcessorType->{$trimmable})) {
$paymentProcessorType->{$trimmable} = trim($paymentProcessorType->{$trimmable});
}
}
*/
if (isset($paymentProcessorType->billing_mode)) {
// ugh unidirectional manipulation
if (!is_numeric($paymentProcessorType->billing_mode)) {
$billingModes = array_flip(CRM_Core_PseudoConstant::billingMode());
if (array_key_exists($paymentProcessorType->billing_mode, $billingModes)) {
$paymentProcessorType->billing_mode = $billingModes[$paymentProcessorType->billing_mode];
}
}
if (!array_key_exists($paymentProcessorType->billing_mode, CRM_Core_PseudoConstant::billingMode())) {
throw new Exception("Unrecognized billing_mode");
}
}
// FIXME handle is_default
if (!empty($paymentProcessorType->id)) {
$ppByName = self::getAllPaymentProcessorTypes('name');
if (array_key_exists($paymentProcessorType->name, $ppByName)) {
if ($ppByName[$paymentProcessorType->name] != $paymentProcessorType->id) {
CRM_Core_Error::fatal('This payment processor type already exists.');
}
}
}
return $paymentProcessorType->save();
}
示例2: billingMode
/**
* Get all payment-processor billing modes
*
* @access public
* @static
*
* @return array ($id => $name)
*/
public static function billingMode()
{
if (!self::$billingMode) {
self::$billingMode = array(CRM_Core_Payment::BILLING_MODE_FORM => 'form', CRM_Core_Payment::BILLING_MODE_BUTTON => 'button', CRM_Core_Payment::BILLING_MODE_NOTIFY => 'notify');
}
return self::$billingMode;
}