//added internal ID
- $form->addElement('text', 'id', ts('Contact ID'), CRM_Core_DAO::getAttribute('CRM_Contact_DAO_Contact', 'id'));
+ $form->addElement('text', 'contact_id', ts('Contact ID'), CRM_Core_DAO::getAttribute('CRM_Contact_DAO_Contact', 'id'));
//added external ID
$form->addElement('text', 'external_identifier', ts('External ID'), CRM_Core_DAO::getAttribute('CRM_Contact_DAO_Contact', 'external_identifier'));
// Phone search
$form->addElement('text', 'phone_numeric', ts('Phone Number'), CRM_Core_DAO::getAttribute('CRM_Core_DAO_Phone', 'phone'));
$locationType = CRM_Core_PseudoConstant::locationType();
- $phoneType = CRM_Core_PseudoConstant::phoneType();
+ $phoneType = CRM_Core_PseudoConstant::get('CRM_Core_DAO_Phone', 'phone_type_id');
$form->add('select', 'phone_location_type_id', ts('Phone Location'), array('' => ts('- any -')) + $locationType);
$form->add('select', 'phone_phone_type_id', ts('Phone Type'), array('' => ts('- any -')) + $phoneType);
}
}
if ($select) {
- $config = CRM_Core_Config::singleton();
- $countryDefault = $config->defaultContactCountry;
- $stateProvinceDefault = $config->defaultContactStateProvince;
- $defaultValues = array();
$stateCountryMap[] = array(
'state_province' => 'state_province',
'country' => 'country',
'county' => 'county',
);
if ($select == 'stateProvince') {
- if ($stateProvinceDefault) {
- //for setdefault state/province
- $defaultValues[$name] = $stateProvinceDefault;
- $form->setDefaults($defaultValues);
- }
- if ($countryDefault && !isset($formValues['country'])) {
- $selectElements = array('' => ts('- any -')) + CRM_Core_PseudoConstant::stateProvinceForCountry($countryDefault);
- }
- elseif ($formValues['country']) {
+ if (CRM_Utils_Array::value('country', $formValues)) {
$selectElements = array('' => ts('- select -')) + CRM_Core_PseudoConstant::stateProvinceForCountry($formValues['country']);
}
else {
$element = $form->addElement('select', $name, $title, $selectElements);
}
elseif ($select == 'country') {
- if ($countryDefault) {
- //for setdefault country
- $defaultValues[$name] = $countryDefault;
- $form->setDefaults($defaultValues);
- }
$selectElements = array('' => ts('- any -')) + CRM_Core_PseudoConstant::$select();
$element = $form->addElement('select', $name, $title, $selectElements);
}
}
}
+ CRM_Core_BAO_Address::addStateCountryMap($stateCountryMap);
+
// extend addresses with proximity search
$form->addElement('text', 'prox_distance', ts('Find contacts within'));
$form->addElement('select', 'prox_distance_unit', NULL, array('miles' => ts('Miles'), 'kilos' => ts('Kilometers')));
// is there another form rule that does decimals besides money ? ...
$form->addRule('prox_distance', ts('Please enter positive number as a distance'), 'numeric');
- CRM_Core_BAO_Address::addStateCountryMap($stateCountryMap);
$worldRegions = array('' => ts('- any region -')) + CRM_Core_PseudoConstant::worldRegion();
$form->addElement('select', 'world_region', ts('World Region'), $worldRegions);
$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,