From 0731e51006ad516b0d1942d663cfe9012114b958 Mon Sep 17 00:00:00 2001 From: Chuck Scott Date: Thu, 24 Aug 2017 15:57:23 -0400 Subject: [PATCH] Added time_specific field to reg_event table - database 0.0.9. Added code to return recurrence and times data from Events via glm-member-db-events-get-event-times filter. Added time_specific field to reg event edit. --- classes/data/dataRegEvent.php | 22 +++++++++++++++---- index.php | 2 +- models/admin/registrations/event.php | 7 +++--- ..._V0.0.8.sql => create_database_V0.0.9.sql} | 1 + setup/databaseScripts/dbVersions.php | 3 ++- ...se_V0.0.8.sql => drop_database_V0.0.9.sql} | 0 .../update_database_V0.0.9.sql | 10 +++++++++ views/admin/registrations/event.html | 10 +++++++++ views/admin/registrations/eventEdit.html | 8 +++++++ 9 files changed, 53 insertions(+), 10 deletions(-) rename setup/databaseScripts/{create_database_V0.0.8.sql => create_database_V0.0.9.sql} (99%) rename setup/databaseScripts/{drop_database_V0.0.8.sql => drop_database_V0.0.9.sql} (100%) create mode 100644 setup/databaseScripts/update_database_V0.0.9.sql diff --git a/classes/data/dataRegEvent.php b/classes/data/dataRegEvent.php index 7943329..bf50fec 100644 --- a/classes/data/dataRegEvent.php +++ b/classes/data/dataRegEvent.php @@ -172,6 +172,14 @@ class GlmDataRegistrationsRegEvent extends GlmDataAbstract 'default' => 0 ), + // Flag to indicate that this event is date/time specific - otherwise registrations may be used any date/time + 'time_specific' => array ( + 'field' => 'time_specific', + 'type' => 'checkbox', + 'use' => 'a', + 'default' => 1 + ), + // Registration requires attendees - Otherwise the person submitting the registration is the registrant 'attendees' => array ( 'field' => 'attendees', @@ -429,13 +437,14 @@ class GlmDataRegistrationsRegEvent extends GlmDataAbstract * Get all event configuration data for a specific event * Used to get data for managing a registration event * - * @param integer $id ID of reg_event record - * @param boolean $extended Request added data from Event add-on if true - * @param boolean $forEdit Ask for results to include arrays necessary for construction of input fields + * @param integer $id ID of reg_event record + * @param boolean $extended Request added data from Event add-on if true + * @param boolean $forEdit Ask for results to include arrays necessary for construction of input fields + * @param boolean $withRecurData As for all times records for this event from EVent add-on if true * * @return array All data related to the setup/configuration of a registration event */ - public function getEventConfig($id = false, $extended = false, $forEdit = false) + public function getEventConfig($id = false, $extended = false, $forEdit = false, $withRecurData = false) { // Save status of extended data flag @@ -476,6 +485,11 @@ class GlmDataRegistrationsRegEvent extends GlmDataAbstract } + // If recurrence data is requested and regsitration for this event is date/time specific - Get recurrence and times data + if ($eventData['time_specific']['value'] & $withRecurData) { + $eventData['recurrences'] = apply_filters('glm-member-db-events-get-event-times', $eventData['event']); + } + // Restore status of extended data flag $this->postProcAddedEventData = $saveExtended; diff --git a/index.php b/index.php index 3b9c19b..0351e4c 100644 --- a/index.php +++ b/index.php @@ -44,7 +44,7 @@ if (!defined('ABSPATH')) { * version from this plugin. */ define('GLM_MEMBERS_REGISTRATIONS_PLUGIN_VERSION', '0.0.1'); -define('GLM_MEMBERS_REGISTRATIONS_PLUGIN_DB_VERSION', '0.0.8'); +define('GLM_MEMBERS_REGISTRATIONS_PLUGIN_DB_VERSION', '0.0.9'); // This is the minimum version of the GLM Members DB plugin require for this plugin. define('GLM_MEMBERS_REGISTRATIONS_PLUGIN_MIN_MEMBERS_REQUIRED_VERSION', '2.8.0'); diff --git a/models/admin/registrations/event.php b/models/admin/registrations/event.php index 6363b18..4d43dfe 100644 --- a/models/admin/registrations/event.php +++ b/models/admin/registrations/event.php @@ -88,9 +88,6 @@ class GlmMembersAdmin_registrations_event extends GlmDataRegistrationsRegEvent public function modelAction($actionData = false) { -// Un-comment to generate a sample set of reg event data -include GLM_MEMBERS_REGISTRATIONS_PLUGIN_PATH . '/data/event_setup.php'; - $option = 'list'; $template = 'list.html'; $regEvent = false; @@ -237,7 +234,7 @@ include GLM_MEMBERS_REGISTRATIONS_PLUGIN_PATH . '/data/event_setup.php'; if ($regEventID) { $this->postProcAddedEventData = true; - $regEvent = $this->getEventConfig($regEventID, true, true); + $regEvent = $this->getEventConfig($regEventID, true, true, true); if ($regEvent) { $haveRegEvent = true; } @@ -270,6 +267,8 @@ include GLM_MEMBERS_REGISTRATIONS_PLUGIN_PATH . '/data/event_setup.php'; 'regEventAdded' => $regEventAdded , 'reason' => $reason ); + + // echo "
".print_r($templateData,1)."
"; // Return status, any suggested view, and any data to controller return array( diff --git a/setup/databaseScripts/create_database_V0.0.8.sql b/setup/databaseScripts/create_database_V0.0.9.sql similarity index 99% rename from setup/databaseScripts/create_database_V0.0.8.sql rename to setup/databaseScripts/create_database_V0.0.9.sql index 29ec947..5f0f1ad 100644 --- a/setup/databaseScripts/create_database_V0.0.8.sql +++ b/setup/databaseScripts/create_database_V0.0.9.sql @@ -307,6 +307,7 @@ CREATE TABLE {prefix}reg_event ( notify_email TINYTEXT NULL, -- E-Mail addresses to recieve notification of a registration other than org_internal_email in management, comma separated admin_active BOOLEAN NULL, -- Active flag for admin from Events - If logged in Admin user for this event and this is true then admin user may enter registrations even if active is off. active BOOLEAN NULL, -- Active flag to indicate that this event is available for registrations + time_specific BOOLEAN NULL, -- Registration for this event is not date/time specific. Can attend any date/time of event. attendees BOOLEAN NULL, -- Registration requires attendees - Otherwise the person submitting the registration is the registrant attendee_max MEDIUMINT NULL, -- Attendee limit - 0 = unlimited attendee_max_per_reg TINYINT NULL, -- Maximum attendees per registration submission - 0 = unlimited diff --git a/setup/databaseScripts/dbVersions.php b/setup/databaseScripts/dbVersions.php index f454c41..454a380 100644 --- a/setup/databaseScripts/dbVersions.php +++ b/setup/databaseScripts/dbVersions.php @@ -21,7 +21,8 @@ $glmMembersRegistrationsDbVersions = array( '0.0.5' => array('version' => '0.0.5', 'tables' => 18, 'date' => '04/04/2017'), '0.0.6' => array('version' => '0.0.6', 'tables' => 19, 'date' => '04/06/2017'), '0.0.7' => array('version' => '0.0.7', 'tables' => 19, 'date' => '04/07/2017'), - '0.0.8' => array('version' => '0.0.8', 'tables' => 19, 'date' => '04/18/2017') + '0.0.8' => array('version' => '0.0.8', 'tables' => 19, 'date' => '04/18/2017'), + '0.0.9' => array('version' => '0.0.9', 'tables' => 19, 'date' => '04/24/2017') ); diff --git a/setup/databaseScripts/drop_database_V0.0.8.sql b/setup/databaseScripts/drop_database_V0.0.9.sql similarity index 100% rename from setup/databaseScripts/drop_database_V0.0.8.sql rename to setup/databaseScripts/drop_database_V0.0.9.sql diff --git a/setup/databaseScripts/update_database_V0.0.9.sql b/setup/databaseScripts/update_database_V0.0.9.sql new file mode 100644 index 0000000..54e7772 --- /dev/null +++ b/setup/databaseScripts/update_database_V0.0.9.sql @@ -0,0 +1,10 @@ +-- Gaslight Media Members Database - Registratiuons Add-On +-- File Created: 08/24/17 09:47:15 +-- Database Version: 0.0.9 +-- Database Update From Previous Version Script +-- +-- To permit each query below to be executed separately, +-- all queries must be separated by a line with four dashes + +ALTER TABLE {prefix}reg_event ADD COLUMN time_specific BOOLEAN; + diff --git a/views/admin/registrations/event.html b/views/admin/registrations/event.html index 70dded7..058c1df 100644 --- a/views/admin/registrations/event.html +++ b/views/admin/registrations/event.html @@ -19,6 +19,16 @@ +
+
+
+

Earliest Registration Date:

+
+
+ {$regEvent.earliest_registration} +
+
+
diff --git a/views/admin/registrations/eventEdit.html b/views/admin/registrations/eventEdit.html index c827a6c..bd9bab0 100644 --- a/views/admin/registrations/eventEdit.html +++ b/views/admin/registrations/eventEdit.html @@ -55,6 +55,14 @@ {if $regEvent.fieldFail.admin_active}

{$regEvent.fieldFail.admin_active}

{/if}
+ + Date/Time Specific Registrations + + + Check this box for events where registrations are for specific dates and times. + {if $regEvent.fieldFail.time_specific}

{$regEvent.fieldFail.time_specific}

{/if}
+ + Registrations Active -- 2.17.1