<?php
/*
+--------------------------------------------------------------------+
- | CiviCRM version 4.3 |
+ | CiviCRM version 4.4 |
+--------------------------------------------------------------------+
| Copyright CiviCRM LLC (c) 2004-2013 |
+--------------------------------------------------------------------+
'id' => $dao->id,
'gid' => $optionGroupID,
'value' => $dao->value,
- )
+ ),
+ ts('more'),
+ FALSE,
+ 'optionValue.row.actions',
+ 'optionValue',
+ $dao->id
);
- if (CRM_Utils_Array::value('component_id', $optionValue[$dao->id])) {
+ if (!empty($optionValue[$dao->id]['component_id'])) {
$optionValue[$dao->id]['component_name'] = $componentNames[$optionValue[$dao->id]['component_id']];
}
else {
$optionValue[$dao->id]['component_name'] = 'Contact';
}
- if (CRM_Utils_Array::value('visibility_id', $optionValue[$dao->id])) {
+ if (!empty($optionValue[$dao->id]['visibility_id'])) {
$optionValue[$dao->id]['visibility_label'] = $visibilityLabels[$optionValue[$dao->id]['visibility_id']];
}
}
$oldWeight = CRM_Core_DAO::getFieldValue('CRM_Core_DAO_OptionValue', $optionValueID, 'weight', 'id');
}
$fieldValues = array('option_group_id' => $optionGroupID);
- $params['weight'] = CRM_Utils_Weight::updateOtherWeights('CRM_Core_DAO_OptionValue', $oldWeight, $params['weight'], $fieldValues);
+ $params['weight'] = CRM_Utils_Weight::updateOtherWeights('CRM_Core_DAO_OptionValue', $oldWeight, CRM_Utils_Array::value('weight', $params), $fieldValues);
}
$params['option_group_id'] = $optionGroupID;
- if (($action & CRM_Core_Action::ADD) && !CRM_Utils_Array::value('value', $params)) {
+ if (($action & CRM_Core_Action::ADD) && empty($params['value'])) {
$fieldValues = array('option_group_id' => $optionGroupID);
// use the next available value
/* CONVERT(value, DECIMAL) is used to convert varchar
}
// set name to label if it's not set - but *only* for ADD action (CRM-3522)
- if (($action & CRM_Core_Action::ADD) && !CRM_Utils_Array::value('name', $params) && $params['label']) {
+ if (($action & CRM_Core_Action::ADD) && empty($params['name']) && $params['label']) {
$params['name'] = $params['label'];
}
if ($action & CRM_Core_Action::UPDATE) {
if (in_array($contactType, array(
'Individual', 'Household', 'Organization', 'All'))) {
$nameTitle = array(
- 'addressee' => array('name' => 'addressee',
+ 'addressee' => array(
+ 'name' => 'addressee',
'title' => ts('Addressee'),
'headerPattern' => '/^addressee$/i',
),
);
$title = array(
- 'email_greeting' => array('name' => 'email_greeting',
+ 'email_greeting' => array(
+ 'name' => 'email_greeting',
'title' => ts('Email Greeting'),
'headerPattern' => '/^email_greeting$/i',
),
);
$nameTitle = array_merge($nameTitle, $title);
}
-
- if ($contactType == 'Individual' || $contactType == 'All') {
- $title = array(
- 'gender' => array('name' => 'gender',
- 'title' => ts('Gender'),
- 'headerPattern' => '/^gender$/i',
- ),
- 'individual_prefix' => array(
- 'name' => 'individual_prefix',
- 'title' => ts('Individual Prefix'),
- 'headerPattern' => '/^(prefix|title)/i',
- ),
- 'individual_suffix' => array(
- 'name' => 'individual_suffix',
- 'title' => ts('Individual Suffix'),
- 'headerPattern' => '/^suffix$/i',
- ),
- );
- $nameTitle = array_merge($nameTitle, $title);
- }
}
if (is_array($nameTitle)) {
foreach ($nameTitle as $name => $attribs) {
self::$_fields[$key][$name] = $optionName;
list($tableName, $fieldName) = explode('.', $optionName['where']);
- // not sure of this fix, so keeping it commented for now
- // this is from CRM-1541
- // self::$_fields[$mode][$name]['where'] = $name . '.' . $fieldName;
self::$_fields[$key][$name]['where'] = "{$name}.label";
foreach ($attribs as $k => $val) {
self::$_fields[$key][$name][$k] = $val;
static function select(&$query) {
if (!empty($query->_params) || !empty($query->_returnProperties)) {
$field = self::getFields();
- foreach ($field as $name => $title) {
- list($tableName, $fieldName) = explode('.', $title['where']);
- if (CRM_Utils_Array::value($name, $query->_returnProperties)) {
+ foreach ($field as $name => $values) {
+ if (!empty($values['pseudoconstant'])) {
+ continue;
+ }
+ list($tableName, $fieldName) = explode('.', $values['where']);
+ if (!empty($query->_returnProperties[$name])) {
$query->_select["{$name}_id"] = "{$name}.value as {$name}_id";
$query->_element["{$name}_id"] = 1;
$query->_select[$name] = "{$name}.{$fieldName} as $name";