Cannot specify manual date range for report
If you try to run the report with a manually entered date range, you get the error message:
One of parameters (value: 2019-09-01) is not of the type Timestamp
See example stack trace log:
Nov 14 15:28:34 [error]
$Fatal Error Details = array:3 [
"message" => "One of parameters (value: 2019-09-01) is not of the type Timestamp"
"code" => null
"exception" => CRM_Core_Exception {#2089
-errorData: array:1 [
"error_code" => 0
]
#cause: null
-_trace: null
#message: "One of parameters (value: 2019-09-01) is not of the type Timestamp"
#code: 0
#file: "/home/cses_org_uk/public_html/administrator/components/com_civicrm/civicrm/CRM/Utils/Type.php"
#line: 470
trace: {
/home/cses_org_uk/public_html/administrator/components/com_civicrm/civicrm/CRM/Utils/Type.php:470 {
› $data = htmlentities($data);
› throw new CRM_Core_Exception("$name (value: $data) is not of the type $type");
› }
}
/home/cses_org_uk/public_html/administrator/components/com_civicrm/civicrm/CRM/Core/DAO.php:1666 { …}
/home/cses_org_uk/public_html/administrator/components/com_civicrm/civicrm/CRM/Core/DAO.php:1548 { …}
/home/cses_org_uk/public_html/media/civicrm/ext/membershipreport-1.0/membershipreport-1.0/CRM/Membershipreport/Form/Report/MembershipRenewal.php:231 { …}
/home/cses_org_uk/public_html/media/civicrm/ext/membershipreport-1.0/membershipreport-1.0/CRM/Membershipreport/Form/Report/MembershipRenewal.php:190 { …}
/home/cses_org_uk/public_html/administrator/components/com_civicrm/civicrm/CRM/Core/Form.php:526 { …}
/home/cses_org_uk/public_html/administrator/components/com_civicrm/civicrm/CRM/Core/QuickForm/Action/Submit.php:56 { …}
/home/cses_org_uk/public_html/administrator/components/com_civicrm/civicrm/packages/HTML/QuickForm/Controller.php:203 { …}
/home/cses_org_uk/public_html/administrator/components/com_civicrm/civicrm/packages/HTML/QuickForm/Page.php:103 { …}
/home/cses_org_uk/public_html/administrator/components/com_civicrm/civicrm/CRM/Core/Controller.php:347 { …}
/home/cses_org_uk/public_html/administrator/components/com_civicrm/civicrm/CRM/Utils/Wrapper.php:98 { …}
/home/cses_org_uk/public_html/administrator/components/com_civicrm/civicrm/CRM/Report/Page/Report.php:56 { …}
/home/cses_org_uk/public_html/administrator/components/com_civicrm/civicrm/CRM/Core/Invoke.php:313 { …}
/home/cses_org_uk/public_html/administrator/components/com_civicrm/civicrm/CRM/Core/Invoke.php:69 { …}
/home/cses_org_uk/public_html/administrator/components/com_civicrm/civicrm/CRM/Core/Invoke.php:36 { …}
/home/cses_org_uk/public_html/administrator/components/com_civicrm/civicrm.php:121 { …}
/home/cses_org_uk/public_html/administrator/components/com_civicrm/civicrm.php:40 { …}
/home/cses_org_uk/public_html/libraries/src/Component/ComponentHelper.php:402 { …}
/home/cses_org_uk/public_html/libraries/src/Component/ComponentHelper.php:377 { …}
/home/cses_org_uk/public_html/libraries/src/Application/AdministratorApplication.php:101 { …}
/home/cses_org_uk/public_html/libraries/src/Application/AdministratorApplication.php:159 { …}
/home/cses_org_uk/public_html/libraries/src/Application/CMSApplication.php:196 { …}
/home/cses_org_uk/public_html/administrator/index.php:51 { …}
}
}
]
The issue seems to be that MembershipRenewal.php assumes that the date input from the form will be in US format, but it is actually in ISO format. (Guess this has changed at some point in CiviCRM core?)
Fix is to use CRM_Utils_Date::isoToMysql()
rather than custom function getDateUSToSQL()
.
Will raise a PR to fix.