From e45c5e687f1c1180ac51cd1eb22be9c3bbae6433 Mon Sep 17 00:00:00 2001 From: eileen Date: Tue, 9 Oct 2018 18:10:38 +0100 Subject: [PATCH] Retain preferred array format while searching Money values. The preferred BAO_Query format is ['BETWEEN' => [12.40 AND 13.50]] but this is currently being munged back into legacy format, creating a test fail Note that the search doesn't work properly with international commas, with, or without this patch :-( --- CRM/Core/BAO/CustomQuery.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/CRM/Core/BAO/CustomQuery.php b/CRM/Core/BAO/CustomQuery.php index b71acb1081..a923bb53c1 100644 --- a/CRM/Core/BAO/CustomQuery.php +++ b/CRM/Core/BAO/CustomQuery.php @@ -420,10 +420,16 @@ SELECT f.id, f.label, f.data_type, $value = CRM_Utils_Array::value($op, (array) $value, $value); if (is_array($value)) { foreach ($value as $key => $val) { - $value[$key] = CRM_Utils_Rule::cleanMoney($value[$key]); + // @todo - this clean money should be in the form layer - it's highly likely to be doing more harm than good here + // Note the only place I can find that this code is reached by is searching a custom money field in advanced search. + // with euro style comma separators this doesn't work - with or without this cleanMoney. + // So this should be removed but is not increasing the brokeness IMHO + $value[$op][$key] = CRM_Utils_Rule::cleanMoney($value[$key]); } } else { + // @todo - this clean money should be in the form layer - it's highly likely to be doing more harm than good here + // comments per above apply. cleanMoney $value = CRM_Utils_Rule::cleanMoney($value); } -- 2.25.1