From fc7dc7cd093277d23170a8e10f7937dca1a87587 Mon Sep 17 00:00:00 2001 From: "deb.monish" Date: Tue, 15 Nov 2016 22:53:38 +0530 Subject: [PATCH] CRM-19394: Relative date is not processed correctly --- CRM/Contact/BAO/Query.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/CRM/Contact/BAO/Query.php b/CRM/Contact/BAO/Query.php index 37b982aa2202..071e76dc8670 100644 --- a/CRM/Contact/BAO/Query.php +++ b/CRM/Contact/BAO/Query.php @@ -1620,6 +1620,13 @@ public static function convertFormValues(&$formValues, $wildcard = 0, $useEquals } if (array_key_exists($fromRange, $formValues) && array_key_exists($toRange, $formValues)) { + // relative dates are not processed correctly as lower date value were ignored, + // to ensure both high and low date value got added IF there is relative date, + // we need to reset $formValues by unset and then adding again via CRM_Contact_BAO_Query::fixDateValues(...) + if (!empty($formValues[$id])) { + unset($formValues[$fromRange]); + unset($formValues[$toRange]); + } CRM_Contact_BAO_Query::fixDateValues($formValues[$id], $formValues[$fromRange], $formValues[$toRange]); continue; }