From 369917ce79abb798c5bb98f81f2f8624234bb343 Mon Sep 17 00:00:00 2001 From: ppound Date: Tue, 24 Aug 2021 14:35:15 -0300 Subject: [PATCH] made logic for the date to far in the future message more foolproof --- src/Controller/CalendarController.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Controller/CalendarController.php b/src/Controller/CalendarController.php index c7fb5a0..f184246 100644 --- a/src/Controller/CalendarController.php +++ b/src/Controller/CalendarController.php @@ -68,15 +68,19 @@ class CalendarController extends ControllerBase { // Determine which day has been selected by the user. If the user has entered a url that specifies a day outside of the // allowable reservation window, then set the current day as the selected day. $yyyy_mmdd = $dates[0]['yyyymmdd']; + $day_selected = false; foreach ($dates as $day) { if ($day['selected']) { $yyyy_mmdd = $day['yyyymmdd']; + $day_selected = TRUE; } } if ($yyyy_mmdd == $dates[0]['yyyymmdd']) { $dates[0]['selected'] = TRUE; $dates[0]['today'] = TRUE; - \Drupal::messenger()->addWarning(t('You have chosen a date to far in the ' + } + if(!$day_selected) { + \Drupal::messenger()->addWarning(t('You have chosen a date to far in the ' . 'future. Please choose a date within 14 days of today. The Calendar' . ' view below has defaulted to todays date.')); }