Various tweaks

This commit is contained in:
2014-11-25 20:04:58 +11:00
parent f7a5856b2c
commit 9f917de8a5
9 changed files with 432 additions and 411 deletions

View File

@@ -138,7 +138,7 @@ function booking_event_form($node, &$form_state, $create, $editid = 0)
'#size' => 60, '#size' => 60,
'#maxlength' => 150, '#maxlength' => 150,
'#required' => TRUE, '#required' => TRUE,
'#default_value' => !empty($data->booking_eventname) ? $data->booking_eventname : '', '#default_value' => !_booking_person_studygroups_cleanup($data->booking_eventname) ? $data->booking_eventname : '',
); );
$form['booking_event_active'] = array( $form['booking_event_active'] = array(
'#type' => 'checkbox', '#type' => 'checkbox',
@@ -148,7 +148,7 @@ function booking_event_form($node, &$form_state, $create, $editid = 0)
$form['booking_event_start'] = array( $form['booking_event_start'] = array(
'#type' => 'date_select', '#type' => 'date_select',
'#title' => t('Date that this event will start'), '#title' => t('Date that this event will start'),
'#default_value' => empty($data->booking_event_start) ? date("Y-m-d H:i:s") : date("Y-m-d H:i:s", $data->booking_event_start), '#default_value' => _booking_person_studygroups_cleanup($data->booking_event_start) ? date("Y-m-d H:i:s") : date("Y-m-d H:i:s", $data->booking_event_start),
'#date_format' => 'd/m/Y H:i', '#date_format' => 'd/m/Y H:i',
'#date_label_position' => 'within', '#date_label_position' => 'within',
'#date_year_range' => '0:+5' '#date_year_range' => '0:+5'
@@ -156,7 +156,7 @@ function booking_event_form($node, &$form_state, $create, $editid = 0)
$form['booking_event_end'] = array( $form['booking_event_end'] = array(
'#type' => 'date_select', '#type' => 'date_select',
'#title' => t('Date that this event will conclude'), '#title' => t('Date that this event will conclude'),
'#default_value' => empty($data->booking_event_end) ? date("Y-m-d H:i:s") : date("Y-m-d H:i:s", $data->booking_event_end), '#default_value' => _booking_person_studygroups_cleanup($data->booking_event_end) ? date("Y-m-d H:i:s") : date("Y-m-d H:i:s", $data->booking_event_end),
'#date_format' => 'd/m/Y H:i', '#date_format' => 'd/m/Y H:i',
'#date_label_position' => 'within', '#date_label_position' => 'within',
'#date_year_range' => '0:+5' '#date_year_range' => '0:+5'
@@ -164,7 +164,7 @@ function booking_event_form($node, &$form_state, $create, $editid = 0)
$form['booking_register_open'] = array( $form['booking_register_open'] = array(
'#type' => 'date_select', '#type' => 'date_select',
'#title' => t('Date that registrations will open for this event'), '#title' => t('Date that registrations will open for this event'),
'#default_value' => empty($data->booking_register_open) ? date("Y-m-d H:i:s") : date("Y-m-d H:i:s", $data->booking_register_open), '#default_value' => _booking_person_studygroups_cleanup($data->booking_register_open) ? date("Y-m-d H:i:s") : date("Y-m-d H:i:s", $data->booking_register_open),
'#date_format' => 'd/m/Y H:i', '#date_format' => 'd/m/Y H:i',
'#date_label_position' => 'within', '#date_label_position' => 'within',
'#date_year_range' => '0:+5' '#date_year_range' => '0:+5'
@@ -172,7 +172,7 @@ function booking_event_form($node, &$form_state, $create, $editid = 0)
$form['booking_earlybird_close'] = array( $form['booking_earlybird_close'] = array(
'#type' => 'date_select', '#type' => 'date_select',
'#title' => t('Date that the early discounted rate will close for this event (if not applicable, set to registration close date)'), '#title' => t('Date that the early discounted rate will close for this event (if not applicable, set to registration close date)'),
'#default_value' => empty($data->booking_earlybird_close) ? date("Y-m-d H:i:s") : date("Y-m-d H:i:s", $data->booking_earlybird_close), '#default_value' => _booking_person_studygroups_cleanup($data->booking_earlybird_close) ? date("Y-m-d H:i:s") : date("Y-m-d H:i:s", $data->booking_earlybird_close),
'#date_format' => 'd/m/Y H:i', '#date_format' => 'd/m/Y H:i',
'#date_label_position' => 'within', '#date_label_position' => 'within',
'#date_year_range' => '0:+5' '#date_year_range' => '0:+5'
@@ -180,7 +180,7 @@ function booking_event_form($node, &$form_state, $create, $editid = 0)
$form['booking_register_close'] = array( $form['booking_register_close'] = array(
'#type' => 'date_select', '#type' => 'date_select',
'#title' => t('Date that registrations will close for this event'), '#title' => t('Date that registrations will close for this event'),
'#default_value' => empty($data->booking_register_close) ? date("Y-m-d H:i:s") : date("Y-m-d H:i:s", $data->booking_register_close), '#default_value' => _booking_person_studygroups_cleanup($data->booking_register_close) ? date("Y-m-d H:i:s") : date("Y-m-d H:i:s", $data->booking_register_close),
'#date_format' => 'd/m/Y H:i', '#date_format' => 'd/m/Y H:i',
'#date_label_position' => 'within', '#date_label_position' => 'within',
'#date_year_range' => '0:+5' '#date_year_range' => '0:+5'

View File

@@ -466,7 +466,7 @@ function booking_update_7225() {
} }
/** /**
* Add table for defininig room location layouts rather than hard coding * Add table for defining room location layouts rather than hard coding
*/ */
function booking_update_7226() { function booking_update_7226() {
//NOTE: This doesn't need a reference to the current event, since it is not anticipated that successive events will have a different room layout //NOTE: This doesn't need a reference to the current event, since it is not anticipated that successive events will have a different room layout

View File

@@ -20,7 +20,7 @@ function booking_manual_payment_admin($nid)
"and booking_price_active=1", "and booking_price_active=1",
array(':eid' => $event->eid,)); array(':eid' => $event->eid,));
//empty payment option //_booking_person_studygroups_cleanup payment option
$payment_type_options[0] = ''; $payment_type_options[0] = '';
foreach($result as $row) foreach($result as $row)

View File

@@ -68,7 +68,7 @@ function booking_paypal_ipn() {
return; return;
} }
*/ */
if (empty($ipn['payment_status']) || ($ipn['payment_status'] != 'Completed' && variable_get('booking_paypal_sandbox', 0) == 0)) if (_booking_person_studygroups_cleanup($ipn['payment_status']) || ($ipn['payment_status'] != 'Completed' && variable_get('booking_paypal_sandbox', 0) == 0))
return; return;
//if (strcasecmp($ipn['receiver_email'], variable_get('booking_paypal_account', '') <> 0)) //if (strcasecmp($ipn['receiver_email'], variable_get('booking_paypal_account', '') <> 0))

View File

@@ -141,7 +141,7 @@ function booking_price_form($node, &$form_state, $create, $editid = 0)
'#size' => 60, '#size' => 60,
'#maxlength' => 150, '#maxlength' => 150,
'#required' => TRUE, '#required' => TRUE,
'#default_value' => !empty($data->booking_price_descrip) ? $data->booking_price_descrip : '', '#default_value' => !_booking_person_studygroups_cleanup($data->booking_price_descrip) ? $data->booking_price_descrip : '',
); );
$form['booking_price'] = array ( $form['booking_price'] = array (
'#type' => 'textfield', '#type' => 'textfield',
@@ -150,7 +150,7 @@ function booking_price_form($node, &$form_state, $create, $editid = 0)
'#size' => 5, '#size' => 5,
'#maxlength' => 10, '#maxlength' => 10,
'#required' => TRUE, '#required' => TRUE,
'#default_value' => !empty($data->booking_price) ? $data->booking_price : '', '#default_value' => !_booking_person_studygroups_cleanup($data->booking_price) ? $data->booking_price : '',
); );
$form['booking_late_price'] = array ( $form['booking_late_price'] = array (
'#type' => 'textfield', '#type' => 'textfield',
@@ -159,33 +159,33 @@ function booking_price_form($node, &$form_state, $create, $editid = 0)
'#size' => 5, '#size' => 5,
'#maxlength' => 10, '#maxlength' => 10,
'#required' => TRUE, '#required' => TRUE,
'#default_value' => !empty($data->booking_late_price) ? $data->booking_late_price : '', '#default_value' => !_booking_person_studygroups_cleanup($data->booking_late_price) ? $data->booking_late_price : '',
); );
$form['booking_buttonid'] = array ( $form['booking_buttonid'] = array (
'#type' => 'textfield', '#type' => 'textfield',
'#title' => t('The PayPal button ID. This setting is deprecated.'), '#title' => t('The PayPal button ID. This setting is deprecated.'),
'#size' => 20, '#size' => 20,
'#maxlength' => 20, '#maxlength' => 20,
'#default_value' => !empty($data->booking_buttonid) ? $data->booking_buttonid : '', '#default_value' => !_booking_person_studygroups_cleanup($data->booking_buttonid) ? $data->booking_buttonid : '',
); );
$form['booking_late_buttonid'] = array ( $form['booking_late_buttonid'] = array (
'#type' => 'textfield', '#type' => 'textfield',
'#title' => t('The PayPal button ID for late bookings. This setting is deprecated.'), '#title' => t('The PayPal button ID for late bookings. This setting is deprecated.'),
'#size' => 20, '#size' => 20,
'#maxlength' => 20, '#maxlength' => 20,
'#default_value' => !empty($data->booking_late_buttonid) ? $data->booking_late_buttonid : '', '#default_value' => !_booking_person_studygroups_cleanup($data->booking_late_buttonid) ? $data->booking_late_buttonid : '',
); );
$form['booking_price_active'] = array( $form['booking_price_active'] = array(
'#type' => 'checkbox', '#type' => 'checkbox',
'#title' => t('Tick to make this price active for the current event.'), '#title' => t('Tick to make this price active for the current event.'),
'#default_value' => !empty($data->booking_price_active) ? $data->booking_price_active : '', '#default_value' => !_booking_person_studygroups_cleanup($data->booking_price_active) ? $data->booking_price_active : '',
); );
$form['booking_depositonly'] = array( $form['booking_depositonly'] = array(
'#type' => 'checkbox', '#type' => 'checkbox',
'#title' => t('Tick to indicate that this is a deposit only price.'), '#title' => t('Tick to indicate that this is a deposit only price.'),
'#default_value' => !empty($data->booking_depositonly) ? $data->booking_depositonly : 0, '#default_value' => !_booking_person_studygroups_cleanup($data->booking_depositonly) ? $data->booking_depositonly : 0,
); );
if ($create == true) if ($create == true)

View File

@@ -11,7 +11,7 @@ function booking_register_page() {
$return_array = array(); $return_array = array();
//set the page title //set the page title
$bookingTitle = !empty($event->booking_eventname) ? $event->booking_eventname : 'Event'; $bookingTitle = !_booking_person_studygroups_cleanup($event->booking_eventname) ? $event->booking_eventname : 'Event';
drupal_set_title($bookingTitle . ' Booking Form'); drupal_set_title($bookingTitle . ' Booking Form');
//figure out if we're allowed to accept bookings //figure out if we're allowed to accept bookings
@@ -58,7 +58,7 @@ function booking_form($node, &$form_state, $inserting = FALSE) {
$partner_options = array(); $partner_options = array();
date_default_timezone_set(TIMEZONE); date_default_timezone_set(TIMEZONE);
if (!empty($node)) if (!_booking_person_studygroups_cleanup($node))
{ {
$data = $node; $data = $node;
//watchdog('booking', 'Booking registration form loading data from saved node: @info', array('@info' => var_export($node, TRUE))); //watchdog('booking', 'Booking registration form loading data from saved node: @info', array('@info' => var_export($node, TRUE)));
@@ -112,21 +112,21 @@ function booking_form($node, &$form_state, $inserting = FALSE) {
'#title' => t('First Name'), '#title' => t('First Name'),
'#maxlength' => 45, '#maxlength' => 45,
'#required' => TRUE, '#required' => TRUE,
'#default_value' => !empty($data->booking_firstname) ? $data->booking_firstname : '' '#default_value' => !_booking_person_studygroups_cleanup($data->booking_firstname) ? $data->booking_firstname : ''
); );
$form['your-details']['booking_lastname'] = array( $form['your-details']['booking_lastname'] = array(
'#type' => 'textfield', '#type' => 'textfield',
'#title' => t('Last Name'), '#title' => t('Last Name'),
'#maxlength' => 45, '#maxlength' => 45,
'#required' => TRUE, '#required' => TRUE,
'#default_value' => !empty($data->booking_lastname) ? $data->booking_lastname : '' '#default_value' => !_booking_person_studygroups_cleanup($data->booking_lastname) ? $data->booking_lastname : ''
); );
$form['your-details']['booking_gender'] = array( $form['your-details']['booking_gender'] = array(
'#type' => 'select', '#type' => 'select',
'#title' => t('Gender'), '#title' => t('Gender'),
'#required' => TRUE, '#required' => TRUE,
'#default_value' => variable_get('booking_gender', empty($data->booking_gender) ? variable_get('booking_default_gender') : $data->booking_gender), '#default_value' => variable_get('booking_gender', _booking_person_studygroups_cleanup($data->booking_gender) ? variable_get('booking_default_gender') : $data->booking_gender),
'#options' => _booking_gender_options(), '#options' => _booking_gender_options(),
); );
@@ -134,7 +134,7 @@ function booking_form($node, &$form_state, $inserting = FALSE) {
$form['your-details']['booking_dob'] = array( $form['your-details']['booking_dob'] = array(
'#type' => 'date_select', '#type' => 'date_select',
'#title' => t('Date of Birth'), '#title' => t('Date of Birth'),
'#default_value' => empty($data->booking_dob) ? '' : date("Y-m-d H:i:s", $data->booking_dob), '#default_value' => _booking_person_studygroups_cleanup($data->booking_dob) ? '' : date("Y-m-d H:i:s", $data->booking_dob),
'#required' => TRUE, '#required' => TRUE,
'#date_format' => 'd/m/Y', '#date_format' => 'd/m/Y',
'#date_label_position' => 'within', '#date_label_position' => 'within',
@@ -154,21 +154,21 @@ function booking_form($node, &$form_state, $inserting = FALSE) {
'#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' => !_booking_person_studygroups_cleanup($data->booking_status) ? $data->booking_status : '',
); );
$form['your-details']['booking_welfare_required'] = array( $form['your-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' => (!_booking_person_studygroups_cleanup($data->booking_welfare_required) && $data->booking_welfare_required == 'Y') ? 1 : 0
); );
$form['your-details']['booking_committee_member'] = array( $form['your-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' => (!_booking_person_studygroups_cleanup($data->booking_committee_member) && $data->booking_committee_member == 'Y') ? 1 : 0
); );
$form['your-details']['booking_amount_paid'] = array( $form['your-details']['booking_amount_paid'] = array(
@@ -176,7 +176,7 @@ function booking_form($node, &$form_state, $inserting = FALSE) {
'#title' => t('Amount Paid'), '#title' => t('Amount Paid'),
'#maxlength' => 10, '#maxlength' => 10,
'#required' => FALSE, '#required' => FALSE,
'#default_value' => !empty($data->booking_amount_paid) ? $data->booking_amount_paid : '' '#default_value' => !_booking_person_studygroups_cleanup($data->booking_amount_paid) ? $data->booking_amount_paid : ''
); );
$form['your-details']['booking_total_pay_reqd'] = array( $form['your-details']['booking_total_pay_reqd'] = array(
@@ -184,21 +184,21 @@ function booking_form($node, &$form_state, $inserting = FALSE) {
'#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' => !_booking_person_studygroups_cleanup($data->booking_total_pay_reqd) ? $data->booking_total_pay_reqd : '0.00'
); );
//refund info //refund info
$form['your-details']['booking_refund_processed'] = array( $form['your-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' => (!_booking_person_studygroups_cleanup($data->booking_refund_processed) && $data->booking_refund_processed == 'Y') ? 1 : 0
); );
$form['your-details']['booking_refund_due'] = array( $form['your-details']['booking_refund_due'] = array(
'#type' => 'textfield', '#type' => 'textfield',
'#title' => t('Refund Amount Due'), '#title' => t('Refund Amount Due'),
'#maxlength' => 10, '#maxlength' => 10,
'#required' => FALSE, '#required' => FALSE,
'#default_value' => !empty($data->booking_refund_due) ? $data->booking_refund_due : '0.00' '#default_value' => !_booking_person_studygroups_cleanup($data->booking_refund_due) ? $data->booking_refund_due : '0.00'
); );
} //end inserting check for booking status } //end inserting check for booking status
@@ -210,7 +210,7 @@ function booking_form($node, &$form_state, $inserting = FALSE) {
'#type' => 'select', '#type' => 'select',
'#title' => t(variable_get('booking_tshirts_text_definition', 'Preferred hoodie size')), '#title' => t(variable_get('booking_tshirts_text_definition', 'Preferred hoodie size')),
'#required' => FALSE, '#required' => FALSE,
'#default_value' => variable_get('booking_shirt_size', empty($data->booking_shirt_size) ? '' : $data->booking_shirt_size), '#default_value' => variable_get('booking_shirt_size', _booking_person_studygroups_cleanup($data->booking_shirt_size) ? '' : $data->booking_shirt_size),
'#options' => _get_tshirt_options(), '#options' => _get_tshirt_options(),
); );
} //end enable tshirts check } //end enable tshirts check
@@ -220,12 +220,12 @@ function booking_form($node, &$form_state, $inserting = FALSE) {
'#title' => t('Ecclesia'), '#title' => t('Ecclesia'),
'#maxlength' => 100, '#maxlength' => 100,
'#required' => FALSE, '#required' => FALSE,
'#default_value' => !empty($data->booking_ecclesia) ? $data->booking_ecclesia : '' '#default_value' => !_booking_person_studygroups_cleanup($data->booking_ecclesia) ? $data->booking_ecclesia : ''
); );
$form['your-details']['booking_baptised'] = array( $form['your-details']['booking_baptised'] = array(
'#type' => 'checkbox', '#type' => 'checkbox',
'#title' => t('I am baptised'), '#title' => t('I am baptised'),
'#default_value' => (!empty($data->booking_baptised) && $data->booking_baptised == 'Y') ? 1 : 0 '#default_value' => (!_booking_person_studygroups_cleanup($data->booking_baptised) && $data->booking_baptised == 'Y') ? 1 : 0
); );
if (variable_get('booking_allow_couples', 0) == 1) if (variable_get('booking_allow_couples', 0) == 1)
@@ -233,7 +233,7 @@ function booking_form($node, &$form_state, $inserting = FALSE) {
$form['your-details']['booking_married'] = array( $form['your-details']['booking_married'] = array(
'#type' => 'checkbox', '#type' => 'checkbox',
'#title' => t('I am married'), '#title' => t('I am married'),
'#default_value' => (!empty($data->booking_married) && $data->booking_married == 'Y') ? 1 : 0 '#default_value' => (!_booking_person_studygroups_cleanup($data->booking_married) && $data->booking_married == 'Y') ? 1 : 0
); );
$form['your-details']['booking_partner_name'] = array( $form['your-details']['booking_partner_name'] = array(
'#type' => 'textfield', '#type' => 'textfield',
@@ -247,7 +247,7 @@ function booking_form($node, &$form_state, $inserting = FALSE) {
':input[name="booking_married"]' => array('checked' => TRUE), ':input[name="booking_married"]' => array('checked' => TRUE),
), ),
), ),
'#default_value' => !empty($data->booking_partner_name) ? $data->booking_partner_name : '' '#default_value' => !_booking_person_studygroups_cleanup($data->booking_partner_name) ? $data->booking_partner_name : ''
); );
if ($inserting == TRUE) if ($inserting == TRUE)
@@ -265,12 +265,12 @@ function booking_form($node, &$form_state, $inserting = FALSE) {
':input[name="booking_married"]' => array('checked' => TRUE), ':input[name="booking_married"]' => array('checked' => TRUE),
), ),
), ),
'#default_value' => !empty($data->booking_partner_name) ? $data->booking_partner_name : '' '#default_value' => !_booking_person_studygroups_cleanup($data->booking_partner_name) ? $data->booking_partner_name : ''
); );
} }
else //not inserting so allow administrator to choose a person else //not inserting so allow administrator to choose a person
{ {
//add the empty element first //add the _booking_person_studygroups_cleanup element first
$partner_options[] = ''; $partner_options[] = '';
//get a list of possible partners //get a list of possible partners
@@ -296,7 +296,7 @@ function booking_form($node, &$form_state, $inserting = FALSE) {
'#maxlength' => 15, '#maxlength' => 15,
'#size' => 4, '#size' => 4,
'#required' => FALSE, '#required' => FALSE,
'#default_value' => !empty($data->booking_bf_gf_nid) ? $data->booking_bf_gf_nid : '', '#default_value' => !_booking_person_studygroups_cleanup($data->booking_bf_gf_nid) ? $data->booking_bf_gf_nid : '',
); );
} }
} //end allow couples check } //end allow couples check
@@ -312,7 +312,7 @@ function booking_form($node, &$form_state, $inserting = FALSE) {
( (
'#type' => 'checkbox', '#type' => 'checkbox',
'#title' => t('Regularly Attend CYC '), '#title' => t('Regularly Attend CYC '),
'#default_value' => empty($data->booking_agreement) ? 0 : $data->booking_agreement, '#default_value' => _booking_person_studygroups_cleanup($data->booking_agreement) ? 0 : $data->booking_agreement,
'#title' => t('I regularly attend CYC events/activities'), '#title' => t('I regularly attend CYC events/activities'),
); */ ); */
@@ -320,7 +320,7 @@ function booking_form($node, &$form_state, $inserting = FALSE) {
( (
'#type' => 'checkbox', '#type' => 'checkbox',
'#title' => t('Aims and Expectations'), '#title' => t('Aims and Expectations'),
'#default_value' => empty($data->booking_agreement) ? 0 : $data->booking_agreement, '#default_value' => _booking_person_studygroups_cleanup($data->booking_agreement) ? 0 : $data->booking_agreement,
/* /*
'#states' => array( '#states' => array(
// Only show this field when the checkbox is unchecked. // Only show this field when the checkbox is unchecked.
@@ -347,7 +347,7 @@ function booking_form($node, &$form_state, $inserting = FALSE) {
'#maxlength' => 30, '#maxlength' => 30,
'#size' => 30, '#size' => 30,
'#required' => FALSE, '#required' => FALSE,
'#default_value' => !empty($data->booking_barcode) ? $data->booking_barcode : '' '#default_value' => !_booking_person_studygroups_cleanup($data->booking_barcode) ? $data->booking_barcode : ''
); );
$form['your-details']['booking_luckynum'] = array( $form['your-details']['booking_luckynum'] = array(
@@ -356,14 +356,14 @@ function booking_form($node, &$form_state, $inserting = FALSE) {
'#maxlength' => 30, '#maxlength' => 30,
'#size' => 30, '#size' => 30,
'#required' => FALSE, '#required' => FALSE,
'#default_value' => !empty($data->booking_luckynum) ? $data->booking_luckynum : '' '#default_value' => !_booking_person_studygroups_cleanup($data->booking_luckynum) ? $data->booking_luckynum : ''
); );
$form['your-details']['booking_readinggroup'] = array( $form['your-details']['booking_readinggroup'] = array(
'#type' => 'textfield', '#type' => 'textfield',
'#title' => t('Reading Group Allocation'), '#title' => t('Reading Group Allocation'),
'#maxlength' => 100, '#maxlength' => 100,
'#default_value' => !empty($data->booking_readinggroup) ? $data->booking_readinggroup : '', '#default_value' => !_booking_person_studygroups_cleanup($data->booking_readinggroup) ? $data->booking_readinggroup : '',
); );
} //end not-inserting check } //end not-inserting check
@@ -378,26 +378,26 @@ function booking_form($node, &$form_state, $inserting = FALSE) {
'#title' => t('Passport Number'), '#title' => t('Passport Number'),
'#maxlength' => 45, '#maxlength' => 45,
'#required' => FALSE, '#required' => FALSE,
'#default_value' => !empty($data->booking_passport_num) ? $data->booking_passport_num : '' '#default_value' => !_booking_person_studygroups_cleanup($data->booking_passport_num) ? $data->booking_passport_num : ''
); );
$form['passport-details']['booking_passport_issue_location'] = array( $form['passport-details']['booking_passport_issue_location'] = array(
'#type' => 'textfield', '#type' => 'textfield',
'#title' => t('City of Issue (eg Sydney)'), '#title' => t('City of Issue (eg Sydney)'),
'#maxlength' => 120, '#maxlength' => 120,
'#required' => FALSE, '#required' => FALSE,
'#default_value' => !empty($data->booking_passport_issue_location) ? $data->booking_passport_issue_location : '' '#default_value' => !_booking_person_studygroups_cleanup($data->booking_passport_issue_location) ? $data->booking_passport_issue_location : ''
); );
$form['passport-details']['booking_passport_issue_name'] = array( $form['passport-details']['booking_passport_issue_name'] = array(
'#type' => 'textfield', '#type' => 'textfield',
'#title' => t('Exact name as listed on passport'), '#title' => t('Exact name as listed on passport'),
'#maxlength' => 120, '#maxlength' => 120,
'#required' => FALSE, '#required' => FALSE,
'#default_value' => !empty($data->booking_passport_issue_name) ? $data->booking_passport_issue_name : '' '#default_value' => !_booking_person_studygroups_cleanup($data->booking_passport_issue_name) ? $data->booking_passport_issue_name : ''
); );
$form['passport-details']['booking_passport_expiry_date'] = array( $form['passport-details']['booking_passport_expiry_date'] = array(
'#type' => 'date_select', '#type' => 'date_select',
'#title' => t('Passport expiry date'), '#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), '#default_value' => _booking_person_studygroups_cleanup($data->booking_passport_expiry_date) ? '' : date("Y-m-d H:i:s", $data->booking_passport_expiry_date),
'#required' => FALSE, '#required' => FALSE,
'#date_format' => 'd/m/Y', '#date_format' => 'd/m/Y',
//'#date_label_position' => 'within', //'#date_label_position' => 'within',
@@ -408,7 +408,7 @@ function booking_form($node, &$form_state, $inserting = FALSE) {
'#title' => t('Travel insurance policy details'), '#title' => t('Travel insurance policy details'),
'#maxlength' => 120, '#maxlength' => 120,
'#required' => FALSE, '#required' => FALSE,
'#default_value' => !empty($data->booking_travel_insurance) ? $data->booking_travel_insurance : '' '#default_value' => !_booking_person_studygroups_cleanup($data->booking_travel_insurance) ? $data->booking_travel_insurance : ''
); );
if ($inserting == FALSE) if ($inserting == FALSE)
{ {
@@ -417,7 +417,7 @@ function booking_form($node, &$form_state, $inserting = FALSE) {
'#title' => t('Which country is this person going to?'), '#title' => t('Which country is this person going to?'),
'#maxlength' => 120, '#maxlength' => 120,
'#required' => FALSE, '#required' => FALSE,
'#default_value' => !empty($data->booking_destination_country) ? $data->booking_destination_country : '', '#default_value' => !_booking_person_studygroups_cleanup($data->booking_destination_country) ? $data->booking_destination_country : '',
); );
//flights from the conference week to the destination country //flights from the conference week to the destination country
@@ -430,27 +430,27 @@ function booking_form($node, &$form_state, $inserting = FALSE) {
'#title' => t('Internal Flight Booking Reference (departing conference week)'), '#title' => t('Internal Flight Booking Reference (departing conference week)'),
'#maxlength' => 120, '#maxlength' => 120,
'#required' => FALSE, '#required' => FALSE,
'#default_value' => !empty($data->booking_outflight_bookingnum) ? $data->booking_outflight_bookingnum : '', '#default_value' => !_booking_person_studygroups_cleanup($data->booking_outflight_bookingnum) ? $data->booking_outflight_bookingnum : '',
); );
$form['outbound-flight-details']['booking_outflight_flightnum'] = array( $form['outbound-flight-details']['booking_outflight_flightnum'] = array(
'#type' => 'textfield', '#type' => 'textfield',
'#title' => t('Internal Flight Number (departing conference week)'), '#title' => t('Internal Flight Number (departing conference week)'),
'#maxlength' => 120, '#maxlength' => 120,
'#required' => FALSE, '#required' => FALSE,
'#default_value' => !empty($data->booking_outflight_flightnum) ? $data->booking_outflight_flightnum : '', '#default_value' => !_booking_person_studygroups_cleanup($data->booking_outflight_flightnum) ? $data->booking_outflight_flightnum : '',
); );
$form['outbound-flight-details']['booking_outflight_origin'] = array( $form['outbound-flight-details']['booking_outflight_origin'] = array(
'#type' => 'textfield', '#type' => 'textfield',
'#title' => t('Internal Flight Origin to Destination (departing conference week)'), '#title' => t('Internal Flight Origin to Destination (departing conference week)'),
'#maxlength' => 120, '#maxlength' => 120,
'#required' => FALSE, '#required' => FALSE,
'#default_value' => !empty($data->booking_outflight_origin) ? $data->booking_outflight_origin : '', '#default_value' => !_booking_person_studygroups_cleanup($data->booking_outflight_origin) ? $data->booking_outflight_origin : '',
); );
$form['outbound-flight-details']['booking_outflight_origin_ts'] = array( $form['outbound-flight-details']['booking_outflight_origin_ts'] = array(
'#type' => 'date_select', '#type' => 'date_select',
'#title' => t('Internal flight departure time (local timezone)'), '#title' => t('Internal flight departure time (local timezone)'),
'#description' => t('Note: 24 hour time - 12:00 is midday'), '#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), '#default_value' => _booking_person_studygroups_cleanup($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_format' => 'd/m/Y H:i',
'#date_year_range' => '0:+1', '#date_year_range' => '0:+1',
); );
@@ -459,20 +459,20 @@ function booking_form($node, &$form_state, $inserting = FALSE) {
'#title' => t('Connecting Flight Number (if applicable)'), '#title' => t('Connecting Flight Number (if applicable)'),
'#maxlength' => 120, '#maxlength' => 120,
'#required' => FALSE, '#required' => FALSE,
'#default_value' => !empty($data->booking_outflight_connecting_flightnum) ? $data->booking_outflight_connecting_flightnum : '', '#default_value' => !_booking_person_studygroups_cleanup($data->booking_outflight_connecting_flightnum) ? $data->booking_outflight_connecting_flightnum : '',
); );
$form['outbound-flight-details']['booking_outflight_destination'] = array( $form['outbound-flight-details']['booking_outflight_destination'] = array(
'#type' => 'textfield', '#type' => 'textfield',
'#title' => t('Connecting Flight Origin to Destination'), '#title' => t('Connecting Flight Origin to Destination'),
'#maxlength' => 120, '#maxlength' => 120,
'#required' => FALSE, '#required' => FALSE,
'#default_value' => !empty($data->booking_outflight_destination) ? $data->booking_outflight_destination : '', '#default_value' => !_booking_person_studygroups_cleanup($data->booking_outflight_destination) ? $data->booking_outflight_destination : '',
); );
$form['outbound-flight-details']['booking_outflight_destination_ts'] = array( $form['outbound-flight-details']['booking_outflight_destination_ts'] = array(
'#type' => 'date_select', '#type' => 'date_select',
'#title' => t('Internal flight arrival time (local timezone)'), '#title' => t('Internal flight arrival time (local timezone)'),
'#description' => t('Note: 24 hour time - 12:00 is midday'), '#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), '#default_value' => _booking_person_studygroups_cleanup($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_format' => 'd/m/Y H:i',
'#date_year_range' => '0:+1', '#date_year_range' => '0:+1',
); );
@@ -487,27 +487,27 @@ function booking_form($node, &$form_state, $inserting = FALSE) {
'#title' => t('Internal Flight Booking Reference (returning to conference)'), '#title' => t('Internal Flight Booking Reference (returning to conference)'),
'#maxlength' => 120, '#maxlength' => 120,
'#required' => FALSE, '#required' => FALSE,
'#default_value' => !empty($data->booking_rtrnflight_bookingnum) ? $data->booking_rtrnflight_bookingnum : '', '#default_value' => !_booking_person_studygroups_cleanup($data->booking_rtrnflight_bookingnum) ? $data->booking_rtrnflight_bookingnum : '',
); );
$form['inbound-flight-details']['booking_rtrnflight_flightnum'] = array( $form['inbound-flight-details']['booking_rtrnflight_flightnum'] = array(
'#type' => 'textfield', '#type' => 'textfield',
'#title' => t('Internal Flight Number (returning to conference)'), '#title' => t('Internal Flight Number (returning to conference)'),
'#maxlength' => 120, '#maxlength' => 120,
'#required' => FALSE, '#required' => FALSE,
'#default_value' => !empty($data->booking_rtrnflight_flightnum) ? $data->booking_rtrnflight_flightnum : '', '#default_value' => !_booking_person_studygroups_cleanup($data->booking_rtrnflight_flightnum) ? $data->booking_rtrnflight_flightnum : '',
); );
$form['inbound-flight-details']['booking_rtrnflight_origin'] = array( $form['inbound-flight-details']['booking_rtrnflight_origin'] = array(
'#type' => 'textfield', '#type' => 'textfield',
'#title' => t('Internal Flight Origin to Destination (returning to conference)'), '#title' => t('Internal Flight Origin to Destination (returning to conference)'),
'#maxlength' => 120, '#maxlength' => 120,
'#required' => FALSE, '#required' => FALSE,
'#default_value' => !empty($data->booking_rtrnflight_origin) ? $data->booking_rtrnflight_origin : '', '#default_value' => !_booking_person_studygroups_cleanup($data->booking_rtrnflight_origin) ? $data->booking_rtrnflight_origin : '',
); );
$form['inbound-flight-details']['booking_rtrnflight_origin_ts'] = array( $form['inbound-flight-details']['booking_rtrnflight_origin_ts'] = array(
'#type' => 'date_select', '#type' => 'date_select',
'#title' => t('Internal flight departure time (local timezone)'), '#title' => t('Internal flight departure time (local timezone)'),
'#description' => t('Note: 24 hour time - 12:00 is midday'), '#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), '#default_value' => _booking_person_studygroups_cleanup($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_format' => 'd/m/Y H:i',
'#date_year_range' => '0:+1', '#date_year_range' => '0:+1',
); );
@@ -516,20 +516,20 @@ function booking_form($node, &$form_state, $inserting = FALSE) {
'#title' => t('Connecting Flight Number (if applicable)'), '#title' => t('Connecting Flight Number (if applicable)'),
'#maxlength' => 120, '#maxlength' => 120,
'#required' => FALSE, '#required' => FALSE,
'#default_value' => !empty($data->booking_rtrnflight_connecting_flightnum) ? $data->booking_rtrnflight_connecting_flightnum : '', '#default_value' => !_booking_person_studygroups_cleanup($data->booking_rtrnflight_connecting_flightnum) ? $data->booking_rtrnflight_connecting_flightnum : '',
); );
$form['inbound-flight-details']['booking_rtrnflight_destination'] = array( $form['inbound-flight-details']['booking_rtrnflight_destination'] = array(
'#type' => 'textfield', '#type' => 'textfield',
'#title' => t('Connecting Flight Origin to Destination'), '#title' => t('Connecting Flight Origin to Destination'),
'#maxlength' => 120, '#maxlength' => 120,
'#required' => FALSE, '#required' => FALSE,
'#default_value' => !empty($data->booking_rtrnflight_destination) ? $data->booking_rtrnflight_destination : '', '#default_value' => !_booking_person_studygroups_cleanup($data->booking_rtrnflight_destination) ? $data->booking_rtrnflight_destination : '',
); );
$form['inbound-flight-details']['booking_rtrnflight_destination_ts'] = array( $form['inbound-flight-details']['booking_rtrnflight_destination_ts'] = array(
'#type' => 'date_select', '#type' => 'date_select',
'#title' => t('Internal flight arrival time (local timezone)'), '#title' => t('Internal flight arrival time (local timezone)'),
'#description' => t('Note: 24 hour time - 12:00 is midday'), '#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), '#default_value' => _booking_person_studygroups_cleanup($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_format' => 'd/m/Y H:i',
'#date_year_range' => '0:+1', '#date_year_range' => '0:+1',
); );
@@ -545,7 +545,7 @@ function booking_form($node, &$form_state, $inserting = FALSE) {
'#title' => t('E-mail address'), '#title' => t('E-mail address'),
'#maxlength' => 100, '#maxlength' => 100,
'#required' => TRUE, '#required' => TRUE,
'#default_value' => !empty($data->booking_email) ? $data->booking_email : '' '#default_value' => !_booking_person_studygroups_cleanup($data->booking_email) ? $data->booking_email : ''
); );
$form['contact-details']['booking_phone'] = array( $form['contact-details']['booking_phone'] = array(
@@ -554,7 +554,7 @@ function booking_form($node, &$form_state, $inserting = FALSE) {
'#maxlength' => 30, '#maxlength' => 30,
'#size' => 35, '#size' => 35,
'#required' => FALSE, '#required' => FALSE,
'#default_value' => !empty($data->booking_phone) ? $data->booking_phone : '' '#default_value' => !_booking_person_studygroups_cleanup($data->booking_phone) ? $data->booking_phone : ''
); );
$form['contact-details']['booking_mobile'] = array( $form['contact-details']['booking_mobile'] = array(
'#type' => 'textfield', '#type' => 'textfield',
@@ -562,7 +562,7 @@ function booking_form($node, &$form_state, $inserting = FALSE) {
'#size' => 35, '#size' => 35,
'#maxlength' => 30, '#maxlength' => 30,
'#required' => FALSE, '#required' => FALSE,
'#default_value' => !empty($data->booking_mobile) ? $data->booking_mobile : '' '#default_value' => !_booking_person_studygroups_cleanup($data->booking_mobile) ? $data->booking_mobile : ''
); );
$form['contact-details']['booking_street'] = array( $form['contact-details']['booking_street'] = array(
@@ -570,14 +570,14 @@ function booking_form($node, &$form_state, $inserting = FALSE) {
'#title' => t('Street Address'), '#title' => t('Street Address'),
'#maxlength' => 50, '#maxlength' => 50,
'#required' => TRUE, '#required' => TRUE,
'#default_value' => !empty($data->booking_street) ? $data->booking_street : '' '#default_value' => !_booking_person_studygroups_cleanup($data->booking_street) ? $data->booking_street : ''
); );
$form['contact-details']['booking_suburb'] = array( $form['contact-details']['booking_suburb'] = array(
'#type' => 'textfield', '#type' => 'textfield',
'#title' => t('Suburb'), '#title' => t('Suburb'),
'#maxlength' => 50, '#maxlength' => 50,
'#required' => TRUE, '#required' => TRUE,
'#default_value' => !empty($data->booking_suburb) ? $data->booking_suburb : '' '#default_value' => !_booking_person_studygroups_cleanup($data->booking_suburb) ? $data->booking_suburb : ''
); );
@@ -587,7 +587,7 @@ function booking_form($node, &$form_state, $inserting = FALSE) {
'#type' => 'select', '#type' => 'select',
'#title' => t('State'), '#title' => t('State'),
'#required' => TRUE, '#required' => TRUE,
'#default_value' => !empty($data->booking_state) ? $data->booking_state : BOOKING_DEFAULT_STATE, '#default_value' => !_booking_person_studygroups_cleanup($data->booking_state) ? $data->booking_state : BOOKING_DEFAULT_STATE,
'#options' => _booking_state_options(), '#options' => _booking_state_options(),
); );
$form['contact-details']['booking_other_state'] = array( $form['contact-details']['booking_other_state'] = array(
@@ -608,7 +608,7 @@ function booking_form($node, &$form_state, $inserting = FALSE) {
'#type' => 'textfield', '#type' => 'textfield',
'#title' => t('State'), '#title' => t('State'),
'#maxlength' => 50, '#maxlength' => 50,
'#default_value' => !empty($data->booking_state) ? $data->booking_state : '', '#default_value' => !_booking_person_studygroups_cleanup($data->booking_state) ? $data->booking_state : '',
); );
} }
@@ -619,13 +619,13 @@ function booking_form($node, &$form_state, $inserting = FALSE) {
'#maxlength' => 8, '#maxlength' => 8,
'#size' => 10, '#size' => 10,
'#required' => TRUE, '#required' => TRUE,
'#default_value' => !empty($data->booking_postcode) ? $data->booking_postcode : '' '#default_value' => !_booking_person_studygroups_cleanup($data->booking_postcode) ? $data->booking_postcode : ''
); );
$form['contact-details']['booking_country'] = array( $form['contact-details']['booking_country'] = array(
'#type' => 'select', '#type' => 'select',
'#title' => t('Country'), '#title' => t('Country'),
'#required' => TRUE, '#required' => TRUE,
'#default_value' => variable_get('booking_country', empty($data->booking_country) ? variable_get('booking_default_country') : $data->booking_country), '#default_value' => variable_get('booking_country', _booking_person_studygroups_cleanup($data->booking_country) ? variable_get('booking_default_country') : $data->booking_country),
'#options' => _booking_country_options(), '#options' => _booking_country_options(),
); );
@@ -640,13 +640,13 @@ function booking_form($node, &$form_state, $inserting = FALSE) {
'#title' => t('Parent/Guardian Name'), '#title' => t('Parent/Guardian Name'),
'#maxlength' => 100, '#maxlength' => 100,
'#required' => TRUE, '#required' => TRUE,
'#default_value' => empty($data->booking_guardian_name) ? '' : $data->booking_guardian_name '#default_value' => _booking_person_studygroups_cleanup($data->booking_guardian_name) ? '' : $data->booking_guardian_name
); );
$form['emergency']['booking_guardian_type'] = array( $form['emergency']['booking_guardian_type'] = array(
'#type' => 'radios', '#type' => 'radios',
'#title' => t('Relation to you'), '#title' => t('Relation to you'),
'#options' => $emergency_contact_type_options, '#options' => $emergency_contact_type_options,
'#default_value' => empty($data->booking_guardian_type) ? 'parent' : $data->booking_guardian_type, '#default_value' => _booking_person_studygroups_cleanup($data->booking_guardian_type) ? 'parent' : $data->booking_guardian_type,
'#required' => TRUE '#required' => TRUE
); );
$form['emergency']['booking_guardian_phone'] = array( $form['emergency']['booking_guardian_phone'] = array(
@@ -655,7 +655,7 @@ function booking_form($node, &$form_state, $inserting = FALSE) {
'#maxlength' => 30, '#maxlength' => 30,
'#size' => 30, '#size' => 30,
'#required' => TRUE, '#required' => TRUE,
'#default_value' => empty($data->booking_guardian_phone) ? '' : $data->booking_guardian_phone '#default_value' => _booking_person_studygroups_cleanup($data->booking_guardian_phone) ? '' : $data->booking_guardian_phone
); );
$form['emergency']['booking_guardian_phone_alt'] = array( $form['emergency']['booking_guardian_phone_alt'] = array(
'#type' => 'textfield', '#type' => 'textfield',
@@ -663,7 +663,7 @@ function booking_form($node, &$form_state, $inserting = FALSE) {
'#maxlength' => 30, '#maxlength' => 30,
'#size' => 30, '#size' => 30,
'#required' => FALSE, '#required' => FALSE,
'#default_value' => empty($data->booking_guardian_phone_alt) ? '' : $data->booking_guardian_phone_alt '#default_value' => _booking_person_studygroups_cleanup($data->booking_guardian_phone_alt) ? '' : $data->booking_guardian_phone_alt
); );
if (variable_get('booking_enable_medicare', 1) == 1) if (variable_get('booking_enable_medicare', 1) == 1)
@@ -674,7 +674,7 @@ function booking_form($node, &$form_state, $inserting = FALSE) {
'#maxlength' => 15, '#maxlength' => 15,
'#size' => 15, '#size' => 15,
'#required' => FALSE, '#required' => FALSE,
'#default_value' => empty($data->booking_medicare) ? '' : $data->booking_medicare '#default_value' => _booking_person_studygroups_cleanup($data->booking_medicare) ? '' : $data->booking_medicare
); );
} }
@@ -690,37 +690,37 @@ function booking_form($node, &$form_state, $inserting = FALSE) {
'#title' => t('I can help with music by playing the following musical instrument(s)'), '#title' => t('I can help with music by playing the following musical instrument(s)'),
'#maxlength' => 200, '#maxlength' => 200,
'#required' => FALSE, '#required' => FALSE,
'#default_value' => !empty($data->booking_help_music) ? $data->booking_help_music : '' '#default_value' => !_booking_person_studygroups_cleanup($data->booking_help_music) ? $data->booking_help_music : ''
); );
$form['help-areas']['booking_help_reading'] = array( $form['help-areas']['booking_help_reading'] = array(
'#type' => 'checkbox', '#type' => 'checkbox',
'#title' => t('I can help with reading'), '#title' => t('I can help with reading'),
'#default_value' => (!empty($data->booking_help_reading) && $data->booking_help_reading == 'Y') ? 1 : 0 '#default_value' => (!_booking_person_studygroups_cleanup($data->booking_help_reading) && $data->booking_help_reading == 'Y') ? 1 : 0
); );
$form['help-areas']['booking_help_chairing'] = array( $form['help-areas']['booking_help_chairing'] = array(
'#type' => 'checkbox', '#type' => 'checkbox',
'#title' => t('I can help with chairing'), '#title' => t('I can help with chairing'),
'#default_value' => (!empty($data->booking_help_chairing) && $data->booking_help_chairing == 'Y') ? 1 : 0 '#default_value' => (!_booking_person_studygroups_cleanup($data->booking_help_chairing) && $data->booking_help_chairing == 'Y') ? 1 : 0
); );
$form['help-areas']['booking_help_praying'] = array( $form['help-areas']['booking_help_praying'] = array(
'#type' => 'checkbox', '#type' => 'checkbox',
'#title' => t('I can help with praying'), '#title' => t('I can help with praying'),
'#default_value' => (!empty($data->booking_help_praying) && $data->booking_help_praying == 'Y') ? 1 : 0 '#default_value' => (!_booking_person_studygroups_cleanup($data->booking_help_praying) && $data->booking_help_praying == 'Y') ? 1 : 0
); );
$form['help-areas']['booking_help_meditations'] = array( $form['help-areas']['booking_help_meditations'] = array(
'#type' => 'checkbox', '#type' => 'checkbox',
'#title' => t('I can help with evening meditations'), '#title' => t('I can help with evening meditations'),
'#default_value' => (!empty($data->booking_help_meditations) && $data->booking_help_meditations == 'Y') ? 1 : 0 '#default_value' => (!_booking_person_studygroups_cleanup($data->booking_help_meditations) && $data->booking_help_meditations == 'Y') ? 1 : 0
); );
$form['help-areas']['booking_firstaid'] = array( $form['help-areas']['booking_firstaid'] = array(
'#type' => 'checkbox', '#type' => 'checkbox',
'#title' => t('I am a qualified First Aid Officer'), '#title' => t('I am a qualified First Aid Officer'),
'#default_value' => (!empty($data->booking_firstaid) && $data->booking_firstaid == 'Y') ? 1 : 0 '#default_value' => (!_booking_person_studygroups_cleanup($data->booking_firstaid) && $data->booking_firstaid == 'Y') ? 1 : 0
); );
$form['help-areas']['booking_nurse'] = array( $form['help-areas']['booking_nurse'] = array(
'#type' => 'checkbox', '#type' => 'checkbox',
'#title' => t('I am a qualified Nurse'), '#title' => t('I am a qualified Nurse'),
'#default_value' => (!empty($data->booking_nurse) && $data->booking_nurse == 'Y') ? 1 : 0 '#default_value' => (!_booking_person_studygroups_cleanup($data->booking_nurse) && $data->booking_nurse == 'Y') ? 1 : 0
); );
} }
@@ -733,7 +733,7 @@ function booking_form($node, &$form_state, $inserting = FALSE) {
$form['mission-experience']['booking_has_mission_experience'] = array( $form['mission-experience']['booking_has_mission_experience'] = array(
'#type' => 'checkbox', '#type' => 'checkbox',
'#title' => t('I have previous mission work experience'), '#title' => t('I have previous mission work experience'),
'#default_value' => (!empty($data->booking_has_mission_experience) && $data->booking_has_mission_experience == 'Y') ? 1 : 0 '#default_value' => (!_booking_person_studygroups_cleanup($data->booking_has_mission_experience) && $data->booking_has_mission_experience == 'Y') ? 1 : 0
); );
$form['mission-experience']['booking_mission_experience_details'] = array( $form['mission-experience']['booking_mission_experience_details'] = array(
@@ -748,7 +748,7 @@ function booking_form($node, &$form_state, $inserting = FALSE) {
':input[name="booking_has_mission_experience"]' => array('checked' => TRUE), ':input[name="booking_has_mission_experience"]' => array('checked' => TRUE),
), ),
), ),
'#default_value' => !empty($data->booking_mission_experience_details) ? $data->booking_mission_experience_details : '' '#default_value' => !_booking_person_studygroups_cleanup($data->booking_mission_experience_details) ? $data->booking_mission_experience_details : ''
); );
$form['skill-areas'] = array( $form['skill-areas'] = array(
'#type' => 'fieldset', '#type' => 'fieldset',
@@ -757,22 +757,22 @@ function booking_form($node, &$form_state, $inserting = FALSE) {
$form['skill-areas']['booking_skills_builder'] = array( $form['skill-areas']['booking_skills_builder'] = array(
'#type' => 'checkbox', '#type' => 'checkbox',
'#title' => t('I am an experienced builder'), '#title' => t('I am an experienced builder'),
'#default_value' => (!empty($data->booking_skills_builder) && $data->booking_skills_builder == 'Y') ? 1 : 0 '#default_value' => (!_booking_person_studygroups_cleanup($data->booking_skills_builder) && $data->booking_skills_builder == 'Y') ? 1 : 0
); );
$form['skill-areas']['booking_skills_cooking'] = array( $form['skill-areas']['booking_skills_cooking'] = array(
'#type' => 'checkbox', '#type' => 'checkbox',
'#title' => t('I can assist with cooking'), '#title' => t('I can assist with cooking'),
'#default_value' => (!empty($data->booking_skills_cooking) && $data->booking_skills_cooking == 'Y') ? 1 : 0 '#default_value' => (!_booking_person_studygroups_cleanup($data->booking_skills_cooking) && $data->booking_skills_cooking == 'Y') ? 1 : 0
); );
$form['skill-areas']['booking_skills_childminding'] = array( $form['skill-areas']['booking_skills_childminding'] = array(
'#type' => 'checkbox', '#type' => 'checkbox',
'#title' => t('I have child minding experience or am happy to work with children and sunday school students'), '#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 '#default_value' => (!_booking_person_studygroups_cleanup($data->booking_skills_childminding) && $data->booking_skills_childminding == 'Y') ? 1 : 0
); );
$form['skill-areas']['booking_skills_language'] = array( $form['skill-areas']['booking_skills_language'] = array(
'#type' => 'checkbox', '#type' => 'checkbox',
'#title' => t('I can speak multiple languages'), '#title' => t('I can speak multiple languages'),
'#default_value' => (!empty($data->booking_skills_language) && $data->booking_skills_language == 'Y') ? 1 : 0 '#default_value' => (!_booking_person_studygroups_cleanup($data->booking_skills_language) && $data->booking_skills_language == 'Y') ? 1 : 0
); );
$form['skill-areas']['booking_skills_language_details'] = array( $form['skill-areas']['booking_skills_language_details'] = array(
@@ -785,13 +785,13 @@ function booking_form($node, &$form_state, $inserting = FALSE) {
':input[name="booking_skills_language"]' => array('checked' => TRUE), ':input[name="booking_skills_language"]' => array('checked' => TRUE),
), ),
), ),
'#default_value' => !empty($data->booking_skills_language_details) ? $data->booking_skills_language_details : '' '#default_value' => !_booking_person_studygroups_cleanup($data->booking_skills_language_details) ? $data->booking_skills_language_details : ''
); );
$form['skill-areas']['booking_skills_other'] = array( $form['skill-areas']['booking_skills_other'] = array(
'#type' => 'checkbox', '#type' => 'checkbox',
'#title' => t('I have other skills that can assist in preaching activities'), '#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 '#default_value' => (!_booking_person_studygroups_cleanup($data->booking_skills_other) && $data->booking_skills_other == 'Y') ? 1 : 0
); );
$form['skill-areas']['booking_skills_other_details'] = array( $form['skill-areas']['booking_skills_other_details'] = array(
'#type' => 'textfield', '#type' => 'textfield',
@@ -803,7 +803,7 @@ function booking_form($node, &$form_state, $inserting = FALSE) {
':input[name="booking_skills_other"]' => array('checked' => TRUE), ':input[name="booking_skills_other"]' => array('checked' => TRUE),
), ),
), ),
'#default_value' => !empty($data->booking_skills_other_details) ? $data->booking_skills_other_details : '' '#default_value' => !_booking_person_studygroups_cleanup($data->booking_skills_other_details) ? $data->booking_skills_other_details : ''
); );
} }
@@ -818,7 +818,7 @@ function booking_form($node, &$form_state, $inserting = FALSE) {
$form['misc-areas']['booking_dietary_check'] = array( $form['misc-areas']['booking_dietary_check'] = array(
'#type' => 'checkbox', '#type' => 'checkbox',
'#title' => t('Special dietary requirements'), '#title' => t('Special dietary requirements'),
'#default_value' => (!empty($data->booking_dietary) && $data->booking_dietary == 'Y') ? 1 : 0 '#default_value' => (!_booking_person_studygroups_cleanup($data->booking_dietary) && $data->booking_dietary == 'Y') ? 1 : 0
); );
if (variable_get('booking_enable_dietary', 0) == 1) if (variable_get('booking_enable_dietary', 0) == 1)
@@ -833,7 +833,7 @@ function booking_form($node, &$form_state, $inserting = FALSE) {
':input[name="booking_dietary_check"]' => array('checked' => TRUE), ':input[name="booking_dietary_check"]' => array('checked' => TRUE),
), ),
), ),
'#default_value' => !empty($data->booking_dietary) ? $data->booking_dietary : '' '#default_value' => !_booking_person_studygroups_cleanup($data->booking_dietary) ? $data->booking_dietary : ''
); );
} }
else else
@@ -853,7 +853,7 @@ function booking_form($node, &$form_state, $inserting = FALSE) {
$form['misc-areas']['booking_medical_conditions_check'] = array( $form['misc-areas']['booking_medical_conditions_check'] = array(
'#type' => 'checkbox', '#type' => 'checkbox',
'#title' => t('Special medical conditions'), '#title' => t('Special medical conditions'),
'#default_value' => (!empty($data->booking_medical_conditions) && $data->booking_medical_conditions == 'Y') ? 1 : 0 '#default_value' => (!_booking_person_studygroups_cleanup($data->booking_medical_conditions) && $data->booking_medical_conditions == 'Y') ? 1 : 0
); );
$form['misc-areas']['booking_medical_conditions'] = array( $form['misc-areas']['booking_medical_conditions'] = array(
'#type' => 'textfield', '#type' => 'textfield',
@@ -865,7 +865,7 @@ function booking_form($node, &$form_state, $inserting = FALSE) {
':input[name="booking_medical_conditions_check"]' => array('checked' => TRUE), ':input[name="booking_medical_conditions_check"]' => array('checked' => TRUE),
), ),
), ),
'#default_value' => !empty($data->booking_medical_conditions) ? $data->booking_medical_conditions : '' '#default_value' => !_booking_person_studygroups_cleanup($data->booking_medical_conditions) ? $data->booking_medical_conditions : ''
); );
} else { } else {
@@ -873,13 +873,13 @@ function booking_form($node, &$form_state, $inserting = FALSE) {
'#type' => 'textfield', '#type' => 'textfield',
'#title' => t('Please describe your dietary requirements.'), '#title' => t('Please describe your dietary requirements.'),
'#maxlength' => 120, '#maxlength' => 120,
'#default_value' => !empty($data->booking_dietary) ? $data->booking_dietary : '' '#default_value' => !_booking_person_studygroups_cleanup($data->booking_dietary) ? $data->booking_dietary : ''
); );
$form['misc-areas']['booking_medical_conditions'] = array( $form['misc-areas']['booking_medical_conditions'] = array(
'#type' => 'textfield', '#type' => 'textfield',
'#title' => t('Please list any medical conditions we need to be aware of.'), '#title' => t('Please list any medical conditions we need to be aware of.'),
'#maxlength' => 120, '#maxlength' => 120,
'#default_value' => !empty($data->booking_medical_conditions) ? $data->booking_medical_conditions : '' '#default_value' => !_booking_person_studygroups_cleanup($data->booking_medical_conditions) ? $data->booking_medical_conditions : ''
); );
} }
@@ -890,7 +890,7 @@ function booking_form($node, &$form_state, $inserting = FALSE) {
'#title' => t('I would like to share a room with'), '#title' => t('I would like to share a room with'),
'#maxlength' => 200, '#maxlength' => 200,
'#required' => FALSE, '#required' => FALSE,
'#default_value' => !empty($data->booking_room_mate1) ? $data->booking_room_mate1 : '', '#default_value' => !_booking_person_studygroups_cleanup($data->booking_room_mate1) ? $data->booking_room_mate1 : '',
); );
} }
@@ -1070,29 +1070,29 @@ 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 = _booking_person_studygroups_cleanup($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 = _booking_person_studygroups_cleanup($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 = _booking_person_studygroups_cleanup($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_passport_expiry_date = _booking_person_studygroups_cleanup($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_destination_country = _booking_person_studygroups_cleanup($values['booking_destination_country']) ? '' : $values['booking_destination_country'];
$node->booking_travel_insurance = empty($values['booking_travel_insurance']) ? '' : $values['booking_travel_insurance']; $node->booking_travel_insurance = _booking_person_studygroups_cleanup($values['booking_travel_insurance']) ? '' : $values['booking_travel_insurance'];
//flight info, which may not be present //flight info, which may not be present
$node->booking_outflight_bookingnum = empty($values['booking_outflight_bookingnum']) ? '' : $values['booking_outflight_bookingnum']; $node->booking_outflight_bookingnum = _booking_person_studygroups_cleanup($values['booking_outflight_bookingnum']) ? '' : $values['booking_outflight_bookingnum'];
$node->booking_outflight_flightnum = empty($values['booking_outflight_flightnum']) ? '' : $values['booking_outflight_flightnum']; $node->booking_outflight_flightnum = _booking_person_studygroups_cleanup($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 = _booking_person_studygroups_cleanup($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_origin_ts = _booking_person_studygroups_cleanup($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_connecting_flightnum = _booking_person_studygroups_cleanup($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 = _booking_person_studygroups_cleanup($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_outflight_destination_ts = _booking_person_studygroups_cleanup($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_bookingnum = _booking_person_studygroups_cleanup($values['booking_rtrnflight_bookingnum']) ? '' : $values['booking_rtrnflight_bookingnum'];
$node->booking_rtrnflight_flightnum = empty($values['booking_rtrnflight_flightnum']) ? '' : $values['booking_rtrnflight_flightnum']; $node->booking_rtrnflight_flightnum = _booking_person_studygroups_cleanup($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 = _booking_person_studygroups_cleanup($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_origin_ts = _booking_person_studygroups_cleanup($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_connecting_flightnum = _booking_person_studygroups_cleanup($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 = _booking_person_studygroups_cleanup($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 = _booking_person_studygroups_cleanup($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'];
@@ -1109,8 +1109,8 @@ function booking_form_submit($form, &$form_state) {
$node->booking_baptised = ($values['booking_baptised'] == 1 ? 'Y' : 'N'); $node->booking_baptised = ($values['booking_baptised'] == 1 ? 'Y' : 'N');
$node->booking_married = ($values['booking_married'] == 1 ? 'Y' : 'N'); $node->booking_married = ($values['booking_married'] == 1 ? 'Y' : 'N');
$node->booking_partner_name = ucwords($values['booking_partner_name']); $node->booking_partner_name = ucwords($values['booking_partner_name']);
$node->booking_partner_id = empty($values['booking_partner_id']) ? 0 : $values['booking_partner_id']; $node->booking_partner_id = _booking_person_studygroups_cleanup($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']; $node->booking_bf_gf_nid = _booking_person_studygroups_cleanup($values['booking_bf_gf_nid']) ? 0 : $values['booking_bf_gf_nid'];
//allow for user-entered value if the state is not already listed //allow for user-entered value if the state is not already listed
if ($values['booking_state'] == 'Other') { if ($values['booking_state'] == 'Other') {
@@ -1124,46 +1124,46 @@ function booking_form_submit($form, &$form_state) {
$node->booking_guardian_type = $values['booking_guardian_type']; $node->booking_guardian_type = $values['booking_guardian_type'];
$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 = _booking_person_studygroups_cleanup($values['booking_medicare']) ? 0 : $values['booking_medicare'];
//fields that may or may not have been present in the initial form //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_barcode = _booking_person_studygroups_cleanup($values['booking_barcode']) ? '' : $values['booking_barcode'];
$node->booking_luckynum = empty($values['booking_luckynum']) ? 0 : $values['booking_luckynum']; $node->booking_luckynum = _booking_person_studygroups_cleanup($values['booking_luckynum']) ? 0 : $values['booking_luckynum'];
$node->booking_welfare_required = empty($values['booking_welfare_required']) ? 'N' : ($values['booking_welfare_required'] == 1 ? 'Y' : 'N'); $node->booking_welfare_required = _booking_person_studygroups_cleanup($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_committee_member = _booking_person_studygroups_cleanup($values['booking_committee_member']) ? 'N' : ($values['booking_committee_member'] == 1 ? 'Y' : 'N');
$node->booking_refund_processed = empty($values['booking_refund_processed']) ? 'N' : ($values['booking_refund_processed'] == 1 ? 'Y' : 'N'); $node->booking_refund_processed = _booking_person_studygroups_cleanup($values['booking_refund_processed']) ? 'N' : ($values['booking_refund_processed'] == 1 ? 'Y' : 'N');
$node->booking_refund_due = empty($values['booking_refund_due']) ? 0 : $values['booking_refund_due']; $node->booking_refund_due = _booking_person_studygroups_cleanup($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_music = _booking_person_studygroups_cleanup($values['booking_help_music']) ? '' : $values['booking_help_music'];
$node->booking_help_meditations = empty($values['booking_help_meditations']) ? '' : $values['booking_help_meditations']; $node->booking_help_meditations = _booking_person_studygroups_cleanup($values['booking_help_meditations']) ? '' : $values['booking_help_meditations'];
$node->booking_help_praying = empty($values['booking_help_praying']) ? '' : $values['booking_help_praying']; $node->booking_help_praying = _booking_person_studygroups_cleanup($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_reading = _booking_person_studygroups_cleanup($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_chairing = _booking_person_studygroups_cleanup($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_readgroup_lead = _booking_person_studygroups_cleanup($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_help_discussgroup_lead = _booking_person_studygroups_cleanup($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_firstaid = _booking_person_studygroups_cleanup($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_nurse = _booking_person_studygroups_cleanup($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_lifesaver = _booking_person_studygroups_cleanup($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_doctor = _booking_person_studygroups_cleanup($values['booking_doctor']) ? 'N' : ($values['booking_doctor'] == 1 ? 'Y' : 'N');
$node->booking_dietary = empty($values['booking_dietary']) ? 'N/A' : $values['booking_dietary']; $node->booking_dietary = _booking_person_studygroups_cleanup($values['booking_dietary']) ? 'N/A' : $values['booking_dietary'];
$node->booking_medical_conditions = empty($values['booking_medical_conditions']) ? 'N/A' : $values['booking_medical_conditions']; $node->booking_medical_conditions = _booking_person_studygroups_cleanup($values['booking_medical_conditions']) ? 'N/A' : $values['booking_medical_conditions'];
$node->booking_mission_experience_details = empty($values['booking_mission_experience_details']) ? 'N/A' : $values['booking_mission_experience_details']; $node->booking_mission_experience_details = _booking_person_studygroups_cleanup($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_has_mission_experience = _booking_person_studygroups_cleanup($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_builder = _booking_person_studygroups_cleanup($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_cooking = _booking_person_studygroups_cleanup($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_childminding = _booking_person_studygroups_cleanup($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 = _booking_person_studygroups_cleanup($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_language_details = _booking_person_studygroups_cleanup($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 = _booking_person_studygroups_cleanup($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']; $node->booking_skills_other_details = _booking_person_studygroups_cleanup($values['booking_skills_other_details']) ? 'N/A' : $values['booking_skills_other_details'];
//potential fields for future //potential fields for future
//$node->booking_payment_method = $payment_method; //$node->booking_payment_method = $payment_method;
$node->booking_room_mate1 = empty($values['booking_room_mate1']) ? '' : $values['booking_room_mate1']; $node->booking_room_mate1 = _booking_person_studygroups_cleanup($values['booking_room_mate1']) ? '' : $values['booking_room_mate1'];
$node->booking_room_mate2 = empty($values['booking_room_mate2']) ? '' : $values['booking_room_mate2']; $node->booking_room_mate2 = _booking_person_studygroups_cleanup($values['booking_room_mate2']) ? '' : $values['booking_room_mate2'];
$node->booking_shirt_size = empty($values['booking_shirt_size']) ? 'N/A' : $values['booking_shirt_size']; $node->booking_shirt_size = _booking_person_studygroups_cleanup($values['booking_shirt_size']) ? 'N/A' : $values['booking_shirt_size'];
//fields only configured by admin //fields only configured by admin
$node->booking_readinggroup = !empty($values['booking_readinggroup']) ? $values['booking_readinggroup'] : ''; $node->booking_readinggroup = !_booking_person_studygroups_cleanup($values['booking_readinggroup']) ? $values['booking_readinggroup'] : '';
$node->booking_timestamp = REQUEST_TIME; $node->booking_timestamp = REQUEST_TIME;
//internal fields //internal fields
@@ -1371,7 +1371,7 @@ function _booking_insert($node) {
'booking_bf_gf_nid' => $node->booking_bf_gf_nid == '' ? 0 : $node->booking_bf_gf_nid, 'booking_bf_gf_nid' => $node->booking_bf_gf_nid == '' ? 0 : $node->booking_bf_gf_nid,
'booking_room_mate1' => $node->booking_room_mate1, 'booking_room_mate1' => $node->booking_room_mate1,
'booking_room_mate2' => $node->booking_room_mate2, 'booking_room_mate2' => $node->booking_room_mate2,
'booking_shirt_size' => empty($node->booking_shirt_size) ? 'N/A' : $node->booking_shirt_size, 'booking_shirt_size' => _booking_person_studygroups_cleanup($node->booking_shirt_size) ? 'N/A' : $node->booking_shirt_size,
'booking_help_music' => $node->booking_help_music, 'booking_help_music' => $node->booking_help_music,
'booking_help_praying' => $node->booking_help_praying, 'booking_help_praying' => $node->booking_help_praying,
'booking_help_meditations' => $node->booking_help_meditations, 'booking_help_meditations' => $node->booking_help_meditations,
@@ -1388,7 +1388,7 @@ function _booking_insert($node) {
'booking_guardian_type' => $node->booking_guardian_type, 'booking_guardian_type' => $node->booking_guardian_type,
'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' => _booking_person_studygroups_cleanup($node->booking_medicare) ? '' : $node->booking_medicare,
'booking_lifesaver' => $node->booking_lifesaver, 'booking_lifesaver' => $node->booking_lifesaver,
'booking_firstaid' => $node->booking_firstaid, 'booking_firstaid' => $node->booking_firstaid,
'booking_nurse' => $node->booking_nurse, 'booking_nurse' => $node->booking_nurse,
@@ -1959,7 +1959,7 @@ function booking_view($node, $view_mode) {
} }
//add the travel info if it has been defined for this attendee //add the travel info if it has been defined for this attendee
if (! empty($node->tid)) if (! _booking_person_studygroups_cleanup($node->tid))
{ {
$travel_heading = t("<h2>Travel Details</h2><p>!link</p>", $travel_heading = t("<h2>Travel Details</h2><p>!link</p>",
array('!link' => l(t('Edit Travel Details'), t('node/!id/edit', array('!id' => $node->tid))) array('!link' => l(t('Edit Travel Details'), t('node/!id/edit', array('!id' => $node->tid)))

View File

@@ -166,7 +166,7 @@ function booking_report_summary() {
//travel form completed? //travel form completed?
if (! empty($person->tid)) if (! _booking_person_studygroups_cleanup($person->tid))
$travelform_count++; $travelform_count++;
//booking status //booking status
@@ -381,6 +381,7 @@ function booking_coming_page() {
global $event; global $event;
$output = ""; $output = "";
$table = ""; $table = "";
$attributes = array('style' => 'max-width:60%');
$booking_limit = variable_get('booking_regn_limit','350'); $booking_limit = variable_get('booking_regn_limit','350');
$rows = array(); $rows = array();
@@ -481,7 +482,7 @@ function booking_coming_page() {
} }
//theme the table of registrations //theme the table of registrations
$output .= theme('table', array('header' => $header, 'rows' => $rows)); $output .= theme('table', array('header' => $header, 'rows' => $rows, 'attributes' => $attributes));
} }
else else
{ {

View File

@@ -412,251 +412,6 @@ function booking_room_edit_form_submit($form, &$form_state) {
} }
/**
* Function to display existing room definitions
*/
function booking_rooms_view_definitions() {
global $event;
$prefix = "<h2>Room Definitions</h2>";
//query for room definitions
$result = db_query("SELECT * from {booking_room_definition}");
$header = array (
'booking_room_location_description' => t('Room Location'),
'booking_room_number' => t('Room Number'),
'booking_room_singlebeds' => t('Number Single Beds'),
'booking_room_doublebeds' => t('Number Double Beds'),
'booking_room_queenbeds' => t('Number Queen Beds'),
'booking_room_ensuite' => t('Ensuite?'),
'booking_room_edit' => t('Edit Room'),
);
foreach($result as $data)
{
$rows[] = array (
_booking_room_location_lookup($data->booking_room_location_id),
$data->booking_room_number,
$data->booking_room_singlebeds,
$data->booking_room_doublebeds,
$data->booking_room_queenbeds,
$data->booking_room_ensuite == 'Y' ? 'Yes' : 'No',
l(t('Edit'), t('admin/config/booking/rooms/!id/edit', array('!id' => $data->rid))),
);
/*
$options[$data->rid] = array
(
'booking_room_location_description' => _booking_room_location_lookup($data->booking_room_location_id),
'booking_room_number' => $data->booking_room_number,
'booking_room_singlebeds' => $data->booking_room_singlebeds,
'booking_room_doublebeds' => $data->booking_room_doublebeds,
'booking_room_queenbeds' => $data->booking_room_queenbeds,
'booking_room_ensuite' => $data->booking_room_ensuite == 'Y' ? 'Yes' : 'No',
);
*/
}
$result = array (
'first_para' => array (
'#type' => 'markup',
'#markup' => $prefix,
),
'table' => array (
'#theme' => 'table',
'#header' => $header,
'#rows' => $rows,
//'#attributes' => array('id' => 'sort-table'),
)
);
return $result;
}
/**
* Function to define the form for configuring room definitions and also display existing room definitions
*/
function booking_rooms_definition_form($node, &$form_state, $create, $room_id = 0) {
global $event;
$prefix = "";
$form = array();
$bedcount_options = array();
//TODO: update to be like booking_price_form()
if ($create == true)
{
$data = $node;
$prefix = t("<p>Create new room defintion.</p>");
//watchdog('booking', 'Creating new room definition: @info', array ('@info' => var_export($node, TRUE)));
}
else
{
//verify that $editid is a number
if (! preg_match('/^[0-9]+$/', $room_id)) {
drupal_set_message("Error: Invalid room ID supplied. Unable to update room definition.", 'error', FALSE);
drupal_goto('admin/config/booking/rooms');
return "";
}
//$data = $form_state['input'];
$data = db_query("SELECT * FROM {booking_room_definition} WHERE rid = :id",
array(':id' => $room_id))
->fetchObject();
$prefix = t("<p>Update the room defintions.</p>");
//add this to the form in a hidden field so we can update the right price
$form['booking_rid'] = array (
'#type' => 'hidden',
'#value' => $room_id,
);
//watchdog('booking', 'Editing existing room definition: @info', array ('@info' => var_export($data, TRUE)));
}
//create the options array for bed counts
for ($i = 0; $i <= 15; $i++)
$bedcount_options[$i] = $i;
//define the form for adding to the room definitions
if(!isset($form_state['storage']['confirm'])) {
$form[] = array (
'first_heading' => array (
'#type' => 'markup',
'#markup' => $prefix,
),
);
$form['booking_room_location_id'] = array(
'#type' => 'select',
'#title' => t('Choose room location'),
'#options' => _booking_room_location_lookup(),
'#default_value' => !empty($data->booking_room_location_id) ? $data->booking_room_location_id : ''
);
$form['booking_room_number'] = array (
'#type' => 'textfield',
'#title' => t('Specify room number'),
'#size' => 5,
'#maxlength' => 10,
'#default_value' => !empty($data->booking_room_number) ? $data->booking_room_number : '',
);
$form['booking_room_singlebeds'] = array (
'#type' => 'select',
'#title' => t('Specify number of single beds'),
'#options' => $bedcount_options,
'#default_value' => !empty($data->booking_room_singlebeds) ? $data->booking_room_singlebeds : '',
);
$form['booking_room_doublebeds'] = array (
'#type' => 'select',
'#title' => t('Specify number of double beds'),
'#options' => $bedcount_options,
'#default_value' => !empty($data->booking_room_doublebeds) ? $data->booking_room_doublebeds : '',
);
$form['booking_room_queenbeds'] = array (
'#type' => 'select',
'#title' => t('Specify number of queen beds'),
'#options' => $bedcount_options,
'#default_value' => !empty($data->booking_room_queenbeds) ? $data->booking_room_queenbeds : '',
);
$form['booking_room_ensuite'] = array(
'#type' => 'checkbox',
'#title' => t('Tick if this room has an ensuite'),
'#default_value' => (!empty($data->booking_room_ensuite) && $data->booking_room_ensuite == 'Y') ? 1 : 0,
);
if ($create == true)
{
$form['submit'] = array
(
'#type' => 'submit',
'#value' => t('Add Room'),
);
} else {
$form['Update'] = array
(
'#type' => 'submit',
'#value' => t('Update Room'),
);
$form['Delete'] = array
(
'#type' => 'submit',
'#value' => t('Delete Room'),
);
}
return array (
'form' => $form,
);
}
else
{
return confirm_form($form, "Are you sure you wish to delete room definition with id " . $room_id . "?",
current_path(), NULL, "Delete Room");
}
}
/**
* Process the form for adding room definitions
*/
function booking_rooms_definition_form_submit($form, &$form_state) {
global $event;
$values = $form_state['input'];
$redirect_path = "admin/config/booking/rooms";
//watchdog('booking', "<pre>Room definition submission:\n@info</pre>", array('@info' => print_r( $form_state, true)));
//if we're deleting, add the confirmation to the form if it hasn't been defined yet
if($form_state['values']['op'] == 'Delete Room' && (!isset($form_state['storage']['confirm'])))
{
//watchdog('booking', "<pre>Room deletion confirmation being set:\n@info</pre>", array('@info' => print_r( $form_state, true)));
$form_state['storage']['confirm'] = TRUE;
$form_state['rebuild'] = TRUE;
}
elseif ($form_state['values']['op'] == 'Delete Room')
{
//delete the room
watchdog('booking', "Deleting room ID !rid", array('!rid' => $values['booking_rid']));
db_delete('booking_room_definition')
->condition('rid', $values['booking_rid'])
->execute();
drupal_set_message('Deleted room id ' . $values['booking_rid'] );
$form_state['redirect'] = $redirect_path;
}
elseif ($form_state['values']['op'] == 'Update Room')
{
$result = db_update('booking_room_definition')
->fields(array(
'booking_room_location_id' => $values['booking_room_location_id'],
'booking_room_number' => $values['booking_room_number'],
'booking_room_singlebeds' => $values['booking_room_singlebeds'],
'booking_room_doublebeds' => $values['booking_room_doublebeds'],
'booking_room_queenbeds' => $values['booking_room_queenbeds'],
'booking_room_ensuite' => $values['booking_room_ensuite'] == 1 ? 'Y' : 'N',
))
->condition('rid', $values['booking_rid'] )
->execute();
drupal_set_message('Updated room id ' . $values['booking_rid'] );
$form_state['redirect'] = $redirect_path;
}
elseif ($form_state['values']['op'] == 'Add Room')
{
db_insert('booking_room_definition')
->fields(array(
'booking_room_location_id' => $values['booking_room_location_id'],
'booking_room_number' => $values['booking_room_number'],
'booking_room_singlebeds' => $values['booking_room_singlebeds'],
'booking_room_doublebeds' => $values['booking_room_doublebeds'],
'booking_room_queenbeds' => $values['booking_room_queenbeds'],
'booking_room_ensuite' => $values['booking_room_ensuite'] == 1 ? 'Y' : 'N',
))
->execute();
drupal_set_message('Created new room definition');
$form_state['redirect'] = $redirect_path;
}
}
/** /**
* Function for allocating rooms * Function for allocating rooms

View File

@@ -28,14 +28,13 @@ function booking_room_view_summary() {
array_shift($room_definitions); array_shift($room_definitions);
$i = 1; $i = 1;
*/ */
foreach ($room_definitions as $room) { foreach ($result as $room) {
$rows[] = array( $rows[] = array(
$room, $room->booking_roomlocation_descrip,
l(t('Allocate Rooms'), t('admin/booking/rooms/!id/assign', array('!id' => $i))), l(t('Allocate Rooms'), t('admin/booking/rooms/!id/assign', array('!id' => $room->lid))),
l(t('View Rooms'), t('admin/booking/rooms/!id/view', array('!id' => $i))), l(t('View Rooms'), t('admin/booking/rooms/!id/view', array('!id' => $room->lid))),
); );
//$i++;
$i++;
} }
//output everything //output everything
@@ -177,7 +176,7 @@ function booking_roomlocation_define_form_submit($form, &$form_state) {
} }
elseif ($form_state['values']['op'] == 'Delete') elseif ($form_state['values']['op'] == 'Delete')
{ {
//verify that booking_pid is a number //verify that booking_lid is a number
if (! preg_match('/^[0-9]+$/', $values['booking_lid'])) { if (! preg_match('/^[0-9]+$/', $values['booking_lid'])) {
drupal_set_message("Error: Invalid room location ID supplied. Unable to delete entry.", 'error', FALSE); drupal_set_message("Error: Invalid room location ID supplied. Unable to delete entry.", 'error', FALSE);
return ""; return "";
@@ -215,3 +214,269 @@ function booking_roomlocation_define_form_submit($form, &$form_state) {
$form_state['redirect'] = $redirect_path; $form_state['redirect'] = $redirect_path;
} }
/**
* Function to display existing room definitions
*/
function booking_rooms_view_definitions() {
global $event;
$rows = array();
$prefix = "<h2>Room Definitions</h2>";
$query = db_select('booking_room_definition', 'r');
$query->join('booking_room_locations', 'l', 'l.lid = r.booking_room_location_id');
$query->condition('l.booking_roomlocation_active', 'Y', '=')
->fields('r')
->fields('l');
$result = $query->execute();
//query for room definitions
//$result = db_query("SELECT * from {booking_room_definition}");
$header = array (
'booking_room_location_description' => t('Room Location'),
'booking_room_number' => t('Room Number'),
'booking_room_singlebeds' => t('Number Single Beds'),
'booking_room_doublebeds' => t('Number Double Beds'),
'booking_room_queenbeds' => t('Number Queen Beds'),
'booking_room_ensuite' => t('Ensuite?'),
'booking_room_edit' => t('Edit Room'),
);
foreach($result as $data)
{
$rows[] = array (
//_booking_room_location_lookup($data->booking_room_location_id),
$data->booking_roomlocation_descrip,
$data->booking_room_number,
$data->booking_room_singlebeds,
$data->booking_room_doublebeds,
$data->booking_room_queenbeds,
$data->booking_room_ensuite == 'Y' ? 'Yes' : 'No',
l(t('Edit'), t('admin/config/booking/rooms/!id/edit', array('!id' => $data->rid))),
);
/*
$options[$data->rid] = array
(
'booking_room_location_description' => _booking_room_location_lookup($data->booking_room_location_id),
'booking_room_number' => $data->booking_room_number,
'booking_room_singlebeds' => $data->booking_room_singlebeds,
'booking_room_doublebeds' => $data->booking_room_doublebeds,
'booking_room_queenbeds' => $data->booking_room_queenbeds,
'booking_room_ensuite' => $data->booking_room_ensuite == 'Y' ? 'Yes' : 'No',
);
*/
}
$result = array (
'first_para' => array (
'#type' => 'markup',
'#markup' => $prefix,
),
'table' => array (
'#theme' => 'table',
'#header' => $header,
'#rows' => $rows,
'#empty' => t('No room definitions found.'),
//'#attributes' => array('id' => 'sort-table'),
)
);
return $result;
}
/**
* Function to define the form for configuring room definitions and also display existing room definitions
*/
function booking_rooms_definition_form($node, &$form_state, $create, $room_id = 0) {
global $event;
$prefix = "";
$form = array();
$location_options = array();
$bedcount_options = array();
//TODO: update to be like booking_price_form()
$query = db_query("SELECT * FROM {booking_room_locations} where booking_roomlocation_active='Y'");
foreach($query as $row)
{
$location_options[$row->lid] = $row->booking_roomlocation_descrip;
}
if ($create == true)
{
$data = $node;
$prefix = t("<p>Create new room defintion.</p>");
//watchdog('booking', 'Creating new room definition: @info', array ('@info' => var_export($node, TRUE)));
}
else
{
//verify that $editid is a number
if (! preg_match('/^[0-9]+$/', $room_id)) {
drupal_set_message("Error: Invalid room ID supplied. Unable to update room definition.", 'error', FALSE);
drupal_goto('admin/config/booking/rooms');
return "";
}
//$data = $form_state['input'];
$data = db_query("SELECT * FROM {booking_room_definition} WHERE rid = :id",
array(':id' => $room_id))
->fetchObject();
$prefix = t("<p>Update the room defintions.</p>");
//add this to the form in a hidden field so we can update the right price
$form['booking_rid'] = array (
'#type' => 'hidden',
'#value' => $room_id,
);
//watchdog('booking', 'Editing existing room definition: @info', array ('@info' => var_export($data, TRUE)));
}
//create the options array for bed counts
for ($i = 0; $i <= 15; $i++)
$bedcount_options[$i] = $i;
//define the form for adding to the room definitions
if(!isset($form_state['storage']['confirm'])) {
$form[] = array (
'first_heading' => array (
'#type' => 'markup',
'#markup' => $prefix,
),
);
$form['booking_room_location_id'] = array(
'#type' => 'select',
'#title' => t('Choose room location'),
'#options' => $location_options,
'#default_value' => !empty($data->booking_room_location_id) ? $data->booking_room_location_id : ''
);
$form['booking_room_number'] = array (
'#type' => 'textfield',
'#title' => t('Specify room number'),
'#size' => 5,
'#maxlength' => 10,
'#default_value' => !empty($data->booking_room_number) ? $data->booking_room_number : '',
);
$form['booking_room_singlebeds'] = array (
'#type' => 'select',
'#title' => t('Specify number of single beds'),
'#options' => $bedcount_options,
'#default_value' => !empty($data->booking_room_singlebeds) ? $data->booking_room_singlebeds : '',
);
$form['booking_room_doublebeds'] = array (
'#type' => 'select',
'#title' => t('Specify number of double beds'),
'#options' => $bedcount_options,
'#default_value' => !empty($data->booking_room_doublebeds) ? $data->booking_room_doublebeds : '',
);
$form['booking_room_queenbeds'] = array (
'#type' => 'select',
'#title' => t('Specify number of queen beds'),
'#options' => $bedcount_options,
'#default_value' => !empty($data->booking_room_queenbeds) ? $data->booking_room_queenbeds : '',
);
$form['booking_room_ensuite'] = array(
'#type' => 'checkbox',
'#title' => t('Tick if this room has an ensuite'),
'#default_value' => (!empty($data->booking_room_ensuite) && $data->booking_room_ensuite == 'Y') ? 1 : 0,
);
if ($create == true)
{
$form['submit'] = array
(
'#type' => 'submit',
'#value' => t('Add Room'),
);
} else {
$form['Update'] = array
(
'#type' => 'submit',
'#value' => t('Update Room'),
);
$form['Delete'] = array
(
'#type' => 'submit',
'#value' => t('Delete Room'),
);
}
return array (
'form' => $form,
);
}
else
{
return confirm_form($form, "Are you sure you wish to delete room definition with id " . $room_id . "?",
current_path(), NULL, "Delete Room");
}
}
/**
* Process the form for adding room definitions
*/
function booking_rooms_definition_form_submit($form, &$form_state) {
global $event;
$values = $form_state['input'];
$redirect_path = "admin/config/booking/rooms";
//watchdog('booking', "<pre>Room definition submission:\n@info</pre>", array('@info' => print_r( $form_state, true)));
//if we're deleting, add the confirmation to the form if it hasn't been defined yet
if($form_state['values']['op'] == 'Delete Room' && (!isset($form_state['storage']['confirm'])))
{
//watchdog('booking', "<pre>Room deletion confirmation being set:\n@info</pre>", array('@info' => print_r( $form_state, true)));
$form_state['storage']['confirm'] = TRUE;
$form_state['rebuild'] = TRUE;
}
elseif ($form_state['values']['op'] == 'Delete Room')
{
//delete the room
watchdog('booking', "Deleting room ID !rid", array('!rid' => $values['booking_rid']));
db_delete('booking_room_definition')
->condition('rid', $values['booking_rid'])
->execute();
drupal_set_message('Deleted room id ' . $values['booking_rid'] );
$form_state['redirect'] = $redirect_path;
}
elseif ($form_state['values']['op'] == 'Update Room')
{
$result = db_update('booking_room_definition')
->fields(array(
'booking_room_location_id' => $values['booking_room_location_id'],
'booking_room_number' => $values['booking_room_number'],
'booking_room_singlebeds' => $values['booking_room_singlebeds'],
'booking_room_doublebeds' => $values['booking_room_doublebeds'],
'booking_room_queenbeds' => $values['booking_room_queenbeds'],
'booking_room_ensuite' => $values['booking_room_ensuite'] == 1 ? 'Y' : 'N',
))
->condition('rid', $values['booking_rid'] )
->execute();
drupal_set_message('Updated room id ' . $values['booking_rid'] );
$form_state['redirect'] = $redirect_path;
}
elseif ($form_state['values']['op'] == 'Add Room')
{
db_insert('booking_room_definition')
->fields(array(
'booking_room_location_id' => $values['booking_room_location_id'],
'booking_room_number' => $values['booking_room_number'],
'booking_room_singlebeds' => $values['booking_room_singlebeds'],
'booking_room_doublebeds' => $values['booking_room_doublebeds'],
'booking_room_queenbeds' => $values['booking_room_queenbeds'],
'booking_room_ensuite' => $values['booking_room_ensuite'] == 1 ? 'Y' : 'N',
))
->execute();
drupal_set_message('Created new room definition');
$form_state['redirect'] = $redirect_path;
}
}