add surname to variety session form
This commit is contained in:
@@ -41,6 +41,20 @@ function booking_variety_regn_form($node, &$form_state)
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
$form['identity']['booking_lastname'] = array(
|
||||||
|
'#type' => 'textfield',
|
||||||
|
'#title' => t('Surname'),
|
||||||
|
'#description' => t('Please enter your last name as it appeared when you registered.'),
|
||||||
|
'#size' => 60,
|
||||||
|
'#required' => TRUE,
|
||||||
|
'#default_value' => !empty($data->booking_lastname) ? $data->booking_lastname : '',
|
||||||
|
'#ajax' => array(
|
||||||
|
'event' => 'change',
|
||||||
|
'wrapper' => 'booking_variety_session_fieldset_wrapper',
|
||||||
|
'callback' => 'booking_variety_session_form_callback',
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
$form['variety-sessions'] = array(
|
$form['variety-sessions'] = array(
|
||||||
'#type' => 'fieldset',
|
'#type' => 'fieldset',
|
||||||
'#title' => 'Select Variety Sessions',
|
'#title' => 'Select Variety Sessions',
|
||||||
@@ -48,6 +62,10 @@ function booking_variety_regn_form($node, &$form_state)
|
|||||||
'#suffix' => '</div>'
|
'#suffix' => '</div>'
|
||||||
);
|
);
|
||||||
|
|
||||||
|
$form['variety-sessions']['booking_feedback_wrapper'] = array(
|
||||||
|
'#markup' => '<div id="booking_feedback_wrapper"></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
|
||||||
foreach($result as $timeslot) {
|
foreach($result as $timeslot) {
|
||||||
$fieldname = 'select-variety-' . $timeslot->tid;
|
$fieldname = 'select-variety-' . $timeslot->tid;
|
||||||
@@ -104,6 +122,7 @@ function _booking_get_variety_timeslot_options($timeslot_id) {
|
|||||||
*/
|
*/
|
||||||
function booking_variety_session_form_callback($form, &$form_state) {
|
function booking_variety_session_form_callback($form, &$form_state) {
|
||||||
$form_state['rebuild'] = TRUE;
|
$form_state['rebuild'] = TRUE;
|
||||||
|
$form['form']['variety-sessions']['booking_feedback_wrapper']['#markup'] = '<div id="booking_feedback_wrapper">Test</div>';
|
||||||
return $form['form']['variety-sessions'];
|
return $form['form']['variety-sessions'];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -133,6 +152,7 @@ function booking_variety_regn_form_validate($form, &$form_state) {
|
|||||||
$db_and->condition('p.booking_eventid', $event->eid, '=');
|
$db_and->condition('p.booking_eventid', $event->eid, '=');
|
||||||
$db_and->condition('p.booking_status', 1, '=');
|
$db_and->condition('p.booking_status', 1, '=');
|
||||||
$db_and->condition('p.nid', $values['booking_nid'], '=');
|
$db_and->condition('p.nid', $values['booking_nid'], '=');
|
||||||
|
$db_and->condition('p.booking_lastname', $values['booking_lastname'], '=');
|
||||||
|
|
||||||
$query = db_select('booking_person', 'p');
|
$query = db_select('booking_person', 'p');
|
||||||
$query->condition($db_and)
|
$query->condition($db_and)
|
||||||
@@ -141,7 +161,7 @@ function booking_variety_regn_form_validate($form, &$form_state) {
|
|||||||
->fetchObject();
|
->fetchObject();
|
||||||
|
|
||||||
if (! $person) {
|
if (! $person) {
|
||||||
form_set_error('booking_nid', t('You have entered an invalid booking reference number.'));
|
form_set_error('booking_nid', t('You have entered an invalid booking reference number or your surname does not match your registration details.'));
|
||||||
}
|
}
|
||||||
|
|
||||||
// --- Check that this person hasn't already registered for variety sessions
|
// --- Check that this person hasn't already registered for variety sessions
|
||||||
|
Reference in New Issue
Block a user