Commit e1b44b82 authored by Lily Yan's avatar Lily Yan
Browse files

ISTWCMS-5072 Fix undefined date_type, date_opterator and date_check

parent db386794
......@@ -26,26 +26,29 @@ function uw_ct_event_views_pre_view(ViewExecutable $view, $display_id, array &$a
// Get date filter's operator, and the date value for the field we're going
// to want to check. Set the base date we'll compare against to today.
$date_operator = $exposed['date_type'];
$date_check = $exposed['date']['value'];
$base_date = date('m/d/Y');
if ($date_operator == 'between') {
// If we are using "between", we want to use the max date as our check.
// Note that if "between" doesn't have two values, it doesn't seem to
// apply at all, so we don't do a comparison if there isn't a start value.
$date_check = $exposed['date']['max'];
if (!$exposed['date']['min']) {
$date_operator = NULL;
}
if (isset($exposed['date_type'])) {
$date_operator = $exposed['date_type'];
$date_check = $exposed['date']['value'];
$base_date = date('m/d/Y');
}
elseif ($date_operator == '<') {
// If we are using "less than", we need to change the date we're comparing
// against tomorrow, to work with how we are comparing dates below.
$base_date = date('m/d/Y', strtotime('tomorrow'));
if (isset($date_operator)) {
if ($date_operator == 'between') {
// If we are using "between", we want to use the max date as our check.
// Note that if "between" doesn't have two values, it doesn't seem to
// apply at all, so we don't do a comparison if there isn't a start value.
$date_check = $exposed['date']['max'];
if (!$exposed['date']['min']) {
$date_operator = NULL;
}
} elseif ($date_operator == '<') {
// If we are using "less than", we need to change the date we're comparing
// against tomorrow, to work with how we are comparing dates below.
$base_date = date('m/d/Y', strtotime('tomorrow'));
}
}
// If there is a date filter set, see if we need to act on it.
if ($date_check) {
if (isset($date_check)) {
// Set which operators allow for date ranges exclusively in the past.
// Note that "!=", ">=", ">" and "not between" would require us to check the
// actual results, so treat these as if they include future results at all
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment