CRM-21148 revert back to odd handling when NULL passed to getFromTo, deprecate
authoreileen <emcnaughton@wikimedia.org>
Mon, 16 Apr 2018 03:57:30 +0000 (15:57 +1200)
committereileen <emcnaughton@wikimedia.org>
Mon, 16 Apr 2018 03:57:30 +0000 (15:57 +1200)
CRM/Report/Form.php

index 6e41d5e1e6a6f2466389d4f4a754f8ad2c0bf9c2..9df5605cf4f0d6324c1e1957bf1a5a747d096d17 100644 (file)
@@ -2056,6 +2056,8 @@ class CRM_Report_Form extends CRM_Core_Form {
   /**
    * Get values for from and to for date ranges.
    *
+   * @deprecated
+   *
    * @param bool $relative
    * @param string $from
    * @param string $to
@@ -2064,7 +2066,13 @@ class CRM_Report_Form extends CRM_Core_Form {
    *
    * @return array
    */
-  public function getFromTo($relative, $from, $to, $fromTime = NULL, $toTime = '235959') {
+  public function getFromTo($relative, $from, $to, $fromTime = NULL, $toTime = NULL) {
+    if (empty($toTime)) {
+      // odd legacy behaviour to treat NULL as 'end of the day'
+      // recommend updating reports to call CRM_Utils_Date::getFromTo
+      //directly (default on the function is the actual default there).
+      $toTime = '235959';
+    }
     return CRM_Utils_Date::getFromTo($relative, $from, $to, $fromTime, $toTime);
   }