Merge branch 'master' into move_event_totals_to_monitor_status

This commit is contained in:
Isaac Connor 2020-11-06 14:17:23 -05:00
commit f2630b8fbc
2 changed files with 21 additions and 2 deletions

View File

@ -48,9 +48,24 @@ class EventsController extends AppController {
$mon_options = '';
}
if ( $this->request->params['named'] ) {
$named_params = $this->request->params['named'];
if ( $named_params ) {
# In 1.35.13 we renamed StartTime and EndTime to StartDateTime and EndDateTime.
# This hack renames the query string params
foreach ( $named_params as $k=>$v ) {
if ( false !== strpos($k, 'StartTime') ) {
$new_k = preg_replace('/StartTime/', 'StartDateTime', $k);
$named_params[$new_k] = $named_params[$k];
unset($named_params[$k]);
}
if ( false !== strpos($k, 'EndTime') ) {
$new_k = preg_replace('/EndTime/', 'EndDateTime', $k);
$named_params[$new_k] = $named_params[$k];
unset($named_params[$k]);
}
}
$this->FilterComponent = $this->Components->load('Filter');
$conditions = $this->FilterComponent->buildFilter($this->request->params['named']);
$conditions = $this->FilterComponent->buildFilter($named_params);
} else {
$conditions = array();
}

View File

@ -31,6 +31,10 @@ class Event extends AppModel {
*/
public $displayField = 'Name';
public $virtualFields = array(
'StartTime' => 'StartDateTime',
'EndTime' => 'EndDateTime'
);
//The Associations below have been created with all possible keys, those that are not needed can be removed