Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Follow up fix on start as a url parameter #14611

Merged
merged 1 commit into from
Jun 23, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 10 additions & 19 deletions CRM/Contribute/Form/Search.php
Original file line number Diff line number Diff line change
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');
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@eileenmcnaughton do we need to port the relative_handling as well?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@seamuslee001 so I think the relative date handling is not handling the relative date in the url but ensuring it is zero'd if the high or low are set - which I think IS handled in the generic handling

$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