From dd2db5e5375c85e362863a432c4086829cf64e0b Mon Sep 17 00:00:00 2001 From: eileen Date: Tue, 30 Oct 2018 12:02:40 +1300 Subject: [PATCH] Remove lowercasing in relationship query --- CRM/Contact/BAO/Query.php | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/CRM/Contact/BAO/Query.php b/CRM/Contact/BAO/Query.php index 083b643c5b..5dd65ba824 100644 --- a/CRM/Contact/BAO/Query.php +++ b/CRM/Contact/BAO/Query.php @@ -4045,16 +4045,16 @@ WHERE $smartGroupClause substr($name, -1, 1) == '"' ) { $name = substr($name, 1, -1); - $name = strtolower(CRM_Core_DAO::escapeString($name)); + $name = CRM_Core_DAO::escapeString($name); $nameClause = "= '$name'"; } else { - $name = strtolower(CRM_Core_DAO::escapeString($name)); + $name = CRM_Core_DAO::escapeString($name); $nameClause = "LIKE '%{$name}%'"; } } - $rTypeValues = $relTypes = $relTypesIds = array(); + $relTypes = $relTypesIds = array(); if (!empty($relationType)) { $relationType[2] = (array) $relationType[2]; foreach ($relationType[2] as $relType) { @@ -4064,21 +4064,16 @@ WHERE $smartGroupClause $typeValues = array(); $rTypeValue = CRM_Contact_BAO_RelationshipType::retrieve($params, $typeValues); if (!empty($rTypeValue)) { - $rTypeValues[] = $rTypeValue; + if ($rTypeValue->name_a_b == $rTypeValue->name_b_a) { + // if we don't know which end of the relationship we are dealing with we'll create a temp table + self::$_relType = 'reciprocal'; + } $relTypesIds[] = $rel[0]; $relTypes[] = $relType; } } } - if (!empty($rTypeValues)) { - foreach ($rTypeValues as $rTypeValue) { - $rTypeValue = (array) $rTypeValue; - if ($rTypeValue['name_a_b'] == $rTypeValue['name_b_a']) { - // if we don't know which end of the relationship we are dealing with we'll create a temp table - self::$_relType = 'reciprocal'; - } - } - } + // if we are creating a temp table we build our own where for the relationship table $relationshipTempTable = NULL; if (self::$_relType == 'reciprocal') { -- 2.25.1