Added date submitted to reg event registrant list and changed headder titles.
Fixed positioning of cancel button for edit event notification in reg admin.
Fixed confusion with first and last dates for event on reg event dashboard.
Now displaying current month on reg event dashboard calendar when not date have been added.
Fixed submission of new reg event dates on reg event dashboard when "All Day" selected.
Fixed confusion with first and last dates attending for attendee.
More work on notifications cron processing. Now have working queries.
// Get the first and last times in the reg_times entries
$firstTime = false;
$lastTime = false;
+ $haveTimeEntry = false;
// Check for reg_time data
if (is_array($this->regEventData['reg_time']) && count($this->regEventData['reg_time']) > 0) {
if (!$lastTime || $time['start_datetime']['timestamp'] > $lastTime) {
$lastTime = $time['start_datetime']['timestamp'];
}
+ $haveTimeEntry = true;
}
}
}
+ // Fix empty first/last datetimes when there's no times entries
+ if (!$haveTimeEntry) {
+ $firstTime = time();
+ $lastTime = time();
+ }
+
// Generate date as used in results
- $firstDateTime = array('datetime' => date('m/d/Y h:i A', $firstTime), 'timestamp' => $firstTime, 'mysql_datetime' => date('Y-m-d H:i:s', $firstTime));
- $lastDateTime = array('datetime' => date('m/d/Y h:i A', $lastTime), 'timestamp' => $lastTime, 'mysql_datetime' => date('Y-m-d H:i:s', $lastTime));
+ if ($haveTimeEntry) {
+ $firstDateTime = array('datetime' => date('m/d/Y h:i A', $firstTime), 'timestamp' => $firstTime, 'mysql_datetime' => date('Y-m-d H:i:s', $firstTime));
+ $lastDateTime = array('datetime' => date('m/d/Y h:i A', $lastTime), 'timestamp' => $lastTime, 'mysql_datetime' => date('Y-m-d H:i:s', $lastTime));
+ } else {
+ $firstDateTime = 'NULL';
+ $lastDateTime = 'NULL';
+ }
// Check if we need to update first and/or last event times in database - if so, do that
if ($this->regEventData['first_datetime']['timestamp'] != $firstTime ||
'field' => 'reg_request',
'as' => 'request_status',
'type' => 'pointer',
- 'p_table' => GLM_MEMBERS_REGISTRATIONS_PLUGIN_DB_PREFIX . 'reg_request R',
+ 'p_table' => GLM_MEMBERS_REGISTRATIONS_PLUGIN_DB_PREFIX . 'reg_request',
'p_field' => 'status',
'p_static' => true,
'required' => true,
'use' => 'lg'
+ ),
+
+ // Date Request Submitted
+ 'date_submitted' => array (
+ 'field' => 'reg_request',
+ 'as' => 'date_submitted',
+ 'type' => 'pointer',
+ 'p_table' => GLM_MEMBERS_REGISTRATIONS_PLUGIN_DB_PREFIX . 'reg_request',
+ 'p_field' => 'date_submitted',
+ 'p_static' => true,
+ 'required' => true,
+ 'use' => 'lg'
)
);
// Get start and end times if available. If start and no end, use start for end
$startTime = filter_input(INPUT_POST, 'start', FILTER_SANITIZE_STRING);
- $startTime = date('Y-m-d H:i:s', strtotime($startTime));
$endTime = filter_input(INPUT_POST, 'end', FILTER_SANITIZE_STRING);
- $endTime = date('Y-m-d H:i:s', strtotime($endTime));
+
+ $startTime = date('Y-m-d H:i:s', strtotime($startTime));
+ $endTime = date('Y-m-d H:i:s', strtotime($endTime));
// Get the reg_time entry id
if ($newTime) {
$haveRegEvent = false;
$haveRegEventRecurrences = false;
$haveRegEventTimes = false;
+ $defaultCalendarDate = false;
$regEventFirstTime = false;
$regEventLastTime = false;
$regEventUpdated = false;
$newEntry = false;
$when = false;
+
// Register the masked input script that we need for input controls
wp_dequeue_script('glm-members-admin-maskedinput');
wp_register_script(
'haveRegEvent' => $haveRegEvent,
'haveRegEventRecurrences' => $haveRegEventRecurrences,
'haveRegEventTimes' => $haveRegEventTimes,
+ 'defaultCalendarDate' => $defaultCalendarDate,
'regEventFirstTime' => $regEventFirstTime,
'regEventLastTime' => $regEventLastTime,
'regEventUpdated' => $regEventUpdated,
'completed' => $completed,
'errorMsg' => $errorMsg,
'newEntry' => $newEntry,
- 'when' => $when,
+ 'when' => $when
);
// echo "<pre>".print_r($templateData,1)."</pre>";
if ($regEvent !== false) {
$haveRegEvent = true;
- $regEventFirstTime = $regEvent['first_datetime'];
- $regEventLastTime = $regEvent['last_datetime'];
+ $haveRegEventTimes = false;
+ $defaultCalendarDate = false;
+
+ // Check that we have reg event times
+ if ($regEvent['first_datetime'] != 'NULL') {
+ $haveRegEventTimes = true;
+ $regEventFirstTime = $regEvent['first_datetime'];
+ $regEventLastTime = $regEvent['last_datetime'];
+ } else {
+ // We don't so set to current time so at least the current month is displayed in the calendar
+ $defaultCalendarDate = date('m/d/Y h:i A');
+ $messages[] = 'There are no dates on the calendar for this '.$this->config['terms']['reg_term_event'].'.';
+ }
+
// if there's a user notice, add it to messages
if (isset($regEvent['message']) && $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 on the calendar for this '.$this->config['terms']['reg_term_event'].'.';
-}
-
$view = 'eventDashboard';
trigger_error('Registrations Notifications Called', E_USER_NOTICE);
}
+ // Get list of notifications for all active events
+ $notifications = $this->wpdb->get_results(
+ "
+ SELECT N.*, E.time_specific, E.first_datetime, E.last_datetime
+ FROM ".GLM_MEMBERS_REGISTRATIONS_PLUGIN_DB_PREFIX."reg_notification N,
+ ".GLM_MEMBERS_REGISTRATIONS_PLUGIN_DB_PREFIX."reg_event E
+ WHERE E.id = N.reg_event
+ AND E.active
+ ORDER BY N.reg_event
+ ",
+ ARRAY_A
+ );
+
+ if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG) {
+ trigger_error('Notifications: Found '.count($notifications).' notifications for active events', E_USER_NOTICE);
+ }
+
+ // If there's notifications
+ if ($notifications and is_array($notifications) && count($notifications) > 0) {
+
+ $event = false;
+
+ // For each notification
+ foreach ($notifications as $notification) {
+
+ // If event is time-specific
+ if ($notification['time_specific']) {
+
+ } else {
+
+ }
+
+ // Build date range we're going to notify (one day)
+ $days = abs($notification['notification_days']);
+ $oper = $notification['notification_days'] < 0 ? '+' : '-';
+ $attendStartTime = strtotime(date('r')." $oper $days days");
+ $attendEndTime = strtotime(date('r', $attendStartTime).' + 1 day');
+ $start = date('Y-m-d 00:00:00', $attendStartTime);
+ $end = date('Y-m-d 00:00:00', $attendEndTime);
+
+ // Build clause to select which event dates to report for
+ if ($oper == '+') {
+ $timeClause = "
+ (NOT T.non_time_specific AND (T.start_datetime >= '$start' AND T.start_datetime < '$end'))
+ OR
+ (T.non_time_specific AND (E.first_datetime >= '$start' AND E.first_datetime < '$end'))
+ ";
+ } else {
+ $timeClause = "
+ (NOT T.non_time_specific AND (T.end_datetime >= '$start' AND T.end_datetime < '$end'))
+ OR
+ (T.non_time_specific AND (E.last_datetime >= '$start' AND E.last_datetime < '$end'))
+ ";
+ }
+
+ $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
+ 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
+ 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 E.id = R.reg_event
+ AND E.active
+ AND E.id = ".$notification['reg_event']."
+ AND (
+ $timeClause
+ )
+ ";
+ $attendees = $this->wpdb->get_results($sql, ARRAY_A);
+
+echo "<pre>".print_r($attendees, 1)."</pre>";
+
+ // 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']."<br>";
+
+
+ }
+ }
+
+
+
+ }
+
+
+ }
// This model does not return any data
return array(
// Sanity check - Must be passed an array
if (is_array($request)) {
+ // Send Registration Notifications
$request[] = array(
'menu' => 'registrations', // Menu where action exists
'action' => 'sendNotifications', // Name of action to run
- 'daysOfWeek'=> array(1, 2, 3, 7), // All Days
- 'times' => array(0, 13, 21), // All Hours
+ 'daysOfWeek'=> false, // All Days
+ 'times' => false, //array(3), // 3 AM ********************************************************************* FIX WHEN DONE TESTING
'params' => false // Any parameters needed by the triggered action
);
event_code TINYTEXT NULL, -- A short code used to reference this event - can be used to directly select an event to register for
notify_email TINYTEXT NULL, -- E-Mail addresses to receive notification of a registration other than org_internal_email in management, comma separated
admin_active BOOLEAN NULL, -- Active flag for admin from Events - If logged in Admin user for this event and this is true then admin user may enter registrations even if active is off.
- active BOOLEAN NULL, -- Active flag to indicate that this event is available for registrations
+ active BOOLEAN NULL, -- Active flag to indicate that this event is available for registrations and notifications
time_specific BOOLEAN NULL, -- Registration for this event is not date/time specific. Can attend any date/time of event.
attendees BOOLEAN NULL, -- Registration requires attendees - Otherwise the person submitting the registration is the registrant
attendee_max MEDIUMINT NULL, -- Attendee limit - 0 = unlimited
<h3>First {$terms.reg_term_event_cap} Time:</h3>
</div>
<div class="glm-small-12 glm-column time-input">
- {$regEventFirstTime.datetime}
+ {$regEventFirstTime.datetime}
</div>
</div>
<div class="glm-row">
<h3>Last {$terms.reg_term_event_cap} Time:</h3>
</div>
<div class="glm-small-12 glm-column">
- {$regEventLastTime.datetime}
+ {$regEventLastTime.datetime}
</div>
</div>
</div>
* Initialize the Full Calendar
*/
function initFullCalendar(){
+
$('#eventCalendar').fullCalendar({
timezone: 'local',
- {if $regEvent.first_datetime.datetime != ''}
+ {if $haveRegEventTimes}
defaultDate : '{$regEvent.first_datetime.datetime}',
+ {else}
+ defaultDate : '{$defaultCalendarDate}',
{/if}
{if $regEvent}
+ {if $haveRegEventTimes}
// Add existing registration dates/times
events: [
- {$sep = ''}
+ {$sep = ''}
{if $haveRegEventTimes}
{foreach $regEvent.reg_time as $t}
{if $t.non_time_specific.value == false}
{/foreach}
{/if}
],
+ {/if}
+
// Clicking on a date cell (not an existing event time) Brings up the new date dialog
dayClick: function(date, allDay, jsEvent, view) {
$('#dialogAvailLine').hide();
$('#dialogAvailSubmit').on('click', function() {
+ if ($('#dialogTimeAllDay').prop('checked')) {
+ $('#dialogStartTime').val('00:00:00');
+ $('#dialogEndTime').val('23:59:59');
+ }
+
if ($('#dialogStartTime').val() == '' || $('#dialogEndTime').val() == '') {
alert('Both start and end times are required!');
} else {
{else}
var max = 0;
{/if}
- var startDate = new Date($('#dialogStartTime').val());
- var startTime = $('#dialogStartTime').val();
var newTimeActive = $('#dialogRegActive').is(":checked");
var newTimeBackgroundColor = '#aaa';
-
if (newTimeActive) {
newTimeBackgroundColor = 'light-blue';
}
+ var startTime = date.format() + ' ' + $('#dialogStartTime').val();
// Initialize the event data object with submitted data
var newEvent = {
{else}
title: '',
{/if}
- start: date.format() + ' ' + startTime,
+ start: startTime,
end: date.format() + ' ' + $('#dialogEndTime').val(),
active: newTimeActive,
backgroundColor: newTimeBackgroundColor,
count: 0,
pending: 0,
available: max,
+ datetime: startTime,
timeId: false
};
-
+
{if $regEvent.time_specific.value}
// If max or active is set, override the defaults
if (newEvent.max > 0 ) {
newEvent.title = ' ' + newEvent.max + '-0-0-' + newEvent.max
}
- if (newEvent.active) {
- newEvent.backgroundColor = 'light-blue';
- }
{/if}
+
// Try to send the data via AJAX
var newTime = $.ajax({
// If response was not a possible time ID
newEvent.timeId = parseInt(newTimeId);
+ newEvent.allDay = false;
if (newEvent.timeId == '0') {
alert('New {$terms.reg_term_event} date/time may not have been stored properly. Reload page to check.');
<div class="glm-row"> </div>
</div>
<div class="glm-row">
- <div class="glm-small-12 glm-large-3 glm-column">
+ <div class="glm-small-12 glm-column">
<input class="button tiny" type="submit" value="{if $newEntry}Add{else}Update{/if} Notification">
- </div>
- <div class="glm-small-12 glm-large-3 glm-column">
<a class="button tiny" href="{$thisUrl}?page={$thisPage}&option=notifications®EventID={$regEventID}">Cancel</a>
</div>
</div>
{if $regNotifications}
{foreach $regNotifications as $n}
<tr class="{if $n@iteration is div by 2}alternate{/if}">
- <td>{$n.id}</td>
- <td>
- <a
- class=""
- href="{$thisUrl}?page={$thisPage}&option=notifications®EventID={$regEventID}&id={$n.id}">{$n.name}</a>
- </td>
+ <td><a href="{$thisUrl}?page={$thisPage}&option=notifications®EventID={$regEventID}&id={$n.id}">{$n.id}</a></td>
+ <td><a href="{$thisUrl}?page={$thisPage}&option=notifications®EventID={$regEventID}&id={$n.id}">{$n.name}</a></td>
<td>{$n.notification_days|regex_replace:"/[-]/":""} days {if $n.notification_days > 0 }After{else}Before{/if}</td>
<td>
<a
<tr>
<th>Name</th>
<th>Level</th>
- <th>Date/Time</th>
+ <th>Event Date/Time</th>
<th>Rate</th>
<th>Status</th>
+ <th>Submitted</th>
</tr>
</thead>
<tbody>
<td>{$r.event_time_reformatted}</td>
<td>{$r.rate_name}</td>
<td>{$r.request_status_name}</td>
+ <td>{$r.date_submitted}</td>
</tr>
<tr id="attendeeLinks_{$r.id}" class="glm-hidden glm-attendee-links"">
<td colspan="5" style="padding: .8rem; background-color: #fff;>
{include file='front/registrations/cartSummary.html'}
- {if $cart.blockCheckout || !$haveCart || !$cart.haveEvents}
+ {if !$haveCart || !$cart.haveEvents}
<div>
<div class="glm-reg-warning">You have not yet submitted your {$terms.reg_term_registration}. See above notes! <img src="{$assetUrl}/fingerUpRed.svg" style="height: 2em;"></div>
</div>
</div>
</div>
{if $cart.globalPayCodes}
-<div class="small-12 columns">
+ <div class="small-12 columns">
{foreach $cart.globalPayCodes as $payCode}
<div class="row glm-reg-cart-event-discount">
<div class="small-8 column glm-reg-right glm-reg-cart-label glm-reg-cart-discount-total">
</div>
</div>
{/foreach}
-</div>
+ </div>
{/if}
<div class="row glm-reg-row-bold glm-reg-cart-summary-footer">
<div class="small-12 medium-7 column text-center glm-reg-cart-total-attendees">
- Total {$terms.reg_term_attendee_plur}: {$cart.totalRegistrants}
+ {$terms.reg_term_attendee_plur_cap}: {$cart.totalRegistrants}
</div>
<div class="small-12 medium-5 column glm-reg-right glm-reg-cart-total">
- Total Cost: ${$cart.grandTotal|number_format:2}
+ Total: ${$cart.grandTotal|number_format:2}
</div>
</div>
</div>