1472 lines
67 KiB
PHP
1472 lines
67 KiB
PHP
<?php
|
|
|
|
/**
|
|
* Handle user registrations
|
|
*/
|
|
function booking_register_page()
|
|
{
|
|
//get some configuration information
|
|
global $event;
|
|
$output = "";
|
|
$return_array = array();
|
|
|
|
//set the page title
|
|
$bookingTitle = !empty($event->booking_eventname) ? $event->booking_eventname : 'Event';
|
|
drupal_set_title($bookingTitle . ' Booking Form');
|
|
|
|
//figure out if we're allowed to accept bookings
|
|
$booking_times = db_query("SELECT booking_register_open, booking_register_close FROM {booking_event} where eid = :eid",
|
|
array(':eid' => $event->eid))->fetchObject();
|
|
|
|
if ($booking_times->booking_register_open < time() && $booking_times->booking_register_close > time()) {
|
|
//we are within the allowed timeframe for registrations
|
|
//check if this registration will be on the waiting list
|
|
if (_booking_check_bookings_full() == True) {
|
|
$output = token_replace(variable_get('booking_registration_waiting_intro_text'), booking_define_tokens());
|
|
} else {
|
|
//watchdog('booking', 'Booking registration form intro text: @info', array('@info' => var_export(variable_get('booking_registration_intro_text'), TRUE)));
|
|
$output = token_replace(variable_get('booking_registration_intro_text'), booking_define_tokens());
|
|
}
|
|
$return_array[] = array(
|
|
'paragraph' => array(
|
|
'#type' => 'markup',
|
|
'#markup' => $output
|
|
)
|
|
);
|
|
$return_array[] = array(
|
|
'form' => drupal_get_form('booking_form', true)
|
|
);
|
|
} elseif ($booking_times->booking_register_close < time()) {
|
|
//too late to register
|
|
$output = token_replace(variable_get('default_into_regn_closed_text'), booking_define_tokens());
|
|
$return_array[] = array(
|
|
'paragraph' => array(
|
|
'#type' => 'markup',
|
|
'#markup' => $output
|
|
)
|
|
);
|
|
} else {
|
|
//too early to register
|
|
$output = token_replace(variable_get('default_into_regn_not_opened_text'), booking_define_tokens());
|
|
$return_array[] = array(
|
|
'paragraph' => array(
|
|
'#type' => 'markup',
|
|
'#markup' => $output
|
|
)
|
|
);
|
|
}
|
|
|
|
return $return_array;
|
|
}
|
|
|
|
function booking_form($node, &$form_state, $inserting = FALSE)
|
|
{
|
|
|
|
global $event;
|
|
$status_options = array();
|
|
$payment_type_options = array();
|
|
$partner_options = array();
|
|
date_default_timezone_set(date_default_timezone(FALSE));
|
|
|
|
//calculate what years to show in the date of birth field
|
|
//along with some fudge factors to handle dates partway through the year
|
|
$min_dob_years = _booking_year_offset(variable_get('booking_min_dob', '1970-01-01 00:00:00')) + 1;
|
|
$max_dob_years = _booking_year_offset(variable_get('booking_max_dob', '1970-01-01 00:00:00')) - 1;
|
|
$date_year_range = "-" . $min_dob_years . ':-' . $max_dob_years;
|
|
|
|
//determine whether loading saved node or form submission
|
|
if (!empty($node)) {
|
|
$data = $node;
|
|
//watchdog('booking', 'Booking registration form loading data from saved node: @info', array('@info' => var_export($node, TRUE)));
|
|
} else {
|
|
$data = $form_state['input'];
|
|
//watchdog('booking', 'Booking registration form loading data from form submission: @info', array('@info' => var_export($form_state, TRUE)));
|
|
}
|
|
|
|
//figure out if we're in the earlybird rate section
|
|
/*
|
|
$early = db_query("SELECT booking_earlybird_close FROM {booking_event} where eid = :eid",
|
|
array(
|
|
':eid' => $event->eid
|
|
))->fetchObject();
|
|
if ($early->booking_earlybird_close > time())
|
|
$select_early = 1;
|
|
else {
|
|
$select_early = 0;
|
|
//watchdog('booking', 'No longer accepting earlybird prices');
|
|
}
|
|
|
|
$result = db_query("SELECT pid, booking_price_descrip, booking_price, booking_late_price FROM {booking_price} where booking_eventid = :eid " . "and booking_price_active=1 and booking_depositonly = 0", array(
|
|
':eid' => $event->eid
|
|
));
|
|
*/
|
|
|
|
$select_early = _booking_is_earlybird();
|
|
|
|
$price_query = db_select('booking_price', 'p');
|
|
$db_and = db_and()->condition('p.booking_eventid', $event->eid, '=')
|
|
->condition('p.booking_price_active', 1, '=')
|
|
->condition('p.booking_depositonly', 0, '=');
|
|
$price_query->condition($db_and);
|
|
$price_query->fields('p');
|
|
$result = $price_query->execute();
|
|
|
|
foreach ($result as $row) {
|
|
$price = $select_early == TRUE ? $row->booking_price : $row->booking_late_price;
|
|
$payment_type_options[$row->pid] = $row->booking_price_descrip . ' ($' . $price . ')';
|
|
}
|
|
|
|
//form starts here
|
|
$form['your-details'] = array(
|
|
'#type' => 'fieldset',
|
|
'#title' => 'Personal details'
|
|
);
|
|
|
|
$form['your-details']['booking_firstname'] = array(
|
|
'#type' => 'textfield',
|
|
'#title' => t('First Name'),
|
|
'#maxlength' => 45,
|
|
'#required' => TRUE,
|
|
'#default_value' => !empty($data->booking_firstname) ? $data->booking_firstname : ''
|
|
);
|
|
$form['your-details']['booking_lastname'] = array(
|
|
'#type' => 'textfield',
|
|
'#title' => t('Last Name'),
|
|
'#maxlength' => 45,
|
|
'#required' => TRUE,
|
|
'#default_value' => !empty($data->booking_lastname) ? $data->booking_lastname : ''
|
|
);
|
|
|
|
$form['your-details']['booking_gender'] = array(
|
|
'#type' => 'select',
|
|
'#title' => t('Gender'),
|
|
'#required' => TRUE,
|
|
'#default_value' => variable_get('booking_gender', empty($data->booking_gender) ? variable_get('booking_default_gender') : $data->booking_gender),
|
|
'#options' => _booking_gender_options()
|
|
);
|
|
|
|
//If we're loading this from an existing node, we need to convert the timestamp into the proper format
|
|
$form['your-details']['booking_dob'] = array(
|
|
'#type' => 'date_select',
|
|
'#title' => t('Date of Birth'),
|
|
'#default_value' => empty($data->booking_dob) ? '' : date("Y-m-d H:i:s", $data->booking_dob),
|
|
'#required' => TRUE,
|
|
'#date_format' => 'd/m/Y',
|
|
'#date_label_position' => 'within',
|
|
'#date_year_range' => '-60:-10'
|
|
//'#date_year_range' => $date_year_range,
|
|
);
|
|
|
|
//override our generous date year range if this is a new form submission and that feature is enabled
|
|
if ($inserting == TRUE && variable_get('booking_enable_min_age_restriction', 1) == 1) {
|
|
$form['your-details']['booking_dob']['#date_year_range'] = $date_year_range;
|
|
}
|
|
|
|
$form['your-details']['booking_payment_id'] = array(
|
|
'#type' => 'select',
|
|
'#title' => t('Choose your payment type'),
|
|
'#default_value' => $inserting != TRUE ? $data->booking_payment_id : variable_get('booking_payment_id', 'worker'),
|
|
'#options' => $payment_type_options
|
|
);
|
|
|
|
// The status field should not be visible unless this registration is being updated...i.e. not at actual registration time...
|
|
if ($inserting != TRUE) {
|
|
|
|
$form['your-details']['booking_comment_field'] = array(
|
|
'#type' => 'textarea',
|
|
'#title' => t('Comments relating to this registration. Internal only.'),
|
|
'#cols' => 60,
|
|
'#rows' => 5,
|
|
'#resizable' => TRUE,
|
|
'#required' => FALSE,
|
|
'#attributes' => array(
|
|
'maxlength' => 1000
|
|
),
|
|
'#default_value' => !empty($data->booking_comment_field) ? $data->booking_comment_field : ''
|
|
);
|
|
|
|
$form['your-details']['booking_status'] = array(
|
|
'#type' => 'select',
|
|
'#title' => t('Registration Status'),
|
|
'#options' => _booking_status_generate(),
|
|
'#default_value' => !empty($data->booking_status) ? $data->booking_status : ''
|
|
);
|
|
|
|
$form['your-details']['booking_welfare_required'] = array(
|
|
'#type' => 'checkbox',
|
|
'#title' => t('Welfare Required?'),
|
|
'#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
|
|
);
|
|
|
|
$form['your-details']['booking_committee_member'] = array(
|
|
'#type' => 'checkbox',
|
|
'#title' => t('Committee Member?'),
|
|
'#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
|
|
);
|
|
|
|
$form['your-details']['booking_amount_paid'] = array(
|
|
'#type' => 'textfield',
|
|
'#title' => t('Amount Paid'),
|
|
'#maxlength' => 10,
|
|
'#required' => FALSE,
|
|
'#default_value' => !empty($data->booking_amount_paid) ? $data->booking_amount_paid : ''
|
|
);
|
|
|
|
$form['your-details']['booking_total_pay_reqd'] = array(
|
|
'#type' => 'textfield',
|
|
'#title' => t('Total Amount Due'),
|
|
'#maxlength' => 10,
|
|
'#required' => FALSE,
|
|
'#default_value' => !empty($data->booking_total_pay_reqd) ? $data->booking_total_pay_reqd : '0.00'
|
|
);
|
|
$form['your-details']['booking_payment_complete'] = array(
|
|
'#type' => 'checkbox',
|
|
'#title' => t('Payment Completed?'),
|
|
'#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
|
|
);
|
|
//refund info
|
|
$form['your-details']['booking_refund_processed'] = array(
|
|
'#type' => 'checkbox',
|
|
'#title' => t('Refund Processed?'),
|
|
'#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
|
|
);
|
|
$form['your-details']['booking_refund_due'] = array(
|
|
'#type' => 'textfield',
|
|
'#title' => t('Refund Amount Due'),
|
|
'#maxlength' => 10,
|
|
'#required' => FALSE,
|
|
'#default_value' => !empty($data->booking_refund_due) ? $data->booking_refund_due : '0.00'
|
|
);
|
|
|
|
} //end inserting check for admin-only fields
|
|
|
|
//tshirts
|
|
if (variable_get('booking_enable_tshirts', 0) == 1) {
|
|
$form['your-details']['booking_shirt_size'] = array(
|
|
'#type' => 'select',
|
|
'#title' => t(variable_get('booking_tshirts_text_definition', 'Preferred hoodie size')),
|
|
'#required' => FALSE,
|
|
'#default_value' => variable_get('booking_shirt_size', empty($data->booking_shirt_size) ? '' : $data->booking_shirt_size),
|
|
'#options' => _get_tshirt_options()
|
|
);
|
|
} //end enable tshirts check
|
|
|
|
$form['your-details']['booking_ecclesia'] = array(
|
|
'#type' => 'textfield',
|
|
'#title' => t('Ecclesia'),
|
|
'#maxlength' => 100,
|
|
'#required' => FALSE,
|
|
'#default_value' => !empty($data->booking_ecclesia) ? $data->booking_ecclesia : ''
|
|
);
|
|
$form['your-details']['booking_baptised'] = array(
|
|
'#type' => 'checkbox',
|
|
'#title' => t('I am baptised'),
|
|
'#default_value' => (!empty($data->booking_baptised) && $data->booking_baptised == 'Y') ? 1 : 0
|
|
);
|
|
|
|
if (variable_get('booking_allow_couples', 0) == 1) {
|
|
$form['your-details']['booking_married'] = array(
|
|
'#type' => 'checkbox',
|
|
'#title' => t('I am married'),
|
|
'#default_value' => (!empty($data->booking_married) && $data->booking_married == 'Y') ? 1 : 0
|
|
);
|
|
$form['your-details']['booking_partner_name'] = array(
|
|
'#type' => 'textfield',
|
|
'#title' => t('If your partner is coming to !event also, please enter their name here. They must register and pay seperately.', array(
|
|
'!event' => $event->booking_eventname
|
|
)),
|
|
'#maxlength' => 120,
|
|
'#required' => FALSE,
|
|
'#states' => array(
|
|
// Only show this field when the 'booking_married' checkbox is enabled.
|
|
'visible' => array(
|
|
':input[name="booking_married"]' => array(
|
|
'checked' => TRUE
|
|
)
|
|
)
|
|
),
|
|
'#default_value' => !empty($data->booking_partner_name) ? $data->booking_partner_name : ''
|
|
);
|
|
|
|
if (variable_get('booking_ask_dependant_children', 0) == 1) {
|
|
$form['your-details']['booking_dependant_children'] = array(
|
|
'#type' => 'radios',
|
|
'#title' => t('Are you bringing dependant children to study week?'),
|
|
'#options' => array(
|
|
0 => t('No'),
|
|
t('Yes')
|
|
),
|
|
'#default_value' => (!empty($data->booking_dependant_children) && $data->booking_dependant_children == 'Y') ? 1 : 0,
|
|
'#required' => FALSE,
|
|
'#states' => array(
|
|
// Only show this field when the 'booking_married' checkbox is enabled.
|
|
'visible' => array(
|
|
':input[name="booking_married"]' => array(
|
|
'checked' => TRUE
|
|
)
|
|
)
|
|
)
|
|
);
|
|
|
|
$form['your-details']['booking_dependant_children_warning'] = array(
|
|
'#type' => 'container',
|
|
'#children' => variable_get('booking_dependant_children_text_definition', "<b>Please note that only one dependant child under the age of two is allowed.</b>"),
|
|
'#states' => array(
|
|
'visible' => array(
|
|
':input[name="booking_dependant_children"]' => array(
|
|
'value' => 1
|
|
)
|
|
)
|
|
)
|
|
);
|
|
}
|
|
|
|
if ($inserting == TRUE) {
|
|
$form['your-details']['booking_partner_id'] = array(
|
|
'#type' => 'textfield',
|
|
'#title' => t('If your partner has already registered for !event, please enter their registration id (number only) from the email they were sent. Otherwise, leave blank', array(
|
|
'!event' => $event->booking_eventname
|
|
)),
|
|
'#maxlength' => 15,
|
|
'#size' => 4,
|
|
'#required' => FALSE,
|
|
'#states' => array(
|
|
// Only show this field when the 'booking_married' checkbox is enabled.
|
|
'visible' => array(
|
|
':input[name="booking_married"]' => array(
|
|
'checked' => TRUE
|
|
)
|
|
)
|
|
),
|
|
'#default_value' => !empty($data->booking_partner_name) ? $data->booking_partner_name : ''
|
|
);
|
|
} else //not inserting so allow administrator to choose a person
|
|
{
|
|
//add the empty element first
|
|
$partner_options[] = '';
|
|
|
|
//get a list of possible partners
|
|
$partners = db_query("SELECT nid, booking_firstname, booking_lastname, booking_partner_id FROM {booking_person} " . "where booking_eventid = :eid and booking_married='Y' order by booking_lastname, booking_firstname", array(
|
|
':eid' => $event->eid
|
|
));
|
|
|
|
//convert that into an array
|
|
foreach ($partners as $row)
|
|
$partner_options[$row->nid] = $row->booking_firstname . ' ' . $row->booking_lastname;
|
|
//create a select field
|
|
$form['your-details']['booking_partner_id'] = array(
|
|
'#type' => 'select',
|
|
'#title' => t('Choose Spouse'),
|
|
'#default_value' => $data->booking_partner_id,
|
|
'#options' => $partner_options
|
|
);
|
|
|
|
//add the boyfriend/girlfriend field in here too
|
|
$form['your-details']['booking_bf_gf_nid'] = array(
|
|
'#type' => 'textfield',
|
|
'#title' => t('Registration ID of Boyfriend/Girlfriend to be placed in the same discussion groups as you.'),
|
|
'#maxlength' => 15,
|
|
'#size' => 4,
|
|
'#required' => FALSE,
|
|
'#default_value' => !empty($data->booking_bf_gf_nid) ? $data->booking_bf_gf_nid : ''
|
|
);
|
|
}
|
|
} //end allow couples check
|
|
|
|
//watchdog('booking', 'Booking registration form payment type: @info. Payment id: !id',
|
|
// array('@info' => $payment_type_options[$data->booking_payment_id], '!id' => $data->booking_payment_id ));
|
|
|
|
//only show the booking agreement tickbox if the node is being created, since this value isn't stored anywhere
|
|
if ($inserting == TRUE) {
|
|
/*
|
|
$form['your-details']['booking_regular_cyc'] = array
|
|
(
|
|
'#type' => 'checkbox',
|
|
'#title' => t('Regularly Attend CYC '),
|
|
'#default_value' => empty($data->booking_agreement) ? 0 : $data->booking_agreement,
|
|
'#title' => t('I regularly attend CYC events/activities'),
|
|
); */
|
|
|
|
$form['your-details']['booking_agreement'] = array(
|
|
'#type' => 'checkbox',
|
|
'#title' => t('Aims and Expectations'),
|
|
'#default_value' => empty($data->booking_agreement) ? 0 : $data->booking_agreement,
|
|
/*
|
|
'#states' => array(
|
|
// Only show this field when the checkbox is unchecked.
|
|
'visible' => array(
|
|
':input[name="booking_agreement"]' => array('checked' => FALSE),
|
|
),
|
|
),
|
|
*/
|
|
'#title' => token_replace(variable_get('booking_registration_aims_rules_checkbox'), booking_define_tokens()),
|
|
'#description' => token_replace(variable_get('booking_registration_aims_rules_text'), booking_define_tokens())
|
|
);
|
|
} else {
|
|
//not inserting
|
|
$form['booking_agreement'] = array(
|
|
'#type' => 'hidden',
|
|
'#value' => 1
|
|
);
|
|
|
|
$form['your-details']['booking_barcode'] = array(
|
|
'#type' => 'textfield',
|
|
'#title' => t('Barcode'),
|
|
'#maxlength' => 30,
|
|
'#size' => 30,
|
|
'#required' => FALSE,
|
|
'#default_value' => !empty($data->booking_barcode) ? $data->booking_barcode : ''
|
|
);
|
|
|
|
$form['your-details']['booking_luckynum'] = array(
|
|
'#type' => 'textfield',
|
|
'#title' => t('Lucky Number'),
|
|
'#maxlength' => 30,
|
|
'#size' => 30,
|
|
'#required' => FALSE,
|
|
'#default_value' => !empty($data->booking_luckynum) ? $data->booking_luckynum : ''
|
|
);
|
|
|
|
$form['your-details']['booking_readinggroup'] = array(
|
|
'#type' => 'textfield',
|
|
'#title' => t('Reading Group Allocation'),
|
|
'#maxlength' => 100,
|
|
'#default_value' => !empty($data->booking_readinggroup) ? $data->booking_readinggroup : ''
|
|
);
|
|
} //end not-inserting check
|
|
|
|
|
|
$form['contact-details'] = array(
|
|
'#type' => 'fieldset',
|
|
'#title' => 'Contact details'
|
|
);
|
|
$form['contact-details']['booking_email'] = array(
|
|
'#type' => 'textfield',
|
|
'#title' => t('E-mail address'),
|
|
'#maxlength' => 100,
|
|
'#required' => TRUE,
|
|
'#default_value' => !empty($data->booking_email) ? $data->booking_email : ''
|
|
);
|
|
|
|
// Only confirm email address if the user is typing in their details
|
|
if ($inserting == TRUE) {
|
|
$form['contact-details']['booking_email_confirm'] = array(
|
|
'#type' => 'textfield',
|
|
'#title' => t('Confirm e-mail address'),
|
|
'#maxlength' => 100,
|
|
'#required' => TRUE,
|
|
'#default_value' => !empty($data->booking_email_confirm) ? $data->booking_email_confirm : ''
|
|
);
|
|
}
|
|
|
|
$form['contact-details']['booking_phone'] = array(
|
|
'#type' => 'textfield',
|
|
'#title' => t('Home Phone Number'),
|
|
'#maxlength' => 30,
|
|
'#size' => 35,
|
|
'#required' => FALSE,
|
|
'#default_value' => !empty($data->booking_phone) ? $data->booking_phone : ''
|
|
);
|
|
$form['contact-details']['booking_mobile'] = array(
|
|
'#type' => 'textfield',
|
|
'#title' => t('Mobile Phone Number'),
|
|
'#size' => 35,
|
|
'#maxlength' => 30,
|
|
'#required' => FALSE,
|
|
'#default_value' => !empty($data->booking_mobile) ? $data->booking_mobile : ''
|
|
);
|
|
|
|
$form['contact-details']['booking_street'] = array(
|
|
'#type' => 'textfield',
|
|
'#title' => t('Street Address'),
|
|
'#maxlength' => 50,
|
|
'#required' => TRUE,
|
|
'#default_value' => !empty($data->booking_street) ? $data->booking_street : ''
|
|
);
|
|
$form['contact-details']['booking_suburb'] = array(
|
|
'#type' => 'textfield',
|
|
'#title' => t('Suburb'),
|
|
'#maxlength' => 50,
|
|
'#required' => TRUE,
|
|
'#default_value' => !empty($data->booking_suburb) ? $data->booking_suburb : ''
|
|
);
|
|
|
|
|
|
if ($inserting == TRUE) {
|
|
$form['contact-details']['booking_state'] = array(
|
|
'#type' => 'select',
|
|
'#title' => t('State'),
|
|
'#required' => TRUE,
|
|
'#default_value' => !empty($data->booking_state) ? $data->booking_state : variable_get('booking_default_state', 'NSW'),
|
|
'#options' => _booking_state_options()
|
|
);
|
|
$form['contact-details']['booking_other_state'] = array(
|
|
'#type' => 'textfield',
|
|
'#title' => t('Please specify state'),
|
|
'#maxlength' => 50,
|
|
'#states' => array(
|
|
// Only show this field when the 'booking_state' is set to other.
|
|
'visible' => array(
|
|
':input[name="booking_state"]' => array(
|
|
'value' => 'Other'
|
|
)
|
|
)
|
|
),
|
|
'#default_value' => ''
|
|
);
|
|
} else {
|
|
//when modifying the node just show the textfield
|
|
$form['contact-details']['booking_state'] = array(
|
|
'#type' => 'textfield',
|
|
'#title' => t('State'),
|
|
'#maxlength' => 50,
|
|
'#default_value' => !empty($data->booking_state) ? $data->booking_state : ''
|
|
);
|
|
}
|
|
|
|
|
|
$form['contact-details']['booking_postcode'] = array(
|
|
'#type' => 'textfield',
|
|
'#title' => t('Postal/Zip code'),
|
|
'#maxlength' => 8,
|
|
'#size' => 10,
|
|
'#required' => TRUE,
|
|
'#default_value' => !empty($data->booking_postcode) ? $data->booking_postcode : ''
|
|
);
|
|
$form['contact-details']['booking_country'] = array(
|
|
'#type' => 'select',
|
|
'#title' => t('Country'),
|
|
'#required' => TRUE,
|
|
'#default_value' => variable_get('booking_country', empty($data->booking_country) ? variable_get('booking_default_country') : $data->booking_country),
|
|
'#options' => _booking_country_options()
|
|
);
|
|
|
|
//emergency contact details
|
|
$form['emergency'] = array(
|
|
'#type' => 'fieldset',
|
|
'#title' => 'Emergency Contact Details',
|
|
'#description' => 'Please enter contact details for use in case of emergency'
|
|
);
|
|
$form['emergency']['booking_guardian_name'] = array(
|
|
'#type' => 'textfield',
|
|
'#title' => t('Parent/Guardian Name'),
|
|
'#maxlength' => 100,
|
|
'#required' => TRUE,
|
|
'#default_value' => empty($data->booking_guardian_name) ? '' : $data->booking_guardian_name
|
|
);
|
|
$form['emergency']['booking_guardian_type'] = array(
|
|
'#type' => 'radios',
|
|
'#title' => t('Relation to you'),
|
|
'#options' => _booking_get_emergency_contact_types(),
|
|
'#default_value' => empty($data->booking_guardian_type) ? 'parent' : $data->booking_guardian_type,
|
|
'#required' => TRUE
|
|
);
|
|
$form['emergency']['booking_guardian_phone'] = array(
|
|
'#type' => 'textfield',
|
|
'#title' => t('Contact Number'),
|
|
'#maxlength' => 30,
|
|
'#size' => 30,
|
|
'#required' => TRUE,
|
|
'#default_value' => empty($data->booking_guardian_phone) ? '' : $data->booking_guardian_phone
|
|
);
|
|
$form['emergency']['booking_guardian_phone_alt'] = array(
|
|
'#type' => 'textfield',
|
|
'#title' => t('Alternate Contact Number'),
|
|
'#maxlength' => 30,
|
|
'#size' => 30,
|
|
'#required' => FALSE,
|
|
'#default_value' => empty($data->booking_guardian_phone_alt) ? '' : $data->booking_guardian_phone_alt
|
|
);
|
|
|
|
if (variable_get('booking_enable_medicare', 1) == 1) {
|
|
$form['emergency']['booking_medicare'] = array(
|
|
'#type' => 'textfield',
|
|
'#title' => t('Your Medicare Number'),
|
|
'#maxlength' => 15,
|
|
'#size' => 15,
|
|
'#required' => FALSE,
|
|
//'#required' => variable_get('booking_enforce_medicare_verification', 1) == 1 ? TRUE : FALSE,
|
|
'#default_value' => empty($data->booking_medicare) ? '' : $data->booking_medicare
|
|
);
|
|
}
|
|
/*
|
|
if (variable_get('booking_enable_passport', 0) == 1) {
|
|
$form['passport-details'] = array(
|
|
'#type' => 'fieldset',
|
|
'#title' => 'Passport Details'
|
|
);
|
|
$form['passport-details']['booking_passport_num'] = array(
|
|
'#type' => 'textfield',
|
|
'#title' => t('Passport Number'),
|
|
'#maxlength' => 45,
|
|
'#required' => FALSE,
|
|
'#default_value' => !empty($data->booking_passport_num) ? $data->booking_passport_num : ''
|
|
);
|
|
$form['passport-details']['booking_passport_issue_location'] = array(
|
|
'#type' => 'textfield',
|
|
'#title' => t('City of Issue (eg Sydney)'),
|
|
'#maxlength' => 120,
|
|
'#required' => FALSE,
|
|
'#default_value' => !empty($data->booking_passport_issue_location) ? $data->booking_passport_issue_location : ''
|
|
);
|
|
$form['passport-details']['booking_passport_issue_name'] = array(
|
|
'#type' => 'textfield',
|
|
'#title' => t('Exact name as listed on passport'),
|
|
'#maxlength' => 120,
|
|
'#required' => FALSE,
|
|
'#default_value' => !empty($data->booking_passport_issue_name) ? $data->booking_passport_issue_name : ''
|
|
);
|
|
$form['passport-details']['booking_passport_expiry_date'] = array(
|
|
'#type' => 'date_select',
|
|
'#title' => t('Passport expiry date'),
|
|
'#default_value' => empty($data->booking_passport_expiry_date) ? '' : date("Y-m-d H:i:s", $data->booking_passport_expiry_date),
|
|
'#required' => FALSE,
|
|
'#date_format' => 'd/m/Y',
|
|
//'#date_label_position' => 'within',
|
|
'#date_year_range' => '+0:+13'
|
|
);
|
|
$form['passport-details']['booking_travel_insurance'] = array(
|
|
'#type' => 'textfield',
|
|
'#title' => t('Travel insurance policy details'),
|
|
'#maxlength' => 120,
|
|
'#required' => FALSE,
|
|
'#default_value' => !empty($data->booking_travel_insurance) ? $data->booking_travel_insurance : ''
|
|
);
|
|
if ($inserting == FALSE) {
|
|
$form['passport-details']['booking_destination_country'] = array(
|
|
'#type' => 'textfield',
|
|
'#title' => t('Which country is this person going to?'),
|
|
'#maxlength' => 120,
|
|
'#required' => FALSE,
|
|
'#default_value' => !empty($data->booking_destination_country) ? $data->booking_destination_country : ''
|
|
);
|
|
|
|
//flights from the conference week to the destination country
|
|
$form['outbound-flight-details'] = array(
|
|
'#type' => 'fieldset',
|
|
'#title' => 'Flight Details (Conference To Destination Country)'
|
|
);
|
|
$form['outbound-flight-details']['booking_outflight_bookingnum'] = array(
|
|
'#type' => 'textfield',
|
|
'#title' => t('Internal Flight Booking Reference (departing conference week)'),
|
|
'#maxlength' => 120,
|
|
'#required' => FALSE,
|
|
'#default_value' => !empty($data->booking_outflight_bookingnum) ? $data->booking_outflight_bookingnum : ''
|
|
);
|
|
$form['outbound-flight-details']['booking_outflight_flightnum'] = array(
|
|
'#type' => 'textfield',
|
|
'#title' => t('Internal Flight Number (departing conference week)'),
|
|
'#maxlength' => 120,
|
|
'#required' => FALSE,
|
|
'#default_value' => !empty($data->booking_outflight_flightnum) ? $data->booking_outflight_flightnum : ''
|
|
);
|
|
$form['outbound-flight-details']['booking_outflight_origin'] = array(
|
|
'#type' => 'textfield',
|
|
'#title' => t('Internal Flight Origin to Destination (departing conference week)'),
|
|
'#maxlength' => 120,
|
|
'#required' => FALSE,
|
|
'#default_value' => !empty($data->booking_outflight_origin) ? $data->booking_outflight_origin : ''
|
|
);
|
|
$form['outbound-flight-details']['booking_outflight_origin_ts'] = array(
|
|
'#type' => 'date_select',
|
|
'#title' => t('Internal flight departure time (local timezone)'),
|
|
'#description' => t('Note: 24 hour time - 12:00 is midday'),
|
|
'#default_value' => empty($data->booking_outflight_origin_ts) ? '' : date("Y-m-d H:i:s", $data->booking_outflight_origin_ts),
|
|
'#date_format' => 'd/m/Y H:i',
|
|
'#date_year_range' => '0:+1'
|
|
);
|
|
$form['outbound-flight-details']['booking_outflight_connecting_flightnum'] = array(
|
|
'#type' => 'textfield',
|
|
'#title' => t('Connecting Flight Number (if applicable)'),
|
|
'#maxlength' => 120,
|
|
'#required' => FALSE,
|
|
'#default_value' => !empty($data->booking_outflight_connecting_flightnum) ? $data->booking_outflight_connecting_flightnum : ''
|
|
);
|
|
$form['outbound-flight-details']['booking_outflight_destination'] = array(
|
|
'#type' => 'textfield',
|
|
'#title' => t('Connecting Flight Origin to Destination'),
|
|
'#maxlength' => 120,
|
|
'#required' => FALSE,
|
|
'#default_value' => !empty($data->booking_outflight_destination) ? $data->booking_outflight_destination : ''
|
|
);
|
|
$form['outbound-flight-details']['booking_outflight_destination_ts'] = array(
|
|
'#type' => 'date_select',
|
|
'#title' => t('Internal flight arrival time (local timezone)'),
|
|
'#description' => t('Note: 24 hour time - 12:00 is midday'),
|
|
'#default_value' => empty($data->booking_outflight_destination_ts) ? '' : date("Y-m-d H:i:s", $data->booking_outflight_destination_ts),
|
|
'#date_format' => 'd/m/Y H:i',
|
|
'#date_year_range' => '0:+1'
|
|
);
|
|
|
|
//flights from the destination country back to conference
|
|
$form['inbound-flight-details'] = array(
|
|
'#type' => 'fieldset',
|
|
'#title' => 'Flight Details (Destination Country Back To Conference)'
|
|
);
|
|
$form['inbound-flight-details']['booking_rtrnflight_bookingnum'] = array(
|
|
'#type' => 'textfield',
|
|
'#title' => t('Internal Flight Booking Reference (returning to conference)'),
|
|
'#maxlength' => 120,
|
|
'#required' => FALSE,
|
|
'#default_value' => !empty($data->booking_rtrnflight_bookingnum) ? $data->booking_rtrnflight_bookingnum : ''
|
|
);
|
|
$form['inbound-flight-details']['booking_rtrnflight_flightnum'] = array(
|
|
'#type' => 'textfield',
|
|
'#title' => t('Internal Flight Number (returning to conference)'),
|
|
'#maxlength' => 120,
|
|
'#required' => FALSE,
|
|
'#default_value' => !empty($data->booking_rtrnflight_flightnum) ? $data->booking_rtrnflight_flightnum : ''
|
|
);
|
|
$form['inbound-flight-details']['booking_rtrnflight_origin'] = array(
|
|
'#type' => 'textfield',
|
|
'#title' => t('Internal Flight Origin to Destination (returning to conference)'),
|
|
'#maxlength' => 120,
|
|
'#required' => FALSE,
|
|
'#default_value' => !empty($data->booking_rtrnflight_origin) ? $data->booking_rtrnflight_origin : ''
|
|
);
|
|
$form['inbound-flight-details']['booking_rtrnflight_origin_ts'] = array(
|
|
'#type' => 'date_select',
|
|
'#title' => t('Internal flight departure time (local timezone)'),
|
|
'#description' => t('Note: 24 hour time - 12:00 is midday'),
|
|
'#default_value' => empty($data->booking_rtrnflight_origin_ts) ? '' : date("Y-m-d H:i:s", $data->booking_rtrnflight_origin_ts),
|
|
'#date_format' => 'd/m/Y H:i',
|
|
'#date_year_range' => '0:+1'
|
|
);
|
|
$form['inbound-flight-details']['booking_rtrnflight_connecting_flightnum'] = array(
|
|
'#type' => 'textfield',
|
|
'#title' => t('Connecting Flight Number (if applicable)'),
|
|
'#maxlength' => 120,
|
|
'#required' => FALSE,
|
|
'#default_value' => !empty($data->booking_rtrnflight_connecting_flightnum) ? $data->booking_rtrnflight_connecting_flightnum : ''
|
|
);
|
|
$form['inbound-flight-details']['booking_rtrnflight_destination'] = array(
|
|
'#type' => 'textfield',
|
|
'#title' => t('Connecting Flight Origin to Destination'),
|
|
'#maxlength' => 120,
|
|
'#required' => FALSE,
|
|
'#default_value' => !empty($data->booking_rtrnflight_destination) ? $data->booking_rtrnflight_destination : ''
|
|
);
|
|
$form['inbound-flight-details']['booking_rtrnflight_destination_ts'] = array(
|
|
'#type' => 'date_select',
|
|
'#title' => t('Internal flight arrival time (local timezone)'),
|
|
'#description' => t('Note: 24 hour time - 12:00 is midday'),
|
|
'#default_value' => empty($data->booking_rtrnflight_destination_ts) ? '' : date("Y-m-d H:i:s", $data->booking_rtrnflight_destination_ts),
|
|
'#date_format' => 'd/m/Y H:i',
|
|
'#date_year_range' => '0:+1'
|
|
);
|
|
}
|
|
} //end passport only fields
|
|
*/
|
|
if (variable_get('booking_enable_helpareas', 1) == 1) {
|
|
$form['help-areas'] = array(
|
|
'#type' => 'fieldset',
|
|
'#title' => 'Help Areas'
|
|
);
|
|
|
|
//retrieve help areas that have been enabled by admin
|
|
$enabled_help_areas = variable_get('booking_enabled_helparea_options', NULL);
|
|
//watchdog('booking', "<pre>Retreiving help area options:\n@info</pre>", array('@info' => print_r( $enabled_help_areas, true)));
|
|
|
|
//define help areas
|
|
$help_areas = array(
|
|
'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 : ''
|
|
),
|
|
'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
|
|
),
|
|
'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
|
|
),
|
|
'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
|
|
),
|
|
'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
|
|
),
|
|
'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
|
|
),
|
|
'booking_nurse' => array(
|
|
'#type' => 'checkbox',
|
|
'#title' => t('I am a qualified Nurse'),
|
|
'#default_value' => (!empty($data->booking_nurse) && $data->booking_nurse == 'Y') ? 1 : 0
|
|
)
|
|
);
|
|
|
|
//include enabled help areas in the form
|
|
foreach ($help_areas as $key => $value) {
|
|
if (in_array($key, $enabled_help_areas)) {
|
|
$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) {
|
|
$form['mission-experience'] = array(
|
|
'#type' => 'fieldset',
|
|
'#title' => 'Mission Work Experience'
|
|
);
|
|
$form['mission-experience']['booking_has_mission_experience'] = array(
|
|
'#type' => 'checkbox',
|
|
'#title' => t('I have previous mission work experience'),
|
|
'#default_value' => (!empty($data->booking_has_mission_experience) && $data->booking_has_mission_experience == 'Y') ? 1 : 0
|
|
);
|
|
|
|
$form['mission-experience']['booking_mission_experience_details'] = array(
|
|
'#type' => 'textfield',
|
|
'#title' => t("Please list the places you've done mission work previously"),
|
|
'#maxlength' => 200,
|
|
//'#size' => 100,
|
|
'#required' => FALSE,
|
|
'#states' => array(
|
|
// Only show this field when the 'booking_has_mission_experience' checkbox is enabled.
|
|
'visible' => array(
|
|
':input[name="booking_has_mission_experience"]' => array(
|
|
'checked' => TRUE
|
|
)
|
|
)
|
|
),
|
|
'#default_value' => !empty($data->booking_mission_experience_details) ? $data->booking_mission_experience_details : ''
|
|
);
|
|
$form['skill-areas'] = array(
|
|
'#type' => 'fieldset',
|
|
'#title' => 'Skills Section'
|
|
);
|
|
$form['skill-areas']['booking_skills_builder'] = array(
|
|
'#type' => 'checkbox',
|
|
'#title' => t('I am an experienced builder'),
|
|
'#default_value' => (!empty($data->booking_skills_builder) && $data->booking_skills_builder == 'Y') ? 1 : 0
|
|
);
|
|
$form['skill-areas']['booking_skills_cooking'] = array(
|
|
'#type' => 'checkbox',
|
|
'#title' => t('I can assist with cooking'),
|
|
'#default_value' => (!empty($data->booking_skills_cooking) && $data->booking_skills_cooking == 'Y') ? 1 : 0
|
|
);
|
|
$form['skill-areas']['booking_skills_childminding'] = array(
|
|
'#type' => 'checkbox',
|
|
'#title' => t('I have child minding experience or am happy to work with children and sunday school students'),
|
|
'#default_value' => (!empty($data->booking_skills_childminding) && $data->booking_skills_childminding == 'Y') ? 1 : 0
|
|
);
|
|
$form['skill-areas']['booking_skills_language'] = array(
|
|
'#type' => 'checkbox',
|
|
'#title' => t('I can speak multiple languages'),
|
|
'#default_value' => (!empty($data->booking_skills_language) && $data->booking_skills_language == 'Y') ? 1 : 0
|
|
);
|
|
|
|
$form['skill-areas']['booking_skills_language_details'] = array(
|
|
'#type' => 'textfield',
|
|
'#title' => t('Please list any languages other than English that you speak'),
|
|
'#maxlength' => 250,
|
|
'#required' => FALSE,
|
|
'#states' => array(
|
|
'visible' => array(
|
|
':input[name="booking_skills_language"]' => array(
|
|
'checked' => TRUE
|
|
)
|
|
)
|
|
),
|
|
'#default_value' => !empty($data->booking_skills_language_details) ? $data->booking_skills_language_details : ''
|
|
);
|
|
|
|
$form['skill-areas']['booking_skills_other'] = array(
|
|
'#type' => 'checkbox',
|
|
'#title' => t('I have other skills that can assist in preaching activities'),
|
|
'#default_value' => (!empty($data->booking_skills_other) && $data->booking_skills_other == 'Y') ? 1 : 0
|
|
);
|
|
$form['skill-areas']['booking_skills_other_details'] = array(
|
|
'#type' => 'textfield',
|
|
'#title' => t('Please list any skills you believe will be helpful'),
|
|
'#maxlength' => 250,
|
|
'#required' => FALSE,
|
|
'#states' => array(
|
|
'visible' => array(
|
|
':input[name="booking_skills_other"]' => array(
|
|
'checked' => TRUE
|
|
)
|
|
)
|
|
),
|
|
'#default_value' => !empty($data->booking_skills_other_details) ? $data->booking_skills_other_details : ''
|
|
);
|
|
|
|
}
|
|
|
|
$form['misc-areas'] = array(
|
|
'#type' => 'fieldset',
|
|
'#title' => 'Miscellaneous'
|
|
);
|
|
|
|
if ($inserting == TRUE) {
|
|
$form['misc-areas']['booking_dietary_check'] = array(
|
|
'#type' => 'checkbox',
|
|
'#title' => t('I have special dietary requirements'),
|
|
'#default_value' => (!empty($data->booking_dietary) && $data->booking_dietary == 'Y') ? 1 : 0
|
|
);
|
|
|
|
if (variable_get('booking_enable_dietary', 0) == 1) {
|
|
$form['misc-areas']['booking_dietary'] = array(
|
|
'#type' => 'textfield',
|
|
'#title' => t('Please describe your dietary requirements.'),
|
|
'#maxlength' => 120,
|
|
'#required' => FALSE,
|
|
'#states' => array(
|
|
'visible' => array(
|
|
':input[name="booking_dietary_check"]' => array(
|
|
'checked' => TRUE
|
|
)
|
|
)
|
|
),
|
|
'#default_value' => !empty($data->booking_dietary) ? $data->booking_dietary : ''
|
|
);
|
|
}
|
|
//the user is not allowed to enter data directly, so show them the instructions specified by the admin configuration options
|
|
else {
|
|
$form['misc-areas']['booking_dietary'] = array(
|
|
'#type' => 'container',
|
|
'#children' => variable_get('booking_dietary_text_definition', "Please contact us to specify your dietary requirements."),
|
|
'#states' => array(
|
|
'visible' => array(
|
|
':input[name="booking_dietary_check"]' => array(
|
|
'checked' => TRUE
|
|
)
|
|
)
|
|
)
|
|
);
|
|
}
|
|
|
|
$form['misc-areas']['booking_medical_conditions_check'] = array(
|
|
'#type' => 'checkbox',
|
|
'#title' => t('I have special medical condition(s), including allergies'),
|
|
'#default_value' => (!empty($data->booking_medical_conditions) && $data->booking_medical_conditions == 'Y') ? 1 : 0
|
|
);
|
|
|
|
if (variable_get('booking_enable_medcond', 0) == 1) {
|
|
$form['misc-areas']['booking_medical_conditions'] = array(
|
|
'#type' => 'textarea',
|
|
'#title' => t('Please list any medical conditions we need to be aware of. For allegies, please list the reaction to the allergen(s).'),
|
|
'#cols' => 60,
|
|
'#rows' => 5,
|
|
'#resizable' => FALSE,
|
|
'#required' => FALSE,
|
|
'#states' => array(
|
|
'visible' => array(
|
|
':input[name="booking_medical_conditions_check"]' => array(
|
|
'checked' => TRUE
|
|
)
|
|
)
|
|
),
|
|
'#attributes' => array(
|
|
'maxlength' => 1000
|
|
),
|
|
'#default_value' => !empty($data->booking_medical_conditions) ? $data->booking_medical_conditions : ''
|
|
);
|
|
}
|
|
//the user is not allowed to enter data directly, so show them the instructions specified by the admin configuration options
|
|
else {
|
|
$form['misc-areas']['booking_medical_conditions'] = array(
|
|
'#type' => 'container',
|
|
'#children' => variable_get('booking_medcond_text_definition', "Please contact us to specify your dietary requirements."),
|
|
'#states' => array(
|
|
'visible' => array(
|
|
':input[name="booking_medical_conditions_check"]' => array(
|
|
'checked' => TRUE
|
|
)
|
|
)
|
|
)
|
|
);
|
|
}
|
|
|
|
//inserting is not true, so give the admin the textfield for entering/viewing data for dietary and medical conditions
|
|
} else {
|
|
$form['misc-areas']['booking_dietary'] = array(
|
|
'#type' => 'textfield',
|
|
'#title' => t('Please describe your dietary requirements.'),
|
|
'#maxlength' => 120,
|
|
'#default_value' => !empty($data->booking_dietary) ? $data->booking_dietary : ''
|
|
);
|
|
$form['misc-areas']['booking_medical_conditions'] = array(
|
|
'#type' => 'textarea',
|
|
'#title' => t('Please list any medical conditions we need to be aware of. For allegies, please list the reaction to the allergen(s).'),
|
|
'#cols' => 60,
|
|
'#rows' => 5,
|
|
'#resizable' => TRUE,
|
|
'#required' => FALSE,
|
|
'#attributes' => array(
|
|
'maxlength' => 1000
|
|
),
|
|
'#default_value' => !empty($data->booking_medical_conditions) ? $data->booking_medical_conditions : ''
|
|
);
|
|
}
|
|
|
|
if (variable_get('booking_enable_roommate', 0) == 1) {
|
|
$form['misc-areas']['booking_room_mate1'] = array(
|
|
'#type' => 'textfield',
|
|
'#title' => t('List up to two people you would like to share a room with (subject to availability).'),
|
|
'#maxlength' => 200,
|
|
'#required' => FALSE,
|
|
'#default_value' => !empty($data->booking_room_mate1) ? $data->booking_room_mate1 : ''
|
|
);
|
|
}
|
|
|
|
$form['misc-areas']['booking_random_facts'] = array(
|
|
'#type' => 'textfield',
|
|
'#title' => t('List three random facts about yourself (optional).'),
|
|
'#maxlength' => 200,
|
|
'#required' => FALSE,
|
|
'#default_value' => !empty($data->booking_random_facts) ? $data->booking_random_facts : ''
|
|
);
|
|
|
|
|
|
if ($inserting == TRUE) {
|
|
$form['submit'] = array(
|
|
'#type' => 'submit',
|
|
'#value' => t('Register')
|
|
);
|
|
}
|
|
return $form;
|
|
}
|
|
|
|
|
|
|
|
function booking_form_validate($form, &$form_state)
|
|
{
|
|
return _booking_validate($form_state['values']['form_id'], $form_state['input']);
|
|
}
|
|
|
|
function _booking_validate($node, &$form_state)
|
|
{
|
|
global $event;
|
|
//watchdog('booking', '<pre>Booking registration form validation:\n@info</pre>', array('@info' => print_r( $form_state, true)));
|
|
|
|
//in case the date of birth field hasn't been filled out
|
|
watchdog('booking', 'Blank date of birth checking: @info', array(
|
|
'@info' => var_export($form_state['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;
|
|
|
|
//Verify this is not a duplicate registration
|
|
//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(
|
|
':first' => $form_state['booking_firstname'],
|
|
':last' => $form_state['booking_lastname'],
|
|
':dob' => $dob_check,
|
|
':eid' => $event->eid
|
|
))->fetchObject();
|
|
|
|
if ($person) {
|
|
if ((strlen($person->booking_tempid) > 0) && (variable_get('booking_use_paypal', 0) == 1)) {
|
|
//they have registered but not paid, so give them the payment link
|
|
form_set_error('booking_firstname', t('Our records indicate that you are part-way through the registration process. Please !click to complete the process.', array(
|
|
'!click' => l('click here', 'confirm/' . $person->booking_tempid)
|
|
)));
|
|
return;
|
|
} else {
|
|
form_set_error('booking_firstname', t('Our records indicate that you have already registered. If you believe this to be incorrect, please !contact using the details provided.', array(
|
|
'!contact' => l('contact us', 'contact-us')
|
|
)));
|
|
}
|
|
}
|
|
|
|
//verify partner id is in the correct format
|
|
if (isset($form_state['booking_partner_id']) && $form_state['booking_partner_id'] != '') {
|
|
|
|
if (!is_numeric($form_state['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(
|
|
'!contact' => l('contact us', 'contact')
|
|
)));
|
|
}
|
|
|
|
//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(
|
|
':nid' => $form_state['booking_partner_id']
|
|
))->fetchObject();
|
|
|
|
//watchdog('booking', 'Checking for partner via query: @info', array('@info' => $partner->__toString()));
|
|
|
|
if (!$partner) {
|
|
form_set_error('booking_partner_id', t('Our records do not indicate that the supplied registration ID of your spouse is correct. Please ensure you are using only the number that relates to their registration. If you believe this to be incorrect, please !contact using the details provided.', array(
|
|
'!contact' => l('contact us', 'contact')
|
|
)));
|
|
}
|
|
}
|
|
|
|
//watchdog('booking', 'Form validate data: @info', array('@info' => var_export($form_state, TRUE)));
|
|
$email = (isset($form_state['booking_email']) ? $form_state['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.'));
|
|
|
|
//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 = preg_replace('/\s+/', '', $email);
|
|
$email_confirm = preg_replace('/\s+/', '', $email_confirm);
|
|
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.'));
|
|
}
|
|
|
|
//if DOB on form is more recent than DOB limit, display validation error
|
|
if ($dob_check > _booking_max_dob_ts()) {
|
|
watchdog('booking', "Attempt to register from !first !last, who is too young (!info) to attend event.", array(
|
|
'!first' => $form_state['booking_firstname'],
|
|
'!last' => $form_state['booking_lastname'],
|
|
'!info' => var_export($form_state['booking_dob'], TRUE)
|
|
));
|
|
form_set_error('booking_dob', t('Unfortunately you are too young to attend !event.', array(
|
|
'!event' => variable_get('booking_event_name', 'this event')
|
|
)));
|
|
}
|
|
|
|
//check the medicare number for people in Australia
|
|
if (variable_get('booking_enable_medicare', 1) == 1 && $form_state['booking_country'] == 'Australia') {
|
|
//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']))) {
|
|
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')
|
|
)));
|
|
} elseif ((variable_get('booking_enforce_medicare_verification', 1) == 0) && (!_valid_medicare_number($form_state['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(
|
|
'!contact' => l('email', 'mailto:' . variable_get('booking_contact_email') . '?subject=Invalid Medicare Number')
|
|
)), 'error', FALSE);
|
|
}
|
|
}
|
|
|
|
//verify state information with the new few checks
|
|
|
|
//make sure state field is not blank
|
|
if ($form_state['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.'));
|
|
}
|
|
|
|
//verify international address has updated the state field
|
|
if ((strcasecmp($form_state['booking_country'], 'New Zealand') == 0) && (strcasecmp($form_state['booking_state'], 'NZ') !== 0)) {
|
|
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)) {
|
|
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
|
|
if (($form_state['booking_state'] == 'Other') && ($form_state['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.'));
|
|
|
|
//verify passport number
|
|
if (variable_get('booking_enable_passport', 0) == 1 && $form_state['booking_country'] == 'Australia') {
|
|
if (($form_state['booking_passport_num'] != '') && (!_valid_passport_number($form_state['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(
|
|
'!contact' => l('send us an email', 'mailto:' . variable_get('booking_contact_email') . '?subject=Invalid Passport Number')
|
|
)));
|
|
}
|
|
}
|
|
|
|
//check at least one phone number has been entered
|
|
if (($form_state['booking_phone'] == '') && ($form_state['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.'));
|
|
if (($form_state['booking_phone'] != '') && (!_valid_phone_number($form_state['booking_phone'])))
|
|
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'])))
|
|
form_set_error('booking_mobile', t('You have entered an invalid mobile phone number.'));
|
|
|
|
//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'])))
|
|
form_set_error('booking_mobile', t('You have entered an invalid mobile phone number.'));
|
|
|
|
//verify guardian phone number(s)
|
|
if (($form_state['booking_guardian_phone'] != '') && (!_valid_phone_number($form_state['booking_guardian_phone'])))
|
|
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
|
|
if ($form_state['booking_agreement'] == 0)
|
|
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 (form_get_errors()) {
|
|
watchdog('booking', "<pre>Detected validation error(s):\n@errors\n\n User data:\n@info</pre>", array(
|
|
'@info' => print_r($form_state, true),
|
|
'@errors' => print_r(form_get_errors(), true)
|
|
));
|
|
}
|
|
|
|
}
|
|
|
|
function booking_form_submit($form, &$form_state)
|
|
{
|
|
global $event;
|
|
|
|
$values = $form_state['input'];
|
|
|
|
//get DOB from form
|
|
$dob = _datearray_to_ts($values['booking_dob']);
|
|
|
|
//retrieve an object with the booking price
|
|
$payment_total_price = db_query("SELECT booking_price FROM {booking_price} where pid = :pid", array(
|
|
':pid' => $form_state['input']['booking_payment_id']
|
|
))->fetchObject();
|
|
|
|
//make a new node object
|
|
$node = new stdClass();
|
|
$node = node_type_set_defaults();
|
|
$node->title = t('!event registration: !name', array(
|
|
'!event' => $event->booking_eventname,
|
|
'!name' => $values['booking_firstname'] . ' ' . $values['booking_lastname']
|
|
));
|
|
$node->type = 'booking';
|
|
$node->status = 1; // set published to true
|
|
$node->promote = 0; // prevent display on front page
|
|
$node->language = LANGUAGE_NONE;
|
|
$node->created = REQUEST_TIME;
|
|
$node->changed = REQUEST_TIME;
|
|
|
|
$node->booking_firstname = ucwords(trim($values['booking_firstname']));
|
|
$node->booking_lastname = ucwords(trim($values['booking_lastname']));
|
|
$node->booking_gender = $values['booking_gender'];
|
|
$node->booking_dob = $dob;
|
|
$node->booking_status = 0; //zero means not yet coming. Only change to 1 when a payment is made
|
|
|
|
//passport details
|
|
$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_name = empty($values['booking_passport_issue_name']) ? '' : $values['booking_passport_issue_name'];
|
|
$node->booking_passport_expiry_date = empty($values['booking_passport_expiry_date']) ? '0' : _datearray_to_ts($values['booking_passport_expiry_date']);
|
|
$node->booking_destination_country = empty($values['booking_destination_country']) ? '' : $values['booking_destination_country'];
|
|
$node->booking_travel_insurance = empty($values['booking_travel_insurance']) ? '' : $values['booking_travel_insurance'];
|
|
|
|
//flight info, which may not be present
|
|
$node->booking_outflight_bookingnum = empty($values['booking_outflight_bookingnum']) ? '' : $values['booking_outflight_bookingnum'];
|
|
$node->booking_outflight_flightnum = empty($values['booking_outflight_flightnum']) ? '' : $values['booking_outflight_flightnum'];
|
|
$node->booking_outflight_origin = empty($values['booking_outflight_origin']) ? '' : $values['booking_outflight_origin'];
|
|
$node->booking_outflight_origin_ts = empty($values['booking_outflight_origin_ts']) ? '0' : _datetime_array_to_ts($values['booking_outflight_origin_ts']);
|
|
$node->booking_outflight_connecting_flightnum = empty($values['booking_outflight_connecting_flightnum']) ? '' : $values['booking_outflight_connecting_flightnum'];
|
|
$node->booking_outflight_destination = empty($values['booking_outflight_destination']) ? '' : $values['booking_outflight_destination'];
|
|
$node->booking_outflight_destination_ts = empty($values['booking_outflight_destination_ts']) ? '0' : _datetime_array_to_ts($values['booking_outflight_destination_ts']);
|
|
|
|
$node->booking_rtrnflight_bookingnum = empty($values['booking_rtrnflight_bookingnum']) ? '' : $values['booking_rtrnflight_bookingnum'];
|
|
$node->booking_rtrnflight_flightnum = empty($values['booking_rtrnflight_flightnum']) ? '' : $values['booking_rtrnflight_flightnum'];
|
|
$node->booking_rtrnflight_origin = empty($values['booking_rtrnflight_origin']) ? '' : $values['booking_rtrnflight_origin'];
|
|
$node->booking_rtrnflight_origin_ts = empty($values['booking_rtrnflight_origin_ts']) ? '0' : _datetime_array_to_ts($values['booking_rtrnflight_origin_ts']);
|
|
$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_ts = empty($values['booking_rtrnflight_destination_ts']) ? '0' : _datetime_array_to_ts($values['booking_rtrnflight_destination_ts']);
|
|
|
|
//payment details
|
|
$node->booking_payment_id = $values['booking_payment_id'];
|
|
|
|
//contact details
|
|
$node->booking_street = ucwords($values['booking_street']);
|
|
$node->booking_suburb = ucwords($values['booking_suburb']);
|
|
$node->booking_postcode = $values['booking_postcode'];
|
|
$node->booking_country = $values['booking_country'];
|
|
$node->booking_phone = $values['booking_phone'];
|
|
$node->booking_mobile = $values['booking_mobile'];
|
|
$node->booking_email = strtolower(trim($values['booking_email']));
|
|
$node->booking_ecclesia = ucwords($values['booking_ecclesia']);
|
|
$node->booking_baptised = ($values['booking_baptised'] == 1 ? 'Y' : 'N');
|
|
$node->booking_married = empty($values['booking_married']) ? 'N' : ($values['booking_married'] == 1 ? 'Y' : 'N');
|
|
$node->booking_partner_name = empty($values['booking_partner_name']) ? '' : ucwords($values['booking_partner_name']);
|
|
$node->booking_partner_id = empty($values['booking_partner_id']) ? 0 : $values['booking_partner_id'];
|
|
$node->booking_bf_gf_nid = empty($values['booking_bf_gf_nid']) ? 0 : $values['booking_bf_gf_nid'];
|
|
|
|
//allow for user-entered value if the state is not already listed
|
|
if ($values['booking_state'] == 'Other') {
|
|
$node->booking_state = $values['booking_other_state'];
|
|
} else {
|
|
$node->booking_state = ucwords($values['booking_state']);
|
|
}
|
|
|
|
//emergency contact info
|
|
$node->booking_guardian_name = $values['booking_guardian_name'];
|
|
$node->booking_guardian_type = $values['booking_guardian_type'];
|
|
$node->booking_guardian_phone = $values['booking_guardian_phone'];
|
|
$node->booking_guardian_phone_alt = $values['booking_guardian_phone_alt'];
|
|
$node->booking_medicare = empty($values['booking_medicare']) ? 0 : $values['booking_medicare'];
|
|
|
|
//fields that may or may not have been present in the initial form
|
|
$node->booking_barcode = empty($values['booking_barcode']) ? '' : $values['booking_barcode'];
|
|
$node->booking_luckynum = empty($values['booking_luckynum']) ? 0 : $values['booking_luckynum'];
|
|
$node->booking_random_facts = empty($values['booking_random_facts']) ? '' : $values['booking_random_facts'];
|
|
$node->booking_welfare_required = empty($values['booking_welfare_required']) ? 'N' : ($values['booking_welfare_required'] == 1 ? 'Y' : 'N');
|
|
$node->booking_committee_member = empty($values['booking_committee_member']) ? 'N' : ($values['booking_committee_member'] == 1 ? 'Y' : 'N');
|
|
$node->booking_payment_complete = empty($values['booking_payment_complete']) ? 'N' : ($values['booking_payment_complete'] == 1 ? 'Y' : 'N');
|
|
$node->booking_refund_processed = empty($values['booking_refund_processed']) ? 'N' : ($values['booking_refund_processed'] == 1 ? 'Y' : 'N');
|
|
$node->booking_dependant_children = empty($values['booking_dependant_children']) ? 'N' : ($values['booking_dependant_children'] == 1 ? 'Y' : 'N');
|
|
$node->booking_refund_due = empty($values['booking_refund_due']) ? 0 : $values['booking_refund_due'];
|
|
$node->booking_help_music = empty($values['booking_help_music']) ? '' : $values['booking_help_music'];
|
|
$node->booking_help_meditations = empty($values['booking_help_meditations']) ? '' : $values['booking_help_meditations'];
|
|
$node->booking_help_praying = empty($values['booking_help_praying']) ? '' : $values['booking_help_praying'];
|
|
$node->booking_help_reading = empty($values['booking_help_reading']) ? 'N' : ($values['booking_help_reading'] == 1 ? 'Y' : 'N');
|
|
$node->booking_help_chairing = empty($values['booking_help_chairing']) ? 'N' : ($values['booking_help_chairing'] == 1 ? 'Y' : 'N');
|
|
$node->booking_help_readgroup_lead = empty($values['booking_help_readgroup_lead']) ? 'N' : ($values['booking_help_readgroup_lead'] == 1 ? 'Y' : 'N');
|
|
$node->booking_help_discussgroup_lead = empty($values['booking_help_discussgroup_lead']) ? 'N' : ($values['booking_help_discussgroup_lead'] == 1 ? 'Y' : 'N');
|
|
$node->booking_firstaid = empty($values['booking_firstaid']) ? 'N' : ($values['booking_firstaid'] == 1 ? 'Y' : 'N');
|
|
$node->booking_nurse = empty($values['booking_nurse']) ? 'N' : ($values['booking_nurse'] == 1 ? 'Y' : 'N');
|
|
$node->booking_lifesaver = empty($values['booking_lifesaver']) ? 'N' : ($values['booking_lifesaver'] == 1 ? 'Y' : 'N');
|
|
$node->booking_doctor = empty($values['booking_doctor']) ? 'N' : ($values['booking_doctor'] == 1 ? 'Y' : 'N');
|
|
$node->booking_dietary = empty($values['booking_dietary']) ? 'N/A' : $values['booking_dietary'];
|
|
$node->booking_mission_experience_details = empty($values['booking_mission_experience_details']) ? 'N/A' : $values['booking_mission_experience_details'];
|
|
$node->booking_has_mission_experience = empty($values['booking_has_mission_experience']) ? 'N' : ($values['booking_has_mission_experience'] == 1 ? 'Y' : 'N');
|
|
$node->booking_skills_builder = empty($values['booking_skills_builder']) ? 'N' : ($values['booking_skills_builder'] == 1 ? 'Y' : 'N');
|
|
$node->booking_skills_cooking = empty($values['booking_skills_cooking']) ? 'N' : ($values['booking_skills_cooking'] == 1 ? 'Y' : 'N');
|
|
$node->booking_skills_childminding = empty($values['booking_skills_childminding']) ? 'N' : ($values['booking_skills_childminding'] == 1 ? 'Y' : 'N');
|
|
$node->booking_skills_language = empty($values['booking_skills_language']) ? 'N' : ($values['booking_skills_language'] == 1 ? 'Y' : 'N');
|
|
$node->booking_skills_language_details = empty($values['booking_skills_language_details']) ? 'N/A' : $values['booking_skills_language_details'];
|
|
$node->booking_skills_other = empty($values['booking_skills_other']) ? 'N' : ($values['booking_skills_other'] == 1 ? 'Y' : 'N');
|
|
$node->booking_skills_other_details = empty($values['booking_skills_other_details']) ? 'N/A' : $values['booking_skills_other_details'];
|
|
|
|
//remove newlines from these fields so the CSV output doesn't get messed up
|
|
$medical = empty($values['booking_medical_conditions']) ? 'N/A' : $values['booking_medical_conditions'];
|
|
$comment = empty($values['booking_comment_field']) ? '' : $values['booking_comment_field'];
|
|
$node->booking_medical_conditions = str_replace(PHP_EOL, '', $medical);
|
|
$node->booking_comment_field = str_replace(PHP_EOL, '', $comment);
|
|
|
|
//potential fields for future
|
|
//$node->booking_payment_method = $payment_method;
|
|
$node->booking_room_mate1 = empty($values['booking_room_mate1']) ? '' : $values['booking_room_mate1'];
|
|
$node->booking_room_mate2 = empty($values['booking_room_mate2']) ? '' : $values['booking_room_mate2'];
|
|
$node->booking_shirt_size = empty($values['booking_shirt_size']) ? 'N/A' : $values['booking_shirt_size'];
|
|
|
|
//fields only configured by admin
|
|
$node->booking_readinggroup = !empty($values['booking_readinggroup']) ? $values['booking_readinggroup'] : '';
|
|
$node->booking_timestamp = REQUEST_TIME;
|
|
|
|
//internal fields
|
|
$tempid = _booking_uuidSecure();
|
|
$node->booking_tempid = $tempid;
|
|
$node->booking_eventid = $event->eid;
|
|
$node->booking_amount_paid = 0;
|
|
$node->booking_total_pay_reqd = $payment_total_price->booking_price;
|
|
|
|
//watchdog('booking', 'Node data: @info', array('@info' => var_export($node, TRUE)));
|
|
$foo = node_submit($node);
|
|
//watchdog('booking', 'Node data after submit: @info', array('@info' => var_export($foo, TRUE)));
|
|
$blah = node_save($foo);
|
|
//watchdog('booking', 'Node data after save: @info', array('@info' => var_export($blah, TRUE)));
|
|
|
|
//post submission triggers
|
|
_booking_form_submit_post_triggers($node);
|
|
|
|
//redirect the user to the confirmation page
|
|
$form_state['redirect'] = array(
|
|
'confirm/' . $tempid
|
|
);
|
|
}
|
|
|
|
/**
|
|
* Perform any workflow actions after the registration form submission
|
|
*/
|
|
function _booking_form_submit_post_triggers($node)
|
|
{
|
|
global $event;
|
|
|
|
//if booking_partner_id is set, make sure the nid it refers to has this node as its booking_partner_id
|
|
if ($node->booking_partner_id != 0) {
|
|
$partner = db_query("Select booking_partner_id from {booking_person} where nid = :nid", array(
|
|
':nid' => $node->booking_partner_id
|
|
))->fetchObject();
|
|
if ($partner->booking_partner_id == 0) {
|
|
watchdog('booking', 'Updating partner node !partner to refer to this node !nid', array(
|
|
'!partner' => $node->booking_partner_id,
|
|
'!nid' => $node->nid
|
|
));
|
|
//update the partner id of the partner to refer to this node
|
|
db_update('booking_person')->fields(array(
|
|
'booking_partner_id' => $node->nid
|
|
))->condition('nid', $node->booking_partner_id)->execute();
|
|
}
|
|
}
|
|
|
|
//@todo repeat the process above for bf/gf
|
|
|
|
//check whether we should send an automatic email even though they haven't paid yet
|
|
if (variable_get('booking_auto_confirm_email', 0) == 1) {
|
|
//send the person an email
|
|
_booking_registration_email($node->nid, FALSE, FALSE);
|
|
} else {
|
|
//just send a notification email
|
|
_booking_regn_notifyonly_email($node, FALSE);
|
|
}
|
|
|
|
}
|
|
|
|
|
|
/**
|
|
* Landing page after returning from paypal
|
|
*/
|
|
function booking_payment_completed_page()
|
|
{
|
|
//get some configuration information
|
|
global $event;
|
|
$output = "";
|
|
$return_array = array();
|
|
|
|
//set the page title
|
|
$bookingTitle = !empty($event->booking_eventname) ? $event->booking_eventname : 'Event';
|
|
drupal_set_title($bookingTitle . ' Registration Completed');
|
|
$input = variable_get('booking_regn_completed_page');
|
|
watchdog('booking_debug', "<pre>Paypal landing page token:\n@info</pre>", array('@info' => print_r($input['value'] , true)));
|
|
|
|
$output = token_replace($input['value'], booking_define_tokens());
|
|
$return_array[] = array(
|
|
'paragraph' => array(
|
|
'#type' => 'markup',
|
|
'#markup' => $output
|
|
)
|
|
);
|
|
|
|
return $return_array;
|
|
} |