From f6afd12f846017e592028c25b23b2e1186a181b9 Mon Sep 17 00:00:00 2001 From: Chuck Scott Date: Thu, 2 Mar 2017 13:07:10 -0500 Subject: [PATCH] Interim commit while developing registrationsSupport.php Fixed error with wrong file name for database creation. Minor database update. Other comment and code cleanup. --- classes/data/dataRegRequest.php | 137 +++--- classes/registrationsSupport.php | 415 ++++++++++++++++++ config/plugin.ini | 4 + misc/documentation/DevelopmentOutline.txt | 12 +- models/admin/registrations/accounts.php | 6 +- .../registrations/{list.php => events.php} | 5 +- models/admin/registrations/requests.php | 180 ++++++++ setup/adminHooks.php | 17 + setup/adminMenus.php | 13 +- ..._V0.0.3.sql => create_database_V0.0.1.sql} | 4 +- setup/databaseScripts/dbVersions.php | 4 +- .../update_database_V0.0.2.sql | 67 --- .../update_database_V0.0.3.sql | 11 - setup/hooksHelp.html | 17 +- setup/validActions.php | 16 +- .../{edit.html => editAccount.html} | 1 - views/admin/registrations/editRequest.html | 25 ++ .../registrations/{list.html => events.html} | 2 +- views/admin/registrations/header.html | 7 +- views/admin/registrations/index.html | 2 +- views/admin/registrations/requests.html | 40 ++ 21 files changed, 778 insertions(+), 207 deletions(-) create mode 100644 classes/registrationsSupport.php rename models/admin/registrations/{list.php => events.php} (94%) create mode 100644 models/admin/registrations/requests.php rename setup/databaseScripts/{create_database_V0.0.3.sql => create_database_V0.0.1.sql} (99%) delete mode 100644 setup/databaseScripts/update_database_V0.0.2.sql delete mode 100644 setup/databaseScripts/update_database_V0.0.3.sql rename views/admin/registrations/{edit.html => editAccount.html} (99%) create mode 100644 views/admin/registrations/editRequest.html rename views/admin/registrations/{list.html => events.html} (73%) create mode 100644 views/admin/registrations/requests.html diff --git a/classes/data/dataRegRequest.php b/classes/data/dataRegRequest.php index b685f14..31ec304 100644 --- a/classes/data/dataRegRequest.php +++ b/classes/data/dataRegRequest.php @@ -24,7 +24,7 @@ * @release SVN: $Id: dataAddedInfoFields.php,v 1.0 2011/01/25 19:31:47 cscott * Exp $ */ -class GlmDataRegistrationsRequest extends GlmDataAbstract +class GlmDataRegistrationRequest extends GlmDataAbstract { /** @@ -107,7 +107,7 @@ class GlmDataRegistrationsRequest extends GlmDataAbstract */ $this->fields = array ( - + // ID 'id' => array ( 'field' => 'id', @@ -115,10 +115,10 @@ class GlmDataRegistrationsRequest extends GlmDataAbstract 'view_only' => true, 'use' => 'a' ), - + // Pointer to user account (table: account) who submitted the registrations 'account' => array ( - 'field' => 'contact_id', + 'field' => 'account', 'type' => 'pointer', 'p_table' => GLM_MEMBERS_REGISTRATIONS_PLUGIN_DB_PREFIX . 'account', 'p_field' => 'id', @@ -126,130 +126,115 @@ class GlmDataRegistrationsRequest extends GlmDataAbstract 'required' => true, 'use' => 'lgneud' ), - + 'bill_fname' => array ( 'field' => 'bill_fname', 'type' => 'text', - 'required' => false, 'use' => 'a' ), - - // + + // 'bill_lname' => array ( 'field' => 'bill_lname', 'type' => 'text', - 'required' => false, 'use' => 'a' ), - - // + + // 'bill_org' => array ( 'field' => 'bill_org', 'type' => 'text', - 'required' => false, 'use' => 'a' ), - - // + + // 'bill_title' => array ( 'field' => 'bill_title', 'type' => 'text', - 'required' => false, 'use' => 'a' ), - - // + + // 'bill_addr1' => array ( 'field' => 'bill_addr1', 'type' => 'text', - 'required' => false, 'use' => 'a' ), - - // + + // 'bill_addr2' => array ( 'field' => 'bill_addr2', 'type' => 'text', - 'required' => false, 'use' => 'a' ), - - // + + // 'bill_city' => array ( 'field' => 'bill_city', 'type' => 'text', - 'required' => false, 'use' => 'a' ), - - // + + // 'bill_state' => array ( 'field' => 'bill_state', 'type' => 'text', - 'required' => false, 'use' => 'a' ), - - // + + // 'bill_zip' => array ( 'field' => 'bill_zip', 'type' => 'text', - 'required' => false, 'use' => 'a' ), - - // + + // 'bill_country' => array ( 'field' => 'bill_country', 'type' => 'text', - 'required' => false, 'use' => 'a' ), - - // + + // 'date_submitted' => array ( 'field' => 'date_submitted', 'type' => 'datetime', 'use' => 'a' ), - - // See payment_method in plugin.ini + + // See payment_method in plugin.ini - used as list 'pay_method' => array ( 'field' => 'pay_method', - 'type' => 'bitmap', - 'bitmap' => $this->config['payment_methods'], - 'default' => 0, // none selected + 'type' => 'list', + 'list' => $this->config['payment_method'], + 'default' => $this->config['payment_method_numb']['Not Yet Defined'], 'use' => 'a' ), - + // Pointer to user account (table: account) who submitted the registrations 'payment_code' => array ( 'field' => 'payment_code', - 'type' => 'pointer', - 'p_table' => GLM_MEMBERS_REGISTRATIONS_PLUGIN_DB_PREFIX . 'payment_code', - 'p_field' => 'id', - 'p_static' => true, - 'required' => true, + 'type' => 'text', 'use' => 'lgneud' ), - + // See submission_status in plugin.ini 'status' => array ( 'field' => 'status', - 'type' => 'bitmap', - 'bitmap' => $this->config['submission_status'], - 'default' => 0, // none selected + 'type' => 'list', + 'list' => $this->config['submission_status'], + 'default' => $this->config['submission_status_numb']['CART'], 'use' => 'a' ), - + // Total charge including all fees and taxes 'total' => array ( 'field' => 'total', 'type' => 'money', - 'required' => false, 'use' => 'a' ), - + // Credit Card type (if used) - See credit_card in plugin.ini 'cc_type' => array ( 'field' => 'cc_type', @@ -258,87 +243,69 @@ class GlmDataRegistrationsRequest extends GlmDataAbstract 'default' => 0, // none selected 'use' => 'a' ), - - // + + // 'cc_name' => array ( 'field' => 'cc_name', 'type' => 'text', - 'required' => false, 'use' => 'a' ), - - // + + // 'cc_numb' => array ( 'field' => 'cc_numb', 'type' => 'text', - 'required' => false, 'use' => 'a' ), - - // + + // 'cc_exp' => array ( 'field' => 'cc_exp', 'type' => 'text', - 'required' => false, 'use' => 'a' ), - - // + + // 'cc_cvv' => array ( 'field' => 'cc_cvv', 'type' => 'text', - 'required' => false, 'use' => 'a' ), - + // Confirmation code back from card processor 'cc_conf' => array ( 'field' => 'cc_conf', 'type' => 'text', - 'required' => false, 'use' => 'a' ), - + // HTML summary of cart contents, costs and payment - Use same HTML displayed to user 'summary' => array ( 'field' => 'summary', 'type' => 'text', - 'required' => false, 'use' => 'a' ), - + // Any MagicForm data associated with registrant 'mf_data' => array ( 'field' => 'mf_data', 'type' => 'text', - 'required' => false, 'use' => 'a' ), - + // System operator's notes for this registration request 'notes' => array ( 'field' => 'notes', 'type' => 'text', - 'required' => false, 'use' => 'a' ), - + // IP Address of user computer and timestamp 'user_trace_info' => array ( 'field' => 'user_trace_info', 'type' => 'text', - 'required' => false, - 'use' => 'a' - ), - - // - '' => array ( - 'field' => '', - 'type' => '', - 'required' => '', 'use' => 'a' - ), - + ) ); } diff --git a/classes/registrationsSupport.php b/classes/registrationsSupport.php new file mode 100644 index 0000000..ebcb507 --- /dev/null +++ b/classes/registrationsSupport.php @@ -0,0 +1,415 @@ + + * @license http://www.gaslightmedia.com Gaslightmedia + * @release registratiosnSupport.php,v 1.0 2014/10/31 19:31:47 cscott Exp $ + * @link http://dev.gaslightmedia.com/ + */ + +/* + * This class provides some standard methods used by this plugin + */ +class GlmRegistrationsSupport +{ + + /** + * WordPress Database Object + * + * @var $wpdb + * @access public + */ + public $wpdb; + /** + * Plugin Configuration Data + * + * @var $config + * @access public + */ + public $config; + + /** + * Constructor + * + * @param object $d database connection + * @param array $config Configuration array + * @param bool $limitedEdit Flag to say indicate limited edit requested + * + * @return void + * @access public + */ + public function __construct($wpdb, $config) + { + + // If this class is not being extended along with existing $wpdb and $config + if (!$this->wpdb) { + + // Save WordPress Database object + $this->wpdb = $wpdb; + + // Save plugin configuration object + $this->config = $config; + + } + + } + + /* + * Retrieve a complete cart + * + * @param integer $requestID + * + * @return array Array of request and all associated information or false + * @access public + */ + public function getRegistrationCart($requestID = false) + { + + // Create return data array + $cart = array( + 'status' => false, // Return status, default to false, true if valid request returned + 'errorMsg' => '', // Any applicable error message + 'notes' => array(), // System generated notes regarding status of request + 'accounts' => array(), // Accounts associated with this request - both requesting and attending (might be the same) + // Index in this array is the account ID as used in data below + 'request' => false, // Request reccord + 'events' => false // Array of events with 'class', 'rate', 'registrant' data under each event + ); + + // Validate request ID + if (!$requestID || ($requestID-0) <= 0) { + return false; + } + + /* + * Base registration request + */ + + // Load Registration Requests data abstract + require_once GLM_MEMBERS_REGISTRATIONS_PLUGIN_CLASS_PATH.'/data/dataRegRequest.php'; + $RegRequest = new GlmDataRegistrationRequest($this->wpdb, $this->config); + + // Try to get the base registration request data + $cart['request'] = $RegRequest->getEntry($requestID); + + if (!$cart['request']) { + $cart['errorMsg'] = 'Unable to retrieve the requested registration request.'; + return $cart; + } + + /* + * Registration requested by + */ + + // Load Registration Requests data abstract + require_once GLM_MEMBERS_REGISTRATIONS_PLUGIN_CLASS_PATH.'/data/dataAccount.php'; + $Account = new GlmDataRegistrationsAccount($this->wpdb, $this->config); + + // Try to get the account record for the person who submitted (is submitting) the request + if ($cart['request']['account']) { + + // Get the the account ID of the person who submitted the request + $accountID = ($cart['request']['account'] - 0); + + // Make sure it's a positive integer + if (is_int($accountID) && $accountID > 0) { + + // Try to get account information + $account = $Account->getEntry($accountID); + + // If we found a good account, add that to the accounts list in the cart. + if ($account) { + $cart['accounts'][$account['id']] = $account; + } else { + $cart['notes'][] = 'Registration request does not have an account for the person submitting the request. (Guest registration?)'; + } + + } + + } + + return $cart; + + } + + + // Temporarily add test data + public function addTestData() + { + + // Event + $sql = " + INSERT INTO ".GLM_MEMBERS_REGISTRATIONS_PLUGIN_DB_PREFIX."reg_event + ( + event, + event_code, + active + ) + VALUES + ( + 0, + 'TEST-EVENT', + true + ) + ;"; + $this->wpdb->query($sql); + $regEventID = $this->wpdb->insert_id; + + // Event Registration Class + $sql = " + INSERT INTO ".GLM_MEMBERS_REGISTRATIONS_PLUGIN_DB_PREFIX."reg_class + ( + reg_event, + name, + descr + ) + VALUES + ( + $regEventID, + 'Admiral Class', + 'This is our Admiral Class registration level.' + ) + ;"; + $this->wpdb->query($sql); + $regClassID = $this->wpdb->insert_id; + + // Event Registration Rates + $sql = " + INSERT INTO ".GLM_MEMBERS_REGISTRATIONS_PLUGIN_DB_PREFIX."reg_rates + ( + reg_event, + reg_class, + start_days, + end_days, + base_rate, + per_registrant, + registrant_credits + ) + VALUES + ( + $regEventID, + $regCLassID, + 100, + 50, + 20, + 10, + 1 + ) + ;"; + $this->wpdb->query($sql); + $regRateID = $this->wpdb->insert_id; + + + // Account + $sql = " + INSERT INTO ".GLM_MEMBERS_REGISTRATIONS_PLUGIN_DB_PREFIX."account + ( + active, + fname + ) + VALUES + ( + true, + 'Chuck' + ) + ;"; + $this->wpdb->query($sql); + $accountID = $this->wpdb->insert_id; + + + // Registration Request + $sql = " + INSERT INTO ".GLM_MEMBERS_REGISTRATIONS_PLUGIN_DB_PREFIX."reg_request + ( + account, + bill_fname, + bill_lname, + bill_org, + bill_title, + bill_addr1, + bill_addr2, + bill_city, + bill_state, + bill_zip, + bill_country, + date_submitted, + pay_method, + payment_code, + status, + total, + cc_type, + cc_name, + cc_numb, + cc_exp, + cc_cvv, + cc_conf, + summary, + mf_data, + notes + ) + VALUES + ( + ".$accountID.", + 'Chuck', + 'Scott', + 'Gaslight Media', + 'Vice President', + '120 E. Lake St.', + '3rd Floor', + 'Petoskey', + 'MI', + '49770', + 'US', + '".date('Y-m-d')."', + ".$this->config['payment_method_numb']['Not Yet Defined'].", + 'NULL', + ".$this->config['submission_status_numb']['CART'].", + 100, + 'NULL', + 'NULL', + 'NULL', + 'NULL', + 'NULL', + 'NULL', + '

HTML SUMMARY

', + 'NULL', + 'Notes go here' + ) + ;"; + $this->wpdb->query($sql); + $requestID = $this->wpdb->insert_id; + +// **** NEED TO RECHECK EVERYTHING FROM HERE DOWN **** + + // Registration Request Event + $sql = " + INSERT INTO ".GLM_MEMBERS_REGISTRATIONS_PLUGIN_DB_PREFIX."reg_request_event + ( + account, + reg_request, + event, + event_time, + total_charge, + notes + ) + VALUES + ( + $accountID, + $requestID, + $regEventID, + 0, + 100, + '' + ) + ;"; + $this->wpdb->query($sql); + $requestEventID = $this->wpdb->insert_id; + + // Registration Request class + $sql = " + INSERT INTO ".GLM_MEMBERS_REGISTRATIONS_PLUGIN_DB_PREFIX."reg_request_class + ( + account, + event, + event_time, + reg_request, + reg_request_event, + total_class_charge, + mf_data, + notes + ) + VALUES + ( + $accountID, + regEventID, + 0, + $requestID, + $requestEventID, + 100, + '', + '' + ) + ;"; + $this->wpdb->query($sql); + $requestClassID = $this->wpdb->insert_id; + + + // Registration Request Rate + $sql = " + INSERT INTO ".GLM_MEMBERS_REGISTRATIONS_PLUGIN_DB_PREFIX."reg_request_class + ( + account, + event, + event_time, + reg_request, + reg_request_event, + total_class_charge, + mf_data, + notes + ) + VALUES + ( + $accountID, + regEventID, + 0, + $requestID, + $requestEventID, + 100, + '', + '' + ) + ;"; + $this->wpdb->query($sql); + $requestClassID = $this->wpdb->insert_id; + + + // Registration Request Registrant + $sql = " + INSERT INTO ".GLM_MEMBERS_REGISTRATIONS_PLUGIN_DB_PREFIX."reg_request_registrant + ( + account, + event, + event_time, + reg_request, + reg_request_event, + total_class_charge, + mf_data, + notes + ) + VALUES + ( + $accountID, + regEventID, + 0, + $requestID, + $requestEventID, + 100, + '', + '' + ) + ;"; + $this->wpdb->query($sql); + $requestClassID = $this->wpdb->insert_id; + + return; + + } + + public function removeTestData($testIDs) + { + + $this->wpdb->query("DELETE FROM ".GLM_MEMBERS_REGISTRATIONS_PLUGIN_DB_PREFIX."reg_request;"); + $this->wpdb->query("DELETE FROM ".GLM_MEMBERS_REGISTRATIONS_PLUGIN_DB_PREFIX."account;"); + $this->wpdb->query("DELETE FROM ".GLM_MEMBERS_REGISTRATIONS_PLUGIN_DB_PREFIX."reg_request_event;"); + + } + + +} diff --git a/config/plugin.ini b/config/plugin.ini index 9ab91c3..a2c58b8 100644 --- a/config/plugin.ini +++ b/config/plugin.ini @@ -30,6 +30,7 @@ registration_account_option['Member'] = 3 ; ; Payment Method - Use as Bitmap Index or List ; +payment_method[0] = 'Not Yet Defined' payment_method[1] = 'No Charge' payment_method[2] = 'Comp Code' payment_method[3] = 'Cash' @@ -37,6 +38,7 @@ payment_method[4] = 'Check' payment_method[5] = 'Credit Card' payment_method[6] = 'Call from Merchant' +payment_method_numb['Not Yet Defined'] = 0 payment_method_numb['No Charge'] = 1 payment_method_numb['Comp Code'] = 2 payment_method_numb['Cash'] = 3 @@ -155,6 +157,7 @@ billing_field_numb['FAX'] = 12 ; ; Submission Status - Use as list only ; +submission_status[0] = 'CART' submission_status[10] = 'UNPAID' submission_status[20] = 'CC_PEND' submission_status[30] = 'CC_PAID' @@ -169,6 +172,7 @@ submission_status[110] = 'OTHER_ADMIN' submission_status[120] = 'FAILED' submission_status[130] = 'CANCELED' +submission_status_numb['CART'] = 0 submission_status_numb['UNPAID'] = 10 submission_status_numb['CC_PEND'] = 20 submission_status_numb['CC_PAID'] = 30 diff --git a/misc/documentation/DevelopmentOutline.txt b/misc/documentation/DevelopmentOutline.txt index 6a36c90..7f64141 100644 --- a/misc/documentation/DevelopmentOutline.txt +++ b/misc/documentation/DevelopmentOutline.txt @@ -1,3 +1,8 @@ +Registration scenarios -Need to outline how this will work + Who can submit a registration, for who, and how they can be selected while entering a registration + For example, if there's an existing account that's been registered, how do we permit somone else so register that person for something? + + Registrations Add-On Work Items - Preliminary ADMIN @@ -13,8 +18,8 @@ ADMIN - Access by Managers only * Misc - Chuck - - Recall and update of Misc configurable text and flags + Chuck + DONE - Recall and update of Misc configurable text and flags - Accessed by Managers and Site owners * Support Classes @@ -56,12 +61,13 @@ ADMIN - List registration details for specific requests * Registration Accounts + - Accounts are specific persons who submit a registration requests - Associated with one or more registration requests - List, Edit (certain data) - List registrations submitted by an account -* Registrants +* Registrants - Uses same table as "Registration Accounts" above - People who are registered for an event - Associated with one or more registration events - List, Edit (certain data) diff --git a/models/admin/registrations/accounts.php b/models/admin/registrations/accounts.php index 7f26738..c0b264e 100644 --- a/models/admin/registrations/accounts.php +++ b/models/admin/registrations/accounts.php @@ -126,14 +126,14 @@ class GlmMembersAdmin_registrations_accounts extends GlmDataRegistrationsAccount } + $view = 'editAccount'; + switch ( $option ) { case 'add': - $view = 'edit'; $account = $this->newEntry(); break; case 'insert': - $view = 'edit'; $account = $this->insertEntry(); if ( $account['status'] ) { $accountAdded = true; @@ -143,7 +143,6 @@ class GlmMembersAdmin_registrations_accounts extends GlmDataRegistrationsAccount break; case 'edit': - $view = 'edit'; $account = $this->editEntry( $this->accountID ); //echo '
$account: ' . print_r( $account, true ) . '
'; if ( $account['status'] ) { @@ -167,7 +166,6 @@ class GlmMembersAdmin_registrations_accounts extends GlmDataRegistrationsAccount $accountUpdateError = true; } - $view = 'edit'; break; case 'delete': diff --git a/models/admin/registrations/list.php b/models/admin/registrations/events.php similarity index 94% rename from models/admin/registrations/list.php rename to models/admin/registrations/events.php index e47ea7f..3e8c90f 100644 --- a/models/admin/registrations/list.php +++ b/models/admin/registrations/events.php @@ -16,7 +16,7 @@ // Load Registrations data abstract // require_once GLM_MEMBERS_REGISTRATIONS_PLUGIN_CLASS_PATH.'/data/dataRegistrations.php'; -class GlmMembersAdmin_registrations_list // extends GlmDataRegistrations +class GlmMembersAdmin_registrations_events // extends GlmDataRegistrations { /** @@ -88,7 +88,6 @@ class GlmMembersAdmin_registrations_list // extends GlmDataRegistrations public function modelAction($actionData = false) { - // Compile template data $templateData = array( ); @@ -96,7 +95,7 @@ class GlmMembersAdmin_registrations_list // extends GlmDataRegistrations return array( 'status' => true, 'modelRedirect' => false, - 'view' => 'admin/registrations/list.html', + 'view' => 'admin/registrations/events.html', 'data' => $templateData ); diff --git a/models/admin/registrations/requests.php b/models/admin/registrations/requests.php new file mode 100644 index 0000000..46e8d62 --- /dev/null +++ b/models/admin/registrations/requests.php @@ -0,0 +1,180 @@ + + * @license http://www.gaslightmedia.com Gaslightmedia + * @release index.php,v 1.0 2014/10/31 19:31:47 cscott Exp $ + * @link http://dev.gaslightmedia.com/ + */ + +// Load Registration Requests data abstract +require_once GLM_MEMBERS_REGISTRATIONS_PLUGIN_CLASS_PATH.'/data/dataRegRequest.php'; + +class GlmMembersAdmin_registrations_requests extends GlmDataRegistrationRequest +{ + + /** + * WordPress Database Object + * + * @var $wpdb + * @access public + */ + public $wpdb; + /** + * Plugin Configuration Data + * + * @var $config + * @access public + */ + public $config; + + /** + * Constructor + * + * This contructor performs the work for this model. This model returns + * an array containing the following. + * + * 'status' + * + * True if successfull and false if there was a fatal failure. + * + * 'view' + * + * A suggested view name that the contoller should use instead of the + * default view for this model or false to indicate that the default view + * should be used. + * + * 'data' + * + * Data that the model is returning for use in merging with the view to + * produce output. + * + * @wpdb object WordPress database object + * + * @return array Array containing status, suggested view, and any data + */ + public function __construct ($wpdb, $config) + { + + // Save WordPress Database object + $this->wpdb = $wpdb; + + // Save plugin configuration object + $this->config = $config; + + /* + * Run constructor for the REgistrations data class + * + * Note, the third parameter is a flag that indicates to the Contacts + * data class that it should flag a group of fields as 'view_only'. + */ + parent::__construct(false, false, true); + + } + + public function modelAction($actionData = false) + { + + + $haveRequests = false; + $requests = false; + $haveRequest = false; + $requestID = false; + $requestCart = false; + $option = 'list'; + $errorMsg = false; + + // Load registrations support class + require_once GLM_MEMBERS_REGISTRATIONS_PLUGIN_CLASS_PATH.'/registrationsSupport.php'; + $regSupport = new GlmRegistrationsSupport($this->wpdb, $this->config); + + +// Test data +//$regSupport->addTestData(); +//$regSupport->removeTestData(); + + // Check for option submitted + if (isset($_REQUEST['option']) && $_REQUEST['option'] != '') { + $option = $_REQUEST['option']; + } + + // Check for registration request ID submitted for edit operation + if (isset($_REQUEST['requestID']) && $_REQUEST['requestID'] != '') { + $requestID = ($_REQUEST['requestID'] - 0); + } + + // Perform selected option + switch ($option) { + + // Display/Edit a registration request + case 'edit': + + // If a request ID has been supplied + if ($requestID) { + + // Try to get the complete cart for this request + $requestCart = $regSupport->getRegistrationCart($requestID); + + // If a valid cart was returned + if ($requestCart && $requestCart['status']) { + $haveRequest = true; + } else { + $errorMsg = $requestCart['errorMsg']; + } + + $view = 'editRequest.html'; + + break; + + } else { + $errorMsg = 'Invalid Registration Request ID supplied. Unable to view/edit selected request.'; + } + + // Fall through to list if no requestID submitted + + // Default is to list requests + default: + + // Get list of requests + $requests = $this->getList(); + if ($requests) { + $haveRequests = true; + } + + $view = 'requests.html'; + + break; + + } + +// Temporary debug info +$cart_r = print_r($requestCart,1); + + // Compile template data + $templateData = array( + 'haveRequests' => $haveRequests, + 'requests' => $requests, + 'haveRequest' => $haveRequest, + 'requestCart' => $requestCart, + 'errorMsg' => $errorMsg, + + 'cart_r' => $cart_r + ); + // Return status, any suggested view, and any data to controller + return array( + 'status' => true, + 'modelRedirect' => false, + 'view' => 'admin/registrations/'.$view, + 'data' => $templateData + ); + + + } + +} diff --git a/setup/adminHooks.php b/setup/adminHooks.php index 3f9c41d..9805205 100644 --- a/setup/adminHooks.php +++ b/setup/adminHooks.php @@ -25,3 +25,20 @@ * * Also note that parameters will be in the context of the main admin controller constructor. */ + +// Add hooksHelp.html file to admin Management hooks output +add_filter('glm-member-db-admin-management-hooksHelp', function($content) { + + // Read in this plugin/addon hook help file + $fname = GLM_MEMBERS_REGISTRATIONS_PLUGIN_PATH.'/setup/hooksHelp.html'; + if (is_file($fname)) { + $hooksHelp = file_get_contents($fname); + if ($hooksHelp != false) { + $content .= $hooksHelp; + } + } + return $content; + }, + 10, + 2 +); diff --git a/setup/adminMenus.php b/setup/adminMenus.php index e7fd00a..67d3f9a 100644 --- a/setup/adminMenus.php +++ b/setup/adminMenus.php @@ -64,8 +64,17 @@ add_submenu_page( 'Registration Events', '    Events', 'glm_members_members', - 'glm-members-admin-menu-registrations-list', - function() {$this->controller('registrations', 'list');} + 'glm-members-admin-menu-registrations-events', + function() {$this->controller('registrations', 'events');} +); + +add_submenu_page( + 'glm-members-admin-menu-members', + 'Registration Requests', + '    Requests', + 'glm_members_members', + 'glm-members-admin-menu-registrations-requests', + function() {$this->controller('registrations', 'requests');} ); add_submenu_page( 'glm-members-admin-menu-members', diff --git a/setup/databaseScripts/create_database_V0.0.3.sql b/setup/databaseScripts/create_database_V0.0.1.sql similarity index 99% rename from setup/databaseScripts/create_database_V0.0.3.sql rename to setup/databaseScripts/create_database_V0.0.1.sql index d5636c5..83f7c9b 100644 --- a/setup/databaseScripts/create_database_V0.0.3.sql +++ b/setup/databaseScripts/create_database_V0.0.1.sql @@ -446,7 +446,7 @@ CREATE TABLE {prefix}reg_request ( bill_country TINYTEXT NULL, date_submitted DATE NULL, pay_method INT NULL, -- See payment_method in plugin.ini - payment_code INT NULL, -- Pointer to payment_code - if submitted and validated + 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 @@ -493,6 +493,7 @@ CREATE TABLE {prefix}reg_request_class ( account INT NULL, -- Pointer to account (person submitting the registration) event INT NULL, -- Pointer to reg_event entry event_time INT NULL, -- Pointer to event_times table entry in Events add-on - To help with registrant searches + reg_request INT NULL, -- Pointer to the registration request record reg_request_event INT NULL, -- Pointer to reg_request_event table entry total_class_charge FLOAT, -- Last calculated total of all charges for this registration class for this request mf_data TEXT NULL, -- Any MagicForm data associated with registrant @@ -513,6 +514,7 @@ CREATE TABLE {prefix}reg_request_rate ( account INT NULL, -- Pointer to account (person submitting the registration) event INT NULL, -- Pointer to reg_event entry event_time INT NULL, -- Pointer to event_times table entry in Events add-on - To help with registrant searches + 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_base FLOAT, -- Base rate at time of registration diff --git a/setup/databaseScripts/dbVersions.php b/setup/databaseScripts/dbVersions.php index 602f2a3..25bea06 100644 --- a/setup/databaseScripts/dbVersions.php +++ b/setup/databaseScripts/dbVersions.php @@ -14,9 +14,7 @@ */ $glmMembersRegistrationsDbVersions = array( - '0.0.1' => array('version' => '0.0.1', 'tables' => 18, 'date' => '02/6/2017'), - '0.0.2' => array('version' => '0.0.2', 'tables' => 18, 'date' => '02/17/2017'), - '0.0.3' => array('version' => '0.0.3', 'tables' => 18, 'date' => '03/2/2017') + '0.0.1' => array('version' => '0.0.1', 'tables' => 18, 'date' => '03/2/2017') ); diff --git a/setup/databaseScripts/update_database_V0.0.2.sql b/setup/databaseScripts/update_database_V0.0.2.sql deleted file mode 100644 index acd8025..0000000 --- a/setup/databaseScripts/update_database_V0.0.2.sql +++ /dev/null @@ -1,67 +0,0 @@ --- Gaslight Media Members Database - Events Add-On --- File Created: 12/09/14 15:27:15 --- Database Version: 0.0.9 --- Database Update From Previous Version Script --- --- To permit each query below to be executed separately, --- all queries must be separated by a line with four dashses - - --- Change size of integer for bitmapped field. -ALTER TABLE {prefix}management MODIFY reg_payment_methods SMALLINT; - ----- - --- Change size of integer for bitmapped field. -ALTER TABLE {prefix}management MODIFY reg_proc_methods SMALLINT; - ----- - --- Change size of integer for bitmapped field. -ALTER TABLE {prefix}management MODIFY reg_cc_accepts SMALLINT; - ----- - --- Change size of integer for bitmapped field. -ALTER TABLE {prefix}management MODIFY reg_bill_info_req_no_charge SMALLINT; - ----- - --- Change size of integer for bitmapped field. -ALTER TABLE {prefix}management MODIFY reg_bill_info_req_comp_code SMALLINT; - ----- - --- Change size of integer for bitmapped field. -ALTER TABLE {prefix}management MODIFY reg_bill_info_req_cash SMALLINT; - ----- - --- Change size of integer for bitmapped field. -ALTER TABLE {prefix}management MODIFY reg_bill_info_req_check SMALLINT; - ----- - --- Change size of integer for bitmapped field. -ALTER TABLE {prefix}management MODIFY reg_bill_info_req_credit_card SMALLINT; - ----- - --- Change size of integer for bitmapped field. -ALTER TABLE {prefix}management MODIFY reg_bill_info_req_merchant_call SMALLINT; - ----- - --- Change size of integer for bitmapped field. -ALTER TABLE {prefix}reg_event MODIFY registration_account_options SMALLINT; - ----- - --- Change size of integer for bitmapped field. -ALTER TABLE {prefix}reg_event MODIFY payment_methods SMALLINT; - ----- - --- Change size of integer for bitmapped field. -ALTER TABLE {prefix}reg_event MODIFY restricted_payment_methods SMALLINT; - diff --git a/setup/databaseScripts/update_database_V0.0.3.sql b/setup/databaseScripts/update_database_V0.0.3.sql deleted file mode 100644 index 00c832b..0000000 --- a/setup/databaseScripts/update_database_V0.0.3.sql +++ /dev/null @@ -1,11 +0,0 @@ --- Gaslight Media Members Database - Events Add-On --- File Created: 3/01/17 10:01:16 --- Database Version: 0.0.3 --- Database Update From Previous Version Script --- --- To permit each query below to be executed separately, --- all queries must be separated by a line with four dashses - - --- Change size of integer for bitmapped field. -ALTER TABLE {prefix}management MODIFY numb_registrants TINYINT; diff --git a/setup/hooksHelp.html b/setup/hooksHelp.html index bbe0e75..b77f9ba 100644 --- a/setup/hooksHelp.html +++ b/setup/hooksHelp.html @@ -1,16 +1,3 @@ - -

Sample Add-On

- - User Permission Hooks - - - some_hook_name - FILTER or ACTION - - - What this hook does. - - - ---> \ No newline at end of file +

Registrations Add-On

diff --git a/setup/validActions.php b/setup/validActions.php index 5a3eaec..6913195 100644 --- a/setup/validActions.php +++ b/setup/validActions.php @@ -60,17 +60,19 @@ $glmMembersRegistrationsAddOnValidActions = array( 'adminActions' => array( 'registrations' => array( - 'index' => GLM_MEMBERS_REGISTRATIONS_PLUGIN_SLUG, - 'list' => GLM_MEMBERS_REGISTRATIONS_PLUGIN_SLUG, - 'accounts' => GLM_MEMBERS_REGISTRATIONS_PLUGIN_SLUG, + 'index' => GLM_MEMBERS_REGISTRATIONS_PLUGIN_SLUG, + 'list' => GLM_MEMBERS_REGISTRATIONS_PLUGIN_SLUG, + 'events' => GLM_MEMBERS_REGISTRATIONS_PLUGIN_SLUG, + 'accounts' => GLM_MEMBERS_REGISTRATIONS_PLUGIN_SLUG, + 'requests' => GLM_MEMBERS_REGISTRATIONS_PLUGIN_SLUG ), 'management' => array( - 'registrations' => GLM_MEMBERS_REGISTRATIONS_PLUGIN_SLUG, - 'regterms' => GLM_MEMBERS_REGISTRATIONS_PLUGIN_SLUG, + 'registrations' => GLM_MEMBERS_REGISTRATIONS_PLUGIN_SLUG, + 'regterms' => GLM_MEMBERS_REGISTRATIONS_PLUGIN_SLUG, ), 'settings' => array( - 'registrationsPaymentCode' => GLM_MEMBERS_REGISTRATIONS_PLUGIN_SLUG, - 'registrationsMisc' => GLM_MEMBERS_REGISTRATIONS_PLUGIN_SLUG, + 'registrationsPaymentCode' => GLM_MEMBERS_REGISTRATIONS_PLUGIN_SLUG, + 'registrationsMisc' => GLM_MEMBERS_REGISTRATIONS_PLUGIN_SLUG, ), ), 'frontActions' => array( diff --git a/views/admin/registrations/edit.html b/views/admin/registrations/editAccount.html similarity index 99% rename from views/admin/registrations/edit.html rename to views/admin/registrations/editAccount.html index 86a411f..f2d9c51 100644 --- a/views/admin/registrations/edit.html +++ b/views/admin/registrations/editAccount.html @@ -513,4 +513,3 @@ {include file='admin/footer.html'} - diff --git a/views/admin/registrations/editRequest.html b/views/admin/registrations/editRequest.html new file mode 100644 index 0000000..9fd144e --- /dev/null +++ b/views/admin/registrations/editRequest.html @@ -0,0 +1,25 @@ + +

Registration Request

+ +

Person submitting the registration: {$requestCart.request.bill_fname} (ID = {$requestCart.request.id})

+ +

+Info in registration request: +{if $requestCart.request.account} + {$requestCart.accounts.{$requestCart.request.account}.fname} +{else} + (No account) +{/if} + + +

+ +

Info from account of person who submitted the registration

+ +

Events selected:

+ + + +{include file='admin/footer.html'} + +
{$cart_r}
diff --git a/views/admin/registrations/list.html b/views/admin/registrations/events.html similarity index 73% rename from views/admin/registrations/list.html rename to views/admin/registrations/events.html index dffe41a..f32dffd 100644 --- a/views/admin/registrations/list.html +++ b/views/admin/registrations/events.html @@ -1,6 +1,6 @@ {include file='admin/registrations/header.html'} -

Registrations List Page

+

Registrations Events List

{include file='admin/footer.html'} diff --git a/views/admin/registrations/header.html b/views/admin/registrations/header.html index 1966b1a..ddbd628 100644 --- a/views/admin/registrations/header.html +++ b/views/admin/registrations/header.html @@ -1,8 +1,9 @@
-

All Events

+

Event Registrations

diff --git a/views/admin/registrations/index.html b/views/admin/registrations/index.html index da6c8f9..defc85d 100644 --- a/views/admin/registrations/index.html +++ b/views/admin/registrations/index.html @@ -1,6 +1,6 @@ {include file='admin/registrations/header.html'} -

Registrations Index Page

+

Registrations Dashboard

{include file='admin/footer.html'} diff --git a/views/admin/registrations/requests.html b/views/admin/registrations/requests.html new file mode 100644 index 0000000..5e3a229 --- /dev/null +++ b/views/admin/registrations/requests.html @@ -0,0 +1,40 @@ +{include file='admin/registrations/header.html'} + +{if $errorMsg} +

{$errorMsg}

+{/if} + +

Registrations Requests List

+ + + + + + + + + + + + + + {if $haveRequests} + {foreach $requests as $r} + + + + + + + + + {/foreach} + {else} + + {/if} + +
IDFirst NameLast NameOrgCityState
{$r.id}{$r.bill_fname}{$r.bill_lname}{$r.bill_org}{$r.bill_city}{$r.bill_state}
(no requests listed)
+ + +{include file='admin/footer.html'} + -- 2.17.1