From: Chuck Scott Date: Wed, 18 Oct 2017 13:54:35 +0000 (-0400) Subject: Now producing event Time/Rate info for non date specific events in getEventForRegistr... X-Git-Tag: v1.0.0^2~345 X-Git-Url: http://cvs2.gaslightmedia.com/gitweb/?a=commitdiff_plain;h=9aeebf734760f3fb952b88452b45826276f4b0a3;p=WP-Plugins%2Fglm-member-db-registrations.git Now producing event Time/Rate info for non date specific events in getEventForRegistration(). --- 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); + } + + } + + } }