if ($name == 'address') {
// FIXME: lookupValue doesn't work for vcard_name
if (CRM_Utils_Array::value('location_type_id', $values)) {
- $vcardNames = CRM_Core_PseudoConstant::locationVcardName();
+ $vcardNames = CRM_Core_PseudoConstant::get('CRM_Core_DAO_Address', 'location_type_id', array('labelColumn' => 'vcard_name'));
$values['vcard_name'] = $vcardNames[$values['location_type_id']];
}
$address = array();
if ( $addressId > 0 ) {
- $locationTypes = CRM_Core_PseudoConstant::locationDisplayName();
+ $locationTypes = CRM_Core_PseudoConstant::get('CRM_Core_DAO_Address', 'location_type_id', array('labelColumn' => 'display_name'));
$entityBlock = array('id' => $addressId);
$address = CRM_Core_BAO_Address::getValues($entityBlock, FALSE, 'id');
// get the emails for this contact
$contactId = CRM_Utils_Request::retrieve('cid', 'Positive', CRM_Core_DAO::$_nullObject, TRUE, NULL, $_REQUEST);
- $locationTypes = CRM_Core_PseudoConstant::locationDisplayName();
+ $locationTypes = CRM_Core_PseudoConstant::get('CRM_Core_DAO_Address', 'location_type_id', array('labelColumn' => 'display_name'));
$entityBlock = array('contact_id' => $contactId);
$emails = CRM_Core_BAO_Email::getValues($entityBlock);
// get the emails for this contact
$contactId = CRM_Utils_Request::retrieve('cid', 'Positive', CRM_Core_DAO::$_nullObject, TRUE, NULL, $_REQUEST);
- $locationTypes = CRM_Core_PseudoConstant::locationDisplayName();
+ $locationTypes = CRM_Core_PseudoConstant::get('CRM_Core_DAO_Address', 'location_type_id', array('labelColumn' => 'display_name'));
$IMProviders = CRM_Core_PseudoConstant::get('CRM_Core_DAO_IM', 'provider_id');
$entityBlock = array('contact_id' => $contactId);
// get the emails for this contact
$contactId = CRM_Utils_Request::retrieve('cid', 'Positive', CRM_Core_DAO::$_nullObject, TRUE, NULL, $_REQUEST);
- $locationTypes = CRM_Core_PseudoConstant::locationDisplayName();
+ $locationTypes = CRM_Core_PseudoConstant::get('CRM_Core_DAO_Address', 'location_type_id', array('labelColumn' => 'display_name'));
$entityBlock = array('contact_id' => $contactId);
$openids = CRM_Core_BAO_OpenID::getValues($entityBlock);
// get the emails for this contact
$contactId = CRM_Utils_Request::retrieve('cid', 'Positive', CRM_Core_DAO::$_nullObject, TRUE, NULL, $_REQUEST);
- $locationTypes = CRM_Core_PseudoConstant::locationDisplayName();
+ $locationTypes = CRM_Core_PseudoConstant::get('CRM_Core_DAO_Address', 'location_type_id', array('labelColumn' => 'display_name'));
$phoneTypes = CRM_Core_PseudoConstant::get('CRM_Core_DAO_Phone', 'phone_type_id');
$entityBlock = array('contact_id' => $contactId);
foreach ($communicationType as $key => $value) {
if (CRM_Utils_Array::value($key, $defaults)) {
foreach ($defaults[$key] as & $val) {
- CRM_Utils_Array::lookupValue($val, 'location_type', CRM_Core_PseudoConstant::locationDisplayName(), FALSE);
+ CRM_Utils_Array::lookupValue($val, 'location_type', CRM_Core_PseudoConstant::get('CRM_Core_DAO_Address', 'location_type_id', array('labelColumn' => 'display_name')), FALSE);
if (!CRM_Utils_Array::value('skip', $value)) {
eval('$pseudoConst = CRM_Core_PseudoConstant::' . $value['type'] . '();');
CRM_Utils_Array::lookupValue($val, $value['id'], $pseudoConst, FALSE);
// now that we have the contact's data - let's build the vCard
// TODO: non-US-ASCII support (requires changes to the Contact_Vcard_Build class)
- $vcardNames = CRM_Core_PseudoConstant::locationVcardName();
+ $vcardNames = CRM_Core_PseudoConstant::get('CRM_Core_DAO_Address', 'location_type_id', array('labelColumn' => 'vcard_name'));
$vcard = new Contact_Vcard_Build('2.1');
if ($defaults['contact_type'] == 'Individual') {
*/
private static $cache;
- /**
- * location vCard name
- * @var array
- * @static
- */
- private static $locationVcardName;
-
- /**
- * location display name
- * @var array
- * @static
- */
- private static $locationDisplayName;
-
/**
* activity type
* @var array
*/
private static $billingMode;
- /**
- * component
- * @var array
- * @static
- */
- private static $component;
-
/**
* states, provinces
* @var array
}
}
- /**
- * Get all location vCard names.
- *
- * The static array locationVcardName is returned
- *
- * @access public
- * @static
- *
- * @param boolean $all - get All location vCard names - default is to get only active ones.
- *
- * @return array - array reference of all location vCard names.
- *
- */
- public static function &locationVcardName($all = FALSE) {
- if (!self::$locationVcardName) {
- self::populate(self::$locationVcardName, 'CRM_Core_DAO_LocationType', $all, 'vcard_name');
- }
- return self::$locationVcardName;
- }
-
- /**
- * Get all location Display names.
- *
- * The static array locationDisplayName is returned
- *
- * @access public
- * @static
- *
- * @param boolean $all - get All location display names - default is to get only active ones.
- *
- * @return array - array reference of all location display names.
- *
- */
- public static function &locationDisplayName($all = FALSE) {
- if (!self::$locationDisplayName) {
- self::populate(self::$locationDisplayName, 'CRM_Core_DAO_LocationType', $all, 'display_name');
- }
- return self::$locationDisplayName;
- }
-
/**
* Get all Activty types.
*
}
return self::$billingMode;
}
-
- /**
- * Get all component names
- *
- * @access public
- * @static
- *
- * @return array - array reference of all location display names.
- *
- */
- public static function &component() {
- if (!self::$component) {
- self::populate(self::$component, 'CRM_Core_DAO_Component', TRUE, 'name');
- }
- return self::$component;
- }
/**
* Get all the State/Province from database.
*
* @return array - array reference of all Currency Symbols
* @static
+ *
+ * FIXME: this is not stored as an optionValue, and it's not tied to a single DB column;
+ * FIXME: It's used for a setting stored in option group 'currencies_enabled'. What to do?
*/
public static function ¤cySymbols($name = 'symbol', $key = 'id') {
$cacheKey = "{$name}_{$key}";
if (!isset(self::$currencySymbols[$cacheKey])) {
self::populate(self::$currencySymbols[$cacheKey], 'CRM_Financial_DAO_Currency', TRUE, $name, NULL, NULL, 'name', $key);
}
-
return self::$currencySymbols[$cacheKey];
}
'CRM_Core_DAO_OptionGroup', 'report_template', 'id', 'name'
);
if (!empty($params['component_id']) && !is_numeric($params['component_id'])) {
- $params['component_id'] = array_search($params['component_id'], CRM_Core_PseudoConstant::component());
+ $components = CRM_Core_PseudoConstant::get('CRM_Core_DAO_OptionValue', 'component_id', array('onlyActive' => FALSE, 'labelColumn' => 'name'));
+ $params['component_id'] = array_search($params['component_id'], $components);
}
return civicrm_api3_option_value_create($params);
}
// - sample: Any one value which is expected in the list of option values.
// - max: integer (default = 10) maximum number of option values expected.
$fields = array(
+ 'CRM_Core_DAO_OptionValue' => array(
+ array(
+ 'fieldName' => 'component_id',
+ 'sample' => 'CiviContribute',
+ ),
+ ),
'CRM_Project_DAO_Task' => array(
array(
'fieldName' => 'priority_id',
<add>2.1</add>
</field>
<field>
- <name>component_id</name>
- <type>int unsigned</type>
- <comment>Component that this menu item belongs to</comment>
- <add>2.1</add>
+ <name>component_id</name>
+ <type>int unsigned</type>
+ <comment>Component that this menu item belongs to</comment>
+ <add>2.1</add>
+ <pseudoconstant>
+ <table>civicrm_component</table>
+ <keyColumn>id</keyColumn>
+ <labelColumn>name</labelColumn>
+ </pseudoconstant>
</field>
<foreignKey>
<name>component_id</name>
<add>2.1</add>
</field>
<field>
- <name>component_id</name>
- <type>int unsigned</type>
- <comment>Component that this menu item belongs to</comment>
- <add>2.1</add>
+ <name>component_id</name>
+ <type>int unsigned</type>
+ <comment>Component that this menu item belongs to</comment>
+ <add>2.1</add>
+ <pseudoconstant>
+ <table>civicrm_component</table>
+ <keyColumn>id</keyColumn>
+ <labelColumn>name</labelColumn>
+ </pseudoconstant>
</field>
<foreignKey>
<name>component_id</name>
<comment>Component that this option value belongs/caters to.</comment>
<add>2.0</add>
<pseudoconstant>
- <name>component</name>
<table>civicrm_component</table>
<keyColumn>id</keyColumn>
<labelColumn>name</labelColumn>
<add>4.1</add>
</field>
<field>
- <name>component_id</name>
- <type>int unsigned</type>
- <comment>Component that this menu item belongs to</comment>
- <add>4.1</add>
+ <name>component_id</name>
+ <type>int unsigned</type>
+ <comment>Component that this menu item belongs to</comment>
+ <add>4.1</add>
+ <pseudoconstant>
+ <table>civicrm_component</table>
+ <keyColumn>id</keyColumn>
+ <labelColumn>name</labelColumn>
+ </pseudoconstant>
</field>
<foreignKey>
<name>component_id</name>