CRM_Utils_Array::lookupValue($defaults, 'prefix', CRM_Core_PseudoConstant::individualPrefix(), $reverse);
CRM_Utils_Array::lookupValue($defaults, 'suffix', CRM_Core_PseudoConstant::individualSuffix(), $reverse);
- CRM_Utils_Array::lookupValue($defaults, 'gender', CRM_Core_PseudoConstant::gender(), $reverse);
+ CRM_Utils_Array::lookupValue($defaults, 'gender', CRM_Core_PseudoConstant::get('CRM_Contact_DAO_Contact', 'gender_id'), $reverse);
//lookup value of email/postal greeting, addressee, CRM-4575
foreach (self::$_greetingTypes as $greeting) {
static function buildQuickForm(&$form) {
// radio button for gender
$genderOptions = array();
- $gender = CRM_Core_PseudoConstant::gender(TRUE);
+ $gender = CRM_Core_PseudoConstant::get('CRM_Contact_DAO_Contact', 'gender_id', array('localize' => TRUE));
foreach ($gender as $key => $var) {
$genderOptions[$key] = $form->createElement('radio', NULL,
ts('Gender'), $var, $key,
$form->add('hidden', 'hidden_demographics', 1);
// radio button for gender
$genderOptions = array();
- $gender = CRM_Core_PseudoConstant::gender();
+ $gender = CRM_Core_PseudoConstant::get('CRM_Contact_DAO_Contact', 'gender_id');
foreach ($gender as $key => $var) {
$genderOptions[$key] = $form->createElement('radio', NULL,
ts('Gender'), $var, $key,
return FALSE;
}
- $allGenders = CRM_Core_PseudoConstant::gender();
+ $allGenders = CRM_Core_PseudoConstant::get('CRM_Contact_DAO_Contact', 'gender_id');
foreach ($allGenders as $key => $value) {
if (strlen($gender) > strlen($value)) {
continue;
CRM_Contact_BAO_Contact::getValues( $params, $defaults );
if (CRM_Utils_Array::value('gender_id', $defaults)) {
- $gender = CRM_Core_PseudoConstant::gender();
+ $gender = CRM_Core_PseudoConstant::get('CRM_Contact_DAO_Contact', 'gender_id');
$defaults['gender_display'] = $gender[CRM_Utils_Array::value('gender_id', $defaults)];
}
}
if (CRM_Utils_Array::value('gender_id', $defaults)) {
- $gender = CRM_Core_PseudoConstant::gender(TRUE);
+ $gender = CRM_Core_PseudoConstant::get('CRM_Contact_DAO_Contact', 'gender_id', array('localize' => TRUE));
$defaults['gender_display'] = $gender[CRM_Utils_Array::value('gender_id', $defaults)];
}
}
elseif ($fieldName === 'gender') {
$genderOptions = array();
- $gender = CRM_Core_PseudoConstant::gender();
+ $gender = CRM_Core_PseudoConstant::get('CRM_Contact_DAO_Contact', 'gender_id');
foreach ($gender as $key => $var) {
$genderOptions[$key] = $form->createElement('radio', NULL, ts('Gender'), $var, $key);
}
*/
private static $cache;
+ /**
+ * static cache for pseudoconstant arrays
+ * @var array
+ * @static
+ */
+ private static $cache;
+
/**
* location type
* @var array
*/
private static $individualSuffix;
- /**
- * gender
- * @var array
- * @static
- */
- private static $gender;
-
/**
* im protocols
* @var array
return self::$individualSuffix;
}
- /**
- * Get all Gender.
- *
- * The static array gender is returned
- *
- * @access public
- * @static
- *
- * @param boolean $all - get All Gender - default is to get only active ones.
- *
- * @return array - array reference of all gender.
- *
- */
- public static function &gender($localize = FALSE) {
- if (!self::$gender) {
- self::$gender = CRM_Core_OptionGroup::values('gender', FALSE, FALSE, $localize);
- }
- return self::$gender;
- }
-
/**
* Get all the IM Providers from database.
*
}
}
elseif ('gender' == substr($name, 0, 6)) {
- $gender = CRM_Core_PseudoConstant::gender();
+ $gender = CRM_Core_PseudoConstant::get('CRM_Contact_DAO_Contact', 'gender_id');
$values[$index] = $gender[$params[$name]];
}
elseif ('individual_prefix' == substr($name, 0, 17)) {
'contribution_status_id' => CRM_Contribute_PseudoConstant::contributionStatus(),
'financial_type_id' => CRM_Contribute_PseudoConstant::financialType(),
'country_id' => CRM_Core_PseudoConstant::country(),
- 'gender_id' => CRM_Core_PseudoConstant::gender(),
+ 'gender_id' => CRM_Core_PseudoConstant::get('CRM_Contact_DAO_Contact', 'gender_id'),
'location_type_id' => CRM_Core_PseudoConstant::locationType(),
'payment_instrument_id' => CRM_Contribute_PseudoConstant::paymentInstrument(),
'phone_type_id' => CRM_Core_PseudoConstant::phoneType(),
);
}
- $this->_genders = CRM_Core_PseudoConstant::gender();
+ $this->_genders = CRM_Core_PseudoConstant::get('CRM_Contact_DAO_Contact', 'gender_id');
parent::__construct();
}
//handle gender
if (array_key_exists('civicrm_contact_gender_id', $row)) {
if ($value = $row['civicrm_contact_gender_id']) {
- $gender = CRM_Core_PseudoConstant::gender();
+ $gender = CRM_Core_PseudoConstant::get('CRM_Contact_DAO_Contact', 'gender_id');
$rows[$rowNum]['civicrm_contact_gender_id'] = $gender[$value];
}
$entryFound = TRUE;
'gender_id' =>
array('title' => ts('Gender'),
'operatorType' => CRM_Report_Form::OP_MULTISELECT,
- 'options' => CRM_Core_PseudoConstant::gender(),
+ 'options' => CRM_Core_PseudoConstant::get('CRM_Contact_DAO_Contact', 'gender_id'),
),
'id' =>
array('title' => ts('Contact ID'),
'name' => 'gender_id',
'title' => ts('Gender'),
'operatorType' => CRM_Report_Form::OP_MULTISELECT,
- 'options' => CRM_Core_PseudoConstant::gender(),
+ 'options' => CRM_Core_PseudoConstant::get('CRM_Contact_DAO_Contact', 'gender_id'),
),
'contact_type' =>
array(
$grantTypes = CRM_Grant_PseudoConstant::grantType();
$countries = CRM_Core_PseudoConstant::country();
- $gender = CRM_Core_PseudoConstant::gender();
+ $gender = CRM_Core_PseudoConstant::get('CRM_Contact_DAO_Contact', 'gender_id');
$grantAmountTotal = "
SELECT COUNT({$this->_aliases['civicrm_grant']}.id) as count ,
if (isset($values['gender'])) {
if (CRM_Utils_Array::value('gender_id', $params)) {
$genders = array();
- $genders = CRM_Core_PseudoConstant::gender();
+ $genders = CRM_Core_PseudoConstant::get('CRM_Contact_DAO_Contact', 'gender_id');
$params['gender'] = $genders[$params['gender_id']];
}
else {
}
if (isset($params['gender_id']) && !(is_numeric($params['gender_id']))) {
- $params['gender_id'] = array_search($params['gender_id'], CRM_Core_PseudoConstant::gender());
+ $params['gender_id'] = array_search($params['gender_id'], CRM_Core_PseudoConstant::get('CRM_Contact_DAO_Contact', 'gender_id'));
}
$error = _civicrm_api3_greeting_format_params($params);
CRM_Contact_BAO_Contact::resolveDefaults($params);
//check the resolve values.
- $genders = CRM_Core_PseudoConstant::gender();
+ $genders = CRM_Core_PseudoConstant::get('CRM_Contact_DAO_Contact', 'gender_id');
$this->assertEquals($genders[$params['gender_id']], $params['gender'], 'Check for gender.');
$prefix = CRM_Core_PseudoConstant::individualPrefix();
$this->assertEquals($prefix[$params['prefix_id']], $params['prefix'], 'Check for prefix.');
'gender_id' =>
array('title' => ts('Gender'),
'operatorType' => CRM_Report_Form::OP_MULTISELECT,
- 'options' => CRM_Core_PseudoConstant::gender(),
+ 'options' => CRM_Core_PseudoConstant::get('CRM_Contact_DAO_Contact', 'gender_id'),
),
),
),