'legal_identifier', 'sic_code', 'home_URL', 'is_deceased',
'deceased_date', 'current_employer', 'email_greeting_custom',
'postal_greeting_custom', 'addressee_custom',
- 'individual_prefix', 'individual_suffix', 'gender',
+ 'prefix_id', 'suffix_id'
),
'Organization' => array(
'first_name', 'middle_name', 'last_name', 'job_title',
'gender_id', 'birth_date', 'household_name',
'email_greeting_custom',
- 'postal_greeting_custom', 'individual_prefix',
- 'individual_suffix', 'gender', 'addressee_custom',
+ 'postal_greeting_custom', 'prefix_id',
+ 'suffix_id', 'gender_id', 'addressee_custom',
'is_deceased', 'deceased_date', 'current_employer',
),
);
continue;
}
- if (CRM_Utils_Array::value('pseudoconstant', $field)) {
- continue;
- }
-
// redirect to activity select clause
if (substr($name, 0, 9) == 'activity_') {
CRM_Activity_BAO_Query::select($this);
$headers = self::$_columnHeaders;
}
elseif (!empty($this->_returnProperties)) {
-
self::$_columnHeaders = array(array('name' => ''),
array(
'name' => ts('Name'),
$names = array();
static $skipFields = array('group', 'tag');
foreach ($this->_fields as $key => $field) {
- if (CRM_Utils_Array::value('in_selector', $field) &&
+ if (
+ CRM_Utils_Array::value('in_selector', $field) &&
!in_array($key, $skipFields)
) {
if (strpos($key, '-') !== FALSE) {
//check explicitly added contact to a Smart Group.
$groupID = CRM_Utils_Array::key('1', $this->_formValues['group']);
+ $pseudoconstants = array();
+ // get all the pseudoconstant values
+ foreach ($this->_fields as $name => $values) {
+ if (isset($this->_fields[$name]['pseudoconstant'])) {
+ $pseudoconstants[$name] =
+ array(
+ 'dbName' => $this->_fields[$name]['name'],
+ 'values' => CRM_Core_PseudoConstant::get('CRM_Contact_DAO_Contact', $name),
+ );
+ }
+ }
+
// for CRM-3157 purposes
if (in_array('country', $names)) {
- $countries = CRM_Core_PseudoConstant::country();
+ $pseudoconstants['country'] = array(
+ 'dbName' => 'country_id',
+ 'values' => CRM_Core_PseudoConstant::country()
+ );
}
if (in_array('state_province', $names)) {
- $provinces = CRM_Core_PseudoConstant::stateProvince();
+ $pseudoconstants['state_province'] = array(
+ 'dbName' => 'state_province_id',
+ 'values' => CRM_Core_PseudoConstant::stateProvince()
+ );
}
if (in_array('world_region', $names)) {
- $regions = CRM_Core_PseudoConstant::worldRegion();
+ $pseudoconstants['world_region'] = array(
+ 'dbName' => 'world_region_id',
+ 'values' => CRM_Core_PseudoConstant::worldRegion()
+ );
}
$seenIDs = array();
continue;
}
if ($cfID = CRM_Core_BAO_CustomField::getKeyID($property)) {
- $row[$property] = CRM_Core_BAO_CustomField::getDisplayValue($result->$property,
+ $row[$property] = CRM_Core_BAO_CustomField::getDisplayValue(
+ $result->$property,
$cfID,
$this->_options,
$result->contact_id
);
}
- elseif ($multipleSelectFields &&
+ elseif (
+ $multipleSelectFields &&
array_key_exists($property, $multipleSelectFields)
) {
- //fix to display student checkboxes
$key = $property;
$paramsNew = array($key => $result->$property);
+ $name = array($key => array('newName' => $key, 'groupName' => $key));
- if ($key == 'test_tutoring') {
- $name = array($key => array('newName' => $key, 'groupName' => 'test'));
- // for readers group
- }
- elseif (substr($key, 0, 4) == 'cmr_') {
- $name = array($key => array('newName' => $key, 'groupName' => substr($key, 0, -3)));
- }
- else {
- $name = array($key => array('newName' => $key, 'groupName' => $key));
- }
CRM_Core_OptionGroup::lookupValues($paramsNew, $name, FALSE);
$row[$key] = $paramsNew[$key];
}
$greeting = $property . '_display';
$row[$property] = $result->$greeting;
}
- elseif ($property == 'country') {
- $row[$property] = CRM_Utils_Array::value($result->country_id, $countries);
- }
- elseif ($property == 'state_province') {
- $row[$property] = CRM_Utils_Array::value($result->state_province_id, $provinces);
- }
- elseif ($property == 'world_region') {
- $row[$property] = CRM_Utils_Array::value($result->worldregion_id, $regions);
+ elseif (isset($pseudoconstants[$property])) {
+ $row[$property] = CRM_Utils_Array::value(
+ $result->{$pseudoconstants[$property]['dbName']},
+ $pseudoconstants[$property]['values']
+ );
}
elseif (strpos($property, '-url') !== FALSE) {
$websiteUrl = '';
$formattedFields = array();
foreach ($fieldArrs as $fieldArr) {
- //$field = new CRM_Core_DAO_UFField();
- //$field->copyValues($fieldArr); // no... converts string('') to string('null')
$field = (object) $fieldArr;
if (!self::filterUFField($field, $searchable, $showAll, $visibility)) {
continue;
'add_captcha' => isset($group->add_captcha) ? $group->add_captcha : NULL,
'field_type' => $field->field_type,
'field_id' => $field->id,
+ 'pseudoconstant' => CRM_Utils_Array::value(
+ 'pseudoconstant',
+ CRM_Utils_Array::value($field->field_name, $importableFields)
+ ),
+ // obsolete this when we remove the name / dbName discrepancy with gender/suffix/prefix
+ 'dbName' => CRM_Utils_Array::value(
+ 'dbName',
+ CRM_Utils_Array::value($field->field_name, $importableFields)
+ ),
'skipDisplay' => 0,
);
);
$nameTitle = array_merge($nameTitle, $title);
}
-
- if ($contactType == 'Individual' || $contactType == 'All') {
- $contactFields = CRM_Contact_DAO_Contact::fields();
- $title = array(
- 'gender' => array(
- 'name' => 'gender',
- 'dbName' => 'gender_id',
- 'title' => ts('Gender'),
- 'headerPattern' => '/^gender$/i',
- 'pseudoconstant' => $contactFields['gender_id']['pseudoconstant'],
- 'where' => 'contact_a.gender_id',
- ),
- 'individual_prefix' => array(
- 'name' => 'individual_prefix',
- 'dbName' => 'prefix_id',
- 'title' => ts('Individual Prefix'),
- 'headerPattern' => '/^(prefix|title)/i',
- 'pseudoconstant' => $contactFields['prefix_id']['pseudoconstant'],
- 'where' => 'contact_a.prefix_id',
- ),
- 'individual_suffix' => array(
- 'name' => 'individual_suffix',
- 'dbName' => 'suffix_id',
- 'title' => ts('Individual Suffix'),
- 'headerPattern' => '/^suffix$/i',
- 'pseudoconstant' => $contactFields['suffix_id']['pseudoconstant'],
- 'where' => 'contact_a.suffix_id',
- ),
- );
- $nameTitle = array_merge($nameTitle, $title);
- }
- }
+ }
if (is_array($nameTitle)) {
foreach ($nameTitle as $name => $attribs) {
if (!empty($query->_params) || !empty($query->_returnProperties)) {
$field = self::getFields();
foreach ($field as $name => $values) {
- if ($values['pseudoconstant']) {
+ if (CRM_Utils_Array::value('pseudoconstant', $values)) {
continue;
}
list($tableName, $fieldName) = explode('.', $values['where']);
}
}
+ // CRM_Core_Error::debug(array($sel1, $sel2, $sel3, $sel4));
$sel->setOptions(array($sel1, $sel2, $sel3, $sel4));
// proper interpretation of spec in CRM-8732
</pseudoconstant>
<headerPattern>/^(prefix|title)/i</headerPattern>
<dataPattern>/^(mr|ms|mrs|sir|dr)\.?$/i</dataPattern>
+ <import>true</import>
<add>1.2</add>
</field>
<index>
<pseudoconstant>
<optionGroupName>individual_suffix</optionGroupName>
</pseudoconstant>
+ <import>true</import>
<comment>Suffix for name (Jr, Sr...). FK to suffix ID</comment>
<headerPattern>/^suffix$/i</headerPattern>
<dataPattern>/^(sr|jr)\.?|i{2,}$/</dataPattern>
</pseudoconstant>
<headerPattern>/^gender$/i</headerPattern>
<comment>FK to gender ID</comment>
+ <import>true</import>
<add>1.2</add>
</field>
<index>