<?php
/*
+--------------------------------------------------------------------+
- | CiviCRM version 4.3 |
+ | CiviCRM version 4.4 |
+--------------------------------------------------------------------+
| Copyright CiviCRM LLC (c) 2004-2013 |
+--------------------------------------------------------------------+
* TODO: In context of chainselect, what to return if e.g. a country has no states?
*
* @param String $fieldName
- * @param String $context: e.g. "search" "edit" "create" "view"
+ * @param String $context: @see CRM_Core_DAO::buildOptionsContext
* @param Array $props: whatever is known about this dao object
*/
public static function buildOptions($fieldName, $context = NULL, $props = array()) {
break;
// Filter country list based on site defaults
case 'country_id':
- $config = CRM_Core_Config::singleton();
- if (!empty($config->countryLimit) && is_array($config->countryLimit)) {
- $params['condition'] = 'id IN (' . implode(',', $config->countryLimit) . ')';
+ if ($context != 'get' && $context != 'validate') {
+ $config = CRM_Core_Config::singleton();
+ if (!empty($config->countryLimit) && is_array($config->countryLimit)) {
+ $params['condition'] = 'id IN (' . implode(',', $config->countryLimit) . ')';
+ }
}
break;
// Filter county list based on chosen state
}
break;
}
- return CRM_Core_PseudoConstant::get(__CLASS__, $fieldName, $params);
+ return CRM_Core_PseudoConstant::get(__CLASS__, $fieldName, $params, $context);
}
-}
+}
\ No newline at end of file