From 402b559b2cbc08c42395e4eaf6463798f2c79c5d Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Fri, 6 Nov 2020 11:15:12 -0500 Subject: [PATCH 1/2] Add StartTime and EndTime virtual fields for backwards compatability --- web/api/app/Model/Event.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/web/api/app/Model/Event.php b/web/api/app/Model/Event.php index 22a97f62f..e54fd125f 100644 --- a/web/api/app/Model/Event.php +++ b/web/api/app/Model/Event.php @@ -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 From 6ed006bc600bde23ba21a4e37923f5515d3d6477 Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Fri, 6 Nov 2020 12:25:04 -0500 Subject: [PATCH 2/2] rename StartTime and EndTime to StartDateTime and EndDateTime in the named query params --- web/api/app/Controller/EventsController.php | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/web/api/app/Controller/EventsController.php b/web/api/app/Controller/EventsController.php index 021c40b5e..d18409387 100644 --- a/web/api/app/Controller/EventsController.php +++ b/web/api/app/Controller/EventsController.php @@ -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(); }