$params['street_address']['title'] = 'Primary Address Street Address';
$params['supplemental_address_1']['title'] = 'Primary Address Supplemental Address 1';
$params['supplemental_address_2']['title'] = 'Primary Address Supplemental Address 2';
+ $params['current_employer']['title'] = 'Current Employer';
$params['city']['title'] = 'Primary Address City';
$params['postal_code_suffix']['title'] = 'Primary Address Post Code Suffix';
$params['postal_code']['title'] = 'Primary Address Post Code';
$params['state_province_id']['title'] = 'Primary Address State Province ID';
$params['state_province_name']['title'] = 'Primary Address State Province Name';
$params['state_province']['title'] = 'Primary Address State Province';
- $params['country_id']['title'] = 'Primary Address State Province ID';
+ $params['country_id']['title'] = 'Primary Address Country ID';
$params['country']['title'] = 'Primary Address country';
$params['worldregion_id']['title'] = 'Primary Address World Region ID';
$params['worldregion']['title'] = 'Primary Address World Region';
$params['provider_id']['title'] = 'Primary Phone Provider ID';
$params['email_id']['title'] = 'Primary Email ID';
$params['email']['title'] = 'Primary Email';
+ $params['gender_id']['title'] = 'Gender ID';
+ $params['gender']['title'] = 'Gender';
$params['on_hold']['title'] = 'Primary Email On Hold';
$params['im']['title'] = 'Primary Instant Messanger';
$params['im_id']['title'] = 'Primary Instant Messanger ID';
if ($contactID == $session->get('userID')) {
return civicrm_api3_create_error('This contact record is linked to the currently logged in user account - and cannot be deleted.');
}
- $restore = CRM_Utils_Array::value('restore', $params) ? $params['restore'] : FALSE;
- $skipUndelete = CRM_Utils_Array::value('skip_undelete', $params) ? $params['skip_undelete'] : FALSE;
+ $restore = !empty($params['restore']) ? $params['restore'] : FALSE;
+ $skipUndelete = !empty($params['skip_undelete']) ? $params['skip_undelete'] : FALSE;
// CRM-12929
// restrict permanent delete if a contact has financial trxn associated with it
$params['preferred_communication_method'] = CRM_Utils_Array::implodePadded($params['preferred_communication_method']);
}
- if (CRM_Utils_Array::value('contact_sub_type', $params) && CRM_Utils_Array::value('contact_type', $params)) {
+ if (!empty($params['contact_sub_type']) && !empty($params['contact_type'])) {
if (!(CRM_Contact_BAO_ContactType::isExtendsContactType($params['contact_sub_type'], $params['contact_type']))) {
throw new API_Exception("Invalid or Mismatched Contact SubType: " . implode(', ', (array)$params['contact_sub_type']));
}
function civicrm_api3_contact_getquick($params) {
civicrm_api3_verify_mandatory($params, NULL, array('name'));
- $name = CRM_Utils_Type::escape($params['name'], 'String');
+ $name = CRM_Utils_Type::escape(CRM_Utils_Array::value('name', $params), 'String');
// get the autocomplete options from settings
$acpref = explode(CRM_Core_DAO::VALUE_SEPARATOR,
$list = array();
foreach ($acpref as $value) {
- if ($value && CRM_Utils_Array::value($value, $acOptions)) {
+ if ($value && !empty($acOptions[$value])) {
$list[$value] = $acOptions[$value];
}
}
case 'phone':
case 'email':
$actualSelectElements[] = $select[] = ($value == 'address') ? $selectText : $value;
+ if ($value == 'phone') {
+ $actualSelectElements[] = $select[] = 'phone_ext';
+ }
$from[$value] = "LEFT JOIN civicrm_{$value} {$suffix} ON ( cc.id = {$suffix}.contact_id AND {$suffix}.is_primary = 1 ) ";
break;
$where .= " AND $aclWhere ";
}
- if (CRM_Utils_Array::value('org', $params)) {
+ if (!empty($params['org'])) {
$where .= " AND contact_type = \"Organization\"";
// CRM-7157, hack: get current employer details when
// employee_id is present.
$currEmpDetails = array();
- if (CRM_Utils_Array::value('employee_id', $params)) {
+ if (!empty($params['employee_id'])) {
if ($currentEmployer = CRM_Core_DAO::getFieldValue('CRM_Contact_DAO_Contact',
(int) $params['employee_id'],
'employer_id'
}
}
+ if (!empty($params['contact_sub_type'])) {
+ $contactSubType = CRM_Utils_Type::escape($params['contact_sub_type'], 'String');
+ $where .= " AND cc.contact_sub_type = '{$contactSubType}'";
+ }
+
//set default for current_employer or return contact with particular id
- if (CRM_Utils_Array::value('id', $params)) {
+ if (!empty($params['id'])) {
$where .= " AND cc.id = " . (int) $params['id'];
}
- if (CRM_Utils_Array::value('cid', $params)) {
+ if (!empty($params['cid'])) {
$where .= " AND cc.id <> " . (int) $params['cid'];
}
//contact's based of relationhip type
$relType = NULL;
- if (CRM_Utils_Array::value('rel', $params)) {
+ if (!empty($params['rel'])) {
$relation = explode('_', CRM_Utils_Array::value('rel', $params));
$relType = CRM_Utils_Type::escape($relation[0], 'Integer');
$rel = CRM_Utils_Type::escape($relation[2], 'String');
}
// check if only CMS users are requested
- if (CRM_Utils_Array::value('cmsuser', $params)) {
+ if (!empty($params['cmsuser'])) {
$additionalFrom = "
INNER JOIN civicrm_uf_match um ON (um.contact_id=cc.id)
";
}
$t['data'] = $dao->data;
$contactList[] = $t;
- if (CRM_Utils_Array::value('org', $params) &&
+ if (!empty($params['org']) &&
!empty($currEmpDetails) &&
$dao->id == $currEmpDetails['id']
) {
//return organization name if doesn't exist in db
if (empty($contactList)) {
- if (CRM_Utils_Array::value('org', $params)) {
+ if (!empty($params['org'])) {
if ($listCurrentEmployer && !empty($currEmpDetails)) {
$contactList = array(
array(