From f9867f8d62e59e18ea79990e1a35bc0b1f2f71ea Mon Sep 17 00:00:00 2001 From: Laury GvR Date: Thu, 2 Mar 2017 10:26:35 -0500 Subject: [PATCH] Data class for request rate & registrant, DB update Minor DB update, changing a float to a tinyint. Also added data classes for the data request rate and request registrant tables. --- classes/data/dataRegRequestRate.php | 122 +++++++++++++++++- classes/data/dataRegRequestRegistrant.php | 103 ++++++++++++++- index.php | 2 +- ..._V0.0.1.sql => create_database_V0.0.3.sql} | 4 +- setup/databaseScripts/dbVersions.php | 3 +- .../update_database_V0.0.3.sql | 11 ++ 6 files changed, 239 insertions(+), 6 deletions(-) rename setup/databaseScripts/{create_database_V0.0.1.sql => create_database_V0.0.3.sql} (99%) create mode 100644 setup/databaseScripts/update_database_V0.0.3.sql diff --git a/classes/data/dataRegRequestRate.php b/classes/data/dataRegRequestRate.php index 04348d4..dcfbc81 100644 --- a/classes/data/dataRegRequestRate.php +++ b/classes/data/dataRegRequestRate.php @@ -107,7 +107,127 @@ class GlmDataRegistrationsAddedInfoFields extends GlmDataAbstract */ $this->fields = array ( - + + + // ID + 'id' => array ( + 'field' => 'id', + 'type' => 'integer', + 'view_only' => true, + 'use' => 'a' + ), + + // Pointer to account (person submitting the registration) + 'account' => array ( + 'field' => 'contact_id', + 'type' => 'pointer', + 'p_table' => GLM_MEMBERS_REGISTRATIONS_PLUGIN_DB_PREFIX . 'account', + 'p_field' => 'id', + 'p_static' => true, + 'required' => true, + 'use' => 'lgneud' + ), + + // Pointer to reg_event entry + 'event' => array ( + 'field' => 'event', + 'type' => 'pointer', + 'p_table' => GLM_MEMBERS_REGISTRATIONS_PLUGIN_DB_PREFIX . 'reg_event', + 'p_field' => 'id', + 'p_static' => true, + 'required' => true, + 'use' => 'lgneud' + ), + + // Pointer to event_times table entry in Events add-on - To help with registrant searches + 'event_time' => array ( + 'field' => 'event_time', + 'type' => 'pointer', + 'p_table' => GLM_MEMBERS_EVENTS_PLUGIN_DB_PREFIX . 'event_times', + 'p_field' => 'id', + 'p_static' => true, + 'required' => true, + 'use' => 'lgneud' + ), + + // Pointer to reg_request_event table entry + 'reg_request_event' => array ( + 'field' => 'reg_request_event', + 'type' => 'pointer', + 'p_table' => GLM_MEMBERS_REGISTRATIONS_PLUGIN_DB_PREFIX . 'reg_request_event', + 'p_field' => 'id', + 'p_static' => true, + 'required' => true, + 'use' => 'lgneud' + ), + + // Pointer to reg_request_class table entry + 'reg_request_class' => array ( + 'field' => 'reg_request_class', + 'type' => 'pointer', + 'p_table' => GLM_MEMBERS_REGISTRATIONS_PLUGIN_DB_PREFIX . 'reg_request_class', + 'p_field' => 'id', + 'p_static' => true, + 'required' => true, + 'use' => 'lgneud' + ), + + // Base rate at time of registration + 'rate_base' => array ( + 'field' => 'rate_base', + 'type' => 'money', + 'required' => false, + 'use' => 'a' + ), + + // Per Registrant Rate at time of registration + 'per_registrant' => array ( + 'field' => 'per_registrant', + 'type' => 'money', + 'required' => false, + 'use' => 'a' + ), + + // Number of registrant credits in base rate at time of registration + 'registrant_credits' => array ( + 'field' => 'registrant_credits', + 'type' => 'integer', + 'required' => false, + 'use' => 'a' + ), + + // Last calculated number of registrants with this rate + 'numb_registrants' => array ( + 'field' => 'numb_registrants', + 'type' => 'integer', + 'required' => false, + 'use' => 'a' + ), + + // Per Registrant Rate at time of registration + 'total_registrant_charges' => array ( + 'field' => 'total_registrant_charges', + 'type' => 'money', + 'required' => false, + 'use' => 'a' + ), + + // Any MagicForm data associated with registrant + 'mf_data' => array ( + 'field' => 'mf_data', + 'type' => 'text', + 'required' => false, + 'use' => 'a' + ), + + // System operator's notes for this registration request + 'notes' => array ( + 'field' => 'notes', + 'type' => 'text', + 'required' => false, + 'use' => 'a' + ), + ); } diff --git a/classes/data/dataRegRequestRegistrant.php b/classes/data/dataRegRequestRegistrant.php index 6ab913b..a8561fd 100644 --- a/classes/data/dataRegRequestRegistrant.php +++ b/classes/data/dataRegRequestRegistrant.php @@ -107,7 +107,108 @@ class GlmDataRegistrationsAddedInfoFields extends GlmDataAbstract */ $this->fields = array ( - + + // ID + 'id' => array ( + 'field' => 'id', + 'type' => 'integer', + 'view_only' => true, + 'use' => 'a' + ), + + // Pointer to account for person submitting the registration + 'account' => array ( + 'field' => 'contact_id', + 'type' => 'pointer', + 'p_table' => GLM_MEMBERS_REGISTRATIONS_PLUGIN_DB_PREFIX . 'account', + 'p_field' => 'id', + 'p_static' => true, + 'required' => true, + 'use' => 'lgneud' + ), + + // Pointer to reg_event entry + 'event' => array ( + 'field' => 'event', + 'type' => 'pointer', + 'p_table' => GLM_MEMBERS_REGISTRATIONS_PLUGIN_DB_PREFIX . 'reg_event', + 'p_field' => 'id', + 'p_static' => true, + 'required' => true, + 'use' => 'lgneud' + ), + + // Pointer to event_times table entry in Events add-on - To help with registrant searches + 'event_time' => array ( + 'field' => 'event_time', + 'type' => 'pointer', + 'p_table' => GLM_MEMBERS_EVENTS_PLUGIN_DB_PREFIX . 'event_times', + 'p_field' => 'id', + 'p_static' => true, + 'required' => true, + 'use' => 'lgneud' + ), + + // Pointer to reg_request_event table entry + 'reg_request_event' => array ( + 'field' => 'reg_request_event', + 'type' => 'pointer', + 'p_table' => GLM_MEMBERS_REGISTRATIONS_PLUGIN_DB_PREFIX . 'reg_request_event', + 'p_field' => 'id', + 'p_static' => true, + 'required' => true, + 'use' => 'lgneud' + ), + + // Pointer to reg_request_class table entry + 'reg_request_class' => array ( + 'field' => 'reg_request_class', + 'type' => 'pointer', + 'p_table' => GLM_MEMBERS_REGISTRATIONS_PLUGIN_DB_PREFIX . 'reg_request_class', + 'p_field' => 'id', + 'p_static' => true, + 'required' => true, + 'use' => 'lgneud' + ), + + // Pointer to reg_request_rate table entry + 'reg_request_rate' => array ( + 'field' => 'reg_request_rate', + 'type' => 'pointer', + 'p_table' => GLM_MEMBERS_REGISTRATIONS_PLUGIN_DB_PREFIX . 'reg_request_rate', + 'p_field' => 'id', + 'p_static' => true, + 'required' => true, + 'use' => 'lgneud' + ), + + // Pointer to account for registrant (person attending) - Not needed if registrants are off for the event + 'reg_request_registrant' => array ( + 'field' => 'reg_request_registrant', + 'type' => 'pointer', + 'p_table' => GLM_MEMBERS_REGISTRATIONS_PLUGIN_DB_PREFIX . 'reg_request_registrant', + 'p_field' => 'id', + 'p_static' => true, + 'required' => true, + 'use' => 'lgneud' + ), + + // Any MagicForm data associated with registrant + 'mf_data' => array ( + 'field' => 'mf_data', + 'type' => 'text', + 'required' => false, + 'use' => 'a' + ), + + // System operator's notes for this registration request + 'notes' => array ( + 'field' => 'notes', + 'type' => 'text', + 'required' => false, + 'use' => 'a' + ), + ); } diff --git a/index.php b/index.php index 25e2ffe..6634acb 100644 --- a/index.php +++ b/index.php @@ -38,7 +38,7 @@ * version from this plugin. */ define('GLM_MEMBERS_REGISTRATIONS_PLUGIN_VERSION', '0.0.1'); -define('GLM_MEMBERS_REGISTRATIONS_PLUGIN_DB_VERSION', '0.0.2'); +define('GLM_MEMBERS_REGISTRATIONS_PLUGIN_DB_VERSION', '0.0.3'); // 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/setup/databaseScripts/create_database_V0.0.1.sql b/setup/databaseScripts/create_database_V0.0.3.sql similarity index 99% rename from setup/databaseScripts/create_database_V0.0.1.sql rename to setup/databaseScripts/create_database_V0.0.3.sql index ff21806..d5636c5 100644 --- a/setup/databaseScripts/create_database_V0.0.1.sql +++ b/setup/databaseScripts/create_database_V0.0.3.sql @@ -1,6 +1,6 @@ -- Gaslight Media Registration Database -- File Created: 01/18/2017 14:40:00 --- Database Version: 0.0.1 +-- Database Version: 0.0.3 -- Database Creation Script -- -- To permit each query below to be executed separately, @@ -518,7 +518,7 @@ CREATE TABLE {prefix}reg_request_rate ( rate_base FLOAT, -- Base rate at time of registration per_registrant FLOAT, -- Per Registrant Rate at time of registration registrant_credits TINYINT NULL, -- Number of registrant credits in base rate at time of registration - numb_registrants FLOAT, -- Last calculated number of registrants with this rate + numb_registrants TINYINT NULL, -- Last calculated number of registrants with this rate total_registrant_charges FLOAT, -- Last calculation registrant charges assoicated with this selected rate mf_data TEXT NULL, -- Any MagicForm data associated with registrant notes TEXT NULL, -- System operator's notes for this registration request diff --git a/setup/databaseScripts/dbVersions.php b/setup/databaseScripts/dbVersions.php index aa7f7a2..602f2a3 100644 --- a/setup/databaseScripts/dbVersions.php +++ b/setup/databaseScripts/dbVersions.php @@ -15,7 +15,8 @@ $glmMembersRegistrationsDbVersions = array( '0.0.1' => array('version' => '0.0.1', 'tables' => 18, 'date' => '02/6/2017'), - '0.0.2' => array('version' => '0.0.2', 'tables' => 18, 'date' => '02/17/2017') + '0.0.2' => array('version' => '0.0.2', 'tables' => 18, 'date' => '02/17/2017'), + '0.0.3' => array('version' => '0.0.3', 'tables' => 18, 'date' => '03/2/2017') ); diff --git a/setup/databaseScripts/update_database_V0.0.3.sql b/setup/databaseScripts/update_database_V0.0.3.sql new file mode 100644 index 0000000..00c832b --- /dev/null +++ b/setup/databaseScripts/update_database_V0.0.3.sql @@ -0,0 +1,11 @@ +-- Gaslight Media Members Database - Events Add-On +-- File Created: 3/01/17 10:01:16 +-- Database Version: 0.0.3 +-- 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 dashses + + +-- Change size of integer for bitmapped field. +ALTER TABLE {prefix}management MODIFY numb_registrants TINYINT; -- 2.17.1