X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=CRM%2FContact%2FBAO%2FQuery.php;h=ff2b028c0a819ecf4b0df52e0ff0dfa731393da2;hb=41cf82488aa2e177384395b9f16e39afae84b9ba;hp=a6b2545d8bfc72265a4d1feaa3992befbc5771c6;hpb=f72dca69434a80734674fdff7f2fcd775c823777;p=civicrm-core.git diff --git a/CRM/Contact/BAO/Query.php b/CRM/Contact/BAO/Query.php index a6b2545d8b..ff2b028c0a 100644 --- a/CRM/Contact/BAO/Query.php +++ b/CRM/Contact/BAO/Query.php @@ -213,13 +213,6 @@ class CRM_Contact_BAO_Query { 'communication_style_id' => 'communication_style', ]; - /** - * The cache to translate the option values into labels. - * - * @var array - */ - public $_options; - /** * Are we in search mode. * @@ -546,7 +539,6 @@ class CRM_Contact_BAO_Query { $this->_whereTables = []; $this->_where = []; $this->_qill = []; - $this->_options = []; $this->_cfIDs = []; $this->_paramLookup = []; $this->_having = []; @@ -577,7 +569,6 @@ class CRM_Contact_BAO_Query { $this->_select = array_merge($this->_select, $this->_customQuery->_select); $this->_element = array_merge($this->_element, $this->_customQuery->_element); $this->_tables = array_merge($this->_tables, $this->_customQuery->_tables); - $this->_options = $this->_customQuery->_options; } $isForcePrimaryOnly = !empty($apiEntity); $this->_whereClause = $this->whereClause($isForcePrimaryOnly); @@ -1121,6 +1112,9 @@ class CRM_Contact_BAO_Query { } $field = $this->_fields[$elementName] ?? NULL; + if (isset($this->_pseudoConstantsSelect[$field['name']])) { + $this->_pseudoConstantsSelect[$name . '-' . $field['name']] = $this->_pseudoConstantsSelect[$field['name']]; + } // hack for profile, add location id if (!$field) { @@ -2186,7 +2180,7 @@ class CRM_Contact_BAO_Query { $name, $op, $value, $grouping, 'CRM_Contact_DAO_Contact', $field, - $field['title'], + $field['html']['label'] ?? $field['title'], CRM_Utils_Type::typeToString($dataType) ); if ($name === 'gender_id') { @@ -4605,7 +4599,6 @@ civicrm_relationship.start_date > {$today} list($select, $from, $where, $having) = $query->query($count); - $options = $query->_options; if (!empty($query->_permissionWhereClause)) { if (!empty($query->_permissionFromClause) && !stripos($from, 'aclContactCache')) { $from .= " $query->_permissionFromClause"; @@ -4654,7 +4647,7 @@ civicrm_relationship.start_date > {$today} } $values[$dao->$entityIDField] = $val; } - return [$values, $options]; + return [$values]; } /** @@ -6938,6 +6931,17 @@ AND displayRelType.is_active = 1 return $field; } + /** + * Get the field datatype, using the type in the database rather than the pseudofield, if a pseudofield. + * + * @param string $fieldName + * + * @return string + */ + public function getDataTypeForRealField($fieldName) { + return CRM_Utils_Type::typeToString($this->getMetadataForRealField($fieldName)['type']); + } + /** * If we have a field that is better rendered via the pseudoconstant handled them here. *