From 0ceea711a0f74ac4206e848153254cd7eda982ec Mon Sep 17 00:00:00 2001 From: Pradeep Nayak Date: Wed, 23 Nov 2016 19:49:53 +0530 Subject: [PATCH 1/2] CRM-19681, fixed code to respect date filters passed from url for report ---------------------------------------- * CRM-19681: date fields not respected when passed through url for report https://issues.civicrm.org/jira/browse/CRM-19681 --- CRM/Report/Utils/Get.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/CRM/Report/Utils/Get.php b/CRM/Report/Utils/Get.php index 8669159425a3..8befb0a580db 100644 --- a/CRM/Report/Utils/Get.php +++ b/CRM/Report/Utils/Get.php @@ -66,7 +66,10 @@ public static function dateParam($fieldName, &$field, &$defaults) { $from = self::getTypedValue("{$fieldName}_from", $type); $to = self::getTypedValue("{$fieldName}_to", $type); - $relative = CRM_Utils_Array::value("{$fieldName}_relative", $_GET); + $relative = self::getTypedValue("{$fieldName}_relative", CRM_Utils_Type::T_STRING); + if ($relative !== NULL) { + $defaults["{$fieldName}_relative"] = $relative; + } if ($relative) { list($from, $to) = CRM_Report_Form::getFromTo($relative, NULL, NULL); $from = substr($from, 0, 8); From dd56d5dc2258bfff5daa0424d8d46ede60edb51d Mon Sep 17 00:00:00 2001 From: Pradeep Nayak Date: Wed, 23 Nov 2016 19:51:18 +0530 Subject: [PATCH 2/2] CRM-19681, fixed static function notice error ---------------------------------------- * CRM-19681: date fields not respected when passed through url for report https://issues.civicrm.org/jira/browse/CRM-19681 --- CRM/Report/Utils/Get.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CRM/Report/Utils/Get.php b/CRM/Report/Utils/Get.php index 8befb0a580db..21005661f3fe 100644 --- a/CRM/Report/Utils/Get.php +++ b/CRM/Report/Utils/Get.php @@ -71,7 +71,7 @@ public static function dateParam($fieldName, &$field, &$defaults) { $defaults["{$fieldName}_relative"] = $relative; } if ($relative) { - list($from, $to) = CRM_Report_Form::getFromTo($relative, NULL, NULL); + list($from, $to) = CRM_Utils_Date::getFromTo($relative, NULL, NULL); $from = substr($from, 0, 8); $to = substr($to, 0, 8); }