Skip to content

Commit

Permalink
Merge pull request #14611 from eileenmcnaughton/url_support
Browse files Browse the repository at this point in the history
Follow up fix on start as a url parameter
  • Loading branch information
eileenmcnaughton committed Jun 23, 2019
2 parents 287d622 + a1caac8 commit 478a85e
Showing 1 changed file with 10 additions and 19 deletions.
29 changes: 10 additions & 19 deletions CRM/Contribute/Form/Search.php
Expand Up @@ -152,6 +152,16 @@ public function preProcess() {
* @throws \Exception
*/
public function setDefaultValues() {
$lowReceiveDate = CRM_Utils_Request::retrieve('start', 'Timestamp');
if (!empty($lowReceiveDate)) {
$this->_formValues['receive_date_low'] = date('Y-m-d H:i:s', strtotime($lowReceiveDate));
CRM_Core_Error::deprecatedFunctionWarning('pass receive_date_low not start');
}
$highReceiveDate = CRM_Utils_Request::retrieve('end', 'Timestamp');
if (!empty($highReceiveDate)) {
$this->_formValues['receive_date_high'] = date('Y-m-d H:i:s', strtotime($highReceiveDate));
CRM_Core_Error::deprecatedFunctionWarning('pass receive_date_high not end');
}
$this->_defaults = parent::setDefaultValues();
if (empty($this->_defaults['contribution_status'])) {
$this->_defaults['contribution_status'][1] = 1;
Expand Down Expand Up @@ -425,25 +435,6 @@ public function fixFormValues() {
}
}

$lowDate = CRM_Utils_Request::retrieve('start', 'Timestamp');
if ($lowDate) {
$lowDate = CRM_Utils_Type::escape($lowDate, 'Timestamp');
$date = CRM_Utils_Date::setDateDefaults($lowDate);
$this->_formValues['contribution_date_low'] = $this->_defaults['contribution_date_low'] = $date[0];
}

$highDate = CRM_Utils_Request::retrieve('end', 'Timestamp');
if ($highDate) {
$highDate = CRM_Utils_Type::escape($highDate, 'Timestamp');
$date = CRM_Utils_Date::setDateDefaults($highDate);
$this->_formValues['contribution_date_high'] = $this->_defaults['contribution_date_high'] = $date[0];
}

if ($highDate || $lowDate) {
//set the Choose Date Range value
$this->_formValues['contribution_date_relative'] = 0;
}

$this->_limit = CRM_Utils_Request::retrieve('limit', 'Positive',
$this
);
Expand Down

0 comments on commit 478a85e

Please sign in to comment.