From 9aeebf734760f3fb952b88452b45826276f4b0a3 Mon Sep 17 00:00:00 2001 From: Chuck Scott Date: Wed, 18 Oct 2017 09:54:35 -0400 Subject: [PATCH] Now producing event Time/Rate info for non date specific events in getEventForRegistration(). --- classes/data/dataRegEvent.php | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/classes/data/dataRegEvent.php b/classes/data/dataRegEvent.php index 74a5ef3..ec94f45 100644 --- a/classes/data/dataRegEvent.php +++ b/classes/data/dataRegEvent.php @@ -677,6 +677,7 @@ class GlmDataRegistrationsRegEvent extends GlmDataAbstract // Try to find a current rate for this time - within the start and end days before this time foreach ($cv['reg_rate'] as $rk=>$rv) { + // Calculate earliest and latest days for this rate calculated from the start of this event time $earliestTime = strtotime(date('m/d/Y', $tv['start_datetime']['timestamp']).' -'.$rv['start_days'].' days'); $latestTime = strtotime(date('m/d/Y', $tv['start_datetime']['timestamp']).' -'.($rv['end_days']-1).' days'); @@ -695,6 +696,22 @@ class GlmDataRegistrationsRegEvent extends GlmDataAbstract // If event time is for non time specific event (might be either mixed in) if (!$tv['event_time']) { + // Try to find a current rate for this time - within the start and end days before this time + foreach ($cv['reg_rate'] as $rk=>$rv) { + + // Calculate earliest and latest days for this rate calculated from the start of the first date/time for this event + // ** We may want to make it optional to use the last day of the event ??? + $earliestTime = strtotime(date('m/d/Y', $this->regEventData['firstTime']['start_time']['timestamp']).' -'.$rv['start_days'].' days'); + $latestTime = strtotime(date('m/d/Y', $this->regEventData['firstTime']['start_time']['timestamp']).' -'.($rv['end_days']-1).' days'); + + // If it's time to register with this time/rate - Add it to the class data + if (time() > $earliestTime && time() < $latestTime) { + $this->regEventData['reg_class'][$ck]['times'][$tv['event_time']] = array_merge($tv, $rv); + } + + } + + } } -- 2.17.1