From e215fb81fe3c46cfe3094a2ca49fb733e0a15094 Mon Sep 17 00:00:00 2001 From: Chuck Scott Date: Mon, 7 May 2018 15:31:33 -0400 Subject: [PATCH] Various requested fixes and updates. Completed Attendee notifications and other minor fixes. Fixed "Show Completed Only" on attendee list to work at all times and default to on. Added request delete method to dataRegRequest that takes out related data Added cron driven task to delete old reg requests and reg accounts Better integration of notifications display to Evnet Registrations Dashboad Added actual class ID pointer output in dataRegRequestRegistrant.php Added custom field data for reg level to attendee edit Changed registrant and account hold days to management fields. Added "Not Attending" checkbox to atteendees list. Added getRegTimeSimplified() to dataRegTime.php Fixed Paging for Attendee list and added time selection to filter --- classes/data/dataManagement.php | 16 ++ classes/data/dataRegEvent.php | 4 +- classes/data/dataRegRequest.php | 179 +++++++++++++ classes/data/dataRegRequestRegistrant.php | 19 ++ classes/data/dataRegTime.php | 30 +++ classes/regCartSupport.php | 15 +- config/plugin.ini | 20 +- css/admin.css | 3 + defines.php | 2 +- index.php | 2 +- js/frontRegApp.js | 2 +- js/views/front/regTime.js | 2 +- models/admin/ajax/regAdmin/attendee.php | 77 +++++- models/admin/registrations/events.php | 12 +- .../events_notificationDisplay.php | 20 ++ .../registrations/events_registrants.php | 49 +++- models/admin/registrations/purgeOld.php | 164 ++++++++++++ models/admin/registrations/requests.php | 45 +++- .../admin/registrations/sendNotifications.php | 239 ++++++++++++++++-- .../front/registrations/checkoutProcess.php | 46 ++-- setup/adminHooks.php | 11 +- setup/adminMenus.php | 2 + ...0.0.28.sql => create_database_V0.0.29.sql} | 6 +- setup/databaseScripts/dbVersions.php | 7 +- ..._V0.0.28.sql => drop_database_V0.0.29.sql} | 0 .../update_database_V0.0.29.sql | 23 ++ setup/validActions.php | 3 +- views/admin/management/registrations.html | 14 + .../registrations/accountsDashboard.html | 10 +- views/admin/registrations/eventEdit.html | 2 + .../admin/registrations/eventEditLevels.html | 52 ++-- .../registrations/eventEditNotification.html | 53 +++- .../registrations/eventNotifications.html | 2 +- .../admin/registrations/eventRegistrants.html | 121 ++++++++- .../admin/registrations/eventsDashboard.html | 5 +- .../registrations/notificationDisplay.html | 14 + .../admin/registrations/requestDashboard.html | 80 +++++- .../registrations/requestsDashboard.html | 29 +++ 38 files changed, 1212 insertions(+), 168 deletions(-) create mode 100644 models/admin/registrations/events_notificationDisplay.php create mode 100644 models/admin/registrations/purgeOld.php rename setup/databaseScripts/{create_database_V0.0.28.sql => create_database_V0.0.29.sql} (98%) rename setup/databaseScripts/{drop_database_V0.0.28.sql => drop_database_V0.0.29.sql} (100%) create mode 100644 setup/databaseScripts/update_database_V0.0.29.sql create mode 100644 views/admin/registrations/notificationDisplay.html diff --git a/classes/data/dataManagement.php b/classes/data/dataManagement.php index 78b87c3..33cb40d 100644 --- a/classes/data/dataManagement.php +++ b/classes/data/dataManagement.php @@ -383,6 +383,22 @@ class GlmDataRegistrationsManagement extends GlmDataAbstract 'default' => 0 ), + // Registration Request Hold Days + 'reg_request_hold_days' => array ( + 'field' => 'reg_request_hold_days', + 'type' => 'integer', + 'use' => 'a', + 'default' => 0 + ), + + // Registration Account Hold Days + 'reg_account_hold_days' => array ( + 'field' => 'reg_account_hold_days', + 'type' => 'integer', + 'use' => 'a', + 'default' => 0 + ), + // Show additional navigation aids 'reg_show_navigation_aids' => array ( 'field' => 'reg_show_navigation_aids', diff --git a/classes/data/dataRegEvent.php b/classes/data/dataRegEvent.php index 0469982..4b3caf9 100644 --- a/classes/data/dataRegEvent.php +++ b/classes/data/dataRegEvent.php @@ -226,7 +226,7 @@ class GlmDataRegistrationsRegEvent extends GlmDataAbstract // 'default' => 60, See models/admin/registrations/events.php - Search for "Add event to registrations" 'use' => 'a' ), - +/* No longer in use - Now using defined parameter // Cart hold in days since last cart access - How long to retain a cart that has not checked and has had no access 'cart_hold_days' => array ( 'field' => 'cart_hold_days', @@ -235,7 +235,7 @@ class GlmDataRegistrationsRegEvent extends GlmDataAbstract // 'default' => 10, See models/admin/registrations/events.php - Search for "Add event to registrations" 'use' => 'a' ), - +*/ // Number of hours before an event that is the latest a registration may be submitted. 'reg_hours_before' => array ( 'field' => 'reg_hours_before', diff --git a/classes/data/dataRegRequest.php b/classes/data/dataRegRequest.php index b7a508b..c5b3a56 100644 --- a/classes/data/dataRegRequest.php +++ b/classes/data/dataRegRequest.php @@ -496,6 +496,185 @@ class GlmDataRegistrationsRegRequest extends GlmDataAbstract } + /** + * Delete a registration request + * + * This method does the following... + * * Deletes any holds on registration slots associated with this request + * * Restores inventory consumed by the registrants + * * Deletes any registrants included in this request + * * Deletes any rate selections included with this request + * * Deletes any class selections included with this request + * * Deletes any event selections included with this event + * * Deletes any accounts that were ONLY associated with this request + * * Deletes any use of payment codes in this request + * * Deletes the specified registration request record + * + * @param integer $id ID of registration request to delete + * + * @return boolean false if no errors, otherwise an error message + */ + public function deleteRegRequest($requestId = false) + { + + // Check that the request ID is valid + if (!$requestId) { + return false; + } + $requestId = $requestId - 0; + if ($requestId <= 0) { + return false; + } + $request = $this->getEntry($requestId); + if (!$request) { + return false; + } + + // Start a transaction + $this->wpdb->query('START TRANSACTION'); + + // For each registrant + $registrants = $this->wpdb->get_results(" + SELECT id, account, reg_time + FROM ".GLM_MEMBERS_REGISTRATIONS_PLUGIN_DB_PREFIX . "reg_request_registrant + WHERE reg_request = $requestId + ", ARRAY_A); + + if (is_array($registrants) && count($registrants) > 0) { + foreach ($registrants as $registrant) { + + // Delete holds in reg_time_pending for this registrant + if (false === $this->wpdb->get_results(" + DELETE FROM ".GLM_MEMBERS_REGISTRATIONS_PLUGIN_DB_PREFIX . "reg_time_pending + WHERE registrant = ".$registrant['id'] + )) { + $err = $this->wpdb->last_error; + $this->wpdb->query('ROLLBACK'); + return $err; + } + + // If request was submitted and inventory updated, restore inventory + $submittedStatus = array( 10, 30, 50, 60, 70 ); // See config/plugin.ini in registrations + if (in_array($request['status']['value'], $submittedStatus)) { + + $this->wpdb->query(" + UPDATE ".GLM_MEMBERS_REGISTRATIONS_PLUGIN_DB_PREFIX . "reg_time + SET attendee_count = attendee_count - 1, + attendees_available = attendees_available + 1 + WHERE id = ".$registrant['reg_time']." + "); + } + + // If registrant's account is not referenced by any other registrants or requests + $registrantAccountCount = $this->wpdb->get_var(" + SELECT count(id) + FROM ".GLM_MEMBERS_REGISTRATIONS_PLUGIN_DB_PREFIX . "reg_request_registrant + WHERE account = ".$registrant['account']." + "); + + $requestAccountCount = $this->wpdb->get_var(" + SELECT count(id) + FROM ".GLM_MEMBERS_REGISTRATIONS_PLUGIN_DB_PREFIX . "reg_request + WHERE account = ".$registrant['account']." + "); + + // If number of registrants with this account is 1 and there are no requests with this account, delete the account + if ($registrantAccountCount == 1 && $requestAccountCount == 0) { + + if (false === $this->wpdb->query(" + DELETE FROM ".GLM_MEMBERS_REGISTRATIONS_PLUGIN_DB_PREFIX . "account + WHERE id = ".$registrant['account'] + )) { + $err = $this->wpdb->last_error; + $this->wpdb->query('ROLLBACK'); + return $err; + } + + } + + // Delete this registrant + if (false === $this->wpdb->query(" + DELETE FROM ".GLM_MEMBERS_REGISTRATIONS_PLUGIN_DB_PREFIX . "reg_request_registrant + WHERE id = ".$registrant['id'] + )) { + $err = $this->wpdb->last_error; + $this->wpdb->query('ROLLBACK'); + return $err; + } + } + } + + // Delete all registration request rate entries for this request + if (false === $this->wpdb->query(" + DELETE FROM ".GLM_MEMBERS_REGISTRATIONS_PLUGIN_DB_PREFIX . "reg_request_rate + WHERE reg_request = $requestId" + )) { + $err = $this->wpdb->last_error; + $this->wpdb->query('ROLLBACK'); + return $err; + } + + // Delete all registration request class entries for this request + if (false === $this->wpdb->query(" + DELETE FROM ".GLM_MEMBERS_REGISTRATIONS_PLUGIN_DB_PREFIX . "reg_request_class + WHERE reg_request = $requestId" + )) { + $err = $this->wpdb->last_error; + $this->wpdb->query('ROLLBACK'); + return $err; + } + + // Delete all registration request event entries for this request + if (false === $this->wpdb->query(" + DELETE FROM ".GLM_MEMBERS_REGISTRATIONS_PLUGIN_DB_PREFIX . "reg_request_event + WHERE reg_request = $requestId" + )) { + $err = $this->wpdb->last_error; + $this->wpdb->query('ROLLBACK'); + return $err; + } + + // Check if account is not referenceed by any registrants or other requests + $registrantAccountCount = $this->wpdb->get_var(" + SELECT count(id) + FROM ".GLM_MEMBERS_REGISTRATIONS_PLUGIN_DB_PREFIX . "reg_request_registrant + WHERE account = ".$request['account']." + "); + $requestAccountCount = $this->wpdb->get_var(" + SELECT count(id) + FROM ".GLM_MEMBERS_REGISTRATIONS_PLUGIN_DB_PREFIX . "reg_request + WHERE account = ".$request['account']." + "); + + // If there's no other registrants and only 1 request with this account, we can delete it + if ($registrantAccountCount == 0 && $requestAccountCount == 1) { + if (false === $this->wpdb->query(" + DELETE FROM ".GLM_MEMBERS_REGISTRATIONS_PLUGIN_DB_PREFIX . "account + WHERE id = ".$request['account'] + )) { + $err = $this->wpdb->last_error; + $this->wpdb->query('ROLLBACK'); + return $err; + } + } + + // Now delete the request + if (false === $this->wpdb->query(" + DELETE FROM ".GLM_MEMBERS_REGISTRATIONS_PLUGIN_DB_PREFIX."reg_request + WHERE id = $requestId + ")) { + $err = $this->wpdb->last_error; + $this->wpdb->query('ROLLBACK'); + return $err; + } + + $this->wpdb->query('COMMIT'); + + return false; + + } + + } diff --git a/classes/data/dataRegRequestRegistrant.php b/classes/data/dataRegRequestRegistrant.php index faf296d..6eef86a 100644 --- a/classes/data/dataRegRequestRegistrant.php +++ b/classes/data/dataRegRequestRegistrant.php @@ -219,8 +219,27 @@ class GlmDataRegistrationsRequestRegistrant extends GlmDataAbstract 'use' => 'a' ), + // Not attending flag + 'not_attending' => array ( + 'field' => 'not_attending', + 'type' => 'checkbox', + 'use' => 'a' + ), + // Additional quick data + // Class ID + 'class_id' => array ( + 'field' => 'reg_request_class', + 'as' => 'class_id', + 'type' => 'pointer', + 'p_table' => GLM_MEMBERS_REGISTRATIONS_PLUGIN_DB_PREFIX . 'reg_request_class', + 'p_field' => 'class', + 'p_static' => true, + 'required' => true, + 'use' => 'lg' + ), + // Class Name 'class_name' => array ( 'field' => 'reg_request_class', diff --git a/classes/data/dataRegTime.php b/classes/data/dataRegTime.php index 53c41a9..9b7cd2f 100644 --- a/classes/data/dataRegTime.php +++ b/classes/data/dataRegTime.php @@ -255,6 +255,36 @@ class GlmDataRegistrationsRegTime extends GlmDataAbstract } + + /* + * Get simplified data + * + * @param string $where Where clause to select time entries + * @param string $order Order by + * + * @return array Simplified list of times + * + */ + public function getRegTimeSimplified($where = '', $order = false) + { + + $savedFields = $this->fields; + + $this->fields = array( + 'id' => $savedFields['id'], + 'active' => $savedFields['active'], + 'reg_event' => $savedFields['reg_event'], + 'start_datetime' => $savedFields['start_datetime'], + 'end_datetime' => $savedFields['end_datetime'] + ); + + $res = $this->getList($where, $order); + + $this->fields = $savedFields; + + return $res; + } + } ?> \ No newline at end of file diff --git a/classes/regCartSupport.php b/classes/regCartSupport.php index 94ea65a..7b3e3a5 100644 --- a/classes/regCartSupport.php +++ b/classes/regCartSupport.php @@ -1287,25 +1287,16 @@ class GlmRegCartSupport */ public function sendHtmlEmail( $to, $subject, $htmlMessage ) { - // change the default wordpress from name when sending mail - add_filter( - 'wp_mail_from_name', - function ( $name ) { - $siteName = get_bloginfo( 'name' ); - return $siteName; - } - ); + // Send confirmation email, set the content type to allow html by using this filter add_filter( 'wp_mail_content_type', array( $this, 'set_content_type' ) ); $message = $htmlMessage; - $header[] = 'From:' . $this->config['settings']['reg_org_from_email']; + $header[] = 'From:' . $this->config['settings']['reg_org_namel'].' <'.$this->config['settings']['reg_org_from_email'].'>'; $header[] = 'Reply-To:' . $this->config['settings']['reg_org_from_email']; wp_mail( $to, $subject, $message, $header ); - // remove the filter to avoid conflicts - remove_filter( 'wp_mail_content_type', array( $this, 'set_content_type' ) ); } /** @@ -1324,7 +1315,7 @@ class GlmRegCartSupport * * This method also removes holds associated with this request. * - * The reason inventory update and notify are both in this method is that they both + * The reason inventory update and notify are both in this method is that they both ********************************************************************* FIX WHEN DONE TESTING * happen at the same time and they both require walking through the cart data. * * @param string $summary HTML Summary of checkout for sending to owner and requesting address diff --git a/config/plugin.ini b/config/plugin.ini index 57ed5b7..0621b53 100644 --- a/config/plugin.ini +++ b/config/plugin.ini @@ -198,16 +198,16 @@ billing_field_numb['FAX'] = 12 ; ; Submission Status - Use as list only ; -submission_status[0] = 'CART' -submission_status[10] = 'COMPLETE' -submission_status[20] = 'UNPAID' -submission_status[30] = 'CC_PEND' -submission_status[40] = 'CC_DECL' -submission_status[50] = 'PAYMENT_PEND' -submission_status[60] = 'ON ARRIVAL' -submission_status[70] = 'ADMIN HOLD' -submission_status[80] = 'FAILED' -submission_status[99] = 'CANCELED' +submission_status[0] = 'In Cart' +submission_status[10] = 'Complete' +submission_status[20] = 'Unpaid' +submission_status[30] = 'Card Pending' +submission_status[40] = 'Card Declined' +submission_status[50] = 'Payment Pending' +submission_status[60] = 'On Arrival' +submission_status[70] = 'Administrative Hold' +submission_status[80] = 'Failed Submission' +submission_status[99] = 'Canceled' submission_status_numb['CART'] = 0 submission_status_numb['COMPLETE'] = 10 diff --git a/css/admin.css b/css/admin.css index 3ad99e3..a61a14d 100644 --- a/css/admin.css +++ b/css/admin.css @@ -54,6 +54,9 @@ margin-top: 1em; margin-left: 2em; } +.glm-reg-gray { + color: gray; +} diff --git a/defines.php b/defines.php index abd0fa5..b521cd8 100644 --- a/defines.php +++ b/defines.php @@ -75,4 +75,4 @@ define('GLM_MEMBERS_REGISTRATIONS_PLUGIN_LIB_PATH', GLM_MEMBERS_REGISTRATIONS_PL define('GLM_MEMBERS_REGISTRATIONS_PLUGIN_UPDATE_SERVER', 'http://www.gaslightmedia.com/update_server'); // Security Secret -define('GLM_MEMBERS_REGISTRATIONS_PLUGIN_SECRET', 'reGS3creTt!4THis'); \ No newline at end of file +define('GLM_MEMBERS_REGISTRATIONS_PLUGIN_SECRET', 'reGS3creTt!4THis'); diff --git a/index.php b/index.php index 0917906..e1d4db5 100644 --- a/index.php +++ b/index.php @@ -44,7 +44,7 @@ if (!defined('ABSPATH')) { * version from this plugin. */ define('GLM_MEMBERS_REGISTRATIONS_PLUGIN_VERSION', '0.0.1'); -define('GLM_MEMBERS_REGISTRATIONS_PLUGIN_DB_VERSION', '0.0.28'); +define('GLM_MEMBERS_REGISTRATIONS_PLUGIN_DB_VERSION', '0.0.29'); // 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.10.27'); diff --git a/js/frontRegApp.js b/js/frontRegApp.js index 7897b4c..ac1067b 100644 --- a/js/frontRegApp.js +++ b/js/frontRegApp.js @@ -996,7 +996,7 @@ app.Views.Front.RegTime = Backbone.View.extend({ return; } if ( email === '' ) { - var confAnsw = confirm( 'You have no email address! Are you sure you want to add this registrant?' ); + var confAnsw = confirm( 'You did not supply an Email address! Are you sure you want to add this registrant?' ); if ( !confAnsw ) { // Hide the loading graphic this.$('#loading-' + this.model.get('id') ).hide(); diff --git a/js/views/front/regTime.js b/js/views/front/regTime.js index a96fc2c..c4e9392 100644 --- a/js/views/front/regTime.js +++ b/js/views/front/regTime.js @@ -102,7 +102,7 @@ app.Views.Front.RegTime = Backbone.View.extend({ return; } if ( email === '' ) { - var confAnsw = confirm( 'You have no email address! Are you sure you want to add this registrant?' ); + var confAnsw = confirm( 'You did not supply and Email address! Are you sure you want to add this registrant?' ); if ( !confAnsw ) { // Hide the loading graphic this.$('#loading-' + this.model.get('id') ).hide(); diff --git a/models/admin/ajax/regAdmin/attendee.php b/models/admin/ajax/regAdmin/attendee.php index 7ce938e..8f587c4 100644 --- a/models/admin/ajax/regAdmin/attendee.php +++ b/models/admin/ajax/regAdmin/attendee.php @@ -1,7 +1,7 @@ fields; + $this->fields = array(); + $this->fields['id'] = $savedFields['id']; + $this->fields['not_attending'] = $savedFields['not_attending']; + $this->fields['reg_time'] = $savedFields['reg_time']; + $this->fields['reg_time_avail'] = array ( + 'field' => 'reg_time', + 'as' => 'reg_time_avail', + 'type' => 'pointer', + 'p_table' => GLM_MEMBERS_REGISTRATIONS_PLUGIN_DB_PREFIX . 'reg_time', + 'p_field' => 'attendees_available', + 'p_static' => true, + 'use' => 'g' + ); + + $registrantData = $this->getEntry($modelData['reg_id']); + $this->fields = $savedFields; + + $notAttending = ($modelData['not_attending'] == 'true'); + $notAvailable = false; + + // If Not attending was not set and we're asking for it now then back-out inventory + if (!$registrantData['not_attending']['value'] && $notAttending) { + $this->wpdb->query(" + UPDATE ".GLM_MEMBERS_REGISTRATIONS_PLUGIN_DB_PREFIX . "reg_time + SET attendee_count = attendee_count - 1, + attendees_available = attendees_available + 1 + WHERE id = ".$registrantData['reg_time']." + "); + } + + // If Not attending was set and we're asking for attending then grab inventory (if possible) + if ($registrantData['not_attending']['value'] && !$notAttending) { + if ($registrantData['reg_time_avail'] > 0) { + $this->wpdb->query(" + UPDATE ".GLM_MEMBERS_REGISTRATIONS_PLUGIN_DB_PREFIX . "reg_time + SET attendee_count = attendee_count + 1, + attendees_available = attendees_available - 1 + WHERE id = ".$registrantData['reg_time']." + "); + } else { + // Tell front-end that the inventory wasn't available + $notAvailable = true; + $notAttending = true; + } + } + $this->wpdb->update( GLM_MEMBERS_REGISTRATIONS_PLUGIN_DB_PREFIX . 'reg_request_registrant', array( + 'not_attending' => $notAttending, 'fname' => $modelData['fname'], 'lname' => $modelData['lname'], ), array( 'id' => $modelData['reg_id'] ), - '%s', + array( + '%d', + '%s', + '%s' + ), array( '%d' ) ); @@ -101,9 +154,12 @@ class GlmMembersAdmin_registrations_ajax_attendee // extends GlmDataRegistration 'id' => $modelData['reg_id'], 'fname' => $modelData['fname'], 'lname' => $modelData['lname'], + 'notAttending' => $notAttending, + 'notAvailable' => $notAvailable ); parse_str( $modelData['formData'], $queryParams ); + // Store the custom field data $_REQUEST = $queryParams; @@ -111,7 +167,16 @@ class GlmMembersAdmin_registrations_ajax_attendee // extends GlmDataRegistration apply_filters( 'glm-members-customfields-form-submit', '', - 'glm_reg_customfields_reg_event_attendee_' . $modelData['reg_event_id'], + 'glm_reg_customfields_reg_event_attendee_'.$modelData['reg_event_id'], + $modelData['reg_id'], + true + ); + + // Save the custom field data if custom fields plugin is on + apply_filters( + 'glm-members-customfields-form-submit', + '', + 'glm_reg_customfields_reg_event_'.$modelData['reg_event_id'].'_level_'.$modelData['reg_class_id'], $modelData['reg_id'], true ); diff --git a/models/admin/registrations/events.php b/models/admin/registrations/events.php index 32caa79..c39648f 100644 --- a/models/admin/registrations/events.php +++ b/models/admin/registrations/events.php @@ -125,11 +125,13 @@ class GlmMembersAdmin_registrations_events extends GlmDataRegistrationsRegEvent $classes = false; $haveRegistrants = false; $registrants = false; - $completed = false; + $completed = true; $errorMsg = false; $newEntry = false; $when = false; - + $haveTimes = false; + $times = false; + $notifications = ''; // Register the masked input script that we need for input controls wp_dequeue_script('glm-members-admin-maskedinput'); @@ -237,7 +239,11 @@ class GlmMembersAdmin_registrations_events extends GlmDataRegistrationsRegEvent 'completed' => $completed, 'errorMsg' => $errorMsg, 'newEntry' => $newEntry, - 'when' => $when + 'when' => $when, + 'haveTimes' => $haveTimes, + 'times' => $times, + 'selectedTime' => $selectedTime, + 'notifications' => $notifications ); // echo "
".print_r($templateData,1)."
"; diff --git a/models/admin/registrations/events_notificationDisplay.php b/models/admin/registrations/events_notificationDisplay.php new file mode 100644 index 0000000..51e4f4f --- /dev/null +++ b/models/admin/registrations/events_notificationDisplay.php @@ -0,0 +1,20 @@ + + * @license http://www.gaslightmedia.com Gaslightmedia + * @release events_dashboard.php,v 1.0 2014/10/31 19:31:47 cscott Exp $ + * @link http://dev.gaslightmedia.com/ + */ + +require_once GLM_MEMBERS_REGISTRATIONS_PLUGIN_PATH.'/models/admin/registrations/sendNotifications.php'; +$SendNotifications = new GlmMembersAdmin_registrations_sendNotifications($this->wpdb, $this->config); +$notifications = $SendNotifications->modelAction(false, true); + +$view = 'notificationDisplay'; diff --git a/models/admin/registrations/events_registrants.php b/models/admin/registrations/events_registrants.php index 58c03d6..41f5d06 100644 --- a/models/admin/registrations/events_registrants.php +++ b/models/admin/registrations/events_registrants.php @@ -13,6 +13,7 @@ * @link http://dev.gaslightmedia.com/ */ + $whereParts = array(); if (isset($_REQUEST['textSearch']) && trim($_REQUEST['textSearch'] != '')) { @@ -29,13 +30,43 @@ $Registrants = new GlmDataRegistrationsRequestRegistrant($this->wpdb, $this->con // Get the regEvent data $regEvent = $this->getEntry($regEventID); -// Filter for complete if given -if ( isset( $_REQUEST['complete'] ) && filter_var( $_REQUEST['complete'], FILTER_VALIDATE_BOOLEAN) ) { - $completed = true; - $whereParts[] = "T.reg_request in ( - SELECT id - FROM " . GLM_MEMBERS_REGISTRATIONS_PLUGIN_DB_PREFIX . "reg_request - WHERE status = {$this->config['submission_status_numb']['COMPLETE']})"; +// If time / date specific event, get all times for time selection picklist +if ($regEvent['time_specific']['value']) { + require_once GLM_MEMBERS_REGISTRATIONS_PLUGIN_CLASS_PATH.'/data/dataRegTime.php'; + $Times = new GlmDataRegistrationsRegTime($this->wpdb, $this->config); + $times = $Times->getRegTimeSimplified("T.reg_event = $regEventID", 'start_datetime'); + + if (is_array($times) && count($times) > 0) { + $haveTimes = true; + } +} + +// Filter for specific time +if (isset($_REQUEST['time'])) { + $selectedTime = filter_var( $_REQUEST['time'], FILTER_VALIDATE_INT); +} +if ($selectedTime) { + $whereParts[] = "T.reg_time = $selectedTime"; +} + +// Filter for not being in status CART +if (isset($_REQUEST['limit'])) { + $completed = filter_var( $_REQUEST['complete'], FILTER_VALIDATE_BOOLEAN); +} +if ($completed) { + $whereParts[] = " + ( + SELECT count(id) + FROM " . GLM_MEMBERS_REGISTRATIONS_PLUGIN_DB_PREFIX . "reg_request + WHERE id = T.reg_request + AND status NOT IN + ( + {$this->config['submission_status_numb']['CART']}, + {$this->config['submission_status_numb']['FAILED']}, + {$this->config['submission_status_numb']['CANCELED']} + ) + ) > 0 + "; } // Get list of all registrants for this event @@ -58,11 +89,11 @@ if ( isset( $_REQUEST['pageSelect'] ) ) { } } +// Check if custom fields add-on is active $customFieldsPluginActive = apply_filters( 'glm-members-customfields-plugin-active', false ); +// Get all of the registrant data $listResult = $Registrants->getFullRegistrantsData($regEventID, $where, $start, $limit); -// echo '
$listResult: ' . print_r( $listResult['list'], true ) . '
'; - // Get count of registrants listed $registrantCount = $listResult['totalCount']; diff --git a/models/admin/registrations/purgeOld.php b/models/admin/registrations/purgeOld.php new file mode 100644 index 0000000..2aea25a --- /dev/null +++ b/models/admin/registrations/purgeOld.php @@ -0,0 +1,164 @@ + + * @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 Registrations Request Data Class +require_once GLM_MEMBERS_REGISTRATIONS_PLUGIN_CLASS_PATH.'/data/dataRegRequest.php'; + +class GlmMembersAdmin_registrations_purgeOld extends GlmDataRegistrationsRegRequest +{ + + /** + * 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) + { + + if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG) { + trigger_error('Registrations Purge Old Called', E_USER_NOTICE); + } + + /* + * Purge old registration requests + * + * - Must be in status CART (never checked out) + * - Must not have been updated in "REQUEST HOLD DAYS" + * + */ + + // Calculate date earlier than which requests in CART status are purged + $requestPurgeDate = date('Y-m-d H:i:s', strtotime(date('Y-m-d H:i:s').' - '.$this->config['settings']['reg_request_hold_days'].' days')); + + + // Get all request IDs where status is CART and Updated is older thad cart_holddays in reg_event + $oldRequests = $this->wpdb->get_results(" + SELECT id + FROM ".GLM_MEMBERS_REGISTRATIONS_PLUGIN_DB_PREFIX . "reg_request + WHERE status = ".$this->config['submission_status_numb']['CART']." + AND last_update < '$requestPurgeDate' + ", ARRAY_A); + + // Purge these old requests + $requestsPurged = 0; + if (is_array($oldRequests) && count($oldRequests)> 0) { + foreach ($oldRequests as $request) { + $this->deleteRegRequest($request['id']); + $purged++; + } + } + + /* + * Purge old accounts that are not in use + * + * - Must be accounts that have not been validated + * - Must not have any reg_request or registrant referring to the account + * - Must have been created earlier than "ACCOUNT HOLD DAYS" + */ + + // Calculate date earlier than create date for accounts that aren't in use + $accountPurgeDate = date('Y-m-d H:i:s', strtotime(date('Y-m-d H:i:s').' - '.$this->config['settings']['reg_account_hold_days'].' days')); + + // Get accounts to purge + $oldAccounts = $this->wpdb->get_col(" + SELECT A.id + FROM ".GLM_MEMBERS_REGISTRATIONS_PLUGIN_DB_PREFIX . "account A + WHERE ( A.validated IS NOT true ) + AND A.date_created < '$accountPurgeDate' + AND ( + SELECT count(R.id) + FROM ".GLM_MEMBERS_REGISTRATIONS_PLUGIN_DB_PREFIX . "reg_request R + WHERE R.account = A.id + ) = 0 + AND ( + SELECT count(R.id) + FROM ".GLM_MEMBERS_REGISTRATIONS_PLUGIN_DB_PREFIX . "reg_request_registrant R + WHERE R.account = A.id + ) = 0 + "); + + // Purge these old Accounts + $oldAccountsIds = implode(',', $oldAccounts); + $accountsPurged = 0; + if ($oldAccountsIds != '') { + $this->wpdb->query(" + DELETE FROM ".GLM_MEMBERS_REGISTRATIONS_PLUGIN_DB_PREFIX . "account + WHERE id in($oldAccountsIds) + "); + $accountsPurged = count($oldAccounts); + } + + if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG) { + trigger_error("Registrations Purge Old: Requests = $requestsPurged, Accounts = $accountsPurged", E_USER_NOTICE); + } + + wp_die(); + } + +} diff --git a/models/admin/registrations/requests.php b/models/admin/registrations/requests.php index 4bc1f75..07d83b2 100644 --- a/models/admin/registrations/requests.php +++ b/models/admin/registrations/requests.php @@ -89,6 +89,10 @@ class GlmMembersAdmin_registrations_requests extends GlmDataRegistrationsRegRequ $haveCart = false; $option = 'dashboard'; $errorMsg = false; + $showCartRequests = false; + $where = ''; + $deleted = false; + $messages = array(); // Load registrations support class require_once GLM_MEMBERS_REGISTRATIONS_PLUGIN_CLASS_PATH.'/regCartSupport.php'; @@ -101,16 +105,6 @@ class GlmMembersAdmin_registrations_requests extends GlmDataRegistrationsRegRequ '1.0' ); - - - /* Test data */ - - /* Uncomment to create one complete sample registration request each time this action is called */ - // $regCartSupport->addTestData(); - - /* Uncomment to remove all registration data - *** WARNING - REMOVES ALL REQUEST DATA - NOT JUST TEST DATA *** */ - // $regCartSupport->removeRegistrationRequestData(); - // Check for option submitted if (isset($_REQUEST['option']) && $_REQUEST['option'] != '') { $option = $_REQUEST['option']; @@ -149,6 +143,24 @@ class GlmMembersAdmin_registrations_requests extends GlmDataRegistrationsRegRequ $cart = $regCartSupport->getRegistrationCart($requestID); + // If this is a delete request + if (isset($_REQUEST['delete']) && $_REQUEST['delete'] = 'true') { + + // Delete the entire request + require_once GLM_MEMBERS_REGISTRATIONS_PLUGIN_CLASS_PATH.'/data/dataRegRequest.php'; + $RegRequest = new GlmDataRegistrationsRegRequest($this->wpdb, $this->config); + $result = $RegRequest->deleteRegRequest($requestID); + + // If there's an error (not false return), add what's returned to the messages array + if ($result !== false) { + $messages[] = $result; + } else { + $deleted = true; + } + + } + + if ($cart) { $haveCart = true; } @@ -187,8 +199,16 @@ class GlmMembersAdmin_registrations_requests extends GlmDataRegistrationsRegRequ case 'dashboard': default: + // If this is a search form submission or paging button + if (isset($_REQUEST['limit'])) { + $showCartRequests = filter_var( $_REQUEST['showCartRequests'], FILTER_VALIDATE_BOOLEAN); + } + if (!$showCartRequests) { + $where = "T.status != {$this->config['submission_status_numb']['CART']}"; + } + // Get list of requests - $requests = $this->getList(); + $requests = $this->getList($where); if ($requests) { $haveRequests = true; } @@ -216,6 +236,9 @@ class GlmMembersAdmin_registrations_requests extends GlmDataRegistrationsRegRequ 'haveCart' => $haveCart, 'errorMsg' => $errorMsg, 'option' => $option, + 'deleted' => $deleted, + 'showCartRequests' => $showCartRequests, + 'messages' => $messages, 'regUrl' => GLM_MEMBERS_REGISTRATIONS_SITE_BASE_URL.$this->config['settings']['canonical_reg_page'].'/' ); // Return status, any suggested view, and any data to controller diff --git a/models/admin/registrations/sendNotifications.php b/models/admin/registrations/sendNotifications.php index 8c90131..4b13642 100644 --- a/models/admin/registrations/sendNotifications.php +++ b/models/admin/registrations/sendNotifications.php @@ -33,13 +33,6 @@ class GlmMembersAdmin_registrations_sendNotifications extends GlmDataRegistratio * @access public */ public $config; - /** - * Registrations Event ID - * - * @var $eventID - * @access public - */ - public $accountID = false; /** * Constructor @@ -85,13 +78,19 @@ class GlmMembersAdmin_registrations_sendNotifications extends GlmDataRegistratio } - public function modelAction($actionData = false) + // $notiicationTest to true to just display notification messages + public function modelAction($actionData = false, $notificationTest = false) { + if ($notificationTest) { + $notificationsOutput = ''; + } if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG) { trigger_error('Registrations Notifications Called', E_USER_NOTICE); } + $fromAddress = $this->config['settings']['reg_org_name'].' <'.$this->config['settings']['reg_org_from_email'].'>'; + // Get list of notifications for all active events $notifications = $this->wpdb->get_results( " @@ -112,7 +111,8 @@ class GlmMembersAdmin_registrations_sendNotifications extends GlmDataRegistratio // If there's notifications if ($notifications and is_array($notifications) && count($notifications) > 0) { - $event = false; + $processed = 0; + $noEmail = 0; // For each notification foreach ($notifications as $notification) { @@ -148,17 +148,19 @@ class GlmMembersAdmin_registrations_sendNotifications extends GlmDataRegistratio } $sql = " - SELECT A.fname, A.lname, A.email, E.event_name, E.first_Datetime, E.last_datetime, E.descr, - T.non_time_specific, T.start_datetime, T.end_datetime + SELECT A.fname, A.lname, A.email, E.event_name, E.first_datetime, E.last_datetime, E.descr, + T.non_time_specific, T.start_datetime, T.end_datetime, C.class_name FROM ".GLM_MEMBERS_REGISTRATIONS_PLUGIN_DB_PREFIX."reg_request_registrant R, ".GLM_MEMBERS_REGISTRATIONS_PLUGIN_DB_PREFIX."reg_request Q, ".GLM_MEMBERS_REGISTRATIONS_PLUGIN_DB_PREFIX."account A, ".GLM_MEMBERS_REGISTRATIONS_PLUGIN_DB_PREFIX."reg_time T, - ".GLM_MEMBERS_REGISTRATIONS_PLUGIN_DB_PREFIX."reg_event E + ".GLM_MEMBERS_REGISTRATIONS_PLUGIN_DB_PREFIX."reg_event E, + ".GLM_MEMBERS_REGISTRATIONS_PLUGIN_DB_PREFIX."reg_request_class C WHERE A.id = R.account AND Q.id = R.reg_request AND Q.status = ".$this->config['submission_status_numb']['COMPLETE']." AND T.id = R.reg_time + AND C.id = R.reg_request_class AND E.id = R.reg_event AND E.active AND E.id = ".$notification['reg_event']." @@ -168,23 +170,81 @@ class GlmMembersAdmin_registrations_sendNotifications extends GlmDataRegistratio "; $attendees = $this->wpdb->get_results($sql, ARRAY_A); -echo "
".print_r($attendees, 1)."
"; - // If there's any attendess to contact, process each if (is_array($attendees) && count($attendees) > 0) { foreach ($attendees as $attendee) { - echo "E-Mail for ".$attendee['fname']."
"; - - + // Only process attendees with valid E-Mail addresses + $email = filter_var($attendee['email'], FILTER_VALIDATE_EMAIL); + if ($email) { + + // Get correct event date & time + if ($attendee['non_time_specific']) { + + // Non date-time specific event + $date = date('m/d/Y', strtotime($attendee['first_datetime'])); + $endDate = date('m/d/Y', strtotime($attendee['last_datetime'])); + if ($date != $endDate) { + $date .= " through $endDate"; + } + $time = 'any time during the event'; + + } else { + + // Date-time specific event + $date = date('m/d/Y', strtotime($attendee['start_datetime'])); + $endDate = date('m/d/Y', strtotime($attendee['end_datetime'])); + if ($date != $endDate) { + $date .= ' through '.date('m/d/Y', strtotime($attendee['last_datetime'])); + } + $time = date('h:i A', strtotime($attendee['start_datetime'])); + $endTime = date('h:i A', strtotime($attendee['end_datetime'])); + if ($time != $endTime) { + $time .= " to $endTime"; + } + + } + + $viewData = array( + 'event_name' => stripslashes($attendee['event_name']), + 'first_name' => stripslashes($attendee['fname']), + 'last_name' => stripslashes($attendee['lname']), + 'level' => stripslashes($attendee['class_name']), + 'event_date' => $date, + 'event_time' => $time, + 'from_name' => stripslashes($this->config['settings']['reg_org_name']), + 'from_short_name' => stripslashes($this->config['settings']['reg_org_short']), + 'from_address' => stripslashes($this->config['settings']['reg_org_address']), + 'from_city' => stripslashes($this->config['settings']['reg_org_city']), + 'from_state' => stripslashes($this->config['settings']['reg_org_state']), + 'from_zip' => $this->config['settings']['reg_org_zip'], + 'from_phone' => $this->config['settings']['reg_org_phone'], + 'from_email' => $this->config['settings']['reg_org_from_email'] + ); + + // Send notification + $subjectLine = $this->generateHTML($viewData, stripslashes($notification['name']), true); + $emailMsg = $this->generateHTML($viewData, nl2br(stripslashes($notification['message'])), true); + + // If admin debug is on, display the messages rather than send them. + if ($notificationTest) { + $notificationsOutput = $this->displayEmailforTesting('Attendee Notification', $fromAddress, $email, $subjectLine, $emailMsg); + } else { + $this->sendHtmlEmail($fromAddress, $email, $subjectLine, $emailMsg); + } + + $processed++; + + } else { + $noEmail++; + } } } - - - } + } - + if ($notificationTest) { + return $notificationsOutput; } // This model does not return any data @@ -197,5 +257,142 @@ echo "
".print_r($attendees, 1)."
"; } + /** + * sendHtmlEmail + * + * Create html email and send using wp_mail. + * + * @param mixed $to To email address + * @param mixed $subject Subject line for the email + * @param mixed $htmlMessage Html message for the email + * + * @access public + * @return void + */ + public function sendHtmlEmail($from, $to, $subject, $htmlMessage) + { + + // Send confirmation email, set the content type to allow html by using this filter + add_filter( 'wp_mail_content_type', array( $this, 'set_content_type' ) ); + + + $message = $htmlMessage; + $header[] = 'From:' . $fromAddress; + $header[] = 'Reply-To:' . $this->config['settings']['reg_org_from_email']; + + wp_mail( $to, $subject, $message, $header ); + + } + + /** + * Output an E-Mail message to screen for testing + * + * @param $whatMsg string What message is being sent + * @param $to string To Address + * @param $subject string Subject Line + * @param $msg string Message body + * + * @return void + * + */ + function displayEmailforTesting($whatMsg, $from, $to, $subject, $msg) + { + + return ' +
+ + + + + + +
E-Mail Message:'.$whatMsg.'
From:'.htmlentities($from).'
To:'.$to.'
Subject:'.$subject.'
Body:'.$msg.'
+
+ '; + + } + + + /** + * Merge template and data to produce HTML + * + * Checks the theme's view directories and the view directories for + * this plugin for a matching view file. + * + * Note that $view needs to have the proper view directory path + * includes. (i.e. "/views/front/registrations/summary.html") + * + * $view may also be a template as a string if $viewIsString is true. + * + * @param $data array Array of data to merge with the template + * @param $view string Name of view file (see above)) + * @param $viewIsString boolean If true, $view is a string containing the view. + * + * @access public + * @return void + */ + function generateHTML($data, $view, $viewIsString = false) + { + + // Load Smarty Template support + $smarty = new smartyTemplateSupport(); + + // Add standard parameters + require GLM_MEMBERS_PLUGIN_SETUP_PATH.'/standardTemplateParams.php'; + + // Add data from model to Smarty template + if (is_array($data) && count($data) > 0) { + foreach ($data as $k => $d) { + $smarty->templateAssign($k, $d); + } + } + + + // If is supplied as a string + if ($viewIsString) { + + $out = $smarty->template->fetch('eval:'.$view); + + // Otherwise $view is a file name + } else { + + // Get the specified view file - check theme first + $viewPath = GLM_MEMBERS_PLUGIN_CURRENT_THEME_DIR."/views"; + $viewPath2 = GLM_MEMBERS_WORDPRESS_PLUGIN_PATH . "views"; // Save default + + // If the view is not found in the theme, fall back to views in the plugin + if (!is_file($viewPath.'/'.$view)) { + + // Next try the plugin/add-on + $viewPath = GLM_MEMBERS_REGISTRATIONS_PLUGIN_PATH . "/views"; + + if (!is_file($viewPath.'/'.$view)) { + + if (GLM_MEMBERS_PLUGIN_FRONT_DEBUG) { + trigger_error("Bad or missing view file when generating checkout HTML: $viewPath/$view", E_USER_NOTICE); + } + + } + + } + + // Update the Smarty view path + $smarty->template->setTemplateDir($viewPath); + + // If the view path doesn't match the default, add the default (using theme view) + if ($viewPath2 != $viewPath) { + $smarty->template->addTemplateDir($viewPath2); + } + + // Generate output from model data and view + $out = $smarty->template->fetch($view); + + } + + return $out; + + } + + } diff --git a/models/front/registrations/checkoutProcess.php b/models/front/registrations/checkoutProcess.php index 9b1601e..7fb2e45 100644 --- a/models/front/registrations/checkoutProcess.php +++ b/models/front/registrations/checkoutProcess.php @@ -137,7 +137,7 @@ class GlmMembersFront_registrations_checkoutProcess extends GlmRegCartSupport } // Check if cart has been successfully checked out or has been marked canceled. - if ($this->cart['request']['status']['name'] != 'CART') { + if ($this->cart['request']['status']['value'] != $this->config['submission_status_numb']['CART']) { $messages[] = "This request has already been submitted!
The information below is a summary of your submitted request."; @@ -577,10 +577,6 @@ class GlmMembersFront_registrations_checkoutProcess extends GlmRegCartSupport $now = date('Y-m-d H:i:s', time()); - // Account ID - $reqData['account'] = $accountId; - $reqFormat[] = '%d'; - // Add billing data to requesst update arrays $reqData = array_merge( $reqData, @@ -596,7 +592,7 @@ class GlmMembersFront_registrations_checkoutProcess extends GlmRegCartSupport 'bill_zip' => $billing['zip'], 'bill_country' => $billing['country'], 'bill_phone' => $billing['phone'], - 'bill_phone' => $regAccount['fieldData']['email'] + 'bill_email' => $regAccount['fieldData']['email'] ) ); $reqFormat = array_merge( @@ -620,52 +616,50 @@ class GlmMembersFront_registrations_checkoutProcess extends GlmRegCartSupport // Check if request to do a test checkout only - Don't clear session or update inventory $doNotClear = $_REQUEST['bill_addr2'] == '*** GLM DO NOT CLEAR ***'; + // User Trace data + $trace = array( + 'DateTime' => date('r'), + 'UserAddr' => $_SERVER['REMOTE_ADDR'], // IP address of user's computer + 'URI' => $_SERVER['REQUEST_URI'], // URI submitted to checkout + 'UserAgent' => $_SERVER['HTTP_USER_AGENT'], // User's browser user agent string + 'Referrer' => $_SERVER['HTTP_REFERER'], // Page user came from, should be our checkout page + 'Method' => $_SERVER['REQUEST_METHOD'] // Request method: GET, POST, ... + ); + // Save date, pay method, status, total if (count($messages) == '' && !$doNotClear) { $reqData = array_merge( $reqData, array( + 'account' => $accountId, 'date_submitted' => $now, + 'last_update' => $now, 'pay_method' => $payMethod, 'status' => $cartStatus, 'total' => $this->cart['totalCharges'], 'total_discounts' => $this->cart['totalDiscounts'], - 'registrants' => $this->cart['totalRegistrants'] + 'registrants' => $this->cart['totalRegistrants'], + 'user_trace_info' => serialize($trace) ) ); $reqFormat = array_merge( $reqFormat, array( + '%d', + '%s', '%s', '%d', '%d', '%f', '%f', - '%d' + '%d', + '%s' ) ); } - // Last update time - $reqData['last_update'] = $now; - $reqFormat[] = '%s'; - - // User Trace data - $trace = array( - 'DateTime' => date('r'), - 'UserAddr' => $_SERVER['REMOTE_ADDR'], // IP address of user's computer - 'URI' => $_SERVER['REQUEST_URI'], // URI submitted to checkout - 'UserAgent' => $_SERVER['HTTP_USER_AGENT'], // User's browser user agent string - 'Referrer' => $_SERVER['HTTP_REFERER'], // Page user came from, should be our checkout page - 'Method' => $_SERVER['REQUEST_METHOD'] // Request method: GET, POST, ... - ); - $reqData['user_trace_info'] = serialize($trace); - $reqFormat[] = '%s'; - - $reqFormat[] = '%s'; - // Store the data $updated = $this->wpdb->update( GLM_MEMBERS_REGISTRATIONS_PLUGIN_DB_PREFIX.'reg_request', diff --git a/setup/adminHooks.php b/setup/adminHooks.php index 170a2e4..6b97106 100644 --- a/setup/adminHooks.php +++ b/setup/adminHooks.php @@ -110,7 +110,16 @@ add_filter('glm_associate_cron_request', function($request) { 'menu' => 'registrations', // Menu where action exists 'action' => 'sendNotifications', // Name of action to run 'daysOfWeek'=> false, // All Days - 'times' => false, //array(3), // 3 AM ********************************************************************* FIX WHEN DONE TESTING + 'times' => array(3), // 3 AM (actually 3:30 since the GLM Associate cron runs on the half-hour) + 'params' => false // Any parameters needed by the triggered action + ); + + // Purge Old Data + $request[] = array( + 'menu' => 'registrations', // Menu where action exists + 'action' => 'purgeOld', // Name of action to run + 'daysOfWeek'=> false, // All Days + 'times' => array(4), // 4 AM (actually 4:30 since the GLM Associate cron runs on the half-hour) 'params' => false // Any parameters needed by the triggered action ); diff --git a/setup/adminMenus.php b/setup/adminMenus.php index d0fa0a3..b7e7f34 100644 --- a/setup/adminMenus.php +++ b/setup/adminMenus.php @@ -83,6 +83,7 @@ add_submenu_page( 'glm-members-admin-menu-registrations-accounts', function() {$this->controller('registrations', 'accounts');} ); +/* add_submenu_page( 'glm-members-admin-menu-members', $this->config['terms']['reg_term_registration_cap'].' Reports', @@ -91,3 +92,4 @@ add_submenu_page( 'glm-members-admin-menu-registrations-reports', function() {$this->controller('registrations', 'reports');} ); +*/ \ No newline at end of file diff --git a/setup/databaseScripts/create_database_V0.0.28.sql b/setup/databaseScripts/create_database_V0.0.29.sql similarity index 98% rename from setup/databaseScripts/create_database_V0.0.28.sql rename to setup/databaseScripts/create_database_V0.0.29.sql index 182d710..9b6a9fa 100644 --- a/setup/databaseScripts/create_database_V0.0.28.sql +++ b/setup/databaseScripts/create_database_V0.0.29.sql @@ -100,6 +100,8 @@ CREATE TABLE {prefix}management ( reg_bill_info_req_credit_card SMALLINT NULL, reg_bill_info_req_merchant_call SMALLINT NULL, -- Misc Options + reg_request_hold_days SMALLINT NULL, -- Number of days past last update that a request will be retained in "CART" status. + req_account_hold_days SMALLINT NULL, -- Number of days past last update that an account will be retained when there are no requests or registrants referring to it. reg_medical_info BOOLEAN NULL, -- This site can ask for "Medical Info" - set in main category of an event reg_show_navigation_aids BOOLEAN NULL, -- No, not marine navigational aids, this enables additional text, arrows, etc to direct a user to do something specific that would not normally be required. PRIMARY KEY (id) @@ -225,7 +227,7 @@ CREATE TABLE {prefix}reg_event ( 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 + cart_hold_days MEDIUMINT NULL, -- NO LONGER IN USE - Number of days hold time for inactive cart before cart is purged reg_hours_before MEDIUMINT NULL, -- Number of hours before an event that is the latest a registration may be submitted. 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 @@ -380,7 +382,7 @@ CREATE TABLE {prefix}account ( country TINYTEXT NULL, phone TINYTEXT NULL, fax TINYTEXT NULL, - bill_fname TINYTEXT NULL, -- Last used billing information - Also stored in each registration request + bill_fname TINYTEXT NULL, -- Last used billing infodeletermation - Also stored in each registration request bill_lname TINYTEXT NULL, bill_org TINYTEXT NULL, bill_title TINYTEXT NULL, diff --git a/setup/databaseScripts/dbVersions.php b/setup/databaseScripts/dbVersions.php index 7dae6f2..88444c0 100644 --- a/setup/databaseScripts/dbVersions.php +++ b/setup/databaseScripts/dbVersions.php @@ -30,8 +30,8 @@ $glmMembersRegistrationsDbVersions = array( '0.0.14' => array('version' => '0.0.14', 'tables' => 20, 'date' => '10/13/2017'), '0.0.15' => array('version' => '0.0.15', 'tables' => 15, 'date' => '10/18/2017'), '0.0.16' => array('version' => '0.0.16', 'tables' => 15, 'date' => '10/24/2017'), - '0.0.17' => array('version' => '0.0.17', 'tables' => 15, 'date' => '11/3/2017'), - '0.0.18' => array('version' => '0.0.18', 'tables' => 15, 'date' => '11/7/2017'), + '0.0.17' => array('version' => '0.0.17', 'tables' => 15, 'date' => '11/03/2017'), + '0.0.18' => array('version' => '0.0.18', 'tables' => 15, 'date' => '11/07/2017'), '0.0.19' => array('version' => '0.0.19', 'tables' => 15, 'date' => '11/22/2017'), '0.0.20' => array('version' => '0.0.20', 'tables' => 16, 'date' => '01/02/2018'), '0.0.21' => array('version' => '0.0.21', 'tables' => 17, 'date' => '01/08/2018'), @@ -41,7 +41,8 @@ $glmMembersRegistrationsDbVersions = array( '0.0.25' => array('version' => '0.0.25', 'tables' => 18, 'date' => '02/02/2018'), '0.0.26' => array('version' => '0.0.26', 'tables' => 18, 'date' => '03/27/2018'), '0.0.27' => array('version' => '0.0.27', 'tables' => 18, 'date' => '04/05/2018'), - '0.0.28' => array('version' => '0.0.28', 'tables' => 18, 'date' => '04/12/2018') + '0.0.28' => array('version' => '0.0.28', 'tables' => 18, 'date' => '04/12/2018'), + '0.0.29' => array('version' => '0.0.29', 'tables' => 18, 'date' => '05/04/2018') ); diff --git a/setup/databaseScripts/drop_database_V0.0.28.sql b/setup/databaseScripts/drop_database_V0.0.29.sql similarity index 100% rename from setup/databaseScripts/drop_database_V0.0.28.sql rename to setup/databaseScripts/drop_database_V0.0.29.sql diff --git a/setup/databaseScripts/update_database_V0.0.29.sql b/setup/databaseScripts/update_database_V0.0.29.sql new file mode 100644 index 0000000..fedf42b --- /dev/null +++ b/setup/databaseScripts/update_database_V0.0.29.sql @@ -0,0 +1,23 @@ +-- Gaslight Media Members Database - Registratiuons Add-On +-- File Updated: 2018-04-12 +-- Database Version: 0.0.29 +-- 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}management ADD COLUMN reg_request_hold_days BOOLEAN; + +---- + +ALTER TABLE {prefix}management ADD COLUMN reg_account_hold_days BOOLEAN; + +---- + +UPDATE {prefix}management SET reg_request_hold_days = 10 WHERE ID = 1; + +---- + +UPDATE {prefix}management SET reg_account_hold_days = 10 WHERE ID = 1; + + diff --git a/setup/validActions.php b/setup/validActions.php index 5bf8b7d..3443045 100644 --- a/setup/validActions.php +++ b/setup/validActions.php @@ -76,7 +76,8 @@ $glmMembersRegistrationsAddOnValidActions = array( 'requests' => GLM_MEMBERS_REGISTRATIONS_PLUGIN_SLUG, 'accounts' => GLM_MEMBERS_REGISTRATIONS_PLUGIN_SLUG, 'reports' => GLM_MEMBERS_REGISTRATIONS_PLUGIN_SLUG, - 'sendNotifications' => GLM_MEMBERS_REGISTRATIONS_PLUGIN_SLUG + 'sendNotifications' => GLM_MEMBERS_REGISTRATIONS_PLUGIN_SLUG, + 'purgeOld' => GLM_MEMBERS_REGISTRATIONS_PLUGIN_SLUG ), 'management' => array( 'registrations' => GLM_MEMBERS_REGISTRATIONS_PLUGIN_SLUG, diff --git a/views/admin/management/registrations.html b/views/admin/management/registrations.html index 5319d48..3b5db9c 100644 --- a/views/admin/management/registrations.html +++ b/views/admin/management/registrations.html @@ -254,6 +254,20 @@

Other General Options

+ + Incomplete Request Retention Days: + + + {if $regSettings.fieldFail.reg_request_hold_days}

{$regSettings.fieldFail.reg_request_hold_days}

{/if} + + + + Unused Account Retention Days: + + + {if $regSettings.fieldFail.reg_account_hold_days}

{$regSettings.fieldFail.reg_account_hold_days}

{/if} + + Display additional navigation aids diff --git a/views/admin/registrations/accountsDashboard.html b/views/admin/registrations/accountsDashboard.html index 2dc4e15..b36e7a5 100644 --- a/views/admin/registrations/accountsDashboard.html +++ b/views/admin/registrations/accountsDashboard.html @@ -25,8 +25,8 @@

Total found: {$numAccounts}  

{if $paging && $numAccounts} - - + + {/if} {if $hasAccounts} @@ -37,6 +37,7 @@ ID Member ID Active + Validated First Name Last Name E-Mail Address @@ -58,6 +59,7 @@ {$account.id} {$account.member_id} {$account.active.name} + {$account.validated.name} {$account.fname} {$account.lname} {$account.email} @@ -74,8 +76,8 @@ {/if} {if $paging && $numAccounts} - - + + {/if} diff --git a/views/admin/registrations/eventEdit.html b/views/admin/registrations/eventEdit.html index fb36c88..489d7a4 100644 --- a/views/admin/registrations/eventEdit.html +++ b/views/admin/registrations/eventEdit.html @@ -80,6 +80,7 @@ {if $regEvent.fieldFail.reg_hold_minutes}

{$regEvent.fieldFail.reg_hold_minutes}

{/if}
+ End of {$terms.reg_term_registration_cap}: diff --git a/views/admin/registrations/eventEditLevels.html b/views/admin/registrations/eventEditLevels.html index 40f993d..d5b910f 100644 --- a/views/admin/registrations/eventEditLevels.html +++ b/views/admin/registrations/eventEditLevels.html @@ -18,37 +18,37 @@ diff --git a/views/admin/registrations/requestsDashboard.html b/views/admin/registrations/requestsDashboard.html index e23df89..3d176c3 100644 --- a/views/admin/registrations/requestsDashboard.html +++ b/views/admin/registrations/requestsDashboard.html @@ -10,6 +10,31 @@ The name, organization, and other information are for the person sumbiting the request. Pending requests may not have this data.

+

+ + + + + +
+

+ + Show attendees in pending carts (not yet submitted): + + + + + + +

+
+
+
@@ -24,6 +49,8 @@ + + @@ -40,6 +67,8 @@ + + {/foreach} -- 2.17.1
Country Phone E-mailCreatedUpdated Status
{$r.bill_country} {$r.bill_phone} {$r.bill_email}{$r.date_created.datetime|substr:0:10}{$r.last_update.datetime|substr:0:10} {$r.status.name}