From: Chuck Scott Date: Mon, 14 May 2018 13:22:50 +0000 (-0400) Subject: Critical updates to Registrations System X-Git-Tag: v1.0.0^2~14 X-Git-Url: http://cvs2.gaslightmedia.com/gitweb/?a=commitdiff_plain;h=d2dfbc011b4b7433b52c635c393ba0da965c88ce;p=WP-Plugins%2Fglm-member-db-registrations.git Critical updates to Registrations System Added time_specific to getSimpleRegEventsList() to have to reg events dashboard. Added time_specific output to reg events dashboard list. Fixed problem with reg event attendee totals after converting an event between time-specific and non-time-specific Fixed problem with non-time-specific time entry not being created when switching even from time-specific to non-time-specific Added AJAX process to display Authorize.net Verified Seal to avoid XXS complaint problem with Chrome. --- diff --git a/classes/data/dataRegEvent.php b/classes/data/dataRegEvent.php index 4b3caf9..adc873c 100644 --- a/classes/data/dataRegEvent.php +++ b/classes/data/dataRegEvent.php @@ -416,7 +416,7 @@ class GlmDataRegistrationsRegEvent extends GlmDataAbstract // If we're asked to get registrant counts if ($this->postProcAddRegistrantsCount) { - $counts = $this->getEventRegistrantCounts($result_data['id']); + $counts = $this->getEventRegistrantCounts($result_data['id'], $result_data['time_specific']); // If we have counts, add them to the result if ($counts && is_array($counts)) { @@ -432,19 +432,36 @@ class GlmDataRegistrationsRegEvent extends GlmDataAbstract * Get registrant count summary for an event * * @param integer $eventId ID of the reg_event record + * @param boolean $time_specific Flag for time-specific event * * @return array Summary array of event counts * */ - public function getEventRegistrantCounts($eventId = false) + public function getEventRegistrantCounts($eventId = false, $time_specific = false) { + if ($time_specific['value']) { +trigger_error("**** Time SPecific",E_USER_NOTICE); + $sql = " + SELECT SUM(attendee_max) AS total, SUM(attendee_count) AS registered, SUM(attendees_pending) AS cartHold, SUM(attendees_available) AS curAvail + FROM ".GLM_MEMBERS_REGISTRATIONS_PLUGIN_DB_PREFIX."reg_time + WHERE active + AND reg_event = $eventId + AND non_time_specific = false + "; + } else { +trigger_error("**** Not Time SPecific",E_USER_NOTICE); + $sql = " + SELECT SUM(attendee_max) AS total, SUM(attendee_count) AS registered, SUM(attendees_pending) AS cartHold, SUM(attendees_available) AS curAvail + FROM ".GLM_MEMBERS_REGISTRATIONS_PLUGIN_DB_PREFIX."reg_time + WHERE active + AND reg_event = $eventId + AND non_time_specific = true + "; + } + // Get sum of all attendee counts - $countsData = $this->wpdb->get_row(" - SELECT SUM(attendee_max) AS total, SUM(attendee_count) AS registered, SUM(attendees_pending) AS cartHold, SUM(attendees_available) AS curAvail - FROM ".GLM_MEMBERS_REGISTRATIONS_PLUGIN_DB_PREFIX."reg_time - WHERE reg_event = $eventId - ;", ARRAY_A); + $countsData = $this->wpdb->get_row($sql, ARRAY_A); $counts = array( 'total' => $countsData['total'], @@ -475,7 +492,6 @@ class GlmDataRegistrationsRegEvent extends GlmDataAbstract 'id' => $savedFields['id'], 'event_name' => $savedFields['event_name'], 'notify_email' => $savedFields['notify_email'], - 'blabla' => 1, 'descr' => $savedFields['descr'], 'first_datetime' => $savedFields['first_datetime'], 'last_datetime' => $savedFields['last_datetime'] @@ -642,6 +658,7 @@ class GlmDataRegistrationsRegEvent extends GlmDataAbstract 'id' => $fSave['id'], 'event' => $fSave['event'], 'event_name' => $fSave['event_name'], + 'time_specific' => $fSave['time_specific'], 'first_datetime' => $fSave['first_datetime'], 'last_datetime' => $fSave['last_datetime'] ); diff --git a/models/admin/ajax/getAuthorizeNetSeal.php b/models/admin/ajax/getAuthorizeNetSeal.php new file mode 100644 index 0000000..1b2451d --- /dev/null +++ b/models/admin/ajax/getAuthorizeNetSeal.php @@ -0,0 +1,83 @@ + + * @license http://www.gaslightmedia.com Gaslightmedia + * @version 0.1 + */ + +class GlmMembersAdmin_ajax_getAuthorizeNetSeal +{ + + /** + * WordPress Database Object + * + * @var $wpdb + * @access public + */ + public $wpdb; + /** + * Plugin Configuration Data + * + * @var $config + * @access public + */ + public $config; + + /* + * Constructor + * + * This contructor sets up this model. At this time that only includes + * storing away the WordPress data object. + * + * @return object Class object + * + */ + public function __construct ($wpdb, $config) + { + + // Save WordPress Database object + $this->wpdb = $wpdb; + + // Save plugin configuration object + $this->config = $config; + + // Run constructor for data class + // parent::__construct(false, false); + + } + + /* + * Perform Model Action + * + * This model returns the correct code to display the Verified Merchant Seal for Authorize.net + * + * This is to avoid the XSS Auditor in Chrome + * + * @param $actionData + * + * Echos Seal Code + */ + public function modelAction( $actionData = false ) + { + + $seal = $this->wpdb->get_var( " + SELECT reg_authorize_net_merchant_seal + FROM ".GLM_MEMBERS_REGISTRATIONS_PLUGIN_DB_PREFIX . "management + WHERE id = 1; + "); + echo html_entity_decode("
".$seal."

Click Seal to Test Verification.

"); + + wp_die(); + + } + + +} diff --git a/models/admin/registrations/events_eventDashboard.php b/models/admin/registrations/events_eventDashboard.php index 737d7ba..9431ba1 100644 --- a/models/admin/registrations/events_eventDashboard.php +++ b/models/admin/registrations/events_eventDashboard.php @@ -62,5 +62,6 @@ if ($regEvent !== false) { } } +// echo "
".print_r($regEvent,1)."
"; $view = 'eventDashboard'; diff --git a/models/admin/registrations/events_update.php b/models/admin/registrations/events_update.php index bbb7453..13048a9 100644 --- a/models/admin/registrations/events_update.php +++ b/models/admin/registrations/events_update.php @@ -13,6 +13,12 @@ * @link http://dev.gaslightmedia.com/ */ +// Get the current reg event type to check for change +$timeSpecific = $this->wpdb->get_var(" + SELECT time_specific + FROM ".GLM_MEMBERS_REGISTRATIONS_PLUGIN_DB_PREFIX . "reg_event + WHERE id = $regEventID +"); // Try to update the reg event $regEvent = $this->updateEntry($regEventID); @@ -20,6 +26,71 @@ $regEvent = $this->updateEntry($regEventID); // If there's some type of failure, flag that for the view file if ($regEvent['status']) { $regEventUpdated = true; + + // Now check to see if the type has been changed from Time specific to Non-Time specific + if ($timeSpecific && !$regEvent['fieldData']['time_specific']['value']) { + + // Changing to non-time=specific, so check if we need to create a time entry for that + $timeEntry = $this->wpdb->get_row(" + SELECT id + FROM ".GLM_MEMBERS_REGISTRATIONS_PLUGIN_DB_PREFIX . "reg_time + WHERE reg_event = $regEventID + AND non_time_specific + "); + + // If there isn't a non-time-specific time entry + if ($timeEntry === null) { + + // Create that now + $this->wpdb->insert( + GLM_MEMBERS_REGISTRATIONS_PLUGIN_DB_PREFIX . 'reg_time', + array( + 'reg_event' => $regEventID, + 'event_time' => 0, + 'all_day' => false, + 'attendees' => true, + 'attendee_max' => $regEvent['fieldData']['attendee_max'], + 'attendee_count' => 0, + 'attendees_pending' => 0, + 'attendees_available' => $regEvent['fieldData']['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, + 'active' => true, + 'non_time_specific' => true + ), + array( + '%d', + '%d', + '%d', + '%d', + '%d', + '%d', + '%d', + '%d', + '%f', + '%f', + '%f', + '%f', + '%f', + '%f', + '%f', + '%d', + '%d' + ) + ); + + // Now get the event data again so it will have the new time entry + $regEvent = $this->editEntry($regEventID); + + } + } + + } else { $regEventUpdateError = true; } diff --git a/setup/validActions.php b/setup/validActions.php index 3443045..689fff3 100644 --- a/setup/validActions.php +++ b/setup/validActions.php @@ -68,7 +68,8 @@ $glmMembersRegistrationsAddOnValidActions = array( 'updateAvailability' => GLM_MEMBERS_REGISTRATIONS_PLUGIN_SLUG, 'registrantsListExport' => GLM_MEMBERS_REGISTRATIONS_PLUGIN_SLUG, 'setupEventRegQueue' => GLM_MEMBERS_REGISTRATIONS_PLUGIN_SLUG, - 'runEventRegQueue' => GLM_MEMBERS_REGISTRATIONS_PLUGIN_SLUG + 'runEventRegQueue' => GLM_MEMBERS_REGISTRATIONS_PLUGIN_SLUG, + 'getAuthorizeNetSeal' => GLM_MEMBERS_REGISTRATIONS_PLUGIN_SLUG ), 'registrations' => array( 'index' => GLM_MEMBERS_REGISTRATIONS_PLUGIN_SLUG, diff --git a/views/admin/management/registrations.html b/views/admin/management/registrations.html index 3b5db9c..58d2c54 100644 --- a/views/admin/management/registrations.html +++ b/views/admin/management/registrations.html @@ -191,9 +191,7 @@ Verified Merchant Seal HTML: -
- {$regSettings.fieldData.reg_authorize_net_merchant_seal|unescape} -
+ {if $regSettings.fieldData.reg_authorize_net_merchant_seal != ''}
Click to test Seal
{/if}
This field is for HTML code that will display an authorized seal for the merchant's Authorized.net account. Once the correct HTML code is entered above, the seal should show to the left of this text. If that does not happen, @@ -385,6 +383,12 @@ $( document ).ready(function() { showSelectedCardProcessor(); }); + + $('#verifiedAuthorizeNetMerchantSeal').on('click', function() { + var sealUrl = '{$ajaxUrl}?action=glm_members_admin_ajax&glm_action=getAuthorizeNetSeal'; + window.open(sealUrl, '_blank', "width=300,height=200,menubar=no,scrollbars=no,location=no"); + return false; + }); }); diff --git a/views/admin/registrations/eventsDashboard.html b/views/admin/registrations/eventsDashboard.html index ffc5e00..5a34b77 100644 --- a/views/admin/registrations/eventsDashboard.html +++ b/views/admin/registrations/eventsDashboard.html @@ -44,6 +44,7 @@ ID {$terms.reg_term_event_cap} Name + Date Specific? Maximum
{$terms.reg_term_attendee_plur_cap} {$terms.reg_term_registered_cap} Cart
Hold @@ -69,6 +70,7 @@ {$r.event_name} + {if $r.time_specific.value}Yes{/if} {$r.total} {$r.registered} {$r.cartHold}