From a87ba7c0e44610ade593fc7c2e4ff2bb08ab49f3 Mon Sep 17 00:00:00 2001 From: kurund Date: Tue, 4 Feb 2014 15:52:35 -0800 Subject: [PATCH] Revert "CRM-13996 - Search views - hack to fix prefix, gender, suffix" This reverts commit e30e8c3cd8ea9e63d01902f9141e774988db8fe7. --- CRM/Contact/BAO/Query.php | 34 +++++----------------------------- 1 file changed, 5 insertions(+), 29 deletions(-) diff --git a/CRM/Contact/BAO/Query.php b/CRM/Contact/BAO/Query.php index 623b8acd60..a5ed7aff6a 100644 --- a/CRM/Contact/BAO/Query.php +++ b/CRM/Contact/BAO/Query.php @@ -634,14 +634,9 @@ class CRM_Contact_BAO_Query { } } } - // Fixme: this stuff does not need to be hard-coded, should be retrieved from schema metadata + if (in_array($name, array('prefix_id', 'suffix_id', 'gender_id'))) { - if ( - // Hack for default search view - !empty($this->_returnProperties[$field['pseudoconstant']['optionGroupName']]) || - // Hack for profile search view - !empty($this->_returnProperties[$name]) - ) { + if (CRM_Utils_Array::value($field['pseudoconstant']['optionGroupName'], $this->_returnProperties)) { $makeException = TRUE; } } @@ -759,31 +754,13 @@ class CRM_Contact_BAO_Query { } elseif ($fieldName != 'id') { if ($fieldName == 'prefix_id') { - // Hack - profile views use different field name than normal views! - $this->_pseudoConstantsSelect['prefix_id'] = - $this->_pseudoConstantsSelect['individual_prefix'] = array( - 'pseudoField' => 'prefix_id', - 'idCol' => "prefix_id", - 'bao' => 'CRM_Contact_BAO_Contact' - ); + $this->_pseudoConstantsSelect['individual_prefix'] = array('pseudoField' => 'prefix_id', 'idCol' => "prefix_id", 'bao' => 'CRM_Contact_BAO_Contact'); } if ($fieldName == 'suffix_id') { - // Hack - profile views use different field name than normal views! - $this->_pseudoConstantsSelect['suffix_id'] = - $this->_pseudoConstantsSelect['individual_suffix'] = array( - 'pseudoField' => 'suffix_id', - 'idCol' => "suffix_id", - 'bao' => 'CRM_Contact_BAO_Contact' - ); + $this->_pseudoConstantsSelect['individual_suffix'] = array('pseudoField' => 'suffix_id', 'idCol' => "suffix_id", 'bao' => 'CRM_Contact_BAO_Contact'); } if ($fieldName == 'gender_id') { - // Hack - profile views use different field name than normal views! - $this->_pseudoConstantsSelect['gender_id'] = - $this->_pseudoConstantsSelect['gender'] = array( - 'pseudoField' => 'gender_id', - 'idCol' => "gender_id", - 'bao' => 'CRM_Contact_BAO_Contact' - ); + $this->_pseudoConstantsSelect['gender'] = array('pseudoField' => 'gender_id', 'idCol' => "gender_id", 'bao' => 'CRM_Contact_BAO_Contact'); } $this->_select[$name] = "contact_a.{$fieldName} as `$name`"; } @@ -5196,7 +5173,6 @@ AND displayRelType.is_active = 1 /** * convert the pseudo constants id's to their names - * FIXME: Get rid of hard-coded references to fields, should be retrievable from schema metadata * * @param reference parameter $dao * @param bool $return -- 2.25.1