Skip to content
Snippets Groups Projects
Commit d8ad616b authored by Allen Shaw's avatar Allen Shaw Committed by colemanw
Browse files

Refactored out of CRM_Core_PseudoConstant: billingMode(). CRM-12464

----------------------------------------
* CRM-12464: Search improvements in 4.4
  http://issues.civicrm.org/jira/browse/CRM-12464
parent 6ce01b02
No related branches found
No related tags found
No related merge requests found
......@@ -379,5 +379,15 @@ INNER JOIN civicrm_contribution con ON ( con.contribution_recur_id = rec.id )
return $newCredit;
}
/* Return a static array of available billing modes, in the format:
* $array[numeric key] = 'descriptive text'.
*/
static function getBillingModes() {
return array(
CRM_Core_Payment::BILLING_MODE_FORM => 'form',
CRM_Core_Payment::BILLING_MODE_BUTTON => 'button',
CRM_Core_Payment::BILLING_MODE_NOTIFY => 'notify',
);
}
}
......@@ -65,13 +65,6 @@ class CRM_Core_PseudoConstant {
*/
private static $activityType;
/**
* payment processor billing modes
* @var array
* @static
*/
private static $billingMode;
/**
* states, provinces
* @var array
......@@ -542,25 +535,6 @@ class CRM_Core_PseudoConstant {
}
return self::$activityType[$index];
}
/**
* 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;
}
/**
* Get all the State/Province from database.
......@@ -852,6 +826,8 @@ WHERE id = %1";
}
/**
* DEPRECATED. Please use the buildOptions() method in the appropriate BAO object.
*
* Get all permissioned groups from database
*
* The static array group is returned, and if it's
......
......@@ -151,12 +151,12 @@ class CRM_Financial_BAO_PaymentProcessorType extends CRM_Financial_DAO_PaymentPr
if (isset($paymentProcessorType->billing_mode)) {
// ugh unidirectional manipulation
if (!is_numeric($paymentProcessorType->billing_mode)) {
$billingModes = array_flip(CRM_Core_PseudoConstant::billingMode());
$billingModes = array_flip(CRM_Core_Payment::getBillingModes());
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())) {
if (!array_key_exists($paymentProcessorType->billing_mode, CRM_Core_Payment::getBillingModes())) {
throw new Exception("Unrecognized billing_mode");
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment