}
if (array_key_exists($relationshipTypes, $contactRelationshipTypes)) {
- if (CRM_Utils_Array::value(2, $value)) {
+ if (!empty($value[2])) {
$relationField = CRM_Utils_Array::value(2, $value);
if (trim(CRM_Utils_Array::value(3, $value))) {
$relLocTypeId = CRM_Utils_Array::value(3, $value);
$relIMProviderId = CRM_Utils_Array::value(4, $value);
}
}
- elseif (CRM_Utils_Array::value(4, $value)) {
+ elseif (!empty($value[4])) {
$relationField = CRM_Utils_Array::value(4, $value);
$relLocTypeId = CRM_Utils_Array::value(5, $value);
if ($relationField == 'phone') {
}
elseif ($exportMode == CRM_Export_Form_Select::EVENT_EXPORT) {
$returnProperties['participant_id'] = 1;
- if (CRM_Utils_Array::value('participant_role', $returnProperties)) {
+ if (!empty($returnProperties['participant_role'])) {
unset($returnProperties['participant_role']);
$returnProperties['participant_role_id'] = 1;
}
}
}
- if (!$selectAll && $componentTable && CRM_Utils_Array::value('additional_group', $exportParams)) {
+ if (!$selectAll && $componentTable && !empty($exportParams['additional_group'])) {
// If an Additional Group is selected, then all contacts in that group are
// added to the export set (filtering out duplicates).
$query = "
if ($moreReturnProperties) {
// fix for CRM-7066
- if (CRM_Utils_Array::value('group', $moreReturnProperties)) {
+ if (!empty($moreReturnProperties['group'])) {
unset($moreReturnProperties['group']);
$moreReturnProperties['groups'] = 1;
}
// make sure the groups stuff is included only if specifically specified
// by the fields param (CRM-1969), else we limit the contacts outputted to only
// ones that are part of a group
- if (CRM_Utils_Array::value('groups', $returnProperties)) {
+ if (!empty($returnProperties['groups'])) {
$oldClause = "( contact_a.id = civicrm_group_contact.contact_id )";
$newClause = " ( $oldClause AND ( civicrm_group_contact.status = 'Added' OR civicrm_group_contact.status IS NULL ) )";
// total hack for export, CRM-3618
$queryString = "$select $from $where $having";
$groupBy = "";
- if (CRM_Utils_Array::value('tags', $returnProperties) ||
- CRM_Utils_Array::value('groups', $returnProperties) ||
+ if (!empty($returnProperties['tags']) || !empty($returnProperties['groups']) ||
CRM_Utils_Array::value('notes', $returnProperties) ||
// CRM-9552
($queryMode & CRM_Contact_BAO_Query::MODE_CONTACTS && $query->_useGroupBy)
if ($order) {
list($field, $dir) = explode(' ', $order, 2);
$field = trim($field);
- if (CRM_Utils_Array::value($field, $returnProperties)) {
+ if (!empty($returnProperties[$field])) {
// $queryString .= " ORDER BY $order";
}
}
$type = explode('-', $fld);
$hdr = "{$ltype}-" . $query->_fields[$type[0]]['title'];
- if (CRM_Utils_Array::value(1, $type)) {
+ if (!empty($type[1])) {
if (CRM_Utils_Array::value(0, $type) == 'phone') {
$hdr .= "-" . CRM_Utils_Array::value($type[1], $phoneTypes);
}
$hdr = "{$ltype}-" . $relationQuery[$field]->_fields[$type[0]]['title'];
- if (CRM_Utils_Array::value(1, $type)) {
+ if (!empty($type[1])) {
if (CRM_Utils_Array::value(0, $type) == 'phone') {
$hdr .= "-" . CRM_Utils_Array::value($type[1], $phoneTypes);
}
elseif ($field == 'pledge_next_pay_amount') {
$row[$field] = $dao->pledge_next_pay_amount + $dao->pledge_outstanding_amount;
}
- elseif (in_array(substr($field, 0, -3), array('gender', 'prefix', 'suffix'))) {
+ elseif (in_array(substr($field, 0, -3), array('gender', 'prefix', 'suffix', 'communication_style'))) {
$row[$field] = CRM_Core_PseudoConstant::getLabel('CRM_Contact_DAO_Contact', $field, $dao->$field);
}
elseif (is_array($value) && $field == 'location') {
// FIXME: We should not be using labels as keys!
$daoField = CRM_Utils_String::munge($ltype) . '-' . $type[0];
- if (CRM_Utils_Array::value(1, $type)) {
+ if (!empty($type[1])) {
$fldValue .= "-" . $type[1];
+ $daoField .= "-" . $type[1];
}
// CRM-3157: localise country, region (both have ‘country’ context) and state_province (‘province’ context)
foreach (array_keys($val) as $fld) {
$type = explode('-', $fld);
$fldValue = "{$ltype}-" . $type[0];
- if (CRM_Utils_Array::value(1, $type)) {
+ if (!empty($type[1])) {
$fldValue .= "-" . $type[1];
}
// CRM-3157: localise country, region (both have ‘country’ context)
case 'gender':
case 'preferred_communication_method':
case 'preferred_mail_format':
+ case 'communication_style':
$row[$field] = $i18n->crm_translate($fieldValue);
break;
}
}
//remove organization name for individuals if it is set for current employer
- if (CRM_Utils_Array::value('contact_type', $row) &&
+ if (!empty($row['contact_type']) &&
$row['contact_type'] == 'Individual' && array_key_exists('organization_name', $row)
) {
$row['organization_name'] = '';
'addressee',
);
foreach ($greetingFields as $greeting) {
- if (CRM_Utils_Array::value($greeting, $exportParams)) {
+ if (!empty($exportParams[$greeting])) {
$greetingLabel = $exportParams[$greeting];
if (empty($contact)) {
$values = array(
);
$contact = civicrm_api('contact', 'get', $values);
- if (CRM_Utils_Array::value('is_error', $contact)) {
+ if (!empty($contact['is_error'])) {
return $greetings;
}
$contact = $contact['values'][$contact['id']];
static function _trimNonTokens(&$parsedString, $defaultGreeting,
$addressMergeGreetings, $greetingType = 'postal_greeting'
) {
- if (CRM_Utils_Array::value($greetingType, $addressMergeGreetings)) {
+ if (!empty($addressMergeGreetings[$greetingType])) {
$greetingLabel = $addressMergeGreetings[$greetingType];
}
$greetingLabel = empty($greetingLabel) ? $defaultGreeting : $greetingLabel;
if (!$sharedAddress && !array_key_exists($copyID, $merge[$masterID]['copy'])) {
- if (CRM_Utils_Array::value('postal_greeting_other', $exportParams) &&
+ if (!empty($exportParams['postal_greeting_other']) &&
count($merge[$masterID]['copy']) >= 1
) {
// use static greetings specified if no of contacts > 2
$merge[$masterID]['postalGreeting'] = str_replace(" {$copyPostalGreeting},", "", $merge[$masterID]['postalGreeting']);
}
- if (CRM_Utils_Array::value('addressee_other', $exportParams) &&
+ if (!empty($exportParams['addressee_other']) &&
count($merge[$masterID]['copy']) >= 1
) {
// use static greetings specified if no of contacts > 2
else {
$householdColName = CRM_Utils_String::munge($prefixColumn . $columnNames, '_', 64);
- if (CRM_Utils_Array::value($householdColName, $sqlColumns)) {
+ if (!empty($sqlColumns[$householdColName])) {
$replaced[$columnNames] = $householdColName;
}
}
$addressOptions = CRM_Core_BAO_Setting::valueOptions(CRM_Core_BAO_Setting::SYSTEM_PREFERENCES_NAME,
'address_options', TRUE, NULL, TRUE
);
- if (CRM_Utils_Array::value('supplemental_address_1', $addressOptions)) {
+ if (!empty($addressOptions['supplemental_address_1'])) {
$addressWhereClause .= " AND ( (supplemental_address_1 IS NULL) OR (supplemental_address_1 = '') ) ";
// enclose it again, since we are doing an AND in between a set of ORs
$addressWhereClause = "( $addressWhereClause )";