}
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;
$form->addRule($name, ts('%1 is a required field.', array(1 => $title)), 'required');
}
}
- elseif ($fieldName === 'prefix_id') {
+ elseif ($fieldName === 'prefix_id' || $fieldName === 'suffix_id') {
$form->add('select', $name, $title,
array(
- '' => ts('- select -')) + CRM_Core_PseudoConstant::get('CRM_Contact_DAO_Contact', 'prefix_id'), $required
- );
- }
- elseif ($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) {
*
* @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'))
) {