progress
This commit is contained in:
@@ -23,12 +23,16 @@ function booking_variety_regn_form($node, &$form_state)
|
|||||||
->orderBy('v.booking_variety_start');
|
->orderBy('v.booking_variety_start');
|
||||||
$result = $timeslot_query->execute();
|
$result = $timeslot_query->execute();
|
||||||
|
|
||||||
$form['booking_variety_regn_feedback_wrapper'] = array(
|
$form['identity'] = array(
|
||||||
|
'#type' => 'fieldset',
|
||||||
|
'#title' => 'Select Person',
|
||||||
|
);
|
||||||
|
$form['identity']['booking_variety_regn_feedback_wrapper'] = array(
|
||||||
'#markup' => '<div id="booking_variety_regn_feedback_wrapper" class="form-item">Please enter your booking number from your lanyard.</div>',
|
'#markup' => '<div id="booking_variety_regn_feedback_wrapper" class="form-item">Please enter your booking number from your lanyard.</div>',
|
||||||
);
|
);
|
||||||
$form['booking_nid'] = array(
|
$form['identity']['booking_nid'] = array(
|
||||||
'#type' => 'textfield',
|
'#type' => 'textfield',
|
||||||
'#title' => t('Booking ID'),
|
'#title' => t('Booking Number'),
|
||||||
'#size' => 60,
|
'#size' => 60,
|
||||||
'#required' => TRUE,
|
'#required' => TRUE,
|
||||||
'#default_value' => !empty($data->booking_nid) ? $data->booking_nid : '',
|
'#default_value' => !empty($data->booking_nid) ? $data->booking_nid : '',
|
||||||
@@ -41,12 +45,9 @@ function booking_variety_regn_form($node, &$form_state)
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
// TODO: Update the whole form when booking ID is updated
|
|
||||||
$form['variety-sessions'] = array(
|
$form['variety-sessions'] = array(
|
||||||
'#type' => 'fieldset',
|
'#type' => 'fieldset',
|
||||||
'#title' => 'Select Variety Sessions',
|
'#title' => 'Select Variety Sessions',
|
||||||
//'#prefix' => '<div id="booking_variety_session_wrapper">',
|
|
||||||
//'#suffix' => '</div>',
|
|
||||||
);
|
);
|
||||||
|
|
||||||
//for each entry in the variety timeslot table, create a new form select item
|
//for each entry in the variety timeslot table, create a new form select item
|
||||||
@@ -80,9 +81,43 @@ function booking_variety_session_callback($form, &$form_state) {
|
|||||||
$data = $form_state['input'];
|
$data = $form_state['input'];
|
||||||
//watchdog('booking_debug', 'booking_variety_session_callback:<br /><pre>@info</pre>', array('@info' => print_r( $data, true)));
|
//watchdog('booking_debug', 'booking_variety_session_callback:<br /><pre>@info</pre>', array('@info' => print_r( $data, true)));
|
||||||
|
|
||||||
// TODO : Update the wrapper for booking ID validity
|
// --- Update the wrapper for booking ID validity ---
|
||||||
|
//verify that user-entered data is a number
|
||||||
|
if (! preg_match('/^[0-9]+$/', $data['booking_nid'])) {
|
||||||
|
watchdog('booking_debug', "<pre>booking_variety_session_callback non-numerical input</pre>");
|
||||||
|
$markup = '<div id="booking_variety_regn_feedback_wrapper" class="form-item"><span style="color:#8c2e0b;font-weight: bold;">' .
|
||||||
|
'You have not entered a valid booking reference number.</span></div>';
|
||||||
|
$commands[] = ajax_command_replace('#booking_variety_regn_feedback_wrapper', $markup);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Perform lookup on barcode to make sure it matches someone attending the current event
|
||||||
|
$db_and = db_and();
|
||||||
|
$db_and->condition('p.booking_eventid', $event->eid, '=');
|
||||||
|
$db_and->condition('p.booking_status', 1, '=');
|
||||||
|
$db_and->condition('p.nid', $data['booking_nid'], '=');
|
||||||
|
|
||||||
|
$query = db_select('booking_person', 'p');
|
||||||
|
$query->condition($db_and)
|
||||||
|
->fields('p');
|
||||||
|
$person = $query->execute()
|
||||||
|
->fetchObject();
|
||||||
|
|
||||||
|
if ($person) {
|
||||||
|
watchdog('booking_debug', "<pre>booking_variety_session_callback found valid attendee</pre>");
|
||||||
|
|
||||||
|
$markup = '<div id="booking_variety_regn_feedback_wrapper" class="form-item"><span style="color:#234600;font-weight: bold;">' .
|
||||||
|
'Matched booking reference number.</span></div>';
|
||||||
|
$commands[] = ajax_command_replace('#booking_variety_regn_feedback_wrapper', $markup);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
watchdog('booking_debug', "<pre>booking_variety_session_callback did not find valid attendee</pre>");
|
||||||
|
|
||||||
|
$markup = '<div id="booking_variety_regn_feedback_wrapper" class="form-item"><span style="color:#8c2e0b;font-weight: bold;">' .
|
||||||
|
'You have not entered a valid booking reference number.</span></div>';
|
||||||
|
$commands[] = ajax_command_replace('#booking_variety_regn_feedback_wrapper', $markup);
|
||||||
|
}
|
||||||
|
|
||||||
|
// --- Update the wrapper for available variety sessions ---
|
||||||
// Query the variety timeslot table
|
// Query the variety timeslot table
|
||||||
$timeslot_query = db_select('booking_variety_times', 'v');
|
$timeslot_query = db_select('booking_variety_times', 'v');
|
||||||
$timeslot_query->condition('v.booking_eventid', $event->eid, '=')
|
$timeslot_query->condition('v.booking_eventid', $event->eid, '=')
|
||||||
|
Reference in New Issue
Block a user