From 9945ddc166e1a0d212d85be85e29f91b6111fc89 Mon Sep 17 00:00:00 2001 From: Chuck Scott Date: Thu, 6 Apr 2017 16:45:24 -0400 Subject: [PATCH] Added Reg Time table --- classes/data/dataRegTime.php | 246 ++++++++++++++++++ .../create_database_V0.0.6.sql | 4 +- .../update_database_V0.0.6.sql | 4 +- 3 files changed, 252 insertions(+), 2 deletions(-) create mode 100644 classes/data/dataRegTime.php diff --git a/classes/data/dataRegTime.php b/classes/data/dataRegTime.php new file mode 100644 index 0000000..43cd0f3 --- /dev/null +++ b/classes/data/dataRegTime.php @@ -0,0 +1,246 @@ + + * @license http://www.gaslightmedia.com Gaslightmedia + * @release SVN: $Id: dataRegTime.php,v 1.0 2011/01/25 19:31:47 cscott Exp $ + */ + +/** + * GlmDataRegistrationsRegTime class + * + * PHP version 5 + * + * @category Data + * @package GLM Member DB + * @author Chuck Scott + * @license http://www.gaslightmedia.com Gaslightmedia + * @release SVN: $Id: dataRegTime.php,v 1.0 2011/01/25 19:31:47 cscott + * Exp $ + */ +class GlmDataRegistrationsRegTime extends GlmDataAbstract +{ + + /** + * WordPress Database Object + * + * @var $wpdb + * @access public + */ + public $wpdb; + /** + * Plugin Configuration Data + * + * @var $config + * @access public + */ + public $config; + /** + * Data Table Name + * + * @var $table + * @access public + */ + public $table; + /** + * Field definitions + * + * 'type' is type of field as defined by the application + * text Regular text field + * pointer Pointer to an entry in another table + * 'filters' is the filter name for a particular filter ID in PHP filter + * functions + * See PHP filter_id() + * + * 'use' is when to use the field + * l = List + * g = Get + * n = New + * i = Insert + * e = Edit + * u = Update + * d = Delete + * a = All + * + * @var $ini + * @access public + */ + public $fields = false; + + /** + * Constructor + * + * @param object $d database connection + * @param array $config Configuration array + * @param bool $limitedEdit Flag to say indicate limited edit requested + * + * @return void + * @access public + */ + public function __construct($wpdb, $config, $limitedEdit = false) + { + + // If this class is not being extended along with existing $wpdb and $config + if (!$this->wpdb) { + + // Save WordPress Database object + $this->wpdb = $wpdb; + + // Save plugin configuration object + $this->config = $config; + + } + + /* + * Table Name + */ + $this->table = GLM_MEMBERS_REGISTRATIONS_PLUGIN_DB_PREFIX . 'reg_event'; + + /* + * Table Data Fields + */ + + $this->fields = array ( + + // ID + 'id' => array ( + 'field' => 'id', + 'type' => 'integer', + 'view_only' => true, + 'use' => 'a' + ), + + // Pointer to event in Events add-on + 'event' => array ( + 'field' => 'event', + 'type' => 'integer', + 'required' => true, + 'use' => 'lgneud' + ), + + // Pointer to event times table entries in Events add-on + 'event_time' => array ( + 'field' => 'event_time', + 'type' => 'integer', + 'required' => true, + 'use' => 'lgneud' + ), + + // Starting date and time for this event - This data comes from the events plug-in tables + 'start_datetime' => array ( + 'field' => 'start_datetime', + 'type' => 'datetime', + 'use' => 'lgneud' + ), + + // Ending date and time for this event - This data comes from the events plug-in tables + 'end_datetime' => array ( + 'field' => 'end_datetime', + 'type' => 'datetime', + 'use' => 'lgneud' + ), + + // All day flag - This data comes from the events plug-in tables + 'all_day' => array ( + 'field' => 'all_day', + 'type' => 'checkbox', + 'use' => 'lgneud' + ), + + // Track Attendees for this event - This data comes from the events plug-in tables + 'attendees' => array ( + 'field' => 'attendees', + 'type' => 'checkbox', + 'use' => 'lgneud' + ), + + // Maximum number of attendees + 'attendee_max' => array ( + 'field' => 'attendee_max', + 'type' => 'integer', + 'use' => 'lgneud' + ), + + // Current attendee count - Calculated on the fly at times + 'attendee_count' => array ( + 'field' => 'attendee_count', + 'type' => 'integer', + 'use' => 'lgneud' + ), + + // Current number of attendees for this time in active pending carts (not processed) + 'attendees_pending' => array ( + 'field' => 'attendees_pending', + 'type' => 'integer', + 'use' => 'lgneud' + ), + + // Currently available attendee count + 'attendees_available' => array ( + 'field' => 'attendees_available', + 'type' => 'integer', + 'use' => 'lgneud' + ), + + // Total base charges + 'total_base_charge' => array ( + 'field' => 'total_base_charge', + 'type' => 'money', + 'use' => 'lgneud' + ), + + // Total per-attendee charges + 'total_per_attendee' => array ( + 'field' => 'total_per_attendee', + 'type' => 'money', + 'use' => 'lgneud' + ), + + // Total other charges (meals, extras, fees, ...) + 'total_other' => array ( + 'field' => 'total_other', + 'type' => 'money', + 'use' => 'lgneud' + ), + + // Total taxes charged + 'total_taxes' => array ( + 'field' => 'total_taxes', + 'type' => 'money', + 'use' => 'lgneud' + ), + + // Total charges (sum of all above) + 'total_charges' => array ( + 'field' => 'total_charges', + 'type' => 'money', + 'use' => 'lgneud' + ), + + // Total discounts of all types (applied payment codes, etc...) + 'total_discounts' => array ( + 'field' => 'total_discounts', + 'type' => 'money', + 'use' => 'lgneud' + ), + + // Total net payments (total charges - total discounts) + 'total_payments' => array ( + 'field' => 'total_payments', + 'type' => 'money', + 'use' => 'lgneud' + ) + + ); + + } + +} + +?> \ No newline at end of file diff --git a/setup/databaseScripts/create_database_V0.0.6.sql b/setup/databaseScripts/create_database_V0.0.6.sql index 5a9b410..6bd7fdd 100644 --- a/setup/databaseScripts/create_database_V0.0.6.sql +++ b/setup/databaseScripts/create_database_V0.0.6.sql @@ -350,7 +350,9 @@ CREATE TABLE {prefix}reg_time ( total_discounts DOUBLE NULL, -- Total discounts of all types (applied payment codes, etc...) total_payments DOUBLE NULL, -- Total net payments (total charges - total discounts) PRIMARY KEY (id), - INDEX (reg_event) + INDEX (reg_event), + INDEX (event_time), + INDEX (start_datetime) ); ---- diff --git a/setup/databaseScripts/update_database_V0.0.6.sql b/setup/databaseScripts/update_database_V0.0.6.sql index 4bb12c6..7a3c2d3 100644 --- a/setup/databaseScripts/update_database_V0.0.6.sql +++ b/setup/databaseScripts/update_database_V0.0.6.sql @@ -29,7 +29,9 @@ CREATE TABLE {prefix}reg_time ( total_discounts DOUBLE NULL, -- Total discounts of all types (applied payment codes, etc...) total_payments DOUBLE NULL, -- Total net payments (total charges - total discounts) PRIMARY KEY (id), - INDEX (reg_event) + INDEX (reg_event), + INDEX (event_time), + INDEX (start_datetime) ); ---- -- 2.17.1