add guardian email address
This commit is contained in:
@@ -539,7 +539,7 @@ function booking_update_7233() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove deprecated passport/flight details
|
* Remove deprecated passport and flight details
|
||||||
*/
|
*/
|
||||||
function booking_update_7234() {
|
function booking_update_7234() {
|
||||||
$fields = array(
|
$fields = array(
|
||||||
@@ -555,7 +555,13 @@ function booking_update_7234() {
|
|||||||
db_drop_field('booking_person', $field);
|
db_drop_field('booking_person', $field);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* Add email address for guardian contact info
|
||||||
|
*/
|
||||||
|
function booking_update_7235() {
|
||||||
|
$spec = array('type' => 'varchar', 'length' => '250', 'not null' => FALSE);
|
||||||
|
db_add_field('booking_person', 'booking_guardian_email', $spec);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Implementation of hook_install().
|
* Implementation of hook_install().
|
||||||
@@ -656,6 +662,7 @@ function booking_schema() {
|
|||||||
//emergency contact info
|
//emergency contact info
|
||||||
'booking_guardian_name' => array('type' => 'varchar', 'length' => '100', 'not null' => TRUE),
|
'booking_guardian_name' => array('type' => 'varchar', 'length' => '100', 'not null' => TRUE),
|
||||||
'booking_guardian_type' => array('type' => 'varchar', 'length' => '100', 'not null' => TRUE),
|
'booking_guardian_type' => array('type' => 'varchar', 'length' => '100', 'not null' => TRUE),
|
||||||
|
'booking_guardian_email' => array('type' => 'varchar', 'length' => '250', 'not null' => FALSE),
|
||||||
'booking_guardian_phone' => array('type' => 'varchar', 'length' => '50', 'not null' => FALSE),
|
'booking_guardian_phone' => array('type' => 'varchar', 'length' => '50', 'not null' => FALSE),
|
||||||
'booking_guardian_phone_alt' => array('type' => 'varchar', 'length' => '50', 'not null' => FALSE),
|
'booking_guardian_phone_alt' => array('type' => 'varchar', 'length' => '50', 'not null' => FALSE),
|
||||||
'booking_medicare' => array('type' => 'varchar', 'length' => '50', 'not null' => FALSE),
|
'booking_medicare' => array('type' => 'varchar', 'length' => '50', 'not null' => FALSE),
|
||||||
|
@@ -121,7 +121,15 @@ function booking_form($node, &$form_state, $inserting = FALSE)
|
|||||||
'#type' => 'fieldset',
|
'#type' => 'fieldset',
|
||||||
'#title' => 'Personal details'
|
'#title' => 'Personal details'
|
||||||
);
|
);
|
||||||
|
|
||||||
|
//add a fieldset for data only admins can see
|
||||||
|
if ($inserting == FALSE) {
|
||||||
|
$form['internal-fields'] = array(
|
||||||
|
'#type' => 'fieldset',
|
||||||
|
'#title' => 'Internal Details'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
$form['your-details']['booking_firstname'] = array(
|
$form['your-details']['booking_firstname'] = array(
|
||||||
'#type' => 'textfield',
|
'#type' => 'textfield',
|
||||||
'#title' => t('First Name'),
|
'#title' => t('First Name'),
|
||||||
@@ -171,8 +179,7 @@ function booking_form($node, &$form_state, $inserting = FALSE)
|
|||||||
|
|
||||||
// The status field should not be visible unless this registration is being updated...i.e. not at actual registration time...
|
// The status field should not be visible unless this registration is being updated...i.e. not at actual registration time...
|
||||||
if ($inserting != TRUE) {
|
if ($inserting != TRUE) {
|
||||||
|
$form['internal-details']['booking_comment_field'] = array(
|
||||||
$form['your-details']['booking_comment_field'] = array(
|
|
||||||
'#type' => 'textarea',
|
'#type' => 'textarea',
|
||||||
'#title' => t('Comments relating to this registration. Internal only.'),
|
'#title' => t('Comments relating to this registration. Internal only.'),
|
||||||
'#cols' => 60,
|
'#cols' => 60,
|
||||||
@@ -185,28 +192,28 @@ function booking_form($node, &$form_state, $inserting = FALSE)
|
|||||||
'#default_value' => !empty($data->booking_comment_field) ? $data->booking_comment_field : ''
|
'#default_value' => !empty($data->booking_comment_field) ? $data->booking_comment_field : ''
|
||||||
);
|
);
|
||||||
|
|
||||||
$form['your-details']['booking_status'] = array(
|
$form['internal-details']['booking_status'] = array(
|
||||||
'#type' => 'select',
|
'#type' => 'select',
|
||||||
'#title' => t('Registration Status'),
|
'#title' => t('Registration Status'),
|
||||||
'#options' => _booking_status_generate(),
|
'#options' => _booking_status_generate(),
|
||||||
'#default_value' => !empty($data->booking_status) ? $data->booking_status : ''
|
'#default_value' => !empty($data->booking_status) ? $data->booking_status : ''
|
||||||
);
|
);
|
||||||
|
|
||||||
$form['your-details']['booking_welfare_required'] = array(
|
$form['internal-details']['booking_welfare_required'] = array(
|
||||||
'#type' => 'checkbox',
|
'#type' => 'checkbox',
|
||||||
'#title' => t('Welfare Required?'),
|
'#title' => t('Welfare Required?'),
|
||||||
'#description' => t('Select to mark this attendee as requiring special financial consideration'),
|
'#description' => t('Select to mark this attendee as requiring special financial consideration'),
|
||||||
'#default_value' => (!empty($data->booking_welfare_required) && $data->booking_welfare_required == 'Y') ? 1 : 0
|
'#default_value' => (!empty($data->booking_welfare_required) && $data->booking_welfare_required == 'Y') ? 1 : 0
|
||||||
);
|
);
|
||||||
|
|
||||||
$form['your-details']['booking_committee_member'] = array(
|
$form['internal-details']['booking_committee_member'] = array(
|
||||||
'#type' => 'checkbox',
|
'#type' => 'checkbox',
|
||||||
'#title' => t('Committee Member?'),
|
'#title' => t('Committee Member?'),
|
||||||
'#description' => t('Select to identify this attendee as being on the committee'),
|
'#description' => t('Select to identify this attendee as being on the committee'),
|
||||||
'#default_value' => (!empty($data->booking_committee_member) && $data->booking_committee_member == 'Y') ? 1 : 0
|
'#default_value' => (!empty($data->booking_committee_member) && $data->booking_committee_member == 'Y') ? 1 : 0
|
||||||
);
|
);
|
||||||
|
|
||||||
$form['your-details']['booking_amount_paid'] = array(
|
$form['internal-details']['booking_amount_paid'] = array(
|
||||||
'#type' => 'textfield',
|
'#type' => 'textfield',
|
||||||
'#title' => t('Amount Paid'),
|
'#title' => t('Amount Paid'),
|
||||||
'#maxlength' => 10,
|
'#maxlength' => 10,
|
||||||
@@ -214,27 +221,27 @@ function booking_form($node, &$form_state, $inserting = FALSE)
|
|||||||
'#default_value' => !empty($data->booking_amount_paid) ? $data->booking_amount_paid : ''
|
'#default_value' => !empty($data->booking_amount_paid) ? $data->booking_amount_paid : ''
|
||||||
);
|
);
|
||||||
|
|
||||||
$form['your-details']['booking_total_pay_reqd'] = array(
|
$form['internal-details']['booking_total_pay_reqd'] = array(
|
||||||
'#type' => 'textfield',
|
'#type' => 'textfield',
|
||||||
'#title' => t('Total Amount Due'),
|
'#title' => t('Total Amount Due'),
|
||||||
'#maxlength' => 10,
|
'#maxlength' => 10,
|
||||||
'#required' => FALSE,
|
'#required' => FALSE,
|
||||||
'#default_value' => !empty($data->booking_total_pay_reqd) ? $data->booking_total_pay_reqd : '0.00'
|
'#default_value' => !empty($data->booking_total_pay_reqd) ? $data->booking_total_pay_reqd : '0.00'
|
||||||
);
|
);
|
||||||
$form['your-details']['booking_payment_complete'] = array(
|
$form['internal-details']['booking_payment_complete'] = array(
|
||||||
'#type' => 'checkbox',
|
'#type' => 'checkbox',
|
||||||
'#title' => t('Payment Completed?'),
|
'#title' => t('Payment Completed?'),
|
||||||
'#description' => t('Select to mark this attendee as having fully paid'),
|
'#description' => t('Select to mark this attendee as having fully paid'),
|
||||||
'#default_value' => (!empty($data->booking_payment_complete) && $data->booking_payment_complete == 'Y') ? 1 : 0
|
'#default_value' => (!empty($data->booking_payment_complete) && $data->booking_payment_complete == 'Y') ? 1 : 0
|
||||||
);
|
);
|
||||||
//refund info
|
//refund info
|
||||||
$form['your-details']['booking_refund_processed'] = array(
|
$form['internal-details']['booking_refund_processed'] = array(
|
||||||
'#type' => 'checkbox',
|
'#type' => 'checkbox',
|
||||||
'#title' => t('Refund Processed?'),
|
'#title' => t('Refund Processed?'),
|
||||||
'#description' => t('Select to mark the processing of any applicable refund as complete'),
|
'#description' => t('Select to mark the processing of any applicable refund as complete'),
|
||||||
'#default_value' => (!empty($data->booking_refund_processed) && $data->booking_refund_processed == 'Y') ? 1 : 0
|
'#default_value' => (!empty($data->booking_refund_processed) && $data->booking_refund_processed == 'Y') ? 1 : 0
|
||||||
);
|
);
|
||||||
$form['your-details']['booking_refund_due'] = array(
|
$form['internal-details']['booking_refund_due'] = array(
|
||||||
'#type' => 'textfield',
|
'#type' => 'textfield',
|
||||||
'#title' => t('Refund Amount Due'),
|
'#title' => t('Refund Amount Due'),
|
||||||
'#maxlength' => 10,
|
'#maxlength' => 10,
|
||||||
@@ -565,9 +572,28 @@ function booking_form($node, &$form_state, $inserting = FALSE)
|
|||||||
'#default_value' => empty($data->booking_guardian_type) ? 'parent' : $data->booking_guardian_type,
|
'#default_value' => empty($data->booking_guardian_type) ? 'parent' : $data->booking_guardian_type,
|
||||||
'#required' => TRUE
|
'#required' => TRUE
|
||||||
);
|
);
|
||||||
|
$form['emergency']['booking_guardian_email'] = array(
|
||||||
|
'#type' => 'textfield',
|
||||||
|
'#title' => t('Contact Email Address'),
|
||||||
|
'#size' => 30,
|
||||||
|
'#required' => TRUE,
|
||||||
|
'#default_value' => empty($data->booking_guardian_email) ? '' : $data->booking_guardian_email,
|
||||||
|
);
|
||||||
|
//confirm the guardians email address if the user is entering details
|
||||||
|
//this isn't saved to the database
|
||||||
|
if ($inserting == TRUE) {
|
||||||
|
$form['emergency']['booking_guardian_email_confirm'] = array(
|
||||||
|
'#type' => 'textfield',
|
||||||
|
'#title' => t('Confirm Contact Email Address'),
|
||||||
|
'#size' => 30,
|
||||||
|
'#required' => TRUE,
|
||||||
|
'#default_value' => empty($data->booking_guardian_email_confirm) ? '' : $data->booking_guardian_email_confirm,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
$form['emergency']['booking_guardian_phone'] = array(
|
$form['emergency']['booking_guardian_phone'] = array(
|
||||||
'#type' => 'textfield',
|
'#type' => 'textfield',
|
||||||
'#title' => t('Contact Number'),
|
'#title' => t('Mobile Phone Contact Number'),
|
||||||
'#maxlength' => 30,
|
'#maxlength' => 30,
|
||||||
'#size' => 30,
|
'#size' => 30,
|
||||||
'#required' => TRUE,
|
'#required' => TRUE,
|
||||||
@@ -818,47 +844,6 @@ function booking_form($node, &$form_state, $inserting = FALSE)
|
|||||||
$form['help-areas'][$key] = $value;
|
$form['help-areas'][$key] = $value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
$form['help-areas']['booking_help_music'] = array(
|
|
||||||
'#type' => 'textfield',
|
|
||||||
'#title' => t('I can help with music by playing the following musical instrument(s)'),
|
|
||||||
'#maxlength' => 200,
|
|
||||||
'#required' => FALSE,
|
|
||||||
'#default_value' => !empty($data->booking_help_music) ? $data->booking_help_music : ''
|
|
||||||
);
|
|
||||||
$form['help-areas']['booking_help_reading'] = array(
|
|
||||||
'#type' => 'checkbox',
|
|
||||||
'#title' => t('I can help with reading'),
|
|
||||||
'#default_value' => (!empty($data->booking_help_reading) && $data->booking_help_reading == 'Y') ? 1 : 0
|
|
||||||
);
|
|
||||||
$form['help-areas']['booking_help_chairing'] = array(
|
|
||||||
'#type' => 'checkbox',
|
|
||||||
'#title' => t('I can help with chairing'),
|
|
||||||
'#default_value' => (!empty($data->booking_help_chairing) && $data->booking_help_chairing == 'Y') ? 1 : 0
|
|
||||||
);
|
|
||||||
$form['help-areas']['booking_help_praying'] = array(
|
|
||||||
'#type' => 'checkbox',
|
|
||||||
'#title' => t('I can help with praying'),
|
|
||||||
'#default_value' => (!empty($data->booking_help_praying) && $data->booking_help_praying == 'Y') ? 1 : 0
|
|
||||||
);
|
|
||||||
$form['help-areas']['booking_help_meditations'] = array(
|
|
||||||
'#type' => 'checkbox',
|
|
||||||
'#title' => t('I can help with evening meditations'),
|
|
||||||
'#default_value' => (!empty($data->booking_help_meditations) && $data->booking_help_meditations == 'Y') ? 1 : 0
|
|
||||||
);
|
|
||||||
$form['help-areas']['booking_firstaid'] = array(
|
|
||||||
'#type' => 'checkbox',
|
|
||||||
'#title' => t('I am a qualified First Aid Officer'),
|
|
||||||
'#default_value' => (!empty($data->booking_firstaid) && $data->booking_firstaid == 'Y') ? 1 : 0
|
|
||||||
);
|
|
||||||
$form['help-areas']['booking_nurse'] = array(
|
|
||||||
'#type' => 'checkbox',
|
|
||||||
'#title' => t('I am a qualified Nurse'),
|
|
||||||
'#default_value' => (!empty($data->booking_nurse) && $data->booking_nurse == 'Y') ? 1 : 0
|
|
||||||
);
|
|
||||||
*/
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (variable_get('booking_enable_skills', 1) == 1) {
|
if (variable_get('booking_enable_skills', 1) == 1) {
|
||||||
@@ -1089,25 +1074,26 @@ function booking_form($node, &$form_state, $inserting = FALSE)
|
|||||||
|
|
||||||
function booking_form_validate($form, &$form_state)
|
function booking_form_validate($form, &$form_state)
|
||||||
{
|
{
|
||||||
return _booking_validate($form_state['values']['form_id'], $form_state['input']);
|
// return _booking_validate($form_state['values']['form_id'], $form_state['input']);
|
||||||
}
|
//}
|
||||||
|
//function _booking_validate($node, &$form_state)
|
||||||
function _booking_validate($node, &$form_state)
|
//{
|
||||||
{
|
|
||||||
global $event;
|
global $event;
|
||||||
//watchdog('booking', '<pre>Booking registration form validation:\n@info</pre>', array('@info' => print_r( $form_state, true)));
|
$node = $form_state['values']['form_id'];
|
||||||
|
$data = $form_state['input'];
|
||||||
|
//watchdog('booking', '<pre>Booking registration form validation:\n@info</pre>', array('@info' => print_r( $data, true)));
|
||||||
|
|
||||||
//in case the date of birth field hasn't been filled out
|
//in case the date of birth field hasn't been filled out
|
||||||
watchdog('booking', 'Blank date of birth checking: @info', array(
|
watchdog('booking', 'Blank date of birth checking: @info', array(
|
||||||
'@info' => var_export($form_state['booking_dob'], TRUE)
|
'@info' => var_export($data['booking_dob'], TRUE)
|
||||||
));
|
));
|
||||||
$dob_check = $form_state['booking_dob']['day'] != '' && $form_state['booking_dob']['month'] != '' && $form_state['booking_dob']['year'] != '' ? _datearray_to_ts($form_state['booking_dob']) : 0;
|
$dob_check = $data['booking_dob']['day'] != '' && $data['booking_dob']['month'] != '' && $data['booking_dob']['year'] != '' ? _datearray_to_ts($data['booking_dob']) : 0;
|
||||||
|
|
||||||
//Verify this is not a duplicate registration
|
//Verify this is not a duplicate registration
|
||||||
//try and find the person in the database for this event
|
//try and find the person in the database for this event
|
||||||
$person = db_query("SELECT person.nid, person.booking_tempid " . "FROM {booking_person} person " . "WHERE booking_firstname = :first AND booking_lastname = :last AND booking_dob = :dob AND booking_eventid = :eid", array(
|
$person = db_query("SELECT person.nid, person.booking_tempid " . "FROM {booking_person} person " . "WHERE booking_firstname = :first AND booking_lastname = :last AND booking_dob = :dob AND booking_eventid = :eid", array(
|
||||||
':first' => $form_state['booking_firstname'],
|
':first' => $data['booking_firstname'],
|
||||||
':last' => $form_state['booking_lastname'],
|
':last' => $data['booking_lastname'],
|
||||||
':dob' => $dob_check,
|
':dob' => $dob_check,
|
||||||
':eid' => $event->eid
|
':eid' => $event->eid
|
||||||
))->fetchObject();
|
))->fetchObject();
|
||||||
@@ -1127,9 +1113,9 @@ function _booking_validate($node, &$form_state)
|
|||||||
}
|
}
|
||||||
|
|
||||||
//verify partner id is in the correct format
|
//verify partner id is in the correct format
|
||||||
if (isset($form_state['booking_partner_id']) && $form_state['booking_partner_id'] != '') {
|
if (isset($data['booking_partner_id']) && $data['booking_partner_id'] != '') {
|
||||||
|
|
||||||
if (!is_numeric($form_state['booking_partner_id'])) {
|
if (!is_numeric($data['booking_partner_id'])) {
|
||||||
form_set_error('booking_partner_id', t('You have entered an invalid partner registration id. Please ensure you are using only the registration reference number your partner received via email. If you believe this to be incorrect, please !contact using the details provided.', array(
|
form_set_error('booking_partner_id', t('You have entered an invalid partner registration id. Please ensure you are using only the registration reference number your partner received via email. If you believe this to be incorrect, please !contact using the details provided.', array(
|
||||||
'!contact' => l('contact us', 'contact')
|
'!contact' => l('contact us', 'contact')
|
||||||
)));
|
)));
|
||||||
@@ -1137,7 +1123,7 @@ function _booking_validate($node, &$form_state)
|
|||||||
|
|
||||||
//check that the partner exists
|
//check that the partner exists
|
||||||
$partner = db_query("SELECT person.nid, person.booking_married " . "FROM {booking_person} person " . "WHERE nid = :nid AND person.booking_married = 'Y'", array(
|
$partner = db_query("SELECT person.nid, person.booking_married " . "FROM {booking_person} person " . "WHERE nid = :nid AND person.booking_married = 'Y'", array(
|
||||||
':nid' => $form_state['booking_partner_id']
|
':nid' => $data['booking_partner_id']
|
||||||
))->fetchObject();
|
))->fetchObject();
|
||||||
|
|
||||||
//watchdog('booking', 'Checking for partner via query: @info', array('@info' => $partner->__toString()));
|
//watchdog('booking', 'Checking for partner via query: @info', array('@info' => $partner->__toString()));
|
||||||
@@ -1149,25 +1135,39 @@ function _booking_validate($node, &$form_state)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//watchdog('booking', 'Form validate data: @info', array('@info' => var_export($form_state, TRUE)));
|
//watchdog('booking', 'Form validate data: @info', array('@info' => var_export($data, TRUE)));
|
||||||
$email = (isset($form_state['booking_email']) ? $form_state['booking_email'] : $node->booking_email);
|
//validate attendee's email address
|
||||||
if (strlen(trim($email)) > 0 && !_valid_email_address($email))
|
$email = (isset($data['booking_email']) ? $data['booking_email'] : $node->booking_email);
|
||||||
|
if (strlen(trim($email)) > 0 && !_valid_email_address($email)) {
|
||||||
form_set_error('booking_email', t('You must enter a valid e-mail address. Please ensure you typed your email address correctly.'));
|
form_set_error('booking_email', t('You must enter a valid e-mail address. Please ensure you typed your email address correctly.'));
|
||||||
|
}
|
||||||
|
|
||||||
//make sure that the email confirmation field matches the first email address entry
|
//make sure that the email confirmation field matches the first email address entry
|
||||||
$email_confirm = (isset($form_state['booking_email_confirm']) ? $form_state['booking_email_confirm'] : $node->booking_email);
|
$email_confirm = (isset($data['booking_email_confirm']) ? $data['booking_email_confirm'] : $node->booking_email);
|
||||||
$email = preg_replace('/\s+/', '', $email);
|
$email = preg_replace('/\s+/', '', $email);
|
||||||
$email_confirm = preg_replace('/\s+/', '', $email_confirm);
|
$email_confirm = preg_replace('/\s+/', '', $email_confirm);
|
||||||
if (strcasecmp($email, $email_confirm) !== 0) {
|
if (strcasecmp($email, $email_confirm) !== 0) {
|
||||||
form_set_error('booking_email', t('Your email address does not match. Please ensure you typed your email address correctly.'));
|
form_set_error('booking_email', t('Your email addresses do not match. Please ensure you typed your email address correctly.'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//validate emergency contact's email address
|
||||||
|
$guardian_email = (isset($data['booking_guardian_email']) ? $data['booking_guardian_email'] : $node->booking_guardian_email);
|
||||||
|
if (strlen(trim($guardian_email)) > 0 && !_valid_email_address($guardian_email)) {
|
||||||
|
form_set_error('booking_guardian_email', t('You must enter a valid e-mail address. Please ensure you typed your emergency contact\'s email address correctly.'));
|
||||||
|
}
|
||||||
|
$guardian_email_confirm = (isset($data['booking_guardian_email_confirm']) ? $data['booking_guardian_email_confirm'] : $node->booking_guardian_email);
|
||||||
|
$guardian_email = preg_replace('/\s+/', '', $guardian_email);
|
||||||
|
$guardian_email_confirm = preg_replace('/\s+/', '', $guardian_email_confirm);
|
||||||
|
if (strcasecmp($guardian_email_confirm, $guardian_email_confirm) !== 0) {
|
||||||
|
form_set_error('booking_guardian_email', t('Your emergency contact\'s email addresses do not match. Please ensure you typed your emergency contact\'s email address correctly.'));
|
||||||
|
}
|
||||||
|
|
||||||
//if DOB on form is more recent than DOB limit, display validation error
|
//if DOB on form is more recent than DOB limit, display validation error
|
||||||
if ($dob_check > _booking_max_dob_ts()) {
|
if ($dob_check > _booking_max_dob_ts()) {
|
||||||
watchdog('booking', "Attempt to register from !first !last, who is too young (!info) to attend event.", array(
|
watchdog('booking', "Attempt to register from !first !last, who is too young (!info) to attend event.", array(
|
||||||
'!first' => $form_state['booking_firstname'],
|
'!first' => $data['booking_firstname'],
|
||||||
'!last' => $form_state['booking_lastname'],
|
'!last' => $data['booking_lastname'],
|
||||||
'!info' => var_export($form_state['booking_dob'], TRUE)
|
'!info' => var_export($data['booking_dob'], TRUE)
|
||||||
));
|
));
|
||||||
form_set_error('booking_dob', t('Unfortunately you are too young to attend !event.', array(
|
form_set_error('booking_dob', t('Unfortunately you are too young to attend !event.', array(
|
||||||
'!event' => variable_get('booking_event_name', 'this event')
|
'!event' => variable_get('booking_event_name', 'this event')
|
||||||
@@ -1175,13 +1175,13 @@ function _booking_validate($node, &$form_state)
|
|||||||
}
|
}
|
||||||
|
|
||||||
//check the medicare number for people in Australia
|
//check the medicare number for people in Australia
|
||||||
if (variable_get('booking_enable_medicare', 1) == 1 && $form_state['booking_country'] == 'Australia') {
|
if (variable_get('booking_enable_medicare', 1) == 1 && $data['booking_country'] == 'Australia') {
|
||||||
//proper validation routine at http://dyball.wordpress.com/2007/12/05/validation-of-medicare-numbers/
|
//proper validation routine at http://dyball.wordpress.com/2007/12/05/validation-of-medicare-numbers/
|
||||||
if ((variable_get('booking_enforce_medicare_verification', 1) == 1) && (!_valid_medicare_number($form_state['booking_medicare']))) {
|
if ((variable_get('booking_enforce_medicare_verification', 1) == 1) && (!_valid_medicare_number($data['booking_medicare']))) {
|
||||||
form_set_error('booking_medicare', t('You have entered an invalid medicare number. Please check your medicare card and re-enter the number. If you believe this to be incorrect, please !contact.', array(
|
form_set_error('booking_medicare', t('You have entered an invalid medicare number. Please check your medicare card and re-enter the number. If you believe this to be incorrect, please !contact.', array(
|
||||||
'!contact' => l('send us an email', 'mailto:' . variable_get('booking_contact_email') . '?subject=Invalid Medicare Number')
|
'!contact' => l('send us an email', 'mailto:' . variable_get('booking_contact_email') . '?subject=Invalid Medicare Number')
|
||||||
)));
|
)));
|
||||||
} elseif ((variable_get('booking_enforce_medicare_verification', 1) == 0) && (!_valid_medicare_number($form_state['booking_medicare']))) {
|
} elseif ((variable_get('booking_enforce_medicare_verification', 1) == 0) && (!_valid_medicare_number($data['booking_medicare']))) {
|
||||||
drupal_set_message(t('You have entered an invalid medicare number. Please ensure you check your medicare card and send us the correct information via !contact.', array(
|
drupal_set_message(t('You have entered an invalid medicare number. Please ensure you check your medicare card and send us the correct information via !contact.', array(
|
||||||
'!contact' => l('email', 'mailto:' . variable_get('booking_contact_email') . '?subject=Invalid Medicare Number')
|
'!contact' => l('email', 'mailto:' . variable_get('booking_contact_email') . '?subject=Invalid Medicare Number')
|
||||||
)), 'error', FALSE);
|
)), 'error', FALSE);
|
||||||
@@ -1191,24 +1191,24 @@ function _booking_validate($node, &$form_state)
|
|||||||
//verify state information with the new few checks
|
//verify state information with the new few checks
|
||||||
|
|
||||||
//make sure state field is not blank
|
//make sure state field is not blank
|
||||||
if ($form_state['booking_state'] == '_blank_') {
|
if ($data['booking_state'] == '_blank_') {
|
||||||
form_set_error('booking_state', t('You must enter your State in the address section of the Contact details. ' . 'Please choose a state of Other and specify N/A if your country does not have states, or choose NZ if you reside in New Zealand.'));
|
form_set_error('booking_state', t('You must enter your State in the address section of the Contact details. ' . 'Please choose a state of Other and specify N/A if your country does not have states, or choose NZ if you reside in New Zealand.'));
|
||||||
}
|
}
|
||||||
|
|
||||||
//verify international address has updated the state field
|
//verify international address has updated the state field
|
||||||
if ((strcasecmp($form_state['booking_country'], 'New Zealand') == 0) && (strcasecmp($form_state['booking_state'], 'NZ') !== 0)) {
|
if ((strcasecmp($data['booking_country'], 'New Zealand') == 0) && (strcasecmp($data['booking_state'], 'NZ') !== 0)) {
|
||||||
form_set_error('booking_state', t('You have indicated you reside in New Zealand. Please select NZ as your state.'));
|
form_set_error('booking_state', t('You have indicated you reside in New Zealand. Please select NZ as your state.'));
|
||||||
} elseif ((strcasecmp($form_state['booking_country'], 'Australia') !== 0) && (strcasecmp($form_state['booking_state'], 'Other') !== 0) && (strcasecmp($form_state['booking_state'], 'NZ') !== 0)) {
|
} elseif ((strcasecmp($data['booking_country'], 'Australia') !== 0) && (strcasecmp($data['booking_state'], 'Other') !== 0) && (strcasecmp($data['booking_state'], 'NZ') !== 0)) {
|
||||||
form_set_error('booking_state', t('You must enter your State in the address section of the Contact details. Please choose a state of Other and specify N/A if your country does not have states.'));
|
form_set_error('booking_state', t('You must enter your State in the address section of the Contact details. Please choose a state of Other and specify N/A if your country does not have states.'));
|
||||||
}
|
}
|
||||||
|
|
||||||
//verify that a state has been entered if "Other" was selected
|
//verify that a state has been entered if "Other" was selected
|
||||||
if (($form_state['booking_state'] == 'Other') && ($form_state['booking_other_state'] == ''))
|
if (($data['booking_state'] == 'Other') && ($data['booking_other_state'] == ''))
|
||||||
form_set_error('booking_other_state', t('You must enter your State in the address section of the Contact details. Please put N/A if your country does not have states.'));
|
form_set_error('booking_other_state', t('You must enter your State in the address section of the Contact details. Please put N/A if your country does not have states.'));
|
||||||
|
|
||||||
//verify passport number
|
//verify passport number
|
||||||
if (variable_get('booking_enable_passport', 0) == 1 && $form_state['booking_country'] == 'Australia') {
|
if (variable_get('booking_enable_passport', 0) == 1 && $data['booking_country'] == 'Australia') {
|
||||||
if (($form_state['booking_passport_num'] != '') && (!_valid_passport_number($form_state['booking_passport_num']))) {
|
if (($data['booking_passport_num'] != '') && (!_valid_passport_number($data['booking_passport_num']))) {
|
||||||
form_set_error('booking_passport_num', t('You have entered an invalid passport number. Please check your passport and re-enter the number. ' . 'If you believe this to be incorrect, please !contact.', array(
|
form_set_error('booking_passport_num', t('You have entered an invalid passport number. Please check your passport and re-enter the number. ' . 'If you believe this to be incorrect, please !contact.', array(
|
||||||
'!contact' => l('send us an email', 'mailto:' . variable_get('booking_contact_email') . '?subject=Invalid Passport Number')
|
'!contact' => l('send us an email', 'mailto:' . variable_get('booking_contact_email') . '?subject=Invalid Passport Number')
|
||||||
)));
|
)));
|
||||||
@@ -1216,29 +1216,29 @@ function _booking_validate($node, &$form_state)
|
|||||||
}
|
}
|
||||||
|
|
||||||
//check at least one phone number has been entered
|
//check at least one phone number has been entered
|
||||||
if (($form_state['booking_phone'] == '') && ($form_state['booking_mobile'] == ''))
|
if (($data['booking_phone'] == '') && ($data['booking_mobile'] == ''))
|
||||||
form_set_error('booking_mobile', t('You must enter at least one phone number, either a mobile phone or a home phone number.'));
|
form_set_error('booking_mobile', t('You must enter at least one phone number, either a mobile phone or a home phone number.'));
|
||||||
if (($form_state['booking_phone'] != '') && (!_valid_phone_number($form_state['booking_phone'])))
|
if (($data['booking_phone'] != '') && (!_valid_phone_number($data['booking_phone'])))
|
||||||
form_set_error('booking_phone', t('You have entered an invalid home phone number.'));
|
form_set_error('booking_phone', t('You have entered an invalid home phone number.'));
|
||||||
if (($form_state['booking_mobile'] != '') && (!_valid_phone_number($form_state['booking_mobile'])))
|
if (($data['booking_mobile'] != '') && (!_valid_phone_number($data['booking_mobile'])))
|
||||||
form_set_error('booking_mobile', t('You have entered an invalid mobile phone number.'));
|
form_set_error('booking_mobile', t('You have entered an invalid mobile phone number.'));
|
||||||
|
|
||||||
//verify an australian mobile number is entered correctly if applicable
|
//verify an australian mobile number is entered correctly if applicable
|
||||||
if (($form_state['booking_mobile'] != '') && ($form_state['booking_country'] == 'Australia') && (!_valid_australian_mobile_number($form_state['booking_mobile'])))
|
if (($data['booking_mobile'] != '') && ($data['booking_country'] == 'Australia') && (!_valid_australian_mobile_number($data['booking_mobile'])))
|
||||||
form_set_error('booking_mobile', t('You have entered an invalid mobile phone number.'));
|
form_set_error('booking_mobile', t('You have entered an invalid mobile phone number.'));
|
||||||
|
|
||||||
//verify guardian phone number(s)
|
//verify guardian phone number(s)
|
||||||
if (($form_state['booking_guardian_phone'] != '') && (!_valid_phone_number($form_state['booking_guardian_phone'])))
|
if (($data['booking_guardian_phone'] != '') && (!_valid_phone_number($data['booking_guardian_phone'])))
|
||||||
form_set_error('booking_guardian_phone', t('You have entered an contact phone number for your emergency contact.'));
|
form_set_error('booking_guardian_phone', t('You have entered an contact phone number for your emergency contact.'));
|
||||||
|
|
||||||
//check the terms and conditions have been agreed to. Do this one last so it stands out more
|
//check the terms and conditions have been agreed to. Do this one last so it stands out more
|
||||||
if ($form_state['booking_agreement'] == 0)
|
if ($data['booking_agreement'] == 0)
|
||||||
form_set_error('booking_agreement', t('You must read and agree with the aims and expectations prior to submitting this form.'));
|
form_set_error('booking_agreement', t('You must read and agree with the aims and expectations prior to submitting this form.'));
|
||||||
|
|
||||||
//if there are any errors then log the data the user entered so we can check it later
|
//if there are any errors then log the data the user entered so we can check it later
|
||||||
if (form_get_errors()) {
|
if (form_get_errors()) {
|
||||||
watchdog('booking', "<pre>Detected validation error(s):\n@errors\n\n User data:\n@info</pre>", array(
|
watchdog('booking', "<pre>Detected validation error(s):\n@errors\n\n User data:\n@info</pre>", array(
|
||||||
'@info' => print_r($form_state, true),
|
'@info' => print_r($data, true),
|
||||||
'@errors' => print_r(form_get_errors(), true)
|
'@errors' => print_r(form_get_errors(), true)
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
@@ -1280,6 +1280,7 @@ function booking_form_submit($form, &$form_state)
|
|||||||
$node->booking_status = 0; //zero means not yet coming. Only change to 1 when a payment is made
|
$node->booking_status = 0; //zero means not yet coming. Only change to 1 when a payment is made
|
||||||
|
|
||||||
//passport details
|
//passport details
|
||||||
|
/*
|
||||||
$node->booking_passport_num = empty($values['booking_passport_num']) ? '' : $values['booking_passport_num'];
|
$node->booking_passport_num = empty($values['booking_passport_num']) ? '' : $values['booking_passport_num'];
|
||||||
$node->booking_passport_issue_location = empty($values['booking_passport_issue_location']) ? '' : $values['booking_passport_issue_location'];
|
$node->booking_passport_issue_location = empty($values['booking_passport_issue_location']) ? '' : $values['booking_passport_issue_location'];
|
||||||
$node->booking_passport_issue_name = empty($values['booking_passport_issue_name']) ? '' : $values['booking_passport_issue_name'];
|
$node->booking_passport_issue_name = empty($values['booking_passport_issue_name']) ? '' : $values['booking_passport_issue_name'];
|
||||||
@@ -1303,7 +1304,7 @@ function booking_form_submit($form, &$form_state)
|
|||||||
$node->booking_rtrnflight_connecting_flightnum = empty($values['booking_rtrnflight_connecting_flightnum']) ? '' : $values['booking_rtrnflight_connecting_flightnum'];
|
$node->booking_rtrnflight_connecting_flightnum = empty($values['booking_rtrnflight_connecting_flightnum']) ? '' : $values['booking_rtrnflight_connecting_flightnum'];
|
||||||
$node->booking_rtrnflight_destination = empty($values['booking_rtrnflight_destination']) ? '' : $values['booking_rtrnflight_destination'];
|
$node->booking_rtrnflight_destination = empty($values['booking_rtrnflight_destination']) ? '' : $values['booking_rtrnflight_destination'];
|
||||||
$node->booking_rtrnflight_destination_ts = empty($values['booking_rtrnflight_destination_ts']) ? '0' : _datetime_array_to_ts($values['booking_rtrnflight_destination_ts']);
|
$node->booking_rtrnflight_destination_ts = empty($values['booking_rtrnflight_destination_ts']) ? '0' : _datetime_array_to_ts($values['booking_rtrnflight_destination_ts']);
|
||||||
|
*/
|
||||||
//payment details
|
//payment details
|
||||||
$node->booking_payment_id = $values['booking_payment_id'];
|
$node->booking_payment_id = $values['booking_payment_id'];
|
||||||
|
|
||||||
@@ -1332,6 +1333,7 @@ function booking_form_submit($form, &$form_state)
|
|||||||
//emergency contact info
|
//emergency contact info
|
||||||
$node->booking_guardian_name = $values['booking_guardian_name'];
|
$node->booking_guardian_name = $values['booking_guardian_name'];
|
||||||
$node->booking_guardian_type = $values['booking_guardian_type'];
|
$node->booking_guardian_type = $values['booking_guardian_type'];
|
||||||
|
$node->booking_guardian_email = $values['booking_guardian_email'];
|
||||||
$node->booking_guardian_phone = $values['booking_guardian_phone'];
|
$node->booking_guardian_phone = $values['booking_guardian_phone'];
|
||||||
$node->booking_guardian_phone_alt = $values['booking_guardian_phone_alt'];
|
$node->booking_guardian_phone_alt = $values['booking_guardian_phone_alt'];
|
||||||
$node->booking_medicare = empty($values['booking_medicare']) ? 0 : $values['booking_medicare'];
|
$node->booking_medicare = empty($values['booking_medicare']) ? 0 : $values['booking_medicare'];
|
||||||
|
@@ -342,7 +342,8 @@ function booking_insert($node) {
|
|||||||
'booking_amount_paid' => $node->booking_amount_paid,
|
'booking_amount_paid' => $node->booking_amount_paid,
|
||||||
'booking_total_pay_reqd' => $node->booking_total_pay_reqd,
|
'booking_total_pay_reqd' => $node->booking_total_pay_reqd,
|
||||||
'booking_guardian_name' => $node->booking_guardian_name,
|
'booking_guardian_name' => $node->booking_guardian_name,
|
||||||
'booking_guardian_type' => $node->booking_guardian_type,
|
'booking_guardian_type' => $node->booking_guardian_type,
|
||||||
|
'booking_guardian_email' => $node->booking_guardian_email,
|
||||||
'booking_guardian_phone' => $node->booking_guardian_phone,
|
'booking_guardian_phone' => $node->booking_guardian_phone,
|
||||||
'booking_guardian_phone_alt' => $node->booking_guardian_phone_alt,
|
'booking_guardian_phone_alt' => $node->booking_guardian_phone_alt,
|
||||||
'booking_medicare' => empty($node->booking_medicare) ? '' : $node->booking_medicare,
|
'booking_medicare' => empty($node->booking_medicare) ? '' : $node->booking_medicare,
|
||||||
@@ -453,7 +454,8 @@ function booking_update($node) {
|
|||||||
'booking_amount_paid' => $node->booking_amount_paid,
|
'booking_amount_paid' => $node->booking_amount_paid,
|
||||||
'booking_refund_due' => $node->booking_refund_due == '' ? 0 : $node->booking_refund_due,
|
'booking_refund_due' => $node->booking_refund_due == '' ? 0 : $node->booking_refund_due,
|
||||||
'booking_guardian_name' => $node->booking_guardian_name,
|
'booking_guardian_name' => $node->booking_guardian_name,
|
||||||
'booking_guardian_type' => $node->booking_guardian_type,
|
'booking_guardian_type' => $node->booking_guardian_type,
|
||||||
|
'booking_guardian_email' => $node->booking_guardian_email,
|
||||||
'booking_guardian_phone' => $node->booking_guardian_phone,
|
'booking_guardian_phone' => $node->booking_guardian_phone,
|
||||||
'booking_guardian_phone_alt' => $node->booking_guardian_phone_alt,
|
'booking_guardian_phone_alt' => $node->booking_guardian_phone_alt,
|
||||||
'booking_medicare' => $node->booking_medicare,
|
'booking_medicare' => $node->booking_medicare,
|
||||||
@@ -858,6 +860,7 @@ function booking_view($node, $view_mode) {
|
|||||||
$rows[] = array(t('Linked Boyfriend/Girlfriend:'), t($bf_gf));
|
$rows[] = array(t('Linked Boyfriend/Girlfriend:'), t($bf_gf));
|
||||||
$rows[] = array(t('Emergency Contact Name:'), $node->booking_guardian_name);
|
$rows[] = array(t('Emergency Contact Name:'), $node->booking_guardian_name);
|
||||||
$rows[] = array(t('Emergency Contact Relationship:'), $node->booking_guardian_type);
|
$rows[] = array(t('Emergency Contact Relationship:'), $node->booking_guardian_type);
|
||||||
|
$rows[] = array(t('Emergency Contact Email Address:'), $node->booking_guardian_email);
|
||||||
$rows[] = array(t('Emergency Contact Phone:'), $node->booking_guardian_phone);
|
$rows[] = array(t('Emergency Contact Phone:'), $node->booking_guardian_phone);
|
||||||
$rows[] = array(t('Emergency Contact Alternate Phone:'), $node->booking_guardian_phone_alt);
|
$rows[] = array(t('Emergency Contact Alternate Phone:'), $node->booking_guardian_phone_alt);
|
||||||
if (variable_get('booking_enable_medicare', 1) == 1)
|
if (variable_get('booking_enable_medicare', 1) == 1)
|
||||||
|
Reference in New Issue
Block a user