From: Chuck Scott Date: Thu, 11 Jan 2018 22:07:41 +0000 (-0500) Subject: Broke up models/admin/registrations/event.php and now have global and event discount... X-Git-Tag: v1.0.0^2~61 X-Git-Url: http://cvs2.gaslightmedia.com/gitweb/?a=commitdiff_plain;h=a29422f6161b2903e5f111cb0885bef63358a3b8;p=WP-Plugins%2Fglm-member-db-registrations.git Broke up models/admin/registrations/event.php and now have global and event discount codes working. --- diff --git a/classes/data/dataRegRequestPayCode.php b/classes/data/dataRegRequestPayCode.php index 38d24c7..3429ee8 100644 --- a/classes/data/dataRegRequestPayCode.php +++ b/classes/data/dataRegRequestPayCode.php @@ -148,7 +148,29 @@ class GlmDataRegistrationsRequestPayCode extends GlmDataAbstract 'use' => 'a' ), - // Current expire date - Now always getting from the payment_code table + // Ref Type (event, level, etc) + 'reg_type' => array( + 'field' => 'payment_code', + 'as' => 'ref_type', + 'type' => 'pointer', + 'p_table' => GLM_MEMBERS_REGISTRATIONS_PLUGIN_DB_PREFIX . 'payment_code', + 'p_field' => 'ref_type', + 'required' => true, + 'use' => 'lgneud' + ), + + // Ref Dest (event, level, etc ID) + 'reg_dest' => array( + 'field' => 'payment_code', + 'as' => 'ref_dest', + 'type' => 'pointer', + 'p_table' => GLM_MEMBERS_REGISTRATIONS_PLUGIN_DB_PREFIX . 'payment_code', + 'p_field' => 'ref_dest', + 'required' => true, + 'use' => 'lgneud' + ), + + // Expire date from the payment_code table 'expire_date' => array( 'field' => 'payment_code', 'as' => 'expire_date', @@ -282,7 +304,7 @@ class GlmDataRegistrationsRequestPayCode extends GlmDataAbstract $regPayCodes = $this->getList("T.reg_request = $requestId"); - if (!regPayCodes) { + if (!$regPayCodes) { return false; } diff --git a/classes/regCartSupport.php b/classes/regCartSupport.php index ae44e20..4a48686 100644 --- a/classes/regCartSupport.php +++ b/classes/regCartSupport.php @@ -665,7 +665,39 @@ class GlmRegCartSupport $haveEvents = true; // Check for event payment code + $this->cart['events'][$eventKey]['payCodes'] = array(); + if ($this->cart['payCodes']) { +echo "1"; + foreach ($this->cart['payCodes'] as $code) { +echo "2"; + $thisDiscount = 0; + if ($code['ref_type'] == $this->config['pay_code_ref_type_numb']['Event'] && + $code['ref_dest'] == $event['reg_event']) { +echo "3"; + switch ($code['code_type']) { + case 'Free': + $thisDiscount = $eventCharges; + $eventDiscounts = $totalCharges; + break; + + case 'Amount': + $thisDiscount = $code['amount']; + $eventDiscounts += $thisDiscount; + break; + + Case 'Percent': + $thisDiscount = ($eventCharges * ($code['amount']/100)); + $eventDiscounts += $thisDiscount; + break; + } + + $code['thisDiscount'] = $thisDiscount; + $this->cart['events'][$eventKey]['payCodes'][$code['id']] = $code; + } + } + } +echo "
".print_r($this->cart['events'][$eventKey]['payCodes'],1)."
"; // Save totals for this event $this->cart['events'][$eventKey]['eventRegistrants'] = $eventRegistrants; $this->cart['events'][$eventKey]['eventCharges'] = $eventCharges; @@ -685,7 +717,34 @@ class GlmRegCartSupport } // Each event // Check for global payment code + $this->cart['globalPayCodes'] = array(); + if ($this->cart['payCodes']) { + foreach ($this->cart['payCodes'] as $code) { + $thisDiscount = 0; + if ($code['ref_type'] == $this->config['pay_code_ref_type_numb']['Global']) { + switch ($code['code_type']) { + case 'Free': + $thisDiscount = $totalCharges; + $totalDiscounts = $totalCharges; + break; + + case 'Amount': + $thisDiscount = $code['amount']; + $totalDiscounts += $thisDiscount; + break; + + Case 'Percent': + $thisDiscount = ($totalCharges * ($code['amount']/100)); + $totalDiscounts += $thisDiscount; + break; + } + + $code['thisDiscount'] = $thisDiscount; + $this->cart['globalPayCodes'][$code['id']] = $code; + } + } + } } // Have events @@ -697,11 +756,24 @@ class GlmRegCartSupport $this->cart['totalRegistrants'] = $totalRegistrants; $this->cart['totalCharges'] = $totalCharges; $this->cart['totalDiscounts'] = $totalDiscounts; + $this->cart['grandTotal'] = $totalCharges - $totalDiscounts; // Update request last_update timestamp -// *** update cart last_update time + $this->wpdb->update( + GLM_MEMBERS_REGISTRATIONS_PLUGIN_DB_PREFIX.'reg_request', + array( + 'total' => $this->cart['grandTotal'], + 'total_discounts' => $this->cart['totalDiscounts'], + 'last_update' => current_time('mysql', 1) + ), + array( 'id' => $requestId ), + array( + '%f', + '%f', + '%s' + ) + ); - // Check if Event Time exists in Events add-on // echo "
".print_r($this->cart,1)."
"; diff --git a/models/admin/registrations/events.php b/models/admin/registrations/events.php index 6bfc3fa..3d2f61f 100644 --- a/models/admin/registrations/events.php +++ b/models/admin/registrations/events.php @@ -78,6 +78,8 @@ class GlmMembersAdmin_registrations_events extends GlmDataRegistrationsRegEvent public function modelAction($actionData = false) { + // *** Need to move the parameters below to their appropriate sub-model file *** + $messages = array(); $option = 'dashboard'; $view = false; @@ -118,6 +120,7 @@ class GlmMembersAdmin_registrations_events extends GlmDataRegistrationsRegEvent $havePayCodes = false; $payCodes = false; $newPayCode = false; + $refPaycodeType = false; $classes = false; $haveRegistrants = false; $registrants = false; @@ -154,591 +157,33 @@ class GlmMembersAdmin_registrations_events extends GlmDataRegistrationsRegEvent } + // Check for invalid reg event id, otherwise store the good one if (!$regEventID || $regEventID <= 0) { $regEventID = false; + } else { + update_option('glmMembersDatabaseRegistrationsRegEventID', $regEventID); } - if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG) { - trigger_error("Registration Events: Admin option = $option ", E_USER_NOTICE); + /* + * Load the proper sub-model file to perform the select $option + */ + $modelFile = $option; + if ($option == 'add' || $option == 'edit') { + $modelFile = 'addEdit'; } - switch ($option) { - - case 'paymentCodes': - - require_once GLM_MEMBERS_REGISTRATIONS_PLUGIN_CLASS_PATH.'/data/dataPaymentCode.php'; - $PayCode = new GlmDataRegistrationsPaymentCode($this->wpdb, $this->config); - - if (isset($_REQUEST['option2']) && $_REQUEST['option2'] != '') { - switch($_REQUEST['option2']) { - - case 'new': - $PayCode->insertEntry(); - break; - - case 'update': - $payCodeId = ($_REQUEST['payCodeId'] - 0); - $x = $PayCode->updateEntry($payCodeId); - break; - - case 'delete': - $payCodeId = ($_REQUEST['payCodeId'] - 0); - if ( $payCodeId > 0 ) { - $PayCode->deleteEntry( $payCodeId, true ); - } - break; - } - } - - $newPayCode = $PayCode->newEntry(); - - // *** NEED TO FIX ref_type to include other possible one for events - $payCodes = $PayCode->getList("T.ref_type = 20 AND T.ref_dest = $regEventID"); - - if ($payCodes) { - $havePayCodes = true; - } - - $regEvent = $this->getEntry($regEventID); - - $view = 'eventPaymentCodes'; - - break; - - case 'notificationsUpdate': - - // New and updated notifications - if (isset($_REQUEST['name']) && is_array($_REQUEST['name'])) { - - foreach ($_REQUEST['name'] as $key=>$val) { - - // Make sure key is positive integer - $id = ($key-0); - if ($id > 0) { - - // Update existing entry - $this->wpdb->update( - GLM_MEMBERS_REGISTRATIONS_PLUGIN_DB_PREFIX.'reg_notification', - array( - 'name' => $_REQUEST['name'][$id], - 'notification_days' => $_REQUEST['notification_days'][$id], - 'message' => $_REQUEST['message'][$id] - ), - array( 'id' => $id ), - array( '%s', '%d', '%s' ), - array( '%d' ) - ); - - // Otherwise if the id is less than 0 it must be a new one - } elseif ($id < 0) { - - // Insert a new entry - $this->wpdb->insert( - GLM_MEMBERS_REGISTRATIONS_PLUGIN_DB_PREFIX.'reg_notification', - array( - 'reg_event' => $regEventID, - 'name' => $_REQUEST['name'][$id], - 'notification_days' => $_REQUEST['notification_days'][$id], - 'message' => $_REQUEST['message'][$id] - ), - array( '%d', '%s', '%d', '%s' ) - ); - } - } - } - - // Delete Notifications - if (isset($_REQUEST['delete']) && is_array($_REQUEST['delete'])) { - - $ids = ''; - foreach ($_REQUEST['delete'] as $key=>$val) { - - // Make sure key is positive integer - $id = ($key-0); - if ($id > 0) { - $this->wpdb->delete( GLM_MEMBERS_REGISTRATIONS_PLUGIN_DB_PREFIX.'reg_notification', array( 'ID' => $id ), array( '%d' ) ); - } - - } - } - - - $regNotifyUpdated = true; - - // Fall through to get the data again - - case 'notifications': - - require_once GLM_MEMBERS_REGISTRATIONS_PLUGIN_CLASS_PATH.'/data/dataRegNotification.php'; - $Notifications = new GlmDataRegistrationsRegNotification($this->wpdb, $this->config); - - $regNotifications = $Notifications->getList("T.reg_event = $regEventID", 'notification_days'); - - $regEvent = $this->getEntry($regEventID); - - $view = 'eventNotifications'; - - break; - - case 'registrants': - - $whereParts = array(); - - if (isset($_REQUEST['textSearch']) && trim($_REQUEST['textSearch'] != '')) { - $textSearch = trim($_REQUEST['textSearch']); - $whereParts[] = "concat( T.fname, ' ', T.lname) LIKE '%".$textSearch."%'"; - - // Clean up for use in redisplaying search value - $textSearch = stripslashes($textSearch); - } - - require_once GLM_MEMBERS_REGISTRATIONS_PLUGIN_CLASS_PATH.'/data/dataRegRequestRegistrant.php'; - $Registrants = new GlmDataRegistrationsRequestRegistrant($this->wpdb, $this->config); - - // 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']})"; - } - - // Get list of all registrants for this event - $where = implode( ' AND ', $whereParts ); - - // Check if we're doing paging - if ( isset( $_REQUEST['pageSelect'] ) ) { - - // If request is for Next - if ( $_REQUEST['pageSelect'][0] == 'N' ) { - $newStart = $_REQUEST['nextStart'] - 0; - - // Otherwise it must be Previous - } else { - $newStart = $_REQUEST['prevStart'] - 0; - } - - if ($newStart > 0) { - $start = $newStart; - } - } - - $customFieldsPluginActive = apply_filters( 'glm-members-customfields-plugin-active', false ); - - $listResult = $Registrants->getFullRegistrantsData($regEventID, $where, $start, $limit); - // echo '
$listResult: ' . print_r( $listResult['list'], true ) . '
'; - - // Get count of registrants listed - $registrantCount = $listResult['totalCount']; - - // If the number of registrants is less than a page, don't do paging - if ($registrantCount <= $limit) { - // $paging = false; - } - - // Get paging results - $numbDisplayed = $listResult['returned']; - $lastDisplayed = $listResult['last']; - if ($start == 1) { - $prevStart = false; - } else { - $prevStart = $start - $limit; - if ($start < 1) { - $start = 1; - } - } - if ($listResult['returned'] == $limit) { - $nextStart = $start + $limit; - } - $registrants = $listResult['list']; - - $success = true; - $haveRegistrants = false; - if ($registrants !== false) { - - $success = true; - - // If we have any entries - if (count($registrants) > 0) { - $haveRegistrants = true; - } - } - // echo "
".print_r($registrants,1)."
"; - - $view = 'eventRegistrants'; - - break; - - case 'eventCustomFields': - - require_once GLM_MEMBERS_REGISTRATIONS_PLUGIN_CLASS_PATH.'/data/dataRegClass.php'; - $RegClasses = new GlmDataRegistrationsRegClass($this->wpdb, $this->config); - $classes = $RegClasses->getList("T.reg_event = $regEventID"); - - $regEvent = $this->getEntry($regEventID); - - $view = 'eventEditCustomFields'; - - break; - - case 'configureEvent': - - $scripts = array( - 'backbone-local' => 'js/lib/backbone.localStorage.min.js', - 'regApp' => 'js/adminRegApp.js', - ); - foreach ( $scripts as $scriptName => $scriptPath ) { - wp_register_script( - $scriptName, - GLM_MEMBERS_REGISTRATIONS_PLUGIN_URL . $scriptPath, - array( 'jquery', 'backbone', 'underscore' ), - '1.0', - true - ); - } - wp_enqueue_script( array( 'jquery', 'backbone' ) ); - wp_enqueue_script( array_keys( $scripts ) ); - $regEvent = array(); - - // Get all current registration event data - $regEvent = $this->getEventConfig($regEventID, false, false, true); - - // Make all arrays of arrays non-associative to make Backbone happy - if (is_array($regEvent['reg_class'])) { - foreach ($regEvent['reg_class'] as $k=>$v) { - if (is_array($regEvent['reg_class'][$k]['reg_rate'])) { - $regEvent['reg_class'][$k]['reg_rate'] = array_values($regEvent['reg_class'][$k]['reg_rate']); - } - } - } - if (is_array($regEvent['reg_class'])) { - $regEvent['reg_class'] = array_values($regEvent['reg_class']); - $regClassesJSON = json_encode($regEvent['reg_class']); - } - if (is_array($regEvent['reg_time'])) { - $regEvent['reg_time'] = array_values($regEvent['reg_time']); - $regTimesJSON = json_encode($regEvent['reg_time']); - } - - // Get rid of class and time arrays so we just have the event data - unset($regEvent['reg_class']); - unset($regEvent['reg_time']); - $regEventJSON = json_encode($regEvent); - - $view = 'eventEditLevels'; - - break; - - case 'add': - case 'edit': - - $problem = false; - - // If we're adding a new reg event - if ($option == 'add') { - - $eventData = false; - $eventID = ($_REQUEST['event']-0); - - // Verify that event is not already listed - $regEvent = $this->getEntry($eventID, 'event'); - if (!$regEvent) { - - // Get data on this event from events add-on - if ($eventID > 0) { - $eventData = apply_filters('glm-member-db-events-get-event', $eventID); - } - - // Did we get event data? - if ($eventData) { - - // Add event to registrations - $sql = " - INSERT INTO ".$this->table." - ( - event, - event_name, - event_code, - notify_email, - admin_active, - active, - time_specific, - attendees, - attendee_max, - attendee_max_per_reg, - reg_hold_minutes, - cart_hold_days, - reg_hours_before, - registration_account_options, - payment_methods, - restricted_payment_methods, - terms - ) - VALUES - ( - ".$eventData['id'].", - '".$eventData['name']."', - '".$eventData['name_slug']."', - '".$eventData['admin_email']."', - true, - false, - true, - true, - 0, - 0, - 60, - 10, - 24, - 14, - 94, - 26, - '' - ) - ;"; - $this->wpdb->query($sql); - $regEventID = $this->wpdb->insert_id; - if ($regEventID) { - - $regEventUpdated = true; - - // Create all needed reg_time entries - $this->checkEventTimes($regEventID); - - } - - } - - - } else { - $messages[] = "Trying to add an event that is already listed in Registrations."; - $problem = true; - } - - } - - // If there's no problem yet, try to get the regEvent data for edit - if (!$problem) { - if ($regEventID) { - $regEvent = $this->editEntry($regEventID); - if ($regEvent) { - $haveRegEvent = true; - } - } - } - - //echo "
".print_r($regEvent,1)."
"; - - $view = 'eventEdit'; - - break; - - case 'update': - - // Try to update the reg event - $regEvent = $this->updateEntry($regEventID); - - // If there's some type of failure, flag that for the view file - if ($regEvent['status']) { - $regEventUpdated = true; - } else { - $regEventUpdateError = true; - } - - $view = 'eventEdit'; - - break; - - - case 'delete': - - $regEventDeleted = false; - - // If we don't have a registration Event ID - if (!$regEventID) { - $messages[] = 'Request to delete registrations for an event but ID for this was not supplied.'; - } else { - - // Check if we received a confirmation override to delete a reg event that has completed registrations - if (isset($_REQUEST['deleteConfirmation']) && $_REQUEST['deleteConfirmation'] == 'DELETE') { - - // Check that we have reg_event entry for this ID - $regEvent = $this->getEntry($regEventID); - - if (!$regEvent) { - $messages[] = 'Request to delete registrations for an event but unable to find registration setup for this event.'; - } else { - - // Delete registrations for this event - $regEventDeleted = $this->deleteRegEvent($regEventID); - - if (!$regEventDeleted) { - $messages[] = 'Attempt to delete registrations for this event failed. Nothing has been deleted'; - } - } - - } else { - $messages[] = 'You did not properly confirm your request by entering "DELETE". No dates and times were added.'; - } - - } - - if ($regEventDeleted) { - - // Return status, any suggested view, and any data to controller - return array( - 'status' => true, - 'modelRedirect' => false, - 'view' => 'admin/registrations/registrationEventDeleted.html', - 'data' => array() - ); - break; - - } - - // Registration event was not deleted so falling through to eventDashboard to display reasons or ask for confirmation - - case 'eventDashboard': - - $regEvent = $this->getEventConfig($regEventID, true, false, true, false, true); - - // Check if there's a request to add event times from the event - if (isset($_REQUEST) && isset($_REQUEST['getTimesFromEvent']) && $_REQUEST['getTimesFromEvent'] == 'yes') { - - // Check that the user entered the correct confirmation string - if (isset($_REQUEST['addConfirmation']) && $_REQUEST['addConfirmation'] == 'ADD') { - - // Get the event data again along with any new times - $regEvent = $this->getEventConfig($regEventID, true, false, true); - - $messages[] = 'Per your request, any dates and times specified in the event schedules that were not already added here, have now been added.'; - - }else{ - $messages[] = 'You did not properly confirm your request by entering "ADD". No dates and times were added.'; - } - - } - - // If this isn't a time specific event - check for new event non-date-specific only time entry - if (!$regEvent['time_specific']['value']) { - $regEvent = $this->checkEventTimes(false, false, true); - } - - if ($regEvent !== false) { - - $haveRegEvent = true; - $regEventFirstTime = $regEvent['first_datetime']; - $regEventLastTime = $regEvent['last_datetime']; - - // if there's a user notice, add it to messages - if (isset($regEvent['message']) && $regEvent['message']) { - $messages[] = $regEvent['message']; - } - - } - - // Check if we have any times for this reg_event - if (is_array($regEvent['reg_time']) || count($regEVent['reg_time']) > 0) { - $haveRegEventTimes = true; - } else { - $messages[] = 'There are no dates for registrations for this event.'; - } - - $view = 'eventDashboard'; - - break; - - case 'dashboard': - default: - - // If doing alpha list - if (isset($_REQUEST['alpha'])) { - $actionData['request']['alpha'] = $_REQUEST['alpha']; - } - - // If user clicked a page request then we need to check the savedAlpha value - if (isset($_REQUEST['savedAlpha']) && isset($_REQUEST['pageSelect'])) { - $actionData['request']['alpha'] = $_REQUEST['savedAlpha']; - } - - if ($actionData['request']['alpha'] && strlen($actionData['request']['alpha']) == 1) { - $alphaSelected = strtoupper($actionData['request']['alpha']); - $alphaWhere .= " AND T.event_name LIKE '$alphaSelected%'"; - } - - $where = ' TRUE '; - if (isset($_REQUEST['text_search']) && trim($_REQUEST['text_search'] != '')) { - $textSearch = trim($_REQUEST['text_search']); - $where = "event_name LIKE '%".$textSearch."%'"; - - // Clean up for use in redisplaying search value - $textSearch = stripslashes($textSearch); - } - - // Get full list for all other filters, but not filtered by alpha (that would be silly) - $alphaList = $this->getAlphaList(''); - - // Get count of reg event listed - $regEventsCount = $this->getStats($where); - - // Get a current list of reg events - $listResult = $this->getSimpleRegEventsList($where.$alphaWhere, 'event_name', true, 'id', $start, $limit, true, true); - - // Get paging results - $numbDisplayed = $listResult['returned']; - $lastDisplayed = $listResult['last']; - if ($start == 1) { - $prevStart = false; - } else { - $prevStart = $start - $limit; - if ($start < 1) { - $start = 1; - } - } - if ($listResult['returned'] == $limit) { - $nextStart = $start + $limit; - } - - // since we're doing paging, we have to break out just the event data - $list = $listResult['list']; - unset($listResult); - - // If we have list entries - even if it's an empty list - $success = true; - $haveRegEvents = false; - if ($list !== false) { - - $success = true; - - // If we have any entries - if (count($list) > 0) { - $haveRegEvents = true; - } - } - - // Get full list of event names matching the current where clause for text search box - $namesList = $this->getSimpleRegEventsList($where); - - $view = 'eventsDashboard'; - - break; + $subModel = GLM_MEMBERS_REGISTRATIONS_PLUGIN_PATH.'/models/admin/registrations/events_'.$modelFile.'.php'; + if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG) { + trigger_error("Registration Events: Sub-Controller calling: $subModel", E_USER_NOTICE); } - // If we have a valid account ID, save that for future use - if ($regEventID > 0) { - update_option('glmMembersDatabaseRegistrationsRegEventID', $regEventID); - } + require_once $subModel; - // calculate default calendar date for event dashboard - $defaultCalTime = time(); - if (isset($regEventFirstTime) && $regEventFirstTime['timestamp']+0 > 0) { - $defaultCalTime = $regEventFirstTime['timestamp']; - } + /* + * *** Need to move the template data compilation to the individual sub-model files. + */ // Compile template data $templateData = array( 'haveMessages' => count($messages) > 0, @@ -776,7 +221,7 @@ class GlmMembersAdmin_registrations_events extends GlmDataRegistrationsRegEvent 'havePayCodes' => $havePayCodes, 'payCodes' => $payCodes, 'newPayCode' => $newPayCode, - 'eventPaycodeType' => $this->config['pay_code_ref_type_numb']['Event'], + 'eventPaycodeType' => $refPaycodeType, 'currentUrl' => GLM_MEMBERS_REGISTRATIONS_PLUGIN_ADMIN_URL, 'thisJsUrl' => GLM_MEMBERS_REGISTRATIONS_PLUGIN_URL . '/js', 'regEventJSON' => $regEventJSON, diff --git a/models/admin/registrations/events_addEdit.php b/models/admin/registrations/events_addEdit.php new file mode 100644 index 0000000..67f9cf9 --- /dev/null +++ b/models/admin/registrations/events_addEdit.php @@ -0,0 +1,113 @@ + + * @license http://www.gaslightmedia.com Gaslightmedia + * @release events_delete.php,v 1.0 2014/10/31 19:31:47 cscott Exp $ + * @link http://dev.gaslightmedia.com/ + */ + +$problem = false; + +// If we're adding a new reg event +if ($option == 'add') { + + $eventData = false; + $eventID = ($_REQUEST['event']-0); + + // Verify that event is not already listed + $regEvent = $this->getEntry($eventID, 'event'); + if (!$regEvent) { + + // Get data on this event from events add-on + if ($eventID > 0) { + $eventData = apply_filters('glm-member-db-events-get-event', $eventID); + } + + // Did we get event data? + if ($eventData) { + + // Add event to registrations + $sql = " + INSERT INTO ".$this->table." + ( + event, + event_name, + event_code, + notify_email, + admin_active, + active, + time_specific, + attendees, + attendee_max, + attendee_max_per_reg, + reg_hold_minutes, + cart_hold_days, + reg_hours_before, + registration_account_options, + payment_methods, + restricted_payment_methods, + terms + ) + VALUES + ( + ".$eventData['id'].", + '".$eventData['name']."', + '".$eventData['name_slug']."', + '".$eventData['admin_email']."', + true, + false, + true, + true, + 0, + 0, + 60, + 10, + 24, + 14, + 94, + 26, + '' + ) + ;"; + $this->wpdb->query($sql); + $regEventID = $this->wpdb->insert_id; + if ($regEventID) { + + $regEventUpdated = true; + + // Create all needed reg_time entries + $this->checkEventTimes($regEventID); + + } + + } + + + } else { + $messages[] = "Trying to add an event that is already listed in Registrations."; + $problem = true; + } + +} + +// If there's no problem yet, try to get the regEvent data for edit +if (!$problem) { + if ($regEventID) { + $regEvent = $this->editEntry($regEventID); + if ($regEvent) { + $haveRegEvent = true; + } + } +} + +//echo "
".print_r($regEvent,1)."
"; + +$view = 'eventEdit'; + diff --git a/models/admin/registrations/events_configureEvent.php b/models/admin/registrations/events_configureEvent.php new file mode 100644 index 0000000..90240ae --- /dev/null +++ b/models/admin/registrations/events_configureEvent.php @@ -0,0 +1,59 @@ + + * @license http://www.gaslightmedia.com Gaslightmedia + * @release events_configureEvent.php,v 1.0 2014/10/31 19:31:47 cscott Exp $ + * @link http://dev.gaslightmedia.com/ + */ + +$scripts = array( + 'backbone-local' => 'js/lib/backbone.localStorage.min.js', + 'regApp' => 'js/adminRegApp.js', +); +foreach ( $scripts as $scriptName => $scriptPath ) { + wp_register_script( + $scriptName, + GLM_MEMBERS_REGISTRATIONS_PLUGIN_URL . $scriptPath, + array( 'jquery', 'backbone', 'underscore' ), + '1.0', + true + ); +} +wp_enqueue_script( array( 'jquery', 'backbone' ) ); +wp_enqueue_script( array_keys( $scripts ) ); +$regEvent = array(); + +// Get all current registration event data +$regEvent = $this->getEventConfig($regEventID, false, false, true); + +// Make all arrays of arrays non-associative to make Backbone happy +if (is_array($regEvent['reg_class'])) { + foreach ($regEvent['reg_class'] as $k=>$v) { + if (is_array($regEvent['reg_class'][$k]['reg_rate'])) { + $regEvent['reg_class'][$k]['reg_rate'] = array_values($regEvent['reg_class'][$k]['reg_rate']); + } + } +} +if (is_array($regEvent['reg_class'])) { + $regEvent['reg_class'] = array_values($regEvent['reg_class']); + $regClassesJSON = json_encode($regEvent['reg_class']); +} +if (is_array($regEvent['reg_time'])) { + $regEvent['reg_time'] = array_values($regEvent['reg_time']); + $regTimesJSON = json_encode($regEvent['reg_time']); +} + +// Get rid of class and time arrays so we just have the event data +unset($regEvent['reg_class']); +unset($regEvent['reg_time']); +$regEventJSON = json_encode($regEvent); + +$view = 'eventEditLevels'; + diff --git a/models/admin/registrations/events_dashboard.php b/models/admin/registrations/events_dashboard.php new file mode 100644 index 0000000..564bcfa --- /dev/null +++ b/models/admin/registrations/events_dashboard.php @@ -0,0 +1,84 @@ + + * @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/ + */ + +// If doing alpha list +if (isset($_REQUEST['alpha'])) { + $actionData['request']['alpha'] = $_REQUEST['alpha']; +} + +// If user clicked a page request then we need to check the savedAlpha value +if (isset($_REQUEST['savedAlpha']) && isset($_REQUEST['pageSelect'])) { + $actionData['request']['alpha'] = $_REQUEST['savedAlpha']; +} + +if ($actionData['request']['alpha'] && strlen($actionData['request']['alpha']) == 1) { + $alphaSelected = strtoupper($actionData['request']['alpha']); + $alphaWhere .= " AND T.event_name LIKE '$alphaSelected%'"; +} + +$where = ' TRUE '; +if (isset($_REQUEST['text_search']) && trim($_REQUEST['text_search'] != '')) { + $textSearch = trim($_REQUEST['text_search']); + $where = "event_name LIKE '%".$textSearch."%'"; + + // Clean up for use in redisplaying search value + $textSearch = stripslashes($textSearch); +} + +// Get full list for all other filters, but not filtered by alpha (that would be silly) +$alphaList = $this->getAlphaList(''); + +// Get count of reg event listed +$regEventsCount = $this->getStats($where); + +// Get a current list of reg events +$listResult = $this->getSimpleRegEventsList($where.$alphaWhere, 'event_name', true, 'id', $start, $limit, true, true); + +// Get paging results +$numbDisplayed = $listResult['returned']; +$lastDisplayed = $listResult['last']; +if ($start == 1) { + $prevStart = false; +} else { + $prevStart = $start - $limit; + if ($start < 1) { + $start = 1; + } +} +if ($listResult['returned'] == $limit) { + $nextStart = $start + $limit; +} + +// since we're doing paging, we have to break out just the event data +$list = $listResult['list']; +unset($listResult); + +// If we have list entries - even if it's an empty list +$success = true; +$haveRegEvents = false; +if ($list !== false) { + + $success = true; + + // If we have any entries + if (count($list) > 0) { + $haveRegEvents = true; + } +} + +// Get full list of event names matching the current where clause for text search box +$namesList = $this->getSimpleRegEventsList($where); + +$view = 'eventsDashboard'; diff --git a/models/admin/registrations/events_delete.php b/models/admin/registrations/events_delete.php new file mode 100644 index 0000000..28dd639 --- /dev/null +++ b/models/admin/registrations/events_delete.php @@ -0,0 +1,62 @@ + + * @license http://www.gaslightmedia.com Gaslightmedia + * @release events_delete.php,v 1.0 2014/10/31 19:31:47 cscott Exp $ + * @link http://dev.gaslightmedia.com/ + */ + +$regEventDeleted = false; + +// If we don't have a registration Event ID +if (!$regEventID) { + $messages[] = 'Request to delete registrations for an event but ID for this was not supplied.'; +} else { + + // Check if we received a confirmation override to delete a reg event that has completed registrations + if (isset($_REQUEST['deleteConfirmation']) && $_REQUEST['deleteConfirmation'] == 'DELETE') { + + // Check that we have reg_event entry for this ID + $regEvent = $this->getEntry($regEventID); + + if (!$regEvent) { + $messages[] = 'Request to delete registrations for an event but unable to find registration setup for this event.'; + } else { + + // Delete registrations for this event + $regEventDeleted = $this->deleteRegEvent($regEventID); + + if (!$regEventDeleted) { + $messages[] = 'Attempt to delete registrations for this event failed. Nothing has been deleted'; + } + } + + } else { + $messages[] = 'You did not properly confirm your request by entering "DELETE". No dates and times were added.'; + } + +} + +if ($regEventDeleted) { + + // Return status, any suggested view, and any data to controller + return array( + 'status' => true, + 'modelRedirect' => false, + 'view' => 'admin/registrations/registrationEventDeleted.html', + 'data' => array() + ); + break; + +} + +// Registration event was not deleted so falling through to eventDashboard to display reasons or ask for confirmation +require_once GLM_MEMBERS_REGISTRATIONS_PLUGIN_PATH.'/models/admin/registrations/events_dashboard.php'; + diff --git a/models/admin/registrations/events_eventCustomFields.php b/models/admin/registrations/events_eventCustomFields.php new file mode 100644 index 0000000..713047d --- /dev/null +++ b/models/admin/registrations/events_eventCustomFields.php @@ -0,0 +1,22 @@ + + * @license http://www.gaslightmedia.com Gaslightmedia + * @release events_eventCustomFields.php,v 1.0 2014/10/31 19:31:47 cscott Exp $ + * @link http://dev.gaslightmedia.com/ + */ + +require_once GLM_MEMBERS_REGISTRATIONS_PLUGIN_CLASS_PATH.'/data/dataRegClass.php'; +$RegClasses = new GlmDataRegistrationsRegClass($this->wpdb, $this->config); +$classes = $RegClasses->getList("T.reg_event = $regEventID"); + +$regEvent = $this->getEntry($regEventID); + +$view = 'eventEditCustomFields'; diff --git a/models/admin/registrations/events_eventDashboard.php b/models/admin/registrations/events_eventDashboard.php new file mode 100644 index 0000000..893c207 --- /dev/null +++ b/models/admin/registrations/events_eventDashboard.php @@ -0,0 +1,66 @@ + + * @license http://www.gaslightmedia.com Gaslightmedia + * @release events_eventDashboard.php,v 1.0 2014/10/31 19:31:47 cscott Exp $ + * @link http://dev.gaslightmedia.com/ + */ + +$regEvent = $this->getEventConfig($regEventID, true, false, true, false, true); + +// Check if there's a request to add event times from the event +if (isset($_REQUEST) && isset($_REQUEST['getTimesFromEvent']) && $_REQUEST['getTimesFromEvent'] == 'yes') { + + // Check that the user entered the correct confirmation string + if (isset($_REQUEST['addConfirmation']) && $_REQUEST['addConfirmation'] == 'ADD') { + + // Get the event data again along with any new times + $regEvent = $this->getEventConfig($regEventID, true, false, true); + + $messages[] = 'Per your request, any dates and times specified in the event schedules that were not already added here, have now been added.'; + + }else{ + $messages[] = 'You did not properly confirm your request by entering "ADD". No dates and times were added.'; + } + +} + +// If this isn't a time specific event - check for new event non-date-specific only time entry +if (!$regEvent['time_specific']['value']) { + $regEvent = $this->checkEventTimes(false, false, true); +} + +if ($regEvent !== false) { + + $haveRegEvent = true; + $regEventFirstTime = $regEvent['first_datetime']; + $regEventLastTime = $regEvent['last_datetime']; + + // if there's a user notice, add it to messages + if (isset($regEvent['message']) && $regEvent['message']) { + $messages[] = $regEvent['message']; + } + +} + +// Check if we have any times for this reg_event +if (is_array($regEvent['reg_time']) || count($regEVent['reg_time']) > 0) { + $haveRegEventTimes = true; +} else { + $messages[] = 'There are no dates for registrations for this event.'; +} + +// calculate default calendar date for event dashboard +$defaultCalTime = time(); +if (isset($regEventFirstTime) && $regEventFirstTime['timestamp']+0 > 0) { + $defaultCalTime = $regEventFirstTime['timestamp']; +} + +$view = 'eventDashboard'; diff --git a/models/admin/registrations/events_globalCodes.php b/models/admin/registrations/events_globalCodes.php new file mode 100644 index 0000000..10f1e1d --- /dev/null +++ b/models/admin/registrations/events_globalCodes.php @@ -0,0 +1,53 @@ + + * @license http://www.gaslightmedia.com Gaslightmedia + * @release events_globalCodes.php,v 1.0 2014/10/31 19:31:47 cscott Exp $ + * @link http://dev.gaslightmedia.com/ + */ + +require_once GLM_MEMBERS_REGISTRATIONS_PLUGIN_CLASS_PATH.'/data/dataPaymentCode.php'; +$PayCode = new GlmDataRegistrationsPaymentCode($this->wpdb, $this->config); + +if (isset($_REQUEST['option2']) && $_REQUEST['option2'] != '') { + switch($_REQUEST['option2']) { + + case 'new': + $PayCode->insertEntry(); + break; + + case 'update': + $payCodeId = ($_REQUEST['payCodeId'] - 0); + $x = $PayCode->updateEntry($payCodeId); + break; + + case 'delete': + $payCodeId = ($_REQUEST['payCodeId'] - 0); + if ( $payCodeId > 0 ) { + $PayCode->deleteEntry( $payCodeId, true ); + } + break; + } +} + +// Create a new paycode entry array for creating new codes +$newPayCode = $PayCode->newEntry(); + +// Specify the pay code type number that should be used. +$refPaycodeType = $this->config['pay_code_ref_type_numb']['Global']; + +// Get a list of current global codes +$payCodes = $PayCode->getList("T.ref_type = $refPaycodeType"); +if ($payCodes) { + $havePayCodes = true; +} + + +$view = 'eventPaymentCodes'; diff --git a/models/admin/registrations/events_notifications.php b/models/admin/registrations/events_notifications.php new file mode 100644 index 0000000..9327f86 --- /dev/null +++ b/models/admin/registrations/events_notifications.php @@ -0,0 +1,23 @@ + + * @license http://www.gaslightmedia.com Gaslightmedia + * @release events_notifications.php,v 1.0 2014/10/31 19:31:47 cscott Exp $ + * @link http://dev.gaslightmedia.com/ + */ + +require_once GLM_MEMBERS_REGISTRATIONS_PLUGIN_CLASS_PATH.'/data/dataRegNotification.php'; +$Notifications = new GlmDataRegistrationsRegNotification($this->wpdb, $this->config); + +$regNotifications = $Notifications->getList("T.reg_event = $regEventID", 'notification_days'); + +$regEvent = $this->getEntry($regEventID); + +$view = 'eventNotifications'; diff --git a/models/admin/registrations/events_notificationsUpdate.php b/models/admin/registrations/events_notificationsUpdate.php new file mode 100644 index 0000000..70c7ffc --- /dev/null +++ b/models/admin/registrations/events_notificationsUpdate.php @@ -0,0 +1,75 @@ + + * @license http://www.gaslightmedia.com Gaslightmedia + * @release events_notificationsUpdate.php,v 1.0 2014/10/31 19:31:47 cscott Exp $ + * @link http://dev.gaslightmedia.com/ + */ + +// New and updated notifications +if (isset($_REQUEST['name']) && is_array($_REQUEST['name'])) { + + foreach ($_REQUEST['name'] as $key=>$val) { + + // Make sure key is positive integer + $id = ($key-0); + if ($id > 0) { + + // Update existing entry + $this->wpdb->update( + GLM_MEMBERS_REGISTRATIONS_PLUGIN_DB_PREFIX.'reg_notification', + array( + 'name' => $_REQUEST['name'][$id], + 'notification_days' => $_REQUEST['notification_days'][$id], + 'message' => $_REQUEST['message'][$id] + ), + array( 'id' => $id ), + array( '%s', '%d', '%s' ), + array( '%d' ) + ); + + // Otherwise if the id is less than 0 it must be a new one + } elseif ($id < 0) { + + // Insert a new entry + $this->wpdb->insert( + GLM_MEMBERS_REGISTRATIONS_PLUGIN_DB_PREFIX.'reg_notification', + array( + 'reg_event' => $regEventID, + 'name' => $_REQUEST['name'][$id], + 'notification_days' => $_REQUEST['notification_days'][$id], + 'message' => $_REQUEST['message'][$id] + ), + array( '%d', '%s', '%d', '%s' ) + ); + } + } +} + +// Delete Notifications +if (isset($_REQUEST['delete']) && is_array($_REQUEST['delete'])) { + + $ids = ''; + foreach ($_REQUEST['delete'] as $key=>$val) { + + // Make sure key is positive integer + $id = ($key-0); + if ($id > 0) { + $this->wpdb->delete( GLM_MEMBERS_REGISTRATIONS_PLUGIN_DB_PREFIX.'reg_notification', array( 'ID' => $id ), array( '%d' ) ); + } + + } +} + + +$regNotifyUpdated = true; + +// Fall through to get the data again +require_once GLM_MEMBERS_REGISTRATIONS_PLUGIN_PATH.'/models/admin/registrations/events_notifications.php'; diff --git a/models/admin/registrations/events_paymentCodes.php b/models/admin/registrations/events_paymentCodes.php new file mode 100644 index 0000000..f9ebef5 --- /dev/null +++ b/models/admin/registrations/events_paymentCodes.php @@ -0,0 +1,53 @@ + + * @license http://www.gaslightmedia.com Gaslightmedia + * @release events_paymentCodes.php,v 1.0 2014/10/31 19:31:47 cscott Exp $ + * @link http://dev.gaslightmedia.com/ + */ + +require_once GLM_MEMBERS_REGISTRATIONS_PLUGIN_CLASS_PATH.'/data/dataPaymentCode.php'; +$PayCode = new GlmDataRegistrationsPaymentCode($this->wpdb, $this->config); + +if (isset($_REQUEST['option2']) && $_REQUEST['option2'] != '') { + switch($_REQUEST['option2']) { + + case 'new': + $PayCode->insertEntry(); + break; + + case 'update': + $payCodeId = ($_REQUEST['payCodeId'] - 0); + $x = $PayCode->updateEntry($payCodeId); + break; + + case 'delete': + $payCodeId = ($_REQUEST['payCodeId'] - 0); + if ( $payCodeId > 0 ) { + $PayCode->deleteEntry( $payCodeId, true ); + } + break; + } +} + +$newPayCode = $PayCode->newEntry(); + +// Specify the pay code type number that should be used. +$refPaycodeType = $this->config['pay_code_ref_type_numb']['Event']; + +$payCodes = $PayCode->getList("T.ref_type = $refPaycodeType"); + +if ($payCodes) { + $havePayCodes = true; +} + +$regEvent = $this->getEntry($regEventID); + +$view = 'eventPaymentCodes'; diff --git a/models/admin/registrations/events_registrants.php b/models/admin/registrations/events_registrants.php new file mode 100644 index 0000000..e351e04 --- /dev/null +++ b/models/admin/registrations/events_registrants.php @@ -0,0 +1,103 @@ + + * @license http://www.gaslightmedia.com Gaslightmedia + * @release events_registrants.php,v 1.0 2014/10/31 19:31:47 cscott Exp $ + * @link http://dev.gaslightmedia.com/ + */ + +$whereParts = array(); + +if (isset($_REQUEST['textSearch']) && trim($_REQUEST['textSearch'] != '')) { + $textSearch = trim($_REQUEST['textSearch']); + $whereParts[] = "concat( T.fname, ' ', T.lname) LIKE '%".$textSearch."%'"; + + // Clean up for use in redisplaying search value + $textSearch = stripslashes($textSearch); +} + +require_once GLM_MEMBERS_REGISTRATIONS_PLUGIN_CLASS_PATH.'/data/dataRegRequestRegistrant.php'; +$Registrants = new GlmDataRegistrationsRequestRegistrant($this->wpdb, $this->config); + +// 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']})"; +} + +// Get list of all registrants for this event +$where = implode( ' AND ', $whereParts ); + +// Check if we're doing paging +if ( isset( $_REQUEST['pageSelect'] ) ) { + + // If request is for Next + if ( $_REQUEST['pageSelect'][0] == 'N' ) { + $newStart = $_REQUEST['nextStart'] - 0; + + // Otherwise it must be Previous + } else { + $newStart = $_REQUEST['prevStart'] - 0; + } + + if ($newStart > 0) { + $start = $newStart; + } +} + +$customFieldsPluginActive = apply_filters( 'glm-members-customfields-plugin-active', false ); + +$listResult = $Registrants->getFullRegistrantsData($regEventID, $where, $start, $limit); +// echo '
$listResult: ' . print_r( $listResult['list'], true ) . '
'; + +// Get count of registrants listed +$registrantCount = $listResult['totalCount']; + +// If the number of registrants is less than a page, don't do paging +if ($registrantCount <= $limit) { + // $paging = false; +} + +// Get paging results +$numbDisplayed = $listResult['returned']; +$lastDisplayed = $listResult['last']; +if ($start == 1) { + $prevStart = false; +} else { + $prevStart = $start - $limit; + if ($start < 1) { + $start = 1; + } +} +if ($listResult['returned'] == $limit) { + $nextStart = $start + $limit; +} +$registrants = $listResult['list']; + +$success = true; +$haveRegistrants = false; +if ($registrants !== false) { + + $success = true; + + // If we have any entries + if (count($registrants) > 0) { + $haveRegistrants = true; + } +} +// echo "
".print_r($registrants,1)."
"; + +$view = 'eventRegistrants'; diff --git a/models/admin/registrations/events_update.php b/models/admin/registrations/events_update.php new file mode 100644 index 0000000..bbb7453 --- /dev/null +++ b/models/admin/registrations/events_update.php @@ -0,0 +1,27 @@ + + * @license http://www.gaslightmedia.com Gaslightmedia + * @release events_update.php,v 1.0 2014/10/31 19:31:47 cscott Exp $ + * @link http://dev.gaslightmedia.com/ + */ + + +// Try to update the reg event +$regEvent = $this->updateEntry($regEventID); + +// If there's some type of failure, flag that for the view file +if ($regEvent['status']) { + $regEventUpdated = true; +} else { + $regEventUpdateError = true; +} + +$view = 'eventEdit'; diff --git a/views/admin/registrations/eventHeader.html b/views/admin/registrations/eventHeader.html index 19369bf..781440c 100644 --- a/views/admin/registrations/eventHeader.html +++ b/views/admin/registrations/eventHeader.html @@ -3,5 +3,6 @@
diff --git a/views/admin/registrations/eventPaymentCodes.html b/views/admin/registrations/eventPaymentCodes.html index 41bdda9..8079d57 100644 --- a/views/admin/registrations/eventPaymentCodes.html +++ b/views/admin/registrations/eventPaymentCodes.html @@ -1,9 +1,14 @@ {include file='admin/registrations/eventHeader.html'} -{include file='admin/registrations/eventSubTabs.html'} +{if $option != 'globalCodes'} + {include file='admin/registrations/eventSubTabs.html'} +{/if}
- Add Event Payment Code -

Registration Event Payment Codes

+{if $option == 'globalCodes'} +

Global Payment Codes

+{else} +

Event Payment Codes

+{/if}
 
@@ -12,7 +17,11 @@
+{if $option == 'globalCodes'} + +{else} +{/if} @@ -24,7 +33,11 @@ @@ -78,7 +91,11 @@
+{if $option == 'globalCodes'} + +{else} +{/if} @@ -142,6 +159,16 @@
+ + +{if $option == 'globalCodes'} + + +{else} + + +{/if} + {if $havePayCodes} {assign var="i" value="0"} {foreach $payCodes as $p} @@ -234,7 +261,11 @@ }); $('#deletePaymentCodeConfirm').click( function() { $("#deletePaymentCodeDialog").dialog("close"); +{if $option == 'globalCodes'} + window.location.href = "{$thisUrl}?page={$thisPage}&option=globalCodes&option2=delete&payCodeId=" + id; +{else} window.location.href = "{$thisUrl}?page={$thisPage}&option=paymentCodes&option2=delete&payCodeId=" + id; +{/if} }); $('#deletePaymentCodeCancel').click( function() { $("#deletePaymentCodeDialog").dialog("close"); diff --git a/views/front/registrations/cartSummary.html b/views/front/registrations/cartSummary.html index 64bb12d..c83f19f 100644 --- a/views/front/registrations/cartSummary.html +++ b/views/front/registrations/cartSummary.html @@ -111,6 +111,21 @@
{/if} {/foreach} {* classes *} + {if $event} + {foreach $event.payCodes as $payCode} +
+
+ Discount Code: "{$payCode.code}", + {if $payCode.code_type == 'Free'}Free{/if} + {if $payCode.code_type =='Amount'}${$payCode.amount|number_format:2}{/if} + {if $payCode.code_type == 'Percent'}{$payCode.amount}%{/if} +
+
+ ${$payCode.thisDiscount|number_format:2} +
+
+ {/foreach} + {/if} {if $event.eventDiscounts > 0}
@@ -133,6 +148,21 @@ {$terms.reg_term_registration_cap} Request Totals
+{if $cart.globalPayCodes} + {foreach $cart.globalPayCodes as $payCode} +
+
+ Discount Code: "{$payCode.code}", + {if $payCode.code_type == 'Free'}Free{/if} + {if $payCode.code_type =='Amount'}${$payCode.amount|number_format:2}{/if} + {if $payCode.code_type == 'Percent'}{$payCode.amount}%{/if} +
+
+ ${$payCode.thisDiscount|number_format:2} +
+
+ {/foreach} +{/if} {if $cart.totalDiscounts > 0}
@@ -148,7 +178,7 @@ Total {$terms.reg_term_attendee_plur}: {$cart.totalRegistrants}
- Total: ${$cart.totalCharges|number_format:2} + Total Cost: ${$cart.grandTotal|number_format:2}
+{if $option == 'globalCodes'} + +{else} +{/if}
 

Payment codes that apply to any event

Add Global Payment Code

Payment codes that apply to any registrations for this event

Add Event Payment Code