From da91c5660d5add3333970ae9b3064e4c5402fca4 Mon Sep 17 00:00:00 2001 From: Chuck Scott Date: Thu, 13 Sep 2018 16:11:09 -0400 Subject: [PATCH] Fixed some front-end date issues and one admin problem Fixed date and time displayed for an event on registration page so it reflects only current or future dates and times. Fixed time displayed for an event on registration page so it no longer shows a range of times, only the time for the date shown. Added display of "(see below for other dates/times)" when there are more than the first date/time displayed on the registration page. Fixed problem where viewing a request from a sold-out event caused the attendees to be removed and the request if there were no attendees. --- classes/data/dataRegEvent.php | 14 +++++-------- index.php | 6 +++--- models/admin/registrations/requests.php | 2 +- readme.txt | 6 ++++++ views/front/registrations/registration.html | 22 ++++++++++----------- views/front/registrations/summaryStore.html | 2 +- 6 files changed, 27 insertions(+), 25 deletions(-) mode change 100644 => 100755 classes/data/dataRegEvent.php mode change 100644 => 100755 views/front/registrations/registration.html mode change 100644 => 100755 views/front/registrations/summaryStore.html diff --git a/classes/data/dataRegEvent.php b/classes/data/dataRegEvent.php old mode 100644 new mode 100755 index 62cc04b..d22ecaf --- a/classes/data/dataRegEvent.php +++ b/classes/data/dataRegEvent.php @@ -714,10 +714,11 @@ class GlmDataRegistrationsRegEvent extends GlmDataAbstract * @param boolean $withRecurData Ask for all recirrences and recurrence times for event if true * @param boolean $counts Ask for attendee counts * @param boolean $inactiveTimes Include inactive times + * @param boolean $firstFutureTime Calculate firstTime based on available current/future times (not past) * * @return array All data related to the setup/configuration of a registration event */ - public function getEventConfig($id = false, $extended = false, $forEdit = false, $withRecurData = false, $counts = false, $inactiveTimes = false) + public function getEventConfig($id = false, $extended = false, $forEdit = false, $withRecurData = false, $counts = false, $inactiveTimes = false, $firstFutureTime = false) { // Save status of extended data flag @@ -788,7 +789,7 @@ class GlmDataRegistrationsRegEvent extends GlmDataAbstract foreach ($this->regEventData['reg_time'] as $time) { // If the time is not for non-time-specific inventory - if (!$time['non_time_specific']['value']) { + if (!$time['non_time_specific']['value'] && (!$firstFutureTime || $time['start_datetime']['timestamp'] > time())) { if (!$firstTime || $time['start_datetime']['timestamp'] < $firstTime) { $firstTime = $time['start_datetime']['timestamp']; } @@ -903,7 +904,7 @@ class GlmDataRegistrationsRegEvent extends GlmDataAbstract { // Get the event data - $this->getEventConfig($regEventId); + $this->getEventConfig($regEventId, false, false, false, false, false, true); // Make sure we have an event if (!$this->regEventData) { @@ -924,11 +925,6 @@ class GlmDataRegistrationsRegEvent extends GlmDataAbstract return false; } - // If now we don't have any time entries - if (count($this->regEventData['reg_time']) == 0) { - return false; - } - // If it's too late to register for this event if ($this->regEventData['last_datetime']['timestamp'] - time() < ($this->regEventData['reg_hours_before'] & 3600)) { return false; @@ -957,7 +953,7 @@ class GlmDataRegistrationsRegEvent extends GlmDataAbstract // Scan times 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 + // Try to find a current rate for this time - within the start and end days before this time (ignore non_time_specific entries) foreach ($regClass['reg_rate'] as $regRateKey=>$regRate) { if (!$regTime['non_time_specific']['value']) { diff --git a/index.php b/index.php index f3fdc44..2e1a6ef 100755 --- a/index.php +++ b/index.php @@ -3,7 +3,7 @@ * Plugin Name: GLM Associate - Event Registrations Add-On * Plugin URI: http://www.gaslightmedia.com/ * Description: Add-on to integrate registrations into Events add-on. - * Version: 1.0.19 + * Version: 1.0.20 * Author: Gaslight Media * Author URI: http://www.gaslightmedia.com/ * License: GPL2 @@ -17,7 +17,7 @@ * @package glmMembersRegistrationsAddOn * @author Chuck Scott * @license http://www.gaslightmedia.com Gaslightmedia - * @version 1.0.19 + * @version 1.0.20 */ // Check that we're being called by WordPress. @@ -41,7 +41,7 @@ if (!defined('ABSPATH')) { * so that we're sure the other add-ons see an up to date * version from this plugin. */ -define('GLM_MEMBERS_REGISTRATIONS_PLUGIN_VERSION', '1.0.19'); +define('GLM_MEMBERS_REGISTRATIONS_PLUGIN_VERSION', '1.0.20'); define('GLM_MEMBERS_REGISTRATIONS_PLUGIN_DB_VERSION', '1.0.1'); // This is the minimum version of the GLM Members DB plugin require for this plugin. diff --git a/models/admin/registrations/requests.php b/models/admin/registrations/requests.php index 47f9eb0..48a83d9 100755 --- a/models/admin/registrations/requests.php +++ b/models/admin/registrations/requests.php @@ -148,7 +148,7 @@ class GlmMembersAdmin_registrations_requests extends GlmDataRegistrationsRegRequ if ($requestID && $requestID > 0) { // Try to check and get the request (cart) - $cart = $regCartSupport->checkRegistrationRequest($requestID); + $cart = $regCartSupport->getRegistrationCart($requestID); // If there's no valid cart if (!$cart || !isset($cart['status']) || !$cart['status'] ) { diff --git a/readme.txt b/readme.txt index d4dfa55..c9962b9 100755 --- a/readme.txt +++ b/readme.txt @@ -25,6 +25,12 @@ e.g. 1. Activate the plugin through the 'Plugins' menu in WordPress == Changelog == += 1.0.20 = +* Fixed date and time displayed for an event on registration page so it reflects only current or future dates and times. +* Fixed time displayed for an event on registration page so it no longer shows a range of times, only the time for the date shown. +* Added display of "(see below for other dates/times)" when there are more than the first date/time displayed on the registration page. +* Fixed problem where viewing a request from a sold-out event caused the attendees to be removed and the request if there were no attendees. + = 1.0.19 = * Removed "Select" from progress bar on checkout page that leaked in from development work diff --git a/views/front/registrations/registration.html b/views/front/registrations/registration.html old mode 100644 new mode 100755 index 318cefd..c68485d --- a/views/front/registrations/registration.html +++ b/views/front/registrations/registration.html @@ -10,10 +10,6 @@ {/literal} -{assign var=first value = $regEvent.reg_time|@key} -{assign var=first_date value = $regEvent.reg_time.$first.start_datetime} -{assign var=last value = $regEvent.reg_time|@end} -{assign var=last_date value = $last.end_datetime} {assign var=time_specific value = $regEvent.time_specific.value} {* Template for the regEvent *}{literal} @@ -31,19 +27,23 @@ {/if}
+ + {* If there's a starting timestamp for this event. Why wouldn't there be? *} {if $regEvent.first_datetime.timestamp} +
{$regEvent.first_datetime.timestamp|date_format:"%A, %B %e, %Y"}
+
{$regEvent.first_datetime.timestamp|date_format:"%l:%M %p"}
- {if $first_date.timestamp != $last_date.timestamp && !$time_specific} -
{$first_date.timestamp|date_format:"%l:%M %p"} - {$last_date.timestamp|date_format:"%l:%M %p"}
- {else} -
{$regEvent.first_datetime.timestamp|date_format:"%l:%M %p"}
+ {* If the first and last timestamp are NOT the same, then there's other dates and times Should be selectable below. *} + {if $regEvent.first_date.timestamp != $regEvent.last_date.timestamp} +
(see other dates and times below)
{/if} + {/if} - {if $regEvent.eventCost} -
{$regEvent.eventCost}
- {/if} + {if $regEvent.eventCost} +
{$regEvent.eventCost}
+ {/if} {if isset( $regEvent.locations ) && ( $regEvent.locations.name || $regEvent.locations.address )}
diff --git a/views/front/registrations/summaryStore.html b/views/front/registrations/summaryStore.html old mode 100644 new mode 100755 index 438d590..02e333f --- a/views/front/registrations/summaryStore.html +++ b/views/front/registrations/summaryStore.html @@ -255,7 +255,7 @@ {else} -         {$customField.field_name}:argh +         {$customField.field_name}: {$customField.stored} {if $customField.cost > 0} -- 2.17.1