X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=CRM%2FFinancial%2FBAO%2FPaymentProcessor.php;h=6e98ba9005c05da0cbe8d5d28579553ccd689339;hb=8563c1cea6e01de7129c602d4061922d4000c7c3;hp=3054bb464989e11fb7ce2c35a8ea0af17a533842;hpb=ef444b4a23f83a38d8362eb66cd1b06071a7cd1c;p=civicrm-core.git diff --git a/CRM/Financial/BAO/PaymentProcessor.php b/CRM/Financial/BAO/PaymentProcessor.php index 3054bb4649..6e98ba9005 100644 --- a/CRM/Financial/BAO/PaymentProcessor.php +++ b/CRM/Financial/BAO/PaymentProcessor.php @@ -150,9 +150,8 @@ class CRM_Financial_BAO_PaymentProcessor extends CRM_Financial_DAO_PaymentProces * @param bool $is_active * Value we want to set the is_active field. * - * @return CRM_Financial_DAO_PaymentProcessor|null - * DAO object on success, null otherwise - * + * @return bool + * true if we found and updated the object, else false */ public static function setIsActive($id, $is_active) { return CRM_Core_DAO::setFieldValue('CRM_Financial_DAO_PaymentProcessor', $id, 'is_active', $is_active); @@ -273,7 +272,7 @@ class CRM_Financial_BAO_PaymentProcessor extends CRM_Financial_DAO_PaymentProces */ public static function getAllPaymentProcessors($mode = 'all', $reset = FALSE, $isCurrentDomainOnly = TRUE) { - $cacheKey = 'CRM_Financial_BAO_Payment_Processor_' . $mode . '_' . CRM_Core_Config::domainID(); + $cacheKey = 'CRM_Financial_BAO_Payment_Processor_' . $mode . '_' . $isCurrentDomainOnly . '_' . CRM_Core_Config::domainID(); if (!$reset) { $processors = CRM_Utils_Cache::singleton()->get($cacheKey); if (!empty($processors)) { @@ -370,10 +369,10 @@ class CRM_Financial_BAO_PaymentProcessor extends CRM_Financial_DAO_PaymentProces public static function getPaymentProcessors($capabilities = array(), $ids = FALSE) { $testProcessors = in_array('TestMode', $capabilities) ? self::getAllPaymentProcessors('test') : array(); if (is_array($ids)) { - $processors = self::getAllPaymentProcessors('all', TRUE, FALSE); + $processors = self::getAllPaymentProcessors('all', FALSE, FALSE); } else { - $processors = self::getAllPaymentProcessors('all', TRUE); + $processors = self::getAllPaymentProcessors('all'); } if (in_array('TestMode', $capabilities) && is_array($ids)) { @@ -598,4 +597,16 @@ INNER JOIN civicrm_contribution con ON ( mp.contribution_id = con.id ) } } + /** + * Get the default financial account id for payment processor accounts. + * + * Note that there is only a 'name' field & no label field. If people customise + * name then this won't work. This is new best-effort functionality so that's non-regressive. + * + * The fix for that is to add a label value to the financial account table. + */ + public static function getDefaultFinancialAccountID() { + return CRM_Core_PseudoConstant::getKey('CRM_Financial_DAO_EntityFinancialAccount', 'financial_account_id', 'Payment Processor Account'); + } + }