From b5cbac9b05b4f6777ddd5d2adaaf7f148ae98c5f Mon Sep 17 00:00:00 2001 From: Chuck Scott Date: Tue, 12 Dec 2017 16:09:45 -0500 Subject: [PATCH] Fixed issues with deletion of custom fields and problems with calculating dates for registration for rates. --- classes/data/dataRegEvent.php | 65 +++++++++---------- .../registrations/eventEditCustomFields.html | 2 +- views/front/registrations/registration.html | 19 +++++- 3 files changed, 51 insertions(+), 35 deletions(-) diff --git a/classes/data/dataRegEvent.php b/classes/data/dataRegEvent.php index 9d18f31..1b92734 100644 --- a/classes/data/dataRegEvent.php +++ b/classes/data/dataRegEvent.php @@ -882,49 +882,51 @@ class GlmDataRegistrationsRegEvent extends GlmDataAbstract // For each event time except non-time-specific entry foreach ($this->regEventData['reg_time'] as $regTimeKey=>$regTime) { - // Try to find a current rate for this time - within the start and end days before this time - foreach ($regClass['reg_rate'] as $regRateKey=>$regRate) { + // If event time is for non-time-specific event - Calculate from the earlies and latest event times + if ($regTime['non_time_specific']['value']) { - // Calculate earliest and latest days for this rate calculated from the start of this event time - $earliestTime = strtotime(date('m/d/Y', $regTime['start_datetime']['timestamp']).' -'.$regRate['start_days'].' days'); - $latestTime = strtotime(date('m/d/Y', $regTime['start_datetime']['timestamp']).' -'.($regRate['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) { + // Try to find a current rate for this time - within the start and end days before this time + foreach ($regClass['reg_rate'] as $regRateKey=>$regRate) { - // Preserve rate ID and don't let it trash the time ID - $regRate['rate_id'] = $regRate['id']; - unset($regRate['id']); + // Calculate earliest and latest days for this rate calculated from the start of the first date/time for this event + $earliestTime = strtotime(date('m/d/Y', $this->regEventData['first_datetime']['timestamp']).' -'.$regRate['start_days'].' days'); + $latestTime = strtotime(date('m/d/Y', $this->regEventData['first_datetime']['timestamp']).' -'.($regRate['end_days']).' days'); - $this->regEventData['reg_class'][$regClassKey]['times'][$regTime['event_time']] = array_merge($regTime, $regRate); - $this->regEventData['reg_class'][$regClassKey]['hasTimes'] = true; - } + // If it's time to register with this time/rate - Add it to the class data + if (time() >= $earliestTime && time() <= $latestTime && false) { - } + // Preserve rate ID and don't let it trash the time ID + $regRate['rate_id'] = $regRate['id']; + unset($regRate['id'], $regRate['reg_event']); - } + $this->regEventData['reg_class'][$regClassKey]['times'][$regTime['event_time']] = array_merge($regTime, $regRate); + $this->regEventData['reg_class'][$regClassKey]['hasTimes'] = true; + } + } + + // If time specific event - calculate based on the time entries + } else { - // If event time is for non-time-specific event - if ($regTime['non_time_specific']) { + // Try to find a current rate for this time - within the start and end days before this time + foreach ($regClass['reg_rate'] as $regRateKey=>$regRate) { - // Try to find a current rate for this time - within the start and end days before this time - foreach ($regClass['reg_rate'] as $regRateKey=>$regRate) { + // Calculate earliest and latest days for this rate calculated from the start of this event time + $earliestTime = strtotime(date('m/d/Y', $regTime['start_datetime']['timestamp']).' -'.$regRate['start_days'].' days'); + $latestTime = strtotime(date('m/d/Y', $regTime['start_datetime']['timestamp']).' -'.($regRate['end_days']-1).' days'); - // 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']).' -'.$regRate['start_days'].' days'); - $latestTime = strtotime(date('m/d/Y', $this->regEventData['firstTime']['start_time']['timestamp']).' -'.($regRate['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) { - // If it's time to register with this time/rate - Add it to the class data - if (time() > $earliestTime && time() < $latestTime) { + // Preserve rate ID and don't let it trash the time ID + $regRate['rate_id'] = $regRate['id']; + unset($regRate['id']); - // Preserve rate ID and don't let it trash the time ID - $regRate['rate_id'] = $regRate['id']; - unset($regRate['id'], $regRate['reg_event']); + $this->regEventData['reg_class'][$regClassKey]['times'][$regTime['event_time']] = array_merge($regTime, $regRate); + $this->regEventData['reg_class'][$regClassKey]['hasTimes'] = true; + } - $this->regEventData['reg_class'][$regClassKey]['times'][$regTime['event_time']] = array_merge($regTime, $regRate); - $this->regEventData['reg_class'][$regClassKey]['hasTimes'] = true; } } @@ -933,9 +935,6 @@ class GlmDataRegistrationsRegEvent extends GlmDataAbstract } // Have rates for this class - // Drop the rate supplied rate data that's now merged with time and saved with the class. -// unset($this->regEventData['reg_class'][$regClassKey]['reg_rate']); - } // for each class // Get rid of all of the recurrence data - No longer needed diff --git a/views/admin/registrations/eventEditCustomFields.html b/views/admin/registrations/eventEditCustomFields.html index 4794bcf..b1d7da0 100644 --- a/views/admin/registrations/eventEditCustomFields.html +++ b/views/admin/registrations/eventEditCustomFields.html @@ -48,7 +48,7 @@

Requested for each attendee for this event

These are additional fields of information that will be requested for each registrant for this event.

- {assign var="attendeeFid" value="glm_reg_customfields_reg_attendee_`$regEventID`"} + {assign var="attendeeFid" value="glm_reg_customfields_reg_event_attendee_`$regEventID`"} {apply_filters('glm-members-customfields-edit', '', $attendeeFid)}

diff --git a/views/front/registrations/registration.html b/views/front/registrations/registration.html index ad31153..b1f29c6 100644 --- a/views/front/registrations/registration.html +++ b/views/front/registrations/registration.html @@ -144,6 +144,24 @@ {/if}{literal} + + + +{/literal} + {if apply_filters('glm-members-customfields-active', false)} +ID = {$regEvent.id} + {assign var="fid" value="glm_reg_customfields_reg_attendee_`$event.id`"} {* assemble the uid with the current event ID *} +
FID = {$fid} + {if apply_filters('glm-members-customfields-have-fields', false, $fid)} + + {apply_filters('glm-members-customfields-form-display', '', $fid, $cartId, 'checkoutForm', false)} + + {/if} + {/if} +{literal} + + +
@@ -245,7 +263,6 @@ var app = { Models: { Front: {}, Admin: {} }, Collections: { Front: {}, Admin: {} }, Views: { Front: {}, Admin: {} }, - //Times: {$regTimesJSON}, isValidEmail: function( email ){ var regex = {literal}/^([a-zA-Z0-9_.+-])+\@(([a-zA-Z0-9-])+\.)+([a-zA-Z0-9]{2,4})+$/;{/literal} return regex.test(email); -- 2.17.1