// hack for CRM-665
if (isset($details->$name) || $name == 'group' || $name == 'tag') {
// to handle gender / suffix / prefix
- if (in_array(substr($name, -6), array('gender', 'prefix', 'suffix'))) {
- $values[$index] = $details->$name;
- $idColumn = "{$name}_id";
- $params[$index] = $details->$idColumn;
+ if (in_array(substr($name, 0, -3), array('gender', 'prefix', 'suffix'))) {
+ $values[$index] = CRM_Core_PseudoConstant::getLabel('CRM_Contact_DAO_Contact', $name, $details->$name);
+ $params[$index] = $details->$name;
}
elseif (in_array($name, CRM_Contact_BAO_Contact::$_greetingTypes)) {
$dname = $name . '_display';
}
elseif ($fieldName == 'im') {
$providerId = $detailName . '-provider_id';
- $providerName = $imProviders[$details->$providerId];
- if ($providerName) {
- $values[$index] = $details->$detailName . " (" . $providerName . ")";
+ if (isset($imProviders[$details->$providerId])) {
+ $values[$index] = $details->$detailName . " (" . $imProviders[$details->$providerId] . ")";
}
else {
$values[$index] = $details->$detailName;
* @static
*/
public static function getModuleUFGroup($moduleName = NULL, $count = 0, $skipPermission = TRUE, $op = CRM_Core_Permission::VIEW, $returnFields = NULL) {
- $selectFields = array('id', 'title', 'created_id', 'description', 'is_active', 'is_reserved', 'group_type');
+ $selectFields = array('id', 'title', 'created_id', 'is_active', 'is_reserved', 'group_type');
+
+ if (!CRM_Core_Config::isUpgradeMode()) {
+ // CRM-13555, since description field was added later (4.4), and to avoid any problems with upgrade
+ $selectFields[] = 'description';
+ }
if (!empty($returnFields)) {
$selectFields = array_merge($returnFields, array_diff($selectFields, $returnFields));
'' => ts('- select -')) + CRM_Member_PseudoConstant::membershipStatus(NULL, NULL, 'label'), $required
);
}
- elseif ($fieldName === 'gender') {
+ elseif ($fieldName === 'gender_id') {
$genderOptions = array();
$gender = CRM_Core_PseudoConstant::get('CRM_Contact_DAO_Contact', 'gender_id');
foreach ($gender as $key => $var) {
$form->addRule($name, ts('%1 is a required field.', array(1 => $title)), 'required');
}
}
- elseif ($fieldName === 'individual_prefix') {
- $form->add('select', $name, $title,
- array(
- '' => ts('- select -')) + CRM_Core_PseudoConstant::get('CRM_Contact_DAO_Contact', 'prefix_id'), $required
- );
- }
- elseif ($fieldName === 'individual_suffix') {
+ elseif ($fieldName === 'prefix_id' || $fieldName === 'suffix_id') {
$form->add('select', $name, $title,
array(
- '' => ts('- select -')) + CRM_Core_PseudoConstant::get('CRM_Contact_DAO_Contact', 'suffix_id'), $required
+ '' => ts('- select -')) + CRM_Core_PseudoConstant::get('CRM_Contact_BAO_Contact', $fieldName), $required
);
}
elseif ($fieldName === 'contact_sub_type') {
$defaults[$fldName] = $value['county_id'];
}
elseif ($fieldName == 'country') {
- $defaults[$fldName] = $value['country_id'];
if (!isset($value['country_id']) || !$value['country_id']) {
$config = CRM_Core_Config::singleton();
if ($config->defaultContactCountry) {
$defaults[$fldName] = $config->defaultContactCountry;
}
}
+ else {
+ $defaults[$fldName] = $value['country_id'];
+ }
}
elseif ($fieldName == 'phone') {
if ($phoneTypeId) {
}
}
else {
+ // TODO: prefix, suffix and gender translation may no longer be necessary - check inputs
if ($key === 'individual_suffix') {
$data['suffix_id'] = $value;
}
*
* @return void.
*/
- function setComponentDefaults(&$fields, $componentId, $component, &$defaults, $isStandalone = FALSE) {
+ public static function setComponentDefaults(&$fields, $componentId, $component, &$defaults, $isStandalone = FALSE) {
if (!$componentId ||
!in_array($component, array('Contribute', 'Membership', 'Event', 'Activity'))
) {