From: Chuck Scott Date: Tue, 3 Oct 2017 20:51:56 +0000 (-0400) Subject: Updated database to version 0.0.13 to get rid of some old fields. X-Git-Tag: v1.0.0^2~375 X-Git-Url: http://cvs2.gaslightmedia.com/gitweb/index.cgi?a=commitdiff_plain;h=7c8150521b5ff63816ee0f493f63ab2b9d2eb75e;p=WP-Plugins%2Fglm-member-db-registrations.git Updated database to version 0.0.13 to get rid of some old fields. Removed those fields from the related data classes. Added information on available dates and times to the registration page on the front-end. Now need to put in pop-up calendar for date selection for time_specific registrations. Added functions to purge expired reg_time_pending entries and to update the quantities in the reg_time table. Improved display of reg times in the event dashboard in admin. --- diff --git a/classes/data/dataRegEvent.php b/classes/data/dataRegEvent.php index 77cf050..3c86c00 100644 --- a/classes/data/dataRegEvent.php +++ b/classes/data/dataRegEvent.php @@ -74,12 +74,12 @@ class GlmDataRegistrationsRegEvent extends GlmDataAbstract public $fields = false; /** * Flag to post process results and add current Event data to each result - * + * * @var $postProcAddedEventData * @access public */ public $postProcAddedEventData = false; - + /** * Constructor @@ -179,7 +179,7 @@ class GlmDataRegistrationsRegEvent extends GlmDataAbstract 'use' => 'a', 'default' => 1 ), - + // Registration requires attendees - Otherwise the person submitting the registration is the registrant 'attendees' => array ( 'field' => 'attendees', @@ -264,7 +264,7 @@ class GlmDataRegistrationsRegEvent extends GlmDataAbstract 'required' => false, 'use' => 'a' ), - + // Name of a downloadable file 'reg_file' => array ( 'field' => 'reg_file', @@ -298,7 +298,7 @@ class GlmDataRegistrationsRegEvent extends GlmDataAbstract ), ); - + } /** @@ -314,13 +314,13 @@ class GlmDataRegistrationsRegEvent extends GlmDataAbstract */ public function entryPostProcessing( $result_data, $action ) { - + // If $postProcAddedEventData option set if ($this->postProcAddedEventData) { - - // If doing the following actions + + // If doing the following actions if (in_array($action, array('l','g'))) { - + // Use hook to Events to get current data for this event $eventData = apply_filters('glm-member-db-events-get-event', $result_data['event']); @@ -332,14 +332,14 @@ class GlmDataRegistrationsRegEvent extends GlmDataAbstract $result_data['contact_email'] = $eventData['contact_email']; $result_data['contact_phone'] = $eventData['contact_phone']; $result_data['url'] = $eventData['url']; - + } - + } - + return $result_data; } - + /* * Get Alpha list of first characters in event name * @@ -351,7 +351,7 @@ class GlmDataRegistrationsRegEvent extends GlmDataAbstract */ public function getAlphaList($where = '', $selected = '') { - + $sql = " SELECT DISTINCT LEFT(T.event_name, 1) AS alpha FROM ".GLM_MEMBERS_REGISTRATIONS_PLUGIN_DB_PREFIX. "reg_event T @@ -360,16 +360,16 @@ class GlmDataRegistrationsRegEvent extends GlmDataAbstract ORDER BY alpha ;"; $alphaData = $this->wpdb->get_results($sql, ARRAY_A); - + // Set selected foreach ($alphaData as $k=>$v) { $alphaData[$k]['default'] = ($v['alpha'] == $selected); } - + return $alphaData; - + } - + /* * Get a simple reg event list - Event Name and ID only * @@ -379,8 +379,8 @@ class GlmDataRegistrationsRegEvent extends GlmDataAbstract * @param string $idField ID field to use * @param integer $start Starting at result # * @param integer $limit Limit results to this number - * @param boolean $extended Add current base data for returned events - * + * @param boolean $extended Add current base data for returned events + * * @return array Array of Name and ID for all reg events * @access public */ @@ -389,34 +389,34 @@ class GlmDataRegistrationsRegEvent extends GlmDataAbstract // Save status of extended data flag $saveExtended = $this->postProcAddedEventData; - + // If extended data is requested, then set flag for post processing if ($extended) { $this->postProcAddedEventData = true; } - + // Save the current fields array and make a copy $fSave = $this->fields; - + // Remove what we don't want from the copy and get the list $this->fields = array( 'id' => $fSave['id'], 'event' => $fSave['event'], 'event_name' => $fSave['event_name'] ); - + $regEventsList = $this->getList($where, $order, $fieldVals, $idField, $start, $limit); - + // Restore the fields list $this->fields = $fSave; - + // Restore status of extended data flag $this->postProcAddedEventData = $saveExtended; - - + + return $regEventsList; } - + /** * Get ID/Event Name list * @@ -427,22 +427,22 @@ class GlmDataRegistrationsRegEvent extends GlmDataAbstract public function getIdRegEvent($where = 'true') { $savedFields = $this->fields; - + $this->fields = array( 'id' => $savedFields['id'], 'event_name' => $savedFields['event_name'] ); - + $r = $this->getList($where); - + $this->fields = $savedFields; - + return $r; - + } - + /** - * Get all event configuration data for a specific event + * 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 @@ -454,10 +454,10 @@ class GlmDataRegistrationsRegEvent extends GlmDataAbstract */ public function getEventConfig($id = false, $extended = false, $forEdit = false, $withRecurData = false) { - + // Save status of extended data flag $saveExtended = $this->postProcAddedEventData; - + // If extended data is requested, then set flag for post processing if ($extended) { $this->postProcAddedEventData = true; @@ -465,7 +465,7 @@ class GlmDataRegistrationsRegEvent extends GlmDataAbstract // Try to get the base information - and extended data from the Event add-on if requested if ($id > 0) { - $eventData = $this->getEntry($id, 'id', ' TRUE ', $forEdit); + $eventData = $this->getEntry($id, 'id', ' TRUE ', $forEdit); if (!$eventData) { return false; } @@ -474,16 +474,22 @@ class GlmDataRegistrationsRegEvent extends GlmDataAbstract // Get all reg_time records for this event require_once GLM_MEMBERS_REGISTRATIONS_PLUGIN_CLASS_PATH.'/data/dataRegTime.php'; $RegTime = new GlmDataRegistrationsRegTime($this->wpdb, $this->config); - $eventData['reg_time'] = $RegTime->getList('T.reg_event = '.$eventData['id'], 'start_datetime', true); - + // If this is a time specific event, then get all times except any default entry that might be there from the event having been a non-time_specific event + if ($eventData['time_specific']['value']) { + $eventData['reg_time'] = $RegTime->getList('T.reg_event = '.$eventData['id'].' AND T.event_time > 0', 'start_datetime', true); + // Otherwise if this is a non-time_specific event, we only want the default entry + } else { + $eventData['reg_time'] = $RegTime->getList('T.reg_event = '.$eventData['id'].' AND T.event_time = 0', 'start_datetime', true); + } + // Get all reg_class records for this event require_once GLM_MEMBERS_REGISTRATIONS_PLUGIN_CLASS_PATH.'/data/dataRegClass.php'; - $RegTime = new GlmDataRegistrationsRegClass($this->wpdb, $this->config); - $eventData['reg_class'] = $RegTime->getList("T.reg_event = ".$eventData['id'], 'name', true); - + $RegClass = new GlmDataRegistrationsRegClass($this->wpdb, $this->config); + $eventData['reg_class'] = $RegClass->getList("T.reg_event = ".$eventData['id'], 'name', true); + // If we have any reg_class results if ($eventData['reg_class']) { - + // Get all reg_rate records for this reg_class require_once GLM_MEMBERS_REGISTRATIONS_PLUGIN_CLASS_PATH.'/data/dataRegRate.php'; $RegRate = new GlmDataRegistrationsRegRate($this->wpdb, $this->config); @@ -492,22 +498,21 @@ 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']); - } - + + // If recurrence data is requested and registration for this event is date/time specific - Get recurrence and times data + $eventData['recurrences'] = array(); + $eventData['recurrences'] = apply_filters('glm-member-db-events-get-event-times', $eventData['event']); + // Restore status of extended data flag $this->postProcAddedEventData = $saveExtended; return $eventData; - + } - - - - + + + + } ?> \ No newline at end of file diff --git a/classes/data/dataRegRequestClass.php b/classes/data/dataRegRequestClass.php index cd12676..148a33c 100644 --- a/classes/data/dataRegRequestClass.php +++ b/classes/data/dataRegRequestClass.php @@ -132,14 +132,6 @@ class GlmDataRegistrationsRequestClass extends GlmDataAbstract 'use' => 'lgneud' ), - // Pointer reg_time entry - 'reg_time' => array ( - 'field' => 'reg_time', - 'type' => 'integer', - 'required' => true, - 'use' => 'lgneud' - ), - // Selected Start Time 'event_datetime' => array ( 'field' => 'event_datetime', diff --git a/classes/data/dataRegRequestEvent.php b/classes/data/dataRegRequestEvent.php index 4b41b1b..ffcaa06 100644 --- a/classes/data/dataRegRequestEvent.php +++ b/classes/data/dataRegRequestEvent.php @@ -140,14 +140,6 @@ class GlmDataRegistrationsRequestEvent extends GlmDataAbstract 'use' => 'lgneud' ), - // Pointer reg_time entry - 'reg_time' => array ( - 'field' => 'reg_time', - 'type' => 'integer', - 'required' => true, - 'use' => 'lgneud' - ), - // Selected Start Time 'event_datetime' => array ( 'field' => 'event_datetime', diff --git a/classes/data/dataRegRequestRate.php b/classes/data/dataRegRequestRate.php index 12b2c7b..372080c 100644 --- a/classes/data/dataRegRequestRate.php +++ b/classes/data/dataRegRequestRate.php @@ -133,14 +133,6 @@ class GlmDataRegistrationsRegRequestRate extends GlmDataAbstract 'use' => 'lgneud' ), - // Pointer reg_time entry - 'reg_time' => array ( - 'field' => 'reg_time', - 'type' => 'integer', - 'required' => true, - 'use' => 'lgneud' - ), - // Selected Start Time 'event_datetime' => array ( 'field' => 'event_datetime', diff --git a/classes/regCartSupport.php b/classes/regCartSupport.php index 4f0fc21..3ec5a59 100644 --- a/classes/regCartSupport.php +++ b/classes/regCartSupport.php @@ -284,6 +284,10 @@ class GlmRegCartSupport return false; } + // First purge any expired pending registration holds + $this->purgeOldRegTimePending(); + + // Instantiate the classes we'll need $RegEvent = new GlmDataRegistrationsRegEvent($this->wpdb, $this->config); $RegTime = new GlmDataRegistrationsRegTime($this->wpdb, $this->config); $RegRequest = new GlmDataRegistrationsRegRequest($this->wpdb, $this->config); @@ -376,6 +380,7 @@ class GlmRegCartSupport // Do rate Checks + // Update reg_time entries for current availability // Check if listed rate is currently available - If not, add as a problem /* @@ -579,4 +584,123 @@ class GlmRegCartSupport } + /* + * Purge old reg_time_pending entries + * + * This function removes any expired reg_time_pending records and removes the counts from the attendees_pending field for + * the referenced reg_time table entry. + * + * This should be run before doing cart validation and in the back-end before displaying any availability numbers. + * + * @access public + */ + public function purgeOldRegTimePending() + { + + $purged = 0; + + // Get all expired + $exp = $this->wpdb->get_results(" + SELECT * + FROM ".GLM_MEMBERS_REGISTRATIONS_PLUGIN_DB_PREFIX."reg_time_pending + WHERE expire_time < NOW() + ;", ARRAY_A); + + foreach ($exp as $e) { + $res = $this->updateTimeEntryCounts($e['reg_time'], -1); + if ($res['success']) { + $this->wpdb->delete( + GLM_MEMBERS_REGISTRATIONS_PLUGIN_DB_PREFIX."reg_time_pending", + array('id', $e['id']) + ); + $purged++; + } else { + trigger_error('purgeOldRegTimePending() errors: '.$res['error'], E_USER_WARNING); + } + } + + trigger_error('purgeOldRegTimePending() pending entries purged: '.$purged, E_USER_NOTICE); + + return; + + } + + /* + * Update inventory for a reg_time entry + * + * This function can adjust the total confirmed attendee and pending attendee counts. + * It will then adjust the attendees available value accordingly and check for invalid values (such as + * availability that exceeds the max value or that is less than 0. + * + * To return counts (reduce) use a negative number. To consume counts use positive. + * + * @param integer $pending Number used to decrement the pending value + * @param integer $count Number used to decrement the attendee_count value (for removing a confirmed registrant) + * + * @return array('success' boolean, 'error' string) + * @access public + */ + public function updateTimeEntryCounts($timeId = false, $pending = 0, $counts = 0) + { + + $res = array( + 'success' => true, + 'error' => '' + ); + + // Get current time data + $time = $this->wpdb->get_results(" + SELECT attendee_max, attendee_count, attendee_pending, attendee_available + FROM ".GLM_MEMBERS_REGISTRATIONS_PLUGIN_DB_PREFIX."reg_time + WHERE id = $timeId + ;", ARRAY_A); + if (!$time) { + $res['success'] = false; + $res['error'] .= 'Invalid time entry ID or unable to retrieve. '; + } + + // Adjust balances + $time['attendee_count'] += $counts; + $time['attendees_pending'] += $pending; + $time['attendess_available'] = $time['attendee_max'] - ($time['attendee_count']+$time['attendees_pending']); + + // Do sanity check on results + if ($time['attendees_pending'] < 0 || $time['attendees_pending'] > ($time['attendee_max']-$time['attendee_count'])) { + $res['success'] = false; + $res['error'] .= 'Result has invalid pending attendees count.'; + } + if ($time['attendee_count'] < 0 || $time['attendee_count'] > ($time['attendee_max'])) { + $res['success'] = false; + $res['error'] .= 'Result has invalid confirmed attendee count.'; + } + + // If all is well, update time entry + if ($res['success']) { + + $updated = $this->wpdb->update( + GLM_MEMBERS_REGISTRATIONS_PLUGIN_DB_PREFIX.'reg_time', + array( + 'attendee_count' => $time['attendee_count'], + 'attendees_pending' => $time['attendees_pending'], + 'attendess_available' => $time['attendess_available'] + ), + array( 'ID' => $timeId ), + array( + '%d', + '%d', + '%d' + ) + ); + + if (!$updated) { + $res['success'] = false; + $res['error'] .= 'Unable to store update.'; + } + } + + return $res; + + } + + } diff --git a/index.php b/index.php index d086fe0..43df332 100644 --- a/index.php +++ b/index.php @@ -44,10 +44,10 @@ 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.12'); +define('GLM_MEMBERS_REGISTRATIONS_PLUGIN_DB_VERSION', '0.0.13'); // 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'); +define('GLM_MEMBERS_REGISTRATIONS_PLUGIN_MIN_MEMBERS_REQUIRED_VERSION', '2.10.10'); // Check if plugin version is not current in WordPress option and if needed updated it if (GLM_MEMBERS_REGISTRATIONS_PLUGIN_VERSION != get_option('glmMembersRegistrationsPluginVersion')) { diff --git a/js/frontRegApp.js b/js/frontRegApp.js index ed6d4f2..caa7152 100644 --- a/js/frontRegApp.js +++ b/js/frontRegApp.js @@ -688,6 +688,7 @@ app.Views.Front.NewRegistrant = Backbone.View.extend({ }, initialize: function(){ +console.log(this); return this; }, diff --git a/models/admin/ajax/regFront/registrant.php b/models/admin/ajax/regFront/registrant.php index dfd6dcd..5a58b3c 100644 --- a/models/admin/ajax/regFront/registrant.php +++ b/models/admin/ajax/regFront/registrant.php @@ -98,6 +98,7 @@ class GlmMembersAdmin_registrations_ajax_registrant extends GlmDataRegistrations switch ( $option ) { case 'add': + // Check for or create reg_request_event if ( $modelData['reg_event'] ) { //return false; @@ -116,14 +117,12 @@ class GlmMembersAdmin_registrations_ajax_registrant extends GlmDataRegistrations 'reg_request' => $modelData['reg_request'], 'reg_event' => $modelData['reg_event'], 'event_name' => $modelData['event_name'], - 'reg_time' => $modelData['reg_time'], 'event_datetime' => $modelData['event_datetime'], ); $dataFormat = array( '%d', // reg_request '%d', // reg_event '%s', // event_name - '%d', // reg_time '%s', // event_datetime ); if ( !$regRequestEventId ) { @@ -142,6 +141,7 @@ class GlmMembersAdmin_registrations_ajax_registrant extends GlmDataRegistrations array( '%d' ) ); } + // Check for or create reg_request_class $regRequestClassId = $this->wpdb->get_var( $this->wpdb->prepare( @@ -158,7 +158,6 @@ class GlmMembersAdmin_registrations_ajax_registrant extends GlmDataRegistrations $data = array( 'reg_event' => $modelData['reg_event'], 'event_name' => $modelData['event_name'], - 'reg_time' => $modelData['reg_time'], 'event_datetime' => $modelData['event_datetime'], 'reg_request' => $modelData['reg_request'], 'reg_request_event' => $regRequestEventId, @@ -167,7 +166,6 @@ class GlmMembersAdmin_registrations_ajax_registrant extends GlmDataRegistrations $dataFormat = array( '%d', // reg_event '%s', // event_name - '%d', // reg_time '%s', // event_datetime '%d', // reg_request '%d', // reg_request_event @@ -189,6 +187,7 @@ class GlmMembersAdmin_registrations_ajax_registrant extends GlmDataRegistrations array( '%d' ) ); } + // Check for or create reg_request_rate $regRequestRate = $this->wpdb->get_var( $this->wpdb->prepare( @@ -215,7 +214,6 @@ class GlmMembersAdmin_registrations_ajax_registrant extends GlmDataRegistrations $data = array( 'reg_event' => $modelData['reg_event'], 'event_name' => $modelData['event_name'], - 'reg_time' => $modelData['reg_time'], 'event_datetime' => $modelData['event_datetime'], 'reg_request' => $modelData['reg_request'], 'reg_request_event' => $regRequestEventId, @@ -229,7 +227,6 @@ class GlmMembersAdmin_registrations_ajax_registrant extends GlmDataRegistrations $dataFormat = array( '%d', // reg_event '%s', // event_name - '%s', // reg_time '%s', // event_datetime '%d', // reg_request '%d', // reg_request_event @@ -301,6 +298,35 @@ class GlmMembersAdmin_registrations_ajax_registrant extends GlmDataRegistrations ) ); + /* + * Check for availability - If available then place a hold by creating a reg_time_pending entry + */ + // + + // Get availability from reg_time entry +/* + * *** NEED TO REVISIT THIS *** + * The reg_time table entry data should be passed to the front-end attendee selection and the ID of the + * selected reg_time entry is what should be used to get the current availability. + * The availability is sent to the registration page now so we can check against that before sending. + * This will also be cheked again in the cart anyway. + * + $regRequestRegistrantAvailble = $this->wpdb->get_var( + $this->wpdb->prepare( + "SELECT attendees_available + FROM " . GLM_MEMBERS_REGISTRATIONS_PLUGIN_DB_PREFIX . "reg_time + WHERE reg_event = %d + AND account = %d + AND reg_request_event = %d + AND reg_request_class = %d", + $modelData['reg_request'], + $accountId, + $regRequestEventId, + $regRequestClassId + ) + ); +*/ + $data = array( 'account' => $accountId, 'reg_event' => $modelData['reg_event'], diff --git a/models/admin/registrations/events.php b/models/admin/registrations/events.php index 67b1e56..eff017f 100644 --- a/models/admin/registrations/events.php +++ b/models/admin/registrations/events.php @@ -274,7 +274,7 @@ class GlmMembersAdmin_registrations_events extends GlmDataRegistrationsRegEvent } } -// echo "
".print_r($regEvent,1)."
"; + //echo "
".print_r($regEvent,1)."
"; $view = 'eventEdit'; @@ -299,58 +299,70 @@ class GlmMembersAdmin_registrations_events extends GlmDataRegistrationsRegEvent case 'eventDashboard': + $needTimesReloaded = false; + // If we have an event ID if ($regEventID) { - $regEvent = $this->getEntry($regEventID); + // Try to get the event configuration including recurrences and times + $this->postProcAddedEventData = true; + $regEvent = $this->getEventConfig($regEventID, true, false, true); + + // If we have the event data if ($regEvent) { $haveRegEvent = true; + $recurrenceSummary = array(); - // Try to get the event configuration including recurrences and times - $this->postProcAddedEventData = true; - $regEvent = $this->getEventConfig($regEventID, true, false, true); + // If we have recurrences for the event + if (is_array($regEvent['recurrences']) && count($regEvent['recurrences']) > 0) { - // If we have the event data - if ($regEvent) { + $haveRegEventRecurrences = true; - $haveRegEvent = true; + // For each recurrence + foreach ($regEvent['recurrences'] as $k=>$v) { - // If event is time_specific and we have recurrences for the event - if ($regEvent['time_specific']['value'] && is_array($regEvent['recurrences']) && count($regEvent['recurrences']) > 0) { + $regEvent['recurrences'][$k]['haveTimes'] = false; - $haveRegEventRecurrences = true; - - // For each recurrence - foreach ($regEvent['recurrences'] as $k=>$v) { + // If we have times for this recurrence + if ($v['times'] && count($v['times']) > 0) { $regEvent['recurrences'][$k]['haveTimes'] = false; + $haveRegEventTimes = true; - // If we have times for this recurrence - if ($v['times'] && count($v['times']) > 0) { + // Get the first event date/time + $first = current($v['times']); + $last = end($v['times']); + $regEvent['recurrences'][$k]['first_time'] = $first; + $regEvent['recurrences'][$k]['lastTime'] = $last; - $regEvent['recurrences'][$k]['haveTimes'] = false; - $haveRegEventTimes = true; + // Set event first and last times + if (!$regEventFirstTime || $regEventFirstTime['timestamp'] < $first ) { + $regEventFirstTime = $first; + } + if (!$regEventLastTime || $regEventLastTime['timestamp'] > $last ) { + $regEventLastTime = $last; + } - // Get the first event date/time - $first = current($v['times']); - $last = end($v['times']); - $regEvent['recurrences'][$k]['first_time'] = $first; - $regEvent['recurrences'][$k]['lastTime'] = $last; - - // Set event first and last times - if (!$regEventFirstTime || $regEventFirstTime['timestamp'] < $first ) { - $regEventFirstTime = $first; - } - if (!$regEventLastTime || $regEventLastTime['timestamp'] > $last ) { - $regEventLastTime = $last; - } + // If this is a time specific event + if ($regEvent['time_specific']['value']) { // Check all event times for matching reg event times foreach ($v['times'] as $tk=>$tv) { - // If time doesn't exist in reg_times - if (!isset($regEvent['reg_times'][$tk])) { + // Check if time already exists in reg_times array + reset($regEvent['reg_time']); + foreach($regEvent['reg_time'] as $rk=>$rv) { + if ($rv['event_time'] == $tk) { + $id = $rk; + break; + } + } + + // If it doesn't now, then add it + if (!$id) { + + $needTimesReloaded = true; $sTime = date('Y-m-d H:i:s',strtotime($tv['start_time']['datetime'])); $eTime = date('Y-m-d H:i:s',strtotime($tv['end_time']['datetime'])); @@ -359,7 +371,7 @@ class GlmMembersAdmin_registrations_events extends GlmDataRegistrationsRegEvent $this->wpdb->insert( GLM_MEMBERS_REGISTRATIONS_PLUGIN_DB_PREFIX."reg_time", array( - 'reg_event' => $regEvent['event'], + 'reg_event' => $regEvent['id'], 'event_time' => $tk, 'start_datetime' => $sTime, 'end_datetime' => $eTime, @@ -400,16 +412,117 @@ class GlmMembersAdmin_registrations_events extends GlmDataRegistrationsRegEvent } // If time isn't in reg_times } // each recurrence times - } // have times for recurrence - } // each recurrence - } // Time specific and have times - } // have event data - } // have reg event ID + } // time specific + } // have times for recurrence + + $recurrenceSummary[] = array( + 'firstTime' => $regEventFirstTime, + 'lastTime' => $regEventLastTime + ); + + } // each recurrence + + // Get rid of all of the recurrence data - No longer needed + unset($regEvent['recurrences']); + + // Add Recurrence summary to event data + $regEvent['recurrenceSummary'] = $recurrenceSummary; + + // If not time specific + if (!$regEvent['time_specific']['value']) { + + // Do we have default reg_time entry? (event_time is 0) + $defTime = false; + if (is_array($regEvent['reg_time'])) { + + // Is there's a default entry for not time specific event? (might be others if time_specific had been selected before - they might switch back) + $defTime = false; + foreach($regEvent['reg_time'] as $r) { + + if ($r['event_time'] == 0) { + $defTime = $r; + break; + } + } + + // Get rid of other time entries and just use this one + if ($defTime !== false) { + $regEvent['reg_time'] = array(); + $regEvent['reg_time'][0] = $defTime; + } + + } + + // If no default time, create one now. + if (!$defTime) { + + $this->wpdb->insert( + GLM_MEMBERS_REGISTRATIONS_PLUGIN_DB_PREFIX."reg_time", + array( + 'reg_event' => $regEvent['id'], + 'event_time' => 0, + 'start_datetime' => NULL, + 'end_datetime' => NULL, + 'all_day' => false, + 'attendees' => $regEvent['attendees']['value'], + 'attendee_max' => $regEvent['attendee_max'], + 'attendee_count' => 0, + 'attendees_pending' => 0, + 'attendees_available' => $regEvent['attendee_max'], + 'total_base_charge' => 0, + 'total_per_attendee' => 0, + 'total_other' => 0, + 'total_taxes' => 0, + 'total_charges' => 0, + 'total_discounts' => 0, + 'total_payments' => 0 + ), + array( + '%d', // reg_event + '%d', // event_time record ID + '%s', // start_datetime + '%s', // end_datetime + '%d', // all_day flag + '%d', // attendees flag + '%d', // attendee_max + '%d', // attendee_count + '%d', // attendees_pending + '%d', // attendees_available + '%f', // total_base__charge + '%f', // total_per_attendee + '%f', // total_other + '%f', // total_taxes + '%f', // total_charges + '%f', // total_discounts + '%f' // total_payments + ) + ); + + + } + + } // not time specific + + } else { // no recurrences + $reaon[] = 'Event has no recurrence data!'; + } + + } // have event data } else { $reason = 'Unable to load registration event data or registration event not selected.'; } + // Check if we need the times entries reloaded + if ($needTimesReloaded) { + + // Get all reg_time records for this event + require_once GLM_MEMBERS_REGISTRATIONS_PLUGIN_CLASS_PATH.'/data/dataRegTime.php'; + $RegTime = new GlmDataRegistrationsRegTime($this->wpdb, $this->config); + $regEvent['reg_time'] = $RegTime->getList('T.reg_event = '.$regEventID, 'start_datetime', true); + + } + $view = 'eventDashboard'; break; @@ -496,6 +609,8 @@ class GlmMembersAdmin_registrations_events extends GlmDataRegistrationsRegEvent update_option('glmMembersDatabaseRegistrationsRegEventID', $regEventID); } + //echo "
".print_r($regEvent,1)."
"; + // Compile template data $templateData = array( 'option' => $option, diff --git a/models/front/registrations/registration.php b/models/front/registrations/registration.php index ef5e848..a4b5aa1 100644 --- a/models/front/registrations/registration.php +++ b/models/front/registrations/registration.php @@ -108,18 +108,19 @@ $regRequestJSON = json_encode( $cart['request'], JSON_NUMERIC_CHECK ); } - switch ( $option ) { default: // Get the RegEvent entry $regEvent = $this->getEventConfig( $eventRegID ); - // echo '
$regEvent: ' . print_r( $regEvent, true ) . '
'; + echo '
$regEvent: ' . print_r( $regEvent, true ) . '
'; $event = array( 'id' => $regEvent['id'], 'event' => $regEvent['event'], 'event_name' => $regEvent['event_name'], 'event_code' => $regEvent['event_code'], 'descr' => $regEvent['descr'], + 'time_specific' => $regEvent['time_specific']['value'], + 'reg_time' => $regEvent['reg_time'], 'attendee_max' => $regEvent['attendee_max'], 'attendee_max_per_reg' => $regEvent['attendee_max_per_reg'], 'reg_hold_minutes' => $regEvent['reg_hold_minutes'], @@ -214,7 +215,6 @@ 'regClassesJSON' => $regClassJSON, 'regCartJSON' => $regCartJSON, 'regRequestJSON' => $regRequestJSON, - 'eventData' => $eventData, 'loginAccount' => $loginAccount, 'termsJSON' => $termsJSON, 'regJSON' => json_encode( $registrants, JSON_NUMERIC_CHECK ), diff --git a/setup/databaseScripts/create_database_V0.0.12.sql b/setup/databaseScripts/create_database_V0.0.12.sql deleted file mode 100644 index 651040d..0000000 --- a/setup/databaseScripts/create_database_V0.0.12.sql +++ /dev/null @@ -1,824 +0,0 @@ --- Gaslight Media Registration Database --- File Created: 01/18/2017 14:40:00 --- Database Version: 0.0.3 --- Database Creation Script --- --- To permit each query below to be executed separately, --- all queries must be separated by a line with four dashes --- -/* - * General Database Organization - * ----------------------------- - * - * management - General options and configuration - Site manager access only - * - * misc - Misc settings and text - Site owner may update - * - * Magic Forms Tables - * magicforms - Forms - * --> Event, Registration, Rate Class, Account, Registrant - * mf_data - Data submitted to a form - * --> Submission, Event Registration, Rate Class selected, Account, Registrant - * mf_temp_file - Temporary file meta-data - * - * added_info_fields - Additional fields - * added_info_data - Submitted additional field data - * --> added_info_fields - * - * payment codes - Promotional payment codes - Used with various things - * --> Event, Submission, Event Registration, Event Registrant, Account or global - * - * reg_event - Describes registration for that event - * reg_time - One record for each date/time this event has people registered - Primarily tracks attendee counts and charge totals - * reg_class - Type of registration for this event (one or more) - * reg_rates - Date range / rate for a reg class (one or more) - * - * reg_account - Describes someone who submits / pays for a registration - * Make these two things the same table.... - * registrant - A person who is registered for an event - * - * reg_request - Information on a specific request for registrations - * reg_request_event - Event selected (one or more) - * reg_request_class - Class of registration (one or more) - * reg_request_rate - Specific registration date/rate (one or more) - * reg_request_registrant - Registrant (one or more) - * - * - * Overall Flow - * ------------ - * - * User selects an event - * If the event has available registrations - * User selects a date for the registration (or if only one that's selected automatically) - * User can log back into registrations at this point if they've been there before and have a password, create an account, or continue as guest ??? - * User selects an available rate type and adds one or more registrants for that rate type - * User may loop back to select additional rate type(s) and registrants - * User may go back to date selection and request additional rate types and registrants for the addional dates - * User may go back to select additional dates and do registrations for those dates as above - * User may go back to select other events and do registrations for them as above - * User may select the "Cart" and deselect something added to it - * User may checkout - * - */ - -/* - * NOTE: Anything below here may not be completed or accurate yet. I'm still working though this - * Lines commented out are selected for possible deletion. - * The INSERT statements are not up-to-date with the tables. - * The "config/plugin.ini" file in this plugin is also a work in progress. - */ - --- Management Options --- General configurationm parameters for the Registrations application --- Only one entry in this table! -CREATE TABLE {prefix}management ( - id INT NOT NULL AUTO_INCREMENT, - canonical_reg_page TINYTEXT NULL, -- Canonical page slug for registrations - -- System Owner Information - reg_org_name TINYTEXT NULL, -- Customer Information - Name of Organization - reg_org_short TINYTEXT NULL, - reg_org_address TINYTEXT NULL, - reg_org_city TINYTEXT NULL, - reg_org_state TINYTEXT NULL, - reg_org_zip TINYTEXT NULL, - reg_org_phone TINYTEXT NULL, - reg_org_toll_free TINYTEXT NULL, - reg_org_internal_email TINYTEXT NULL, - reg_org_from_email TINYTEXT NULL, - reg_payment_methods SMALLINT NULL, -- Payment methods available for all registrations - Bitmap - see payment_method in plugin.ini - reg_proc_methods SMALLINT NULL, -- Payment processing methods available - Bitmap - see proc_method in plugin.ini - reg_cc_accepts SMALLINT NULL, -- Credit Cards Accepted - Bitmap - See credit_card in plugin.ini - -- Authorize.net Credentials - reg_authorize_net_login TINYTEXT NULL, - reg_authorize_net_key TINYTEXT NULL, - reg_authorize_net_test TINYINT NULL, -- Authorize.net test mode - List - see proc_test_mode in plugin.ini - reg_authorize_net_conf BOOLEAN NULL, -- Flag to send payment confirmation Email from Authorize.net - reg_authorize_net_merchant_email TINYTEXT NULL, -- E-Mail Authorize.net will send copy of confirmation E-Mail - -- Merchant Solutions Credentials - reg_merchant_solutions_acctid TINYTEXT NULL, -- Merchant Solutions credentials - reg_merchant_solutions_merchantpin TINYTEXT NULL, - reg_merchant_solutions_test TINYINT NULL, -- Merchant Solutions test mode - List - see proc_test_mode in plugin.ini - -- Billing settings - reg_full_billing_info BOOLEAN NULL, -- Always request full billing information in checkout page regardless of the following settings - reg_bill_info_req_no_charge SMALLINT NULL, -- Bitmap of fields to use in checkout for these types of payments - See billing_field in plugin.conf - reg_bill_info_req_comp_code SMALLINT NULL, - reg_bill_info_req_cash SMALLINT NULL, - reg_bill_info_req_check SMALLINT NULL, - reg_bill_info_req_credit_card SMALLINT NULL, - reg_bill_info_req_merchant_call SMALLINT NULL, - -- Misc Options - reg_medical_info BOOLEAN NULL, -- This site can ask for "Medical Info" - set in main category of an event - PRIMARY KEY (id) -); - ----- - --- Terms used in site modifiable on Management page in admin - Only 1 entry in this table --- Terms in this table should be all self-explanatory -CREATE TABLE {prefix}settings_terms ( - id INT NOT NULL AUTO_INCREMENT, - reg_term_registrations_name TINYTEXT NULL, -- Term "Event Registration" - reg_term_registration TINYTEXT NULL, - reg_term_registration_cap TINYTEXT NULL, - reg_term_registration_plur TINYTEXT NULL, - reg_term_registration_plur_cap TINYTEXT NULL, - reg_term_register TINYTEXT NULL, - reg_term_register_cap TINYTEXT NULL, - reg_term_registers TINYTEXT NULL, -- Intransitive verb of register - reg_term_registering TINYTEXT NULL, - reg_term_registering_cap TINYTEXT NULL, - reg_term_registered TINYTEXT NULL, - reg_term_registered_cap TINYTEXT NULL, - reg_term_attendee TINYTEXT NULL, - reg_term_attendee_cap TINYTEXT NULL, - reg_term_attendee_plur TINYTEXT NULL, - reg_term_attendee_plur_cap TINYTEXT NULL, - reg_term_attending TINYTEXT NULL, - reg_term_attended TINYTEXT NULL, - reg_term_registered_user TINYTEXT NULL, - reg_term_registered_user_cap TINYTEXT NULL, - reg_term_registered_user_plur TINYTEXT NULL, - reg_term_registered_user_plur_cap TINYTEXT NULL, - reg_term_id TINYTEXT NULL, - reg_term_id_cap TINYTEXT NULL, - reg_term_id_plur TINYTEXT NULL, - reg_term_id_plur_cap TINYTEXT NULL, - reg_term_password TINYTEXT NULL, - reg_term_password_cap TINYTEXT NULL, - reg_term_password_plur TINYTEXT NULL, - reg_term_password_plur_cap TINYTEXT NULL, - reg_term_instructor TINYTEXT NULL, - reg_term_instructor_cap TINYTEXT NULL, - reg_term_instructor_plur TINYTEXT NULL, - reg_term_instructor_plur_cap TINYTEXT NULL, - reg_term_payment_code TINYTEXT NULL, - reg_term_payment_code_cap TINYTEXT NULL, - reg_term_payment_code_plur TINYTEXT NULL, - reg_term_payment_code_plur_cap TINYTEXT NULL, - reg_term_registration_button TINYTEXT NULL, - reg_term_contact_information TINYTEXT NULL, - PRIMARY KEY (id) -); - ----- - --- Misc system-wide customer configurable configuration --- Various text and flags to be configured by customer --- Only one entry in this table! -CREATE TABLE {prefix}misc ( - id INT NOT NULL AUTO_INCREMENT, - reg_bulletin TEXT NULL, -- Text to display at top of first registration page - cart_page_text TEXT NULL, -- Text to display at top of cart page - checkout_page_text TEXT NULL, -- Text to display at top of checkout page - summary_page_text TEXT NULL, -- Text to display at top of summary page (after checkout) - reg_terms TEXT NULL, -- Registration terms and conditions - notify_subject TEXT NULL, -- Subject of notification E-Mail to site owner - notify_text TEXT NULL, -- Notification E-Mail text for site owner - instr_notify_subject TEXT NULL, -- Subject of notification E-Mail to instructor - instr_notify_text TEXT NULL, -- Notification E-Mail text for instructor - submission_notify_subject TEXT NULL, -- Subject of notification E-Mail to person submitting the registrations - submission_notify_text TEXT NULL, -- Notification E-Mail text to person submitting the registrations - registrant_notify_subject TEXT NULL, -- Subject of notification E-Mail to registrant - registrant_notify_text TEXT NULL, -- Text of notification E-Mail to registrant - submission_ack_subject TEXT NULL, -- Subject of acknowledgement E-Mail to person submitting the registrations - submission_ack_text TEXT NULL, -- Text of acknowledgement E-Mail text to person submitting the registrations - registrant_ack_subject TEXT NULL, -- Subject of acknowledgement E-Mail to registrant - registrant_ack_text TEXT NULL, -- Text of acknowledgement E-Mail to registrant - PRIMARY KEY (id) -); - ----- - --- Additional fields for collecting information for various things - submission, event registration, or registrant --- Related to the registration submission or specific event registration -CREATE TABLE {prefix}added_info_fields ( - id INT NOT NULL AUTO_INCREMENT, - ref_type TINYINT NULL, -- See data_ref_type table in plugin.ini - ref_dest INT NULL, -- Pointer to the specific entity of ref_type - (not user submitted data record) - name TINYTEXT NULL, -- Displayed field prompt - also used on retrieval of data - description TINYTEXT NULL, -- Description of field - possibly to display to user - PRIMARY KEY (id), - INDEX (ref_dest) -); - ----- - --- Additional field data for various specific things -CREATE TABLE {prefix}added_info_data ( - id INT NOT NULL AUTO_INCREMENT, - added_info_field INT NULL, -- Pointer to added_info_field table - ref_type TINYINT NULL, -- See data ref_type table in plugin.ini - ref_dest INT NULL, -- Pointer to specific entryt of the correct type (user submitted data record) - field_value TINYTEXT NULL, - PRIMARY KEY (id), - INDEX (ref_dest) -); - - ----- - --- magicform -CREATE TABLE {prefix}magicform ( - id INT NOT NULL AUTO_INCREMENT, - form_id TINYTEXT NULL, - custom_id TINYTEXT NULL, - title TINYTEXT NULL, - type SMALLINT NULL, - descr TEXT NULL, - active BOOLEAN NULL, - required BOOLEAN NULL, - data1 TINYTEXT NULL, - sort SMALLINT NULL, - expanded BOOLEAN NULL, - style TEXT NULL, - file TINYTEXT NULL, - cols INT NULL, - rows INT NULL, - size TINYTEXT NULL, - format TINYTEXT NULL, - default_val TINYTEXT NULL, - PRIMARY KEY (id), - INDEX(form_id(20)) -); - ----- - --- mf_data -CREATE TABLE {prefix}mf_data ( - id INT NOT NULL AUTO_INCREMENT, - fiid INT NULL, - form_id TINYTEXT NULL, - field_id TINYTEXT NULL, - level TINYTEXT NULL, - title TINYTEXT NULL, - type INT NULL, - txt_type TEXT NULL, - value TEXT NULL, - numb_value DOUBLE PRECISION NULL, - txt_value TEXT NULL, - opt_num INT NULL, - valid BOOLEAN NULL, - required BOOLEAN NULL, - failure TEXT NULL, - PRIMARY KEY (id), - INDEX(form_id(20)), - INDEX(fiid) -); - ----- - --- mf_temp_file -CREATE TABLE {prefix}mf_temp_file ( - id INT NOT NULL AUTO_INCREMENT, - file_name TINYTEXT NULL, - upload_time DATE NULL, - PRIMARY KEY (id), - INDEX(file_name(20)), - INDEX(upload_time) -); - ----- - --- Payment Codes --- Promotional payment codes for free/discounted payment -CREATE TABLE {prefix}payment_code ( - id INT NOT NULL AUTO_INCREMENT, - code_type TINYINT NULL, -- Type of adjustment - Free only to start with - See pay_code_type in plugin.ini - ref_type TINYINT NULL, -- See payment_ref_type in plugin.ini - ref_dest INT NULL, -- Pointer to the specific entity of ref_type - code TINYTEXT NULL, -- Text code user must enter to use - amount FLOAT, -- Amount of discount if not type "Free" - Either $ amount or percent - descr TEXT NULL, - PRIMARY KEY (id), - INDEX (ref_dest), - INDEX (code(10)) -); - ----- - --- Registration event specific information --- One record for each event in Events add-on --- Only created when an event is selected to offer registrations -CREATE TABLE {prefix}reg_event ( - id INT NOT NULL AUTO_INCREMENT, - event INT NULL, -- Pointer to event in Events add-on - False if event record in Events add-on no longer exists - event_name TINYTEXT NULL, -- Name of Event so it will always be in the cart data - event_code TINYTEXT NULL, -- A short code used to reference this event - can be used to directly select an event to register for - 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 - reg_hold_minutes MEDIUMINT NULL, -- Number of minutes hold time for an inactive cart before registrant count hold expires (after which cart attempts to hold again on next access) - cart_hold_days MEDIUMINT NULL, -- Number of days hold time for inactive cart before cart is purged - registration_account_options SMALLINT NULL, -- Bitmap of how user accounts may be used for this event - See registration_account_option in plugin.ini - payment_methods SMALLINT NULL, -- Bitmap of payment methods available to users for this event - See payment_method in plugin.ini - restricted_payment_methods SMALLINT NULL, -- Bitmap of restricted (admin use only) payment methods for this event - see payment_method - descr TEXT NULL, -- Registrations specific description field for this event - terms TEXT NULL, -- Terms and Conditions for registration - reg_file TINYTEXT NULL, -- Name of a downloadable file - reg_file_title TINYTEXT NULL, -- Title for downloadable file - form_revision SMALLINT NULL, -- Current MagicForm form revision - notes TEXT NULL, -- System operator's notes for this event - Not visible to users - PRIMARY KEY (id), - INDEX (event), - INDEX (event_code(10)) -); - ----- - --- Registration Event Time - Information and summary data for a specific event instance (relates to a perticular time record in events) --- A pseudo entry is created if registration is not date/time sensitive for this event. The pseudo entry does not point to an event time. --- These are created the first time a person tries to register for an event instance (time) --- One or more for each event -CREATE TABLE {prefix}reg_time ( - id INT NOT NULL AUTO_INCREMENT, - reg_event INT NULL, -- Pointer to reg_event table - event_time INT NULL, -- ID of events times table entry in Events add-on - If false (0), then this is a pseudo entry to use for all registrations (non-date/time specific) - start_datetime DATETIME NULL, -- Date and time when event instance starts - Informational - Actual events data is definitive - end_datetime DATETIME NULL, -- Date and time when event instance ends - Informational - all_day BOOLEAN NULL, -- All Day flag - Informational - attendees BOOLEAN NULL, -- Flag if tracking attendees or if only one per registration submission (registers account submitting) - get from reg_event - attendee_max MEDIUMINT NULL, -- Attendee count limit - 0 = unlimited - get from reg_event record - attendee_count MEDIUMINT NULL, -- Current attendee count - calculated on the fly and stored here for reference - attendees_pending MEDIUMINT NULL, -- Current number of attendees for this time in active pending carts (Not checked out and attendees slots held) - attendees_available MEDIUMINT NULL, -- Currently available attendee count (limit - current - pending) - total_base_charge DOUBLE NULL, -- Total base charges - total_per_attendee DOUBLE NULL, -- Total per-attendee charges - total_other DOUBLE NULL, -- Total other charges (meals, extras, fees, ...) - total_taxes DOUBLE NULL, -- Total taxes charged - total_charges DOUBLE NULL, -- Total charges (sum of all above) - total_discounts DOUBLE NULL, -- Total discounts of all types (applied payment codes, etc...) - total_payments DOUBLE NULL, -- Total net payments (total charges - total discounts) - descr TEXT NULL, -- Optional description field for this time entry - PRIMARY KEY (id), - INDEX (reg_event), - INDEX (event_time), - INDEX (start_datetime) -); - ----- - --- Pending Attendees - In carts but not checked out --- Attendee counts may be held for a particular reg_time entry for carts that have not been checked out --- These are held for reg_event reg_hold_minutes, afterwhich they are timed out and removed from this table --- Cart entries are given the ID's for these entries when a hold is requested, if the entry is gone, the hold has expired -CREATE TABLE {prefix}reg_time_pending ( - id INT NOT NULL AUTO_INCREMENT, - reg_event INT NULL, -- Pointer to reg_event table - reg_time INT NULL, -- ID of time record - expire_time DATETIME NULL, -- Time at which this hold expires - PRIMARY KEY (id), - INDEX (reg_event), - INDEX (reg_time) -); - ----- - --- Registration Class - Type of registration for a specific event - Equates to "Rate Options" in the old system --- One or more for each event -CREATE TABLE {prefix}reg_class ( - id INT NOT NULL AUTO_INCREMENT, - reg_event INT NULL, -- Pointer to reg_event table - name TINYTEXT NULL, -- Name of this registration type - descr TEXT NULL, -- Description - PRIMARY KEY (id), - INDEX (reg_event) -); - ----- - --- Rates and dates for a particular reg_class --- One or more per reg_class - **** Days should not overlap for a particular reg_class -CREATE TABLE {prefix}reg_rate ( - id INT NOT NULL AUTO_INCREMENT, - reg_event INT NULL, -- Pointer to reg_event table - reg_class INT NULL, -- Pointer to reg_class table - name TINYTEXT NULL, -- Namme of this rate - start_days INT NULL, -- # of days before event time rate becomes available - may be entered as a date then coverted for storage - end_days INT NULL, -- # of days before event time rate becomes unavailable - base_rate FLOAT, -- Base rate to register - per_registrant FLOAT, -- Rate per registrant - registrant_credits TINYINT NULL, -- Number of registrants included in base rate - PRIMARY KEY (id), - INDEX (reg_event), - INDEX (reg_class) -); - ----- - --- An account for a person submitting a registration or a registrant for an event --- Depending on the use of these entries may not have all data included --- A single account may be referenced as a person submitting registrations and/or a person registered for an event -CREATE TABLE {prefix}account ( - id INT NOT NULL AUTO_INCREMENT, - active BOOLEAN NULL, -- Is active flag (may be accessed or used) - default is true - validated BOOLEAN NULL, -- Flag indicating that the account has been validated - Set to false when recovering password - validation_code TINYTEXT NULL, -- Validation code and timestamp ("{validation code}-{timestamp}) - Clear this after validation - registered_by INT NULL, -- Account - member_id TINYTEXT NULL, -- Free-form field for a member ID (not a GLM Associate member ID) - fname TINYTEXT NULL, -- Account primary address - lname TINYTEXT NULL, - org TINYTEXT NULL, - title TINYTEXT NULL, - addr1 TINYTEXT NULL, - addr2 TINYTEXT NULL, - city TINYTEXT NULL, - state TINYTEXT NULL, - zip TINYTEXT NULL, - country TINYTEXT NULL, - phone TINYTEXT NULL, - fax TINYTEXT NULL, - bill_fname TINYTEXT NULL, -- Last used billing information - Also stored in each registration request - bill_lname TINYTEXT NULL, - bill_org TINYTEXT NULL, - bill_title TINYTEXT NULL, - bill_addr1 TINYTEXT NULL, - bill_addr2 TINYTEXT NULL, - bill_city TINYTEXT NULL, - bill_state TINYTEXT NULL, - bill_zip TINYTEXT NULL, - bill_country TINYTEXT NULL, - bill_phone TINYTEXT NULL, - bill_fax TINYTEXT NULL, - email TINYTEXT NULL, - password TINYTEXT NULL, -- Crypted password for login back into this account - email_ok BOOLEAN NULL, - is_member BOOLEAN NULL, -- Is a member of the entity that owns the site - contact_id INT NULL, -- Pointer to GLM Associate member contact record if account is for a member contact - contact_fname TINYTEXT NULL, - contact_lname TINYTEXT NULL, - contact_org TINYTEXT NULL, - contact_title TINYTEXT NULL, - contact_addr1 TINYTEXT NULL, - contact_addr2 TINYTEXT NULL, - contact_city TINYTEXT NULL, - contact_state TINYTEXT NULL, - contact_zip TINYTEXT NULL, - contact_country TINYTEXT NULL, - contact_phone TINYTEXT NULL, - contact_fax TINYTEXT NULL, - contact_email TINYTEXT NULL, - contact_email_ok BOOLEAN NULL, - guardian TINYTEXT NULL, - emer_contact TINYTEXT NULL, - emer_phone TINYTEXT NULL, - med_history TINYTEXT NULL, - allergy_med TINYTEXT NULL, - date_created DATE NULL, - notes TEXT NULL, -- System operator's notes for this account - not visible to account owner - user_trace_info TINYTEXT NULL, -- IP Address of user computer and timestamp of last update - PRIMARY KEY (id), - INDEX (registered_by), - INDEX (member_id(10)), - INDEX (fname(10)), - INDEX (lname(10)), - INDEX (org(10)), - INDEX (city(10)), - INDEX (state(5)), - INDEX (zip(5)), - INDEX (email(10)), - INDEX (contact_id) -); - ----- - --- A request for registration --- Has one or more reg_detail records associated with it -CREATE TABLE {prefix}reg_request ( - id INT NOT NULL AUTO_INCREMENT, - account INT NULL, -- Pointer to user account (reg_account) who submitted the registrations. If 0 then guest request (prior to checkout) - validated BOOLEAN NULL, -- Flag that indicates if request passed last validation with checkRegistrationRequest() - validation_message TEXT NULL, -- Reasons that request did not pass validation with checkRegistrationRequest() - Serialized array - bill_fname TINYTEXT NULL, -- Billing information used for this registration submission - Updates account billing address - Kept here for each request - bill_lname TINYTEXT NULL, - bill_org TINYTEXT NULL, - bill_title TINYTEXT NULL, - bill_addr1 TINYTEXT NULL, - bill_addr2 TINYTEXT NULL, - bill_city TINYTEXT NULL, - bill_state TINYTEXT NULL, - bill_zip TINYTEXT NULL, - bill_country TINYTEXT NULL, - date_submitted DATE NULL, - pay_method INT NULL, -- See payment_method in plugin.ini - payment_code TINYTEXT NULL, -- Payment_code (code text) - if submitted and validated - status SMALLINT NULL, -- See submission_status in plugin.ini - total DOUBLE PRECISION NULL, -- Total charge including all fees and taxes - cc_type TINYINT NULL, -- Credit Card type (if used) - See credit_card in plugin.ini - cc_name TINYTEXT NULL, - cc_numb TINYTEXT NULL, - cc_exp TINYTEXT NULL, - cc_cvv TINYTEXT NULL, - cc_conf TINYTEXT NULL, -- Confirmation code back from card processor - summary TEXT NULL, -- HTML summary of cart contents, costs and payment - Use same HTML displayed to user - mf_data TEXT NULL, -- Any MagicForm data associated with registrant - notes TEXT NULL, -- System operator's notes for this registration request - user_trace_info TINYTEXT NULL, -- IP Address of user computer and timestamp - last_update DATETIME NULL, -- Last update date/time - Used for timing out pending carts and attendee counts - PRIMARY KEY (id), - INDEX (account), - INDEX (date_submitted) -); - ----- - --- Registration for a specific event --- Has one or more reg_selected_rate records associated with it - *** Need to remove from this table: account, total_charge **** -CREATE TABLE {prefix}reg_request_event ( - id INT NOT NULL AUTO_INCREMENT, - reg_request INT NULL, -- Pointer to reg_request table - reg_event INT NULL, -- Pointer to reg_event - event_name TINYTEXT NULL, -- Name of Event so it will always be in the cart data - reg_time INT NULL, -- Pointer to times table entry in Events add-on - event_datetime DATETIME NULL, -- Date and time of event time selected so it will always be in the cart - mf_data TEXT NULL, -- Any MagicForm data associated with requested event - notes TEXT NULL, -- System operator's notes for this registration request - PRIMARY KEY (id), - INDEX (reg_request), - INDEX (reg_event), - INDEX (reg_time) -); - ----- - --- A particular reg_class selected --- Has one or more reg_request_rate records associated with it - *** Need to remove from this table: account, total_class_charge **** -CREATE TABLE {prefix}reg_request_class ( - id INT NOT NULL AUTO_INCREMENT, - reg_event INT NULL, -- Pointer to reg_event entry - event_name TINYTEXT NULL, -- Name of Event so it will always be in the cart data - reg_time INT NULL, -- Pointer to times table entry in Events add-on - event_datetime DATETIME NULL, -- Date and time of event time selected so it will always be in the cart - reg_request INT NULL, -- Pointer to the registration request record - reg_request_event INT NULL, -- Pointer to reg_request_event table entry - class INT NULL, -- Pointer to event reg_class table - False (0) if registration class no longer exits - class_name TINYTEXT NULL, -- Name of event class at the time selected - mf_data TEXT NULL, -- Any MagicForm data associated with registrant - notes TEXT NULL, -- System operator's notes for this registration request - PRIMARY KEY (id), - INDEX (reg_event), - INDEX (reg_time), - INDEX (reg_request_event) -); - ----- - --- A particular reg_rate selected --- Has one or more reg_request_registrant records associated with it - *** Need to remove from this table: account, numb_registrants, total_registrant_charges **** -CREATE TABLE {prefix}reg_request_rate ( - id INT NOT NULL AUTO_INCREMENT, - reg_event INT NULL, -- Pointer to reg_event entry - event_name TINYTEXT NULL, -- Name of Event so it will always be in the cart data - reg_time INT NULL, -- Pointer to times table entry in Events add-on - event_datetime DATETIME NULL, -- Date and time of event time selected so it will always be in the cart - reg_request INT NULL, -- Pointer to the registration request record - reg_request_event INT NULL, -- Pointer to reg_request_event table entry - reg_request_class INT NULL, -- Pointer to reg_request_class table entry - rate INT NULL, -- Pointer to event reg_rate table - False (0) if registration rate no longer exists - rate_name TINYTEXT NULL, -- Name of event class rate at the time selected - base_rate FLOAT, -- Base rate at time of registration - per_registrant FLOAT, -- Per Registrant Rate at time of registration - registrant_credits TINYINT NULL, -- Number of registrants included in base rate at time of registration - mf_data TEXT NULL, -- Any MagicForm data associated with registrant - notes TEXT NULL, -- System operator's notes for this registration request - PRIMARY KEY (id), - INDEX (reg_event), - INDEX (reg_time), - INDEX (reg_request_event), - INDEX (reg_request_class) -); - ----- - --- A specific registrant for a selected registration rate - *** Need to remove from this table: reg_request_registrant, reg_request_hold, reg_request_hold_not_available **** -CREATE TABLE {prefix}reg_request_registrant ( - id INT NOT NULL AUTO_INCREMENT, - account INT NULL, -- Pointer to the account entry for the person being registered - False (0) if account no longer exists or registrant account not needed - reg_event INT NULL, -- Pointer to reg_event entry - event_name TINYTEXT NULL, -- Name of Event so it will always be in the cart data - reg_time INT NULL, -- Pointer reg_time entry - event_datetime DATETIME NULL, -- Date and time of event time selected so it will always be in the cart - reg_request INT NULL, -- Pointer to the registration request record - reg_request_event INT NULL, -- Pointer to reg_request_event table entry - reg_request_class INT NULL, -- Pointer to reg_request_class table entry - reg_request_rate INT NULL, -- Pointer to reg_request_rate table entry - fname TINYTEXT NULL, -- First name of registrant at the time of selection - lname TINYTEXT NULL, -- Last name of registrant at the time of selection - mf_data TEXT NULL, -- Any MagicForm data associated with registrant - notes TEXT NULL, -- System operator's notes for this registration request - PRIMARY KEY (id), - INDEX (account), - INDEX (reg_event), - INDEX (reg_time), - INDEX (reg_request), - INDEX (reg_request_event), - INDEX (reg_request_class), - INDEX (reg_request_rate) -); - ----- - --- Insert into management table -INSERT INTO {prefix}management - ( - canonical_reg_page, - reg_org_name, - reg_org_short, - reg_org_address, - reg_org_city, - reg_org_state, - reg_org_zip, - reg_org_phone, - reg_org_toll_free, - reg_org_internal_email, - reg_org_from_email, - reg_payment_methods, - reg_proc_methods, - reg_cc_accepts, - reg_authorize_net_login, - reg_authorize_net_key, - reg_authorize_net_test, - reg_authorize_net_conf, - reg_authorize_net_merchant_email, - reg_merchant_solutions_acctid, - reg_merchant_solutions_merchantpin, - reg_merchant_solutions_test, - reg_full_billing_info, - reg_bill_info_req_no_charge, - reg_bill_info_req_comp_code, - reg_bill_info_req_cash, - reg_bill_info_req_check, - reg_bill_info_req_credit_card, - reg_bill_info_req_merchant_call, - reg_medical_info - ) - VALUES - ( - 'registrations', -- reg_canonical_reg_page, - 'Gaslight Media', -- reg_org_name, - 'GLM', -- reg_org_short, - '120 E. Lake St.', -- reg_org_address, - 'Petoskey', -- reg_org_city, - 'MI', -- reg_org_state, - '49770', -- reg_org_zip, - '231-487-0692', -- reg_org_phone, - '800-123-1234', -- reg_org_toll_free, - 'internal@gaslightmedia.com', -- reg_org_internal_email, - 'info@gaslightmedia.com', -- reg_org_from_email, - 0, -- reg_payment_methods, - 0, -- reg_proc_methods, - 0, -- reg_cc_accepts, - '', -- reg_authorize_net_login, - '', -- reg_authorize_net_key, - 1, -- reg_authorize_net_test, - true, -- reg_authorize_net_conf - '', -- reg_authorize_net_merchant_email, - '', -- reg_merchant_solutions_acctid, - '', -- reg_merchant_solutions_merchantpin, - 1, -- reg_merchant_solutions_test, - true, -- reg_full_billing_info, - 0, -- reg_bill_info_req_no_charge, - 0, -- reg_bill_info_req_comp_code, - 0, -- reg_bill_info_req_cash, - 0, -- reg_bill_info_req_check, - 0, -- reg_bill_info_req_credit_card, - 0, -- reg_bill_info_req_merchant_call, - true -- reg_medical_info, - ); - ----- - --- Insert into settings_terms table -INSERT INTO {prefix}settings_terms - ( - reg_term_registrations_name, - reg_term_registration, - reg_term_registration_cap, - reg_term_registration_plur, - reg_term_registration_plur_cap, - reg_term_register, - reg_term_register_cap, - reg_term_registers, - reg_term_registering, - reg_term_registering_cap, - reg_term_registered, - reg_term_registered_cap, - reg_term_attendee, - reg_term_attendee_cap, - reg_term_attendee_plur, - reg_term_attendee_plur_cap, - reg_term_attending, - reg_term_attended, - reg_term_registered_user, - reg_term_registered_user_cap, - reg_term_registered_user_plur, - reg_term_registered_user_plur_cap, - reg_term_id, - reg_term_id_cap, - reg_term_id_plur, - reg_term_id_plur_cap, - reg_term_password, - reg_term_password_cap, - reg_term_password_plur, - reg_term_password_plur_cap, - reg_term_instructor, - reg_term_instructor_cap, - reg_term_instructor_plur, - reg_term_instructor_plur_cap, - reg_term_payment_code, - reg_term_payment_code_cap, - reg_term_payment_code_plur, - reg_term_payment_code_plur_cap, - reg_term_registration_button, - reg_term_contact_information - ) - VALUES - ( - 'Event Registrations', -- reg_term_registrations_name - 'registration', -- reg_term_registration - 'Registration', -- reg_term_registration_cap - 'registrations', -- reg_term_registration_plur - 'Registrations', -- reg_term_registration_plur_cap - 'register', -- reg_term_registe - 'Register', -- reg_term_register_cap - 'registers', -- reg_term_registers - 'registering', -- reg_term_registering - 'Registering', -- reg_term_registering_cap - 'registered', -- reg_term_registered - 'Registered', -- reg_term_registered_cap - 'attendee', -- reg_term_attendee - 'Attendee', -- reg_term_attendee_cap - 'attendees', -- reg_term_attendee_plur - 'Attendees', -- reg_term_attendee_plur_cap - 'attending', -- reg_term_attending - 'attended', -- reg_term_attended - 'user', -- reg_term_registered_user - 'User', -- reg_term_registered_user_cap - 'users', -- reg_term_registered_user_plur - 'Users', -- reg_term_registered_user_plur_cap - 'ID', -- reg_term_id - 'ID', -- reg_term_id_cap - 'IDs', -- reg_term_id_plur - 'IDs', -- reg_term_id_plur_cap - 'password', -- reg_term_password - 'passwords', -- reg_term_password_cap - 'Password', -- reg_term_password_plur - 'Passwords', -- reg_term_password_plur_cap - 'instructor', -- reg_term_instructor - 'Instructor', -- reg_term_instructor_cap - 'instructors', -- reg_term_instructor_plur - 'Instructors', -- reg_term_instructor_plur_cap - 'payment code', -- reg_term_payment_code - 'Payment code', -- reg_term_payment_code_cap - 'payment codes', -- reg_term_payment_code_plur - 'Payment codes', -- reg_term_payment_code_plur_cap - 'Register for Event', -- reg_term_registration_button - 'Contact Information' -- reg_term_contact_information - ); - ----- - --- Insert into misc table -INSERT INTO {prefix}misc - ( - reg_bulletin, - cart_page_text, - checkout_page_text, - summary_page_text, - reg_terms, - notify_subject, - notify_text, - instr_notify_subject, - instr_notify_text, - submission_notify_subject, - submission_notify_text, - registrant_notify_subject, - registrant_notify_text, - submission_ack_subject, - submission_ack_text, - registrant_ack_subject, - registrant_ack_text - ) - VALUES - ( - 'Registration Bulletin Text', - 'Text for top of Cart Page', - 'Text for top of Checkout Page', - 'Text for top of Summary Page', - 'Terms and Conditions', - 'Subject of notification to site owner of a registration', - 'Text of notification to site owner of a registration', - 'Subject of notification to instructor of registration', - 'Text for notification to instructor of registration', - 'Subject of notification to person submitting registration', - 'Text of notification to person submitting registration', - 'Subject for notification to registrant', - 'Text for notification to registrant', - 'Subject of acknowledgement to person submitting registration', - 'Text of acknowledgement to person submitting registration', - 'Subject of acknowledgement to registrant', - 'Text of acknowledgement to registrant' - ); diff --git a/setup/databaseScripts/create_database_V0.0.13.sql b/setup/databaseScripts/create_database_V0.0.13.sql new file mode 100644 index 0000000..667db41 --- /dev/null +++ b/setup/databaseScripts/create_database_V0.0.13.sql @@ -0,0 +1,821 @@ +-- Gaslight Media Registration Database +-- File Created: 01/18/2017 14:40:00 +-- Database Version: 0.0.3 +-- Database Creation Script +-- +-- To permit each query below to be executed separately, +-- all queries must be separated by a line with four dashes +-- +/* + * General Database Organization + * ----------------------------- + * + * management - General options and configuration - Site manager access only + * + * misc - Misc settings and text - Site owner may update + * + * Magic Forms Tables + * magicforms - Forms + * --> Event, Registration, Rate Class, Account, Registrant + * mf_data - Data submitted to a form + * --> Submission, Event Registration, Rate Class selected, Account, Registrant + * mf_temp_file - Temporary file meta-data + * + * added_info_fields - Additional fields + * added_info_data - Submitted additional field data + * --> added_info_fields + * + * payment codes - Promotional payment codes - Used with various things + * --> Event, Submission, Event Registration, Event Registrant, Account or global + * + * reg_event - Describes registration for that event + * reg_time - One record for each date/time this event has people registered - Primarily tracks attendee counts and charge totals + * reg_class - Type of registration for this event (one or more) + * reg_rates - Date range / rate for a reg class (one or more) + * + * reg_account - Describes someone who submits / pays for a registration + * Make these two things the same table.... + * registrant - A person who is registered for an event + * + * reg_request - Information on a specific request for registrations + * reg_request_event - Event selected (one or more) + * reg_request_class - Class of registration (one or more) + * reg_request_rate - Specific registration date/rate (one or more) + * reg_request_registrant - Registrant (one or more) + * + * + * Overall Flow + * ------------ + * + * User selects an event + * If the event has available registrations + * User selects a date for the registration (or if only one that's selected automatically) + * User can log back into registrations at this point if they've been there before and have a password, create an account, or continue as guest ??? + * User selects an available rate type and adds one or more registrants for that rate type + * User may loop back to select additional rate type(s) and registrants + * User may go back to date selection and request additional rate types and registrants for the addional dates + * User may go back to select additional dates and do registrations for those dates as above + * User may go back to select other events and do registrations for them as above + * User may select the "Cart" and deselect something added to it + * User may checkout + * + */ + +/* + * NOTE: Anything below here may not be completed or accurate yet. I'm still working though this + * Lines commented out are selected for possible deletion. + * The INSERT statements are not up-to-date with the tables. + * The "config/plugin.ini" file in this plugin is also a work in progress. + */ + +-- Management Options +-- General configurationm parameters for the Registrations application +-- Only one entry in this table! +CREATE TABLE {prefix}management ( + id INT NOT NULL AUTO_INCREMENT, + canonical_reg_page TINYTEXT NULL, -- Canonical page slug for registrations + -- System Owner Information + reg_org_name TINYTEXT NULL, -- Customer Information - Name of Organization + reg_org_short TINYTEXT NULL, + reg_org_address TINYTEXT NULL, + reg_org_city TINYTEXT NULL, + reg_org_state TINYTEXT NULL, + reg_org_zip TINYTEXT NULL, + reg_org_phone TINYTEXT NULL, + reg_org_toll_free TINYTEXT NULL, + reg_org_internal_email TINYTEXT NULL, + reg_org_from_email TINYTEXT NULL, + reg_payment_methods SMALLINT NULL, -- Payment methods available for all registrations - Bitmap - see payment_method in plugin.ini + reg_proc_methods SMALLINT NULL, -- Payment processing methods available - Bitmap - see proc_method in plugin.ini + reg_cc_accepts SMALLINT NULL, -- Credit Cards Accepted - Bitmap - See credit_card in plugin.ini + -- Authorize.net Credentials + reg_authorize_net_login TINYTEXT NULL, + reg_authorize_net_key TINYTEXT NULL, + reg_authorize_net_test TINYINT NULL, -- Authorize.net test mode - List - see proc_test_mode in plugin.ini + reg_authorize_net_conf BOOLEAN NULL, -- Flag to send payment confirmation Email from Authorize.net + reg_authorize_net_merchant_email TINYTEXT NULL, -- E-Mail Authorize.net will send copy of confirmation E-Mail + -- Merchant Solutions Credentials + reg_merchant_solutions_acctid TINYTEXT NULL, -- Merchant Solutions credentials + reg_merchant_solutions_merchantpin TINYTEXT NULL, + reg_merchant_solutions_test TINYINT NULL, -- Merchant Solutions test mode - List - see proc_test_mode in plugin.ini + -- Billing settings + reg_full_billing_info BOOLEAN NULL, -- Always request full billing information in checkout page regardless of the following settings + reg_bill_info_req_no_charge SMALLINT NULL, -- Bitmap of fields to use in checkout for these types of payments - See billing_field in plugin.conf + reg_bill_info_req_comp_code SMALLINT NULL, + reg_bill_info_req_cash SMALLINT NULL, + reg_bill_info_req_check SMALLINT NULL, + reg_bill_info_req_credit_card SMALLINT NULL, + reg_bill_info_req_merchant_call SMALLINT NULL, + -- Misc Options + reg_medical_info BOOLEAN NULL, -- This site can ask for "Medical Info" - set in main category of an event + PRIMARY KEY (id) +); + +---- + +-- Terms used in site modifiable on Management page in admin - Only 1 entry in this table +-- Terms in this table should be all self-explanatory +CREATE TABLE {prefix}settings_terms ( + id INT NOT NULL AUTO_INCREMENT, + reg_term_registrations_name TINYTEXT NULL, -- Term "Event Registration" + reg_term_registration TINYTEXT NULL, + reg_term_registration_cap TINYTEXT NULL, + reg_term_registration_plur TINYTEXT NULL, + reg_term_registration_plur_cap TINYTEXT NULL, + reg_term_register TINYTEXT NULL, + reg_term_register_cap TINYTEXT NULL, + reg_term_registers TINYTEXT NULL, -- Intransitive verb of register + reg_term_registering TINYTEXT NULL, + reg_term_registering_cap TINYTEXT NULL, + reg_term_registered TINYTEXT NULL, + reg_term_registered_cap TINYTEXT NULL, + reg_term_attendee TINYTEXT NULL, + reg_term_attendee_cap TINYTEXT NULL, + reg_term_attendee_plur TINYTEXT NULL, + reg_term_attendee_plur_cap TINYTEXT NULL, + reg_term_attending TINYTEXT NULL, + reg_term_attended TINYTEXT NULL, + reg_term_registered_user TINYTEXT NULL, + reg_term_registered_user_cap TINYTEXT NULL, + reg_term_registered_user_plur TINYTEXT NULL, + reg_term_registered_user_plur_cap TINYTEXT NULL, + reg_term_id TINYTEXT NULL, + reg_term_id_cap TINYTEXT NULL, + reg_term_id_plur TINYTEXT NULL, + reg_term_id_plur_cap TINYTEXT NULL, + reg_term_password TINYTEXT NULL, + reg_term_password_cap TINYTEXT NULL, + reg_term_password_plur TINYTEXT NULL, + reg_term_password_plur_cap TINYTEXT NULL, + reg_term_instructor TINYTEXT NULL, + reg_term_instructor_cap TINYTEXT NULL, + reg_term_instructor_plur TINYTEXT NULL, + reg_term_instructor_plur_cap TINYTEXT NULL, + reg_term_payment_code TINYTEXT NULL, + reg_term_payment_code_cap TINYTEXT NULL, + reg_term_payment_code_plur TINYTEXT NULL, + reg_term_payment_code_plur_cap TINYTEXT NULL, + reg_term_registration_button TINYTEXT NULL, + reg_term_contact_information TINYTEXT NULL, + PRIMARY KEY (id) +); + +---- + +-- Misc system-wide customer configurable configuration +-- Various text and flags to be configured by customer +-- Only one entry in this table! +CREATE TABLE {prefix}misc ( + id INT NOT NULL AUTO_INCREMENT, + reg_bulletin TEXT NULL, -- Text to display at top of first registration page + cart_page_text TEXT NULL, -- Text to display at top of cart page + checkout_page_text TEXT NULL, -- Text to display at top of checkout page + summary_page_text TEXT NULL, -- Text to display at top of summary page (after checkout) + reg_terms TEXT NULL, -- Registration terms and conditions + notify_subject TEXT NULL, -- Subject of notification E-Mail to site owner + notify_text TEXT NULL, -- Notification E-Mail text for site owner + instr_notify_subject TEXT NULL, -- Subject of notification E-Mail to instructor + instr_notify_text TEXT NULL, -- Notification E-Mail text for instructor + submission_notify_subject TEXT NULL, -- Subject of notification E-Mail to person submitting the registrations + submission_notify_text TEXT NULL, -- Notification E-Mail text to person submitting the registrations + registrant_notify_subject TEXT NULL, -- Subject of notification E-Mail to registrant + registrant_notify_text TEXT NULL, -- Text of notification E-Mail to registrant + submission_ack_subject TEXT NULL, -- Subject of acknowledgement E-Mail to person submitting the registrations + submission_ack_text TEXT NULL, -- Text of acknowledgement E-Mail text to person submitting the registrations + registrant_ack_subject TEXT NULL, -- Subject of acknowledgement E-Mail to registrant + registrant_ack_text TEXT NULL, -- Text of acknowledgement E-Mail to registrant + PRIMARY KEY (id) +); + +---- + +-- Additional fields for collecting information for various things - submission, event registration, or registrant +-- Related to the registration submission or specific event registration +CREATE TABLE {prefix}added_info_fields ( + id INT NOT NULL AUTO_INCREMENT, + ref_type TINYINT NULL, -- See data_ref_type table in plugin.ini + ref_dest INT NULL, -- Pointer to the specific entity of ref_type - (not user submitted data record) + name TINYTEXT NULL, -- Displayed field prompt - also used on retrieval of data + description TINYTEXT NULL, -- Description of field - possibly to display to user + PRIMARY KEY (id), + INDEX (ref_dest) +); + +---- + +-- Additional field data for various specific things +CREATE TABLE {prefix}added_info_data ( + id INT NOT NULL AUTO_INCREMENT, + added_info_field INT NULL, -- Pointer to added_info_field table + ref_type TINYINT NULL, -- See data ref_type table in plugin.ini + ref_dest INT NULL, -- Pointer to specific entryt of the correct type (user submitted data record) + field_value TINYTEXT NULL, + PRIMARY KEY (id), + INDEX (ref_dest) +); + + +---- + +-- magicform +CREATE TABLE {prefix}magicform ( + id INT NOT NULL AUTO_INCREMENT, + form_id TINYTEXT NULL, + custom_id TINYTEXT NULL, + title TINYTEXT NULL, + type SMALLINT NULL, + descr TEXT NULL, + active BOOLEAN NULL, + required BOOLEAN NULL, + data1 TINYTEXT NULL, + sort SMALLINT NULL, + expanded BOOLEAN NULL, + style TEXT NULL, + file TINYTEXT NULL, + cols INT NULL, + rows INT NULL, + size TINYTEXT NULL, + format TINYTEXT NULL, + default_val TINYTEXT NULL, + PRIMARY KEY (id), + INDEX(form_id(20)) +); + +---- + +-- mf_data +CREATE TABLE {prefix}mf_data ( + id INT NOT NULL AUTO_INCREMENT, + fiid INT NULL, + form_id TINYTEXT NULL, + field_id TINYTEXT NULL, + level TINYTEXT NULL, + title TINYTEXT NULL, + type INT NULL, + txt_type TEXT NULL, + value TEXT NULL, + numb_value DOUBLE PRECISION NULL, + txt_value TEXT NULL, + opt_num INT NULL, + valid BOOLEAN NULL, + required BOOLEAN NULL, + failure TEXT NULL, + PRIMARY KEY (id), + INDEX(form_id(20)), + INDEX(fiid) +); + +---- + +-- mf_temp_file +CREATE TABLE {prefix}mf_temp_file ( + id INT NOT NULL AUTO_INCREMENT, + file_name TINYTEXT NULL, + upload_time DATE NULL, + PRIMARY KEY (id), + INDEX(file_name(20)), + INDEX(upload_time) +); + +---- + +-- Payment Codes +-- Promotional payment codes for free/discounted payment +CREATE TABLE {prefix}payment_code ( + id INT NOT NULL AUTO_INCREMENT, + code_type TINYINT NULL, -- Type of adjustment - Free only to start with - See pay_code_type in plugin.ini + ref_type TINYINT NULL, -- See payment_ref_type in plugin.ini + ref_dest INT NULL, -- Pointer to the specific entity of ref_type + code TINYTEXT NULL, -- Text code user must enter to use + amount FLOAT, -- Amount of discount if not type "Free" - Either $ amount or percent + descr TEXT NULL, + PRIMARY KEY (id), + INDEX (ref_dest), + INDEX (code(10)) +); + +---- + +-- Registration event specific information +-- One record for each event in Events add-on +-- Only created when an event is selected to offer registrations +CREATE TABLE {prefix}reg_event ( + id INT NOT NULL AUTO_INCREMENT, + event INT NULL, -- Pointer to event in Events add-on - False if event record in Events add-on no longer exists + event_name TINYTEXT NULL, -- Name of Event so it will always be in the cart data + event_code TINYTEXT NULL, -- A short code used to reference this event - can be used to directly select an event to register for + 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 + reg_hold_minutes MEDIUMINT NULL, -- Number of minutes hold time for an inactive cart before registrant count hold expires (after which cart attempts to hold again on next access) + cart_hold_days MEDIUMINT NULL, -- Number of days hold time for inactive cart before cart is purged + registration_account_options SMALLINT NULL, -- Bitmap of how user accounts may be used for this event - See registration_account_option in plugin.ini + payment_methods SMALLINT NULL, -- Bitmap of payment methods available to users for this event - See payment_method in plugin.ini + restricted_payment_methods SMALLINT NULL, -- Bitmap of restricted (admin use only) payment methods for this event - see payment_method + descr TEXT NULL, -- Registrations specific description field for this event + terms TEXT NULL, -- Terms and Conditions for registration + reg_file TINYTEXT NULL, -- Name of a downloadable file + reg_file_title TINYTEXT NULL, -- Title for downloadable file + form_revision SMALLINT NULL, -- Current MagicForm form revision + notes TEXT NULL, -- System operator's notes for this event - Not visible to users + PRIMARY KEY (id), + INDEX (event), + INDEX (event_code(10)) +); + +---- + +-- Registration Event Time - Information and summary data for a specific event instance (relates to a perticular time record in events) +-- A pseudo entry is created if registration is not date/time sensitive for this event. The pseudo entry does not point to an event time. +-- These are created the first time a person tries to register for an event instance (time) +-- One or more for each event +CREATE TABLE {prefix}reg_time ( + id INT NOT NULL AUTO_INCREMENT, + reg_event INT NULL, -- Pointer to reg_event table + event_time INT NULL, -- ID of events times table entry in Events add-on - If false (0), then this is a pseudo entry to use for all registrations (non-date/time specific) + start_datetime DATETIME NULL, -- Date and time when event instance starts - Informational - Actual events data is definitive + end_datetime DATETIME NULL, -- Date and time when event instance ends - Informational + all_day BOOLEAN NULL, -- All Day flag - Informational + attendees BOOLEAN NULL, -- Flag if tracking attendees or if only one per registration submission (registers account submitting) - get from reg_event + attendee_max MEDIUMINT NULL, -- Attendee count limit - 0 = unlimited - get from reg_event record + attendee_count MEDIUMINT NULL, -- Current attendee count - calculated on the fly and stored here for reference + attendees_pending MEDIUMINT NULL, -- Current number of attendees for this time in active pending carts (Not checked out and attendees slots held) + attendees_available MEDIUMINT NULL, -- Currently available attendee count (limit - current - pending) + total_base_charge DOUBLE NULL, -- Total base charges + total_per_attendee DOUBLE NULL, -- Total per-attendee charges + total_other DOUBLE NULL, -- Total other charges (meals, extras, fees, ...) + total_taxes DOUBLE NULL, -- Total taxes charged + total_charges DOUBLE NULL, -- Total charges (sum of all above) + total_discounts DOUBLE NULL, -- Total discounts of all types (applied payment codes, etc...) + total_payments DOUBLE NULL, -- Total net payments (total charges - total discounts) + descr TEXT NULL, -- Optional description field for this time entry + PRIMARY KEY (id), + INDEX (reg_event), + INDEX (event_time), + INDEX (start_datetime) +); + +---- + +-- Pending Attendees - In carts but not checked out +-- Attendee counts may be held for a particular reg_time entry for carts that have not been checked out +-- These are held for reg_event reg_hold_minutes, afterwhich they are timed out and removed from this table +-- Cart entries are given the ID's for these entries when a hold is requested, if the entry is gone, the hold has expired +CREATE TABLE {prefix}reg_time_pending ( + id INT NOT NULL AUTO_INCREMENT, + reg_event INT NULL, -- Pointer to reg_event table + reg_time INT NULL, -- ID of time record + expire_time DATETIME NULL, -- Time at which this hold expires + PRIMARY KEY (id), + INDEX (reg_event), + INDEX (reg_time) +); + +---- + +-- Registration Class - Type of registration for a specific event - Equates to "Rate Options" in the old system +-- One or more for each event +CREATE TABLE {prefix}reg_class ( + id INT NOT NULL AUTO_INCREMENT, + reg_event INT NULL, -- Pointer to reg_event table + name TINYTEXT NULL, -- Name of this registration type + descr TEXT NULL, -- Description + PRIMARY KEY (id), + INDEX (reg_event) +); + +---- + +-- Rates and dates for a particular reg_class +-- One or more per reg_class - **** Days should not overlap for a particular reg_class +CREATE TABLE {prefix}reg_rate ( + id INT NOT NULL AUTO_INCREMENT, + reg_event INT NULL, -- Pointer to reg_event table + reg_class INT NULL, -- Pointer to reg_class table + name TINYTEXT NULL, -- Namme of this rate + start_days INT NULL, -- # of days before event time rate becomes available - may be entered as a date then coverted for storage + end_days INT NULL, -- # of days before event time rate becomes unavailable + base_rate FLOAT, -- Base rate to register + per_registrant FLOAT, -- Rate per registrant + registrant_credits TINYINT NULL, -- Number of registrants included in base rate + PRIMARY KEY (id), + INDEX (reg_event), + INDEX (reg_class) +); + +---- + +-- An account for a person submitting a registration or a registrant for an event +-- Depending on the use of these entries may not have all data included +-- A single account may be referenced as a person submitting registrations and/or a person registered for an event +CREATE TABLE {prefix}account ( + id INT NOT NULL AUTO_INCREMENT, + active BOOLEAN NULL, -- Is active flag (may be accessed or used) - default is true + validated BOOLEAN NULL, -- Flag indicating that the account has been validated - Set to false when recovering password + validation_code TINYTEXT NULL, -- Validation code and timestamp ("{validation code}-{timestamp}) - Clear this after validation + registered_by INT NULL, -- Account + member_id TINYTEXT NULL, -- Free-form field for a member ID (not a GLM Associate member ID) + fname TINYTEXT NULL, -- Account primary address + lname TINYTEXT NULL, + org TINYTEXT NULL, + title TINYTEXT NULL, + addr1 TINYTEXT NULL, + addr2 TINYTEXT NULL, + city TINYTEXT NULL, + state TINYTEXT NULL, + zip TINYTEXT NULL, + country TINYTEXT NULL, + phone TINYTEXT NULL, + fax TINYTEXT NULL, + bill_fname TINYTEXT NULL, -- Last used billing information - Also stored in each registration request + bill_lname TINYTEXT NULL, + bill_org TINYTEXT NULL, + bill_title TINYTEXT NULL, + bill_addr1 TINYTEXT NULL, + bill_addr2 TINYTEXT NULL, + bill_city TINYTEXT NULL, + bill_state TINYTEXT NULL, + bill_zip TINYTEXT NULL, + bill_country TINYTEXT NULL, + bill_phone TINYTEXT NULL, + bill_fax TINYTEXT NULL, + email TINYTEXT NULL, + password TINYTEXT NULL, -- Crypted password for login back into this account + email_ok BOOLEAN NULL, + is_member BOOLEAN NULL, -- Is a member of the entity that owns the site + contact_id INT NULL, -- Pointer to GLM Associate member contact record if account is for a member contact + contact_fname TINYTEXT NULL, + contact_lname TINYTEXT NULL, + contact_org TINYTEXT NULL, + contact_title TINYTEXT NULL, + contact_addr1 TINYTEXT NULL, + contact_addr2 TINYTEXT NULL, + contact_city TINYTEXT NULL, + contact_state TINYTEXT NULL, + contact_zip TINYTEXT NULL, + contact_country TINYTEXT NULL, + contact_phone TINYTEXT NULL, + contact_fax TINYTEXT NULL, + contact_email TINYTEXT NULL, + contact_email_ok BOOLEAN NULL, + guardian TINYTEXT NULL, + emer_contact TINYTEXT NULL, + emer_phone TINYTEXT NULL, + med_history TINYTEXT NULL, + allergy_med TINYTEXT NULL, + date_created DATE NULL, + notes TEXT NULL, -- System operator's notes for this account - not visible to account owner + user_trace_info TINYTEXT NULL, -- IP Address of user computer and timestamp of last update + PRIMARY KEY (id), + INDEX (registered_by), + INDEX (member_id(10)), + INDEX (fname(10)), + INDEX (lname(10)), + INDEX (org(10)), + INDEX (city(10)), + INDEX (state(5)), + INDEX (zip(5)), + INDEX (email(10)), + INDEX (contact_id) +); + +---- + +-- A request for registration +-- Has one or more reg_detail records associated with it +CREATE TABLE {prefix}reg_request ( + id INT NOT NULL AUTO_INCREMENT, + account INT NULL, -- Pointer to user account (reg_account) who submitted the registrations. If 0 then guest request (prior to checkout) + validated BOOLEAN NULL, -- Flag that indicates if request passed last validation with checkRegistrationRequest() + validation_message TEXT NULL, -- Reasons that request did not pass validation with checkRegistrationRequest() - Serialized array + bill_fname TINYTEXT NULL, -- Billing information used for this registration submission - Updates account billing address - Kept here for each request + bill_lname TINYTEXT NULL, + bill_org TINYTEXT NULL, + bill_title TINYTEXT NULL, + bill_addr1 TINYTEXT NULL, + bill_addr2 TINYTEXT NULL, + bill_city TINYTEXT NULL, + bill_state TINYTEXT NULL, + bill_zip TINYTEXT NULL, + bill_country TINYTEXT NULL, + date_submitted DATE NULL, + pay_method INT NULL, -- See payment_method in plugin.ini + payment_code TINYTEXT NULL, -- Payment_code (code text) - if submitted and validated + status SMALLINT NULL, -- See submission_status in plugin.ini + total DOUBLE PRECISION NULL, -- Total charge including all fees and taxes + cc_type TINYINT NULL, -- Credit Card type (if used) - See credit_card in plugin.ini + cc_name TINYTEXT NULL, + cc_numb TINYTEXT NULL, + cc_exp TINYTEXT NULL, + cc_cvv TINYTEXT NULL, + cc_conf TINYTEXT NULL, -- Confirmation code back from card processor + summary TEXT NULL, -- HTML summary of cart contents, costs and payment - Use same HTML displayed to user + mf_data TEXT NULL, -- Any MagicForm data associated with registrant + notes TEXT NULL, -- System operator's notes for this registration request + user_trace_info TINYTEXT NULL, -- IP Address of user computer and timestamp + last_update DATETIME NULL, -- Last update date/time - Used for timing out pending carts and attendee counts + PRIMARY KEY (id), + INDEX (account), + INDEX (date_submitted) +); + +---- + +-- Registration for a specific event +-- Has one or more reg_selected_rate records associated with it +CREATE TABLE {prefix}reg_request_event ( + id INT NOT NULL AUTO_INCREMENT, + reg_request INT NULL, -- Pointer to reg_request table + reg_event INT NULL, -- Pointer to reg_event + event_name TINYTEXT NULL, -- Name of Event so it will always be in the cart data + event_datetime DATETIME NULL, -- Date and time of event time selected so it will always be in the cart + mf_data TEXT NULL, -- Any MagicForm data associated with requested event + notes TEXT NULL, -- System operator's notes for this registration request + PRIMARY KEY (id), + INDEX (reg_request), + INDEX (reg_event), + INDEX (reg_time) +); + +---- + +-- A particular reg_class selected +-- Has one or more reg_request_rate records associated with it +CREATE TABLE {prefix}reg_request_class ( + id INT NOT NULL AUTO_INCREMENT, + reg_event INT NULL, -- Pointer to reg_event entry + event_name TINYTEXT NULL, -- Name of Event so it will always be in the cart data + event_datetime DATETIME NULL, -- Date and time of event time selected so it will always be in the cart + reg_request INT NULL, -- Pointer to the registration request record + reg_request_event INT NULL, -- Pointer to reg_request_event table entry + class INT NULL, -- Pointer to event reg_class table - False (0) if registration class no longer exits + class_name TINYTEXT NULL, -- Name of event class at the time selected + mf_data TEXT NULL, -- Any MagicForm data associated with registrant + notes TEXT NULL, -- System operator's notes for this registration request + PRIMARY KEY (id), + INDEX (reg_event), + INDEX (reg_time), + INDEX (reg_request_event) +); + +---- + +-- A particular reg_rate selected +-- Has one or more reg_request_registrant records associated with it +CREATE TABLE {prefix}reg_request_rate ( + id INT NOT NULL AUTO_INCREMENT, + reg_event INT NULL, -- Pointer to reg_event entry + event_name TINYTEXT NULL, -- Name of Event so it will always be in the cart data + event_datetime DATETIME NULL, -- Date and time of event time selected so it will always be in the cart + reg_request INT NULL, -- Pointer to the registration request record + reg_request_event INT NULL, -- Pointer to reg_request_event table entry + reg_request_class INT NULL, -- Pointer to reg_request_class table entry + rate INT NULL, -- Pointer to event reg_rate table - False (0) if registration rate no longer exists + rate_name TINYTEXT NULL, -- Name of event class rate at the time selected + base_rate FLOAT, -- Base rate at time of registration + per_registrant FLOAT, -- Per Registrant Rate at time of registration + registrant_credits TINYINT NULL, -- Number of registrants included in base rate at time of registration + mf_data TEXT NULL, -- Any MagicForm data associated with registrant + notes TEXT NULL, -- System operator's notes for this registration request + PRIMARY KEY (id), + INDEX (reg_event), + INDEX (reg_time), + INDEX (reg_request_event), + INDEX (reg_request_class) +); + +---- + +-- A specific registrant for a selected registration rate +CREATE TABLE {prefix}reg_request_registrant ( + id INT NOT NULL AUTO_INCREMENT, + account INT NULL, -- Pointer to the account entry for the person being registered - False (0) if account no longer exists or registrant account not needed + reg_event INT NULL, -- Pointer to reg_event entry + event_name TINYTEXT NULL, -- Name of Event so it will always be in the cart data + reg_time INT NULL, -- Pointer reg_time entry + event_datetime DATETIME NULL, -- Date and time of event time selected so it will always be in the cart + reg_request INT NULL, -- Pointer to the registration request record + reg_request_event INT NULL, -- Pointer to reg_request_event table entry + reg_request_class INT NULL, -- Pointer to reg_request_class table entry + reg_request_rate INT NULL, -- Pointer to reg_request_rate table entry + fname TINYTEXT NULL, -- First name of registrant at the time of selection + lname TINYTEXT NULL, -- Last name of registrant at the time of selection + mf_data TEXT NULL, -- Any MagicForm data associated with registrant + notes TEXT NULL, -- System operator's notes for this registration request + PRIMARY KEY (id), + INDEX (account), + INDEX (reg_event), + INDEX (reg_time), + INDEX (reg_request), + INDEX (reg_request_event), + INDEX (reg_request_class), + INDEX (reg_request_rate) +); + +---- + +-- Insert into management table +INSERT INTO {prefix}management + ( + canonical_reg_page, + reg_org_name, + reg_org_short, + reg_org_address, + reg_org_city, + reg_org_state, + reg_org_zip, + reg_org_phone, + reg_org_toll_free, + reg_org_internal_email, + reg_org_from_email, + reg_payment_methods, + reg_proc_methods, + reg_cc_accepts, + reg_authorize_net_login, + reg_authorize_net_key, + reg_authorize_net_test, + reg_authorize_net_conf, + reg_authorize_net_merchant_email, + reg_merchant_solutions_acctid, + reg_merchant_solutions_merchantpin, + reg_merchant_solutions_test, + reg_full_billing_info, + reg_bill_info_req_no_charge, + reg_bill_info_req_comp_code, + reg_bill_info_req_cash, + reg_bill_info_req_check, + reg_bill_info_req_credit_card, + reg_bill_info_req_merchant_call, + reg_medical_info + ) + VALUES + ( + 'registrations', -- reg_canonical_reg_page, + 'Gaslight Media', -- reg_org_name, + 'GLM', -- reg_org_short, + '120 E. Lake St.', -- reg_org_address, + 'Petoskey', -- reg_org_city, + 'MI', -- reg_org_state, + '49770', -- reg_org_zip, + '231-487-0692', -- reg_org_phone, + '800-123-1234', -- reg_org_toll_free, + 'internal@gaslightmedia.com', -- reg_org_internal_email, + 'info@gaslightmedia.com', -- reg_org_from_email, + 0, -- reg_payment_methods, + 0, -- reg_proc_methods, + 0, -- reg_cc_accepts, + '', -- reg_authorize_net_login, + '', -- reg_authorize_net_key, + 1, -- reg_authorize_net_test, + true, -- reg_authorize_net_conf + '', -- reg_authorize_net_merchant_email, + '', -- reg_merchant_solutions_acctid, + '', -- reg_merchant_solutions_merchantpin, + 1, -- reg_merchant_solutions_test, + true, -- reg_full_billing_info, + 0, -- reg_bill_info_req_no_charge, + 0, -- reg_bill_info_req_comp_code, + 0, -- reg_bill_info_req_cash, + 0, -- reg_bill_info_req_check, + 0, -- reg_bill_info_req_credit_card, + 0, -- reg_bill_info_req_merchant_call, + true -- reg_medical_info, + ); + +---- + +-- Insert into settings_terms table +INSERT INTO {prefix}settings_terms + ( + reg_term_registrations_name, + reg_term_registration, + reg_term_registration_cap, + reg_term_registration_plur, + reg_term_registration_plur_cap, + reg_term_register, + reg_term_register_cap, + reg_term_registers, + reg_term_registering, + reg_term_registering_cap, + reg_term_registered, + reg_term_registered_cap, + reg_term_attendee, + reg_term_attendee_cap, + reg_term_attendee_plur, + reg_term_attendee_plur_cap, + reg_term_attending, + reg_term_attended, + reg_term_registered_user, + reg_term_registered_user_cap, + reg_term_registered_user_plur, + reg_term_registered_user_plur_cap, + reg_term_id, + reg_term_id_cap, + reg_term_id_plur, + reg_term_id_plur_cap, + reg_term_password, + reg_term_password_cap, + reg_term_password_plur, + reg_term_password_plur_cap, + reg_term_instructor, + reg_term_instructor_cap, + reg_term_instructor_plur, + reg_term_instructor_plur_cap, + reg_term_payment_code, + reg_term_payment_code_cap, + reg_term_payment_code_plur, + reg_term_payment_code_plur_cap, + reg_term_registration_button, + reg_term_contact_information + ) + VALUES + ( + 'Event Registrations', -- reg_term_registrations_name + 'registration', -- reg_term_registration + 'Registration', -- reg_term_registration_cap + 'registrations', -- reg_term_registration_plur + 'Registrations', -- reg_term_registration_plur_cap + 'register', -- reg_term_registe + 'Register', -- reg_term_register_cap + 'registers', -- reg_term_registers + 'registering', -- reg_term_registering + 'Registering', -- reg_term_registering_cap + 'registered', -- reg_term_registered + 'Registered', -- reg_term_registered_cap + 'attendee', -- reg_term_attendee + 'Attendee', -- reg_term_attendee_cap + 'attendees', -- reg_term_attendee_plur + 'Attendees', -- reg_term_attendee_plur_cap + 'attending', -- reg_term_attending + 'attended', -- reg_term_attended + 'user', -- reg_term_registered_user + 'User', -- reg_term_registered_user_cap + 'users', -- reg_term_registered_user_plur + 'Users', -- reg_term_registered_user_plur_cap + 'ID', -- reg_term_id + 'ID', -- reg_term_id_cap + 'IDs', -- reg_term_id_plur + 'IDs', -- reg_term_id_plur_cap + 'password', -- reg_term_password + 'passwords', -- reg_term_password_cap + 'Password', -- reg_term_password_plur + 'Passwords', -- reg_term_password_plur_cap + 'instructor', -- reg_term_instructor + 'Instructor', -- reg_term_instructor_cap + 'instructors', -- reg_term_instructor_plur + 'Instructors', -- reg_term_instructor_plur_cap + 'payment code', -- reg_term_payment_code + 'Payment code', -- reg_term_payment_code_cap + 'payment codes', -- reg_term_payment_code_plur + 'Payment codes', -- reg_term_payment_code_plur_cap + 'Register for Event', -- reg_term_registration_button + 'Contact Information' -- reg_term_contact_information + ); + +---- + +-- Insert into misc table +INSERT INTO {prefix}misc + ( + reg_bulletin, + cart_page_text, + checkout_page_text, + summary_page_text, + reg_terms, + notify_subject, + notify_text, + instr_notify_subject, + instr_notify_text, + submission_notify_subject, + submission_notify_text, + registrant_notify_subject, + registrant_notify_text, + submission_ack_subject, + submission_ack_text, + registrant_ack_subject, + registrant_ack_text + ) + VALUES + ( + 'Registration Bulletin Text', + 'Text for top of Cart Page', + 'Text for top of Checkout Page', + 'Text for top of Summary Page', + 'Terms and Conditions', + 'Subject of notification to site owner of a registration', + 'Text of notification to site owner of a registration', + 'Subject of notification to instructor of registration', + 'Text for notification to instructor of registration', + 'Subject of notification to person submitting registration', + 'Text of notification to person submitting registration', + 'Subject for notification to registrant', + 'Text for notification to registrant', + 'Subject of acknowledgement to person submitting registration', + 'Text of acknowledgement to person submitting registration', + 'Subject of acknowledgement to registrant', + 'Text of acknowledgement to registrant' + ); diff --git a/setup/databaseScripts/dbVersions.php b/setup/databaseScripts/dbVersions.php index d71e653..84e91bb 100644 --- a/setup/databaseScripts/dbVersions.php +++ b/setup/databaseScripts/dbVersions.php @@ -25,7 +25,8 @@ $glmMembersRegistrationsDbVersions = array( '0.0.9' => array('version' => '0.0.9', 'tables' => 19, 'date' => '04/24/2017'), '0.0.10' => array('version' => '0.0.10', 'tables' => 20, 'date' => '04/25/2017'), '0.0.11' => array('version' => '0.0.11', 'tables' => 20, 'date' => '04/29/2017'), - '0.0.12' => array('version' => '0.0.12', 'tables' => 20, 'date' => '09/11/2017') + '0.0.12' => array('version' => '0.0.12', 'tables' => 20, 'date' => '09/11/2017'), + '0.0.13' => array('version' => '0.0.13', 'tables' => 20, 'date' => '10/03/2017') ); diff --git a/setup/databaseScripts/drop_database_V0.0.12.sql b/setup/databaseScripts/drop_database_V0.0.12.sql deleted file mode 100644 index 92113cd..0000000 --- a/setup/databaseScripts/drop_database_V0.0.12.sql +++ /dev/null @@ -1,29 +0,0 @@ --- Gaslight Media Members Database --- File Created: 12/09/14 15:27:15 --- Database Version: 1.1.23 --- Database Deletion Script --- Note: Tables with DELETE CASCADE must appear before referenced table - -DROP TABLE IF EXISTS - {prefix}management, - {prefix}settings_terms, - {prefix}misc, - {prefix}added_info_fields, - {prefix}added_info_data, - {prefix}magicform, - {prefix}mf_data, - {prefix}mf_temp_file, - {prefix}payment_code, - {prefix}reg_event, - {prefix}reg_time, - {prefix}reg_time_pending, - {prefix}reg_class, - {prefix}reg_rate, - {prefix}account, - {prefix}reg_request, - {prefix}reg_request_event, - {prefix}reg_request_class, - {prefix}reg_request_rate, - {prefix}reg_request_registrant -; - diff --git a/setup/databaseScripts/drop_database_V0.0.13.sql b/setup/databaseScripts/drop_database_V0.0.13.sql new file mode 100644 index 0000000..92113cd --- /dev/null +++ b/setup/databaseScripts/drop_database_V0.0.13.sql @@ -0,0 +1,29 @@ +-- Gaslight Media Members Database +-- File Created: 12/09/14 15:27:15 +-- Database Version: 1.1.23 +-- Database Deletion Script +-- Note: Tables with DELETE CASCADE must appear before referenced table + +DROP TABLE IF EXISTS + {prefix}management, + {prefix}settings_terms, + {prefix}misc, + {prefix}added_info_fields, + {prefix}added_info_data, + {prefix}magicform, + {prefix}mf_data, + {prefix}mf_temp_file, + {prefix}payment_code, + {prefix}reg_event, + {prefix}reg_time, + {prefix}reg_time_pending, + {prefix}reg_class, + {prefix}reg_rate, + {prefix}account, + {prefix}reg_request, + {prefix}reg_request_event, + {prefix}reg_request_class, + {prefix}reg_request_rate, + {prefix}reg_request_registrant +; + diff --git a/setup/databaseScripts/update_database_V0.0.13.sql b/setup/databaseScripts/update_database_V0.0.13.sql new file mode 100644 index 0000000..193a284 --- /dev/null +++ b/setup/databaseScripts/update_database_V0.0.13.sql @@ -0,0 +1,57 @@ +-- Gaslight Media Members Database - Registratiuons Add-On +-- File Created: 10/03/17 11:00:00 +-- Database Version: 0.0.13 +-- 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_request_event DROP COLUMN account; + +---- + +ALTER TABLE {prefix}reg_request_event DROP COLUMN total_charge; + +---- + +ALTER TABLE {prefix}reg_request_event DROP COLUMN reg_time; + +---- + +ALTER TABLE {prefix}reg_request_class DROP COLUMN account; + +---- + +ALTER TABLE {prefix}reg_request_class DROP COLUMN total_class_charge; + +---- + +ALTER TABLE {prefix}reg_request_class DROP COLUMN reg_time; + +---- + +ALTER TABLE {prefix}reg_request_rate DROP COLUMN account; + +---- + +ALTER TABLE {prefix}reg_request_rate DROP COLUMN numb_registrants; + +---- + +ALTER TABLE {prefix}reg_request_rate DROP COLUMN total_registrant_charges; + +---- + +ALTER TABLE {prefix}reg_request_rate DROP COLUMN reg_time; + +---- + +ALTER TABLE {prefix}reg_request_registrant DROP COLUMN reg_request_registrant; + +---- + +ALTER TABLE {prefix}reg_request_registrant DROP COLUMN reg_request_hold; + +---- + +ALTER TABLE {prefix}reg_request_registrant DROP COLUMN reg_request_hold_not_available; diff --git a/views/admin/registrations/eventDashboard.html b/views/admin/registrations/eventDashboard.html index 20f7fc2..adeeb90 100644 --- a/views/admin/registrations/eventDashboard.html +++ b/views/admin/registrations/eventDashboard.html @@ -67,19 +67,46 @@
- {if $haveRegEvent} + {if $haveRegEvent}

Dates and Availability

+ + {if $regEvent.time_specific.value} +

*** NEED TO ADD POP-UP FOR EDITING OF MAX ATTENDEES AND ATTENDEE LIST FOR EACH DATE ***

+ +

Availability guide: (limit)-(registered)-(pending)-(available)

-
+
{else} -

Did not find selected event.

+

Event occurs every day from first day to last day at the times shown.

+ + {foreach $regEvent.recurrenceSummary as $rs} + + + {/foreach} + {foreach $regEvent.reg_time as $rt} + {if $rt.attendee_max == 0} + + {else} + + + + + + + {/if} + {/foreach} +
First Day of Event: {$rs.firstTime.start_time.datetime} - {$rs.firstTime.end_time.datetime}
Last Day of Event: {$rs.lastTime.start_time.datetime} - {$rs.lastTime.end_time.datetime}
Unlimited registration - Not maintaining available inventory.
 
Limited availability for this event - the below numbers are for all days. +
*** NEED TO ADD EDITING OF MAX ATTENDEES *** +
Maximum attendees: {$rt.attendee_max}
Registered: {$rt.attendee_count}
Attendees pending in carts: {$rt.attendees_pending}
Currently available: {$rt.attendees_available}
{/if} - + {else} +

Did not find selected event.

+ {/if}
@@ -88,38 +115,45 @@ var fullCalendarLoaded = false; - /* - * Initialize the Full Calendar - */ - function initFullCalendar(){ - $('#eventCalendar').fullCalendar({ - {if $haveRegEventTimes} - events: [ - {$sep = ''} - {foreach $regEvent.recurrences as $r} - {foreach $r['times'] as $t} - {$sep}{ - title : 'Event Calendar', - start : '{$t.start_time.datetime}', - end : '{$t.end_time.datetime}', - allday : {$t.all_day.value} - } - {$sep = ','} - {/foreach} - {/foreach} - ], - defaultDate : '{$regEventFirstTime.start_time.datetime}', - timeFormat : 'h:mma', - fixedWeekCount : false, - eventClick: function(calEvent, jsEvent, view) { - $("#occurrences").dialog(); - $(this).css('border-color', 'red'); - } - {/if} - }); - } + // If this is a time specific event, then display the calendar + if ({$regEvent.time_specific.value}) { + + /* + * Initialize the Full Calendar + */ + function initFullCalendar(){ + $('#eventCalendar').fullCalendar({ + {if $regEvent} + events: [ + {$sep = ''} + {foreach $regEvent.reg_time as $t} + {$sep}{ + {if $t.attendee_max == 0} + title : 'unlimited', + {else} + title : '{$t.attendee_max}-{$t.attendee_count}-{$t.attendees_pending}-{$t.attendees_available}', + {/if} + start : '{$t.start_datetime.datetime}', + end : '{$t.end_datetime.datetime}', + allday : {$t.all_day.value} + } + {$sep = ','} + {/foreach} + ], + defaultDate : '{$regEventFirstTime.start_time.datetime}', + timeFormat : 'h:mma', + fixedWeekCount : false, + eventClick: function(calEvent, jsEvent, view) { + $("#occurrences").dialog(); + $(this).css('border-color', 'red'); + } + {/if} + }); + } + + initFullCalendar(); - initFullCalendar(); + } // Flash certain elements for a short time after display $(".glm-flash-updated").fadeOut(500).fadeIn(500).fadeOut(500).fadeIn(500).fadeOut(500).fadeIn(500).fadeOut(500).fadeIn(500).fadeOut(500).fadeIn(500).fadeOut(500); diff --git a/views/front/registrations/registration.html b/views/front/registrations/registration.html index 3de4609..72c9cdd 100644 --- a/views/front/registrations/registration.html +++ b/views/front/registrations/registration.html @@ -1,4 +1,4 @@ -{* Event Registration App - Backbone.js *} +{* Even Registration App - Backbone.js *} {* Underscore Templates for the Event Registration App *} {* Template for Account Login *}{literal}