X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=CRM%2FCore%2FPseudoConstant.php;h=076068079206d672ccc52787a09b719b37de394e;hb=39c3fbcda92848d435b973f403d041fff51e4d4e;hp=5cef5e081eb4aa7da36d8443963f24754d69c2de;hpb=25833519fc4c33bff4d5ffa1466d3f19821a8efe;p=civicrm-core.git diff --git a/CRM/Core/PseudoConstant.php b/CRM/Core/PseudoConstant.php index 5cef5e081e..0760680792 100644 --- a/CRM/Core/PseudoConstant.php +++ b/CRM/Core/PseudoConstant.php @@ -3,7 +3,7 @@ +--------------------------------------------------------------------+ | CiviCRM version 5 | +--------------------------------------------------------------------+ - | Copyright CiviCRM LLC (c) 2004-2018 | + | Copyright CiviCRM LLC (c) 2004-2019 | +--------------------------------------------------------------------+ | This file is a part of CiviCRM. | | | @@ -43,7 +43,7 @@ * This provides greater consistency/predictability after flushing. * * @package CRM - * @copyright CiviCRM LLC (c) 2004-2018 + * @copyright CiviCRM LLC (c) 2004-2019 */ class CRM_Core_PseudoConstant { @@ -201,10 +201,14 @@ class CRM_Core_PseudoConstant { public static function get($daoName, $fieldName, $params = array(), $context = NULL) { CRM_Core_DAO::buildOptionsContext($context); $flip = !empty($params['flip']); + // Historically this was 'false' but according to the notes in + // CRM_Core_DAO::buildOptionsContext it should be context dependent. + // timidly changing for 'search' only to fix world_region in search options. + $localizeDefault = in_array($context, ['search']) ? TRUE : FALSE; // Merge params with defaults $params += array( 'grouping' => FALSE, - 'localize' => FALSE, + 'localize' => $localizeDefault, 'onlyActive' => ($context == 'validate' || $context == 'get') ? FALSE : TRUE, 'fresh' => FALSE, 'context' => $context, @@ -378,11 +382,8 @@ class CRM_Core_PseudoConstant { // Localize results if (!empty($params['localize']) || $pseudoconstant['table'] == 'civicrm_country' || $pseudoconstant['table'] == 'civicrm_state_province') { $I18nParams = array(); - if ($pseudoconstant['table'] == 'civicrm_country') { - $I18nParams['context'] = 'country'; - } - if ($pseudoconstant['table'] == 'civicrm_state_province') { - $I18nParams['context'] = 'province'; + if (isset($fieldSpec['localize_context'])) { + $I18nParams['context'] = $fieldSpec['localize_context']; } $i18n = CRM_Core_I18n::singleton(); $i18n->localizeArray($output, $I18nParams); @@ -539,7 +540,7 @@ class CRM_Core_PseudoConstant { $cacheKey = CRM_Core_BAO_Cache::cleanKey("CRM_PC_{$name}_{$all}_{$key}_{$retrieve}_{$filter}_{$condition}_{$orderby}"); $cache = CRM_Utils_Cache::singleton(); $var = $cache->get($cacheKey); - if ($var && empty($force)) { + if ($var !== NULL && empty($force)) { return $var; } @@ -1571,4 +1572,17 @@ WHERE id = %1 return Civi::$statics[__CLASS__]['taxRates']; } + /** + * Get participant status class options. + * + * @return array + */ + public static function emailOnHoldOptions() { + return array( + '0' => ts('No'), + '1' => ts('On Hold Bounce'), + '2' => ts('On Hold Opt Out'), + ); + } + }