diff --git a/booking.events.inc b/booking.events.inc index 293bc5c..3819963 100644 --- a/booking.events.inc +++ b/booking.events.inc @@ -138,7 +138,7 @@ function booking_event_form($node, &$form_state, $create, $editid = 0) '#size' => 60, '#maxlength' => 150, '#required' => TRUE, - '#default_value' => !_booking_person_studygroups_cleanup($data->booking_eventname) ? $data->booking_eventname : '', + '#default_value' => !empty($data->booking_eventname) ? $data->booking_eventname : '', ); $form['booking_event_active'] = array( '#type' => 'checkbox', @@ -148,7 +148,7 @@ function booking_event_form($node, &$form_state, $create, $editid = 0) $form['booking_event_start'] = array( '#type' => 'date_select', '#title' => t('Date that this event will 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), + '#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), '#date_format' => 'd/m/Y H:i', '#date_label_position' => 'within', '#date_year_range' => '0:+5' @@ -156,7 +156,7 @@ function booking_event_form($node, &$form_state, $create, $editid = 0) $form['booking_event_end'] = array( '#type' => 'date_select', '#title' => t('Date that this event will conclude'), - '#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), + '#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), '#date_format' => 'd/m/Y H:i', '#date_label_position' => 'within', '#date_year_range' => '0:+5' @@ -164,7 +164,7 @@ function booking_event_form($node, &$form_state, $create, $editid = 0) $form['booking_register_open'] = array( '#type' => 'date_select', '#title' => t('Date that registrations will open for this event'), - '#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), + '#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), '#date_format' => 'd/m/Y H:i', '#date_label_position' => 'within', '#date_year_range' => '0:+5' @@ -172,7 +172,7 @@ function booking_event_form($node, &$form_state, $create, $editid = 0) $form['booking_earlybird_close'] = array( '#type' => 'date_select', '#title' => t('Date that the early discounted rate will close for this event (if not applicable, set to registration close date)'), - '#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), + '#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), '#date_format' => 'd/m/Y H:i', '#date_label_position' => 'within', '#date_year_range' => '0:+5' @@ -180,7 +180,7 @@ function booking_event_form($node, &$form_state, $create, $editid = 0) $form['booking_register_close'] = array( '#type' => 'date_select', '#title' => t('Date that registrations will close for this event'), - '#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), + '#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), '#date_format' => 'd/m/Y H:i', '#date_label_position' => 'within', '#date_year_range' => '0:+5' diff --git a/booking.helper.inc b/booking.helper.inc index 8033c79..2276831 100644 --- a/booking.helper.inc +++ b/booking.helper.inc @@ -596,7 +596,7 @@ function _booking_room_capacity_check($room_id, $room_bedtype, $room_definition_ * @param $nid - the node id for the person * @return nothing */ -function _booking_rooms_cleanup($nid) +function _booking_person_rooms_cleanup($nid) { global $event; diff --git a/booking.manual_payment.inc b/booking.manual_payment.inc index 87197d9..ffe972b 100644 --- a/booking.manual_payment.inc +++ b/booking.manual_payment.inc @@ -20,7 +20,7 @@ function booking_manual_payment_admin($nid) "and booking_price_active=1", array(':eid' => $event->eid,)); - //_booking_person_studygroups_cleanup payment option + //empty payment option $payment_type_options[0] = ''; foreach($result as $row) diff --git a/booking.paypal.inc b/booking.paypal.inc index 83349be..9742688 100644 --- a/booking.paypal.inc +++ b/booking.paypal.inc @@ -68,7 +68,7 @@ function booking_paypal_ipn() { return; } */ - if (_booking_person_studygroups_cleanup($ipn['payment_status']) || ($ipn['payment_status'] != 'Completed' && variable_get('booking_paypal_sandbox', 0) == 0)) + if (empty($ipn['payment_status']) || ($ipn['payment_status'] != 'Completed' && variable_get('booking_paypal_sandbox', 0) == 0)) return; //if (strcasecmp($ipn['receiver_email'], variable_get('booking_paypal_account', '') <> 0)) diff --git a/booking.prices.inc b/booking.prices.inc index 8600b44..5ad58dc 100644 --- a/booking.prices.inc +++ b/booking.prices.inc @@ -141,7 +141,7 @@ function booking_price_form($node, &$form_state, $create, $editid = 0) '#size' => 60, '#maxlength' => 150, '#required' => TRUE, - '#default_value' => !_booking_person_studygroups_cleanup($data->booking_price_descrip) ? $data->booking_price_descrip : '', + '#default_value' => !empty($data->booking_price_descrip) ? $data->booking_price_descrip : '', ); $form['booking_price'] = array ( '#type' => 'textfield', @@ -150,7 +150,7 @@ function booking_price_form($node, &$form_state, $create, $editid = 0) '#size' => 5, '#maxlength' => 10, '#required' => TRUE, - '#default_value' => !_booking_person_studygroups_cleanup($data->booking_price) ? $data->booking_price : '', + '#default_value' => !empty($data->booking_price) ? $data->booking_price : '', ); $form['booking_late_price'] = array ( '#type' => 'textfield', @@ -159,33 +159,33 @@ function booking_price_form($node, &$form_state, $create, $editid = 0) '#size' => 5, '#maxlength' => 10, '#required' => TRUE, - '#default_value' => !_booking_person_studygroups_cleanup($data->booking_late_price) ? $data->booking_late_price : '', + '#default_value' => !empty($data->booking_late_price) ? $data->booking_late_price : '', ); $form['booking_buttonid'] = array ( '#type' => 'textfield', '#title' => t('The PayPal button ID. This setting is deprecated.'), '#size' => 20, '#maxlength' => 20, - '#default_value' => !_booking_person_studygroups_cleanup($data->booking_buttonid) ? $data->booking_buttonid : '', + '#default_value' => !empty($data->booking_buttonid) ? $data->booking_buttonid : '', ); $form['booking_late_buttonid'] = array ( '#type' => 'textfield', '#title' => t('The PayPal button ID for late bookings. This setting is deprecated.'), '#size' => 20, '#maxlength' => 20, - '#default_value' => !_booking_person_studygroups_cleanup($data->booking_late_buttonid) ? $data->booking_late_buttonid : '', + '#default_value' => !empty($data->booking_late_buttonid) ? $data->booking_late_buttonid : '', ); $form['booking_price_active'] = array( '#type' => 'checkbox', '#title' => t('Tick to make this price active for the current event.'), - '#default_value' => !_booking_person_studygroups_cleanup($data->booking_price_active) ? $data->booking_price_active : '', + '#default_value' => !empty($data->booking_price_active) ? $data->booking_price_active : '', ); $form['booking_depositonly'] = array( '#type' => 'checkbox', '#title' => t('Tick to indicate that this is a deposit only price.'), - '#default_value' => !_booking_person_studygroups_cleanup($data->booking_depositonly) ? $data->booking_depositonly : 0, + '#default_value' => !empty($data->booking_depositonly) ? $data->booking_depositonly : 0, ); if ($create == true) diff --git a/booking.register.inc b/booking.register.inc index b5dca6c..416ed36 100644 --- a/booking.register.inc +++ b/booking.register.inc @@ -11,7 +11,7 @@ function booking_register_page() { $return_array = array(); //set the page title - $bookingTitle = !_booking_person_studygroups_cleanup($event->booking_eventname) ? $event->booking_eventname : 'Event'; + $bookingTitle = !empty($event->booking_eventname) ? $event->booking_eventname : 'Event'; drupal_set_title($bookingTitle . ' Booking Form'); //figure out if we're allowed to accept bookings @@ -58,7 +58,7 @@ function booking_form($node, &$form_state, $inserting = FALSE) { $partner_options = array(); date_default_timezone_set(TIMEZONE); - if (!_booking_person_studygroups_cleanup($node)) + if (!empty($node)) { $data = $node; //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'), '#maxlength' => 45, '#required' => TRUE, - '#default_value' => !_booking_person_studygroups_cleanup($data->booking_firstname) ? $data->booking_firstname : '' + '#default_value' => !empty($data->booking_firstname) ? $data->booking_firstname : '' ); $form['your-details']['booking_lastname'] = array( '#type' => 'textfield', '#title' => t('Last Name'), '#maxlength' => 45, '#required' => TRUE, - '#default_value' => !_booking_person_studygroups_cleanup($data->booking_lastname) ? $data->booking_lastname : '' + '#default_value' => !empty($data->booking_lastname) ? $data->booking_lastname : '' ); $form['your-details']['booking_gender'] = array( '#type' => 'select', '#title' => t('Gender'), '#required' => TRUE, - '#default_value' => variable_get('booking_gender', _booking_person_studygroups_cleanup($data->booking_gender) ? variable_get('booking_default_gender') : $data->booking_gender), + '#default_value' => variable_get('booking_gender', empty($data->booking_gender) ? variable_get('booking_default_gender') : $data->booking_gender), '#options' => _booking_gender_options(), ); @@ -134,7 +134,7 @@ function booking_form($node, &$form_state, $inserting = FALSE) { $form['your-details']['booking_dob'] = array( '#type' => 'date_select', '#title' => t('Date of Birth'), - '#default_value' => _booking_person_studygroups_cleanup($data->booking_dob) ? '' : date("Y-m-d H:i:s", $data->booking_dob), + '#default_value' => empty($data->booking_dob) ? '' : date("Y-m-d H:i:s", $data->booking_dob), '#required' => TRUE, '#date_format' => 'd/m/Y', '#date_label_position' => 'within', @@ -154,21 +154,21 @@ function booking_form($node, &$form_state, $inserting = FALSE) { '#type' => 'select', '#title' => t('Registration Status'), '#options' => _booking_status_generate(), - '#default_value' => !_booking_person_studygroups_cleanup($data->booking_status) ? $data->booking_status : '', + '#default_value' => !empty($data->booking_status) ? $data->booking_status : '', ); $form['your-details']['booking_welfare_required'] = array( '#type' => 'checkbox', '#title' => t('Welfare Required?'), '#description' => t('Select to mark this attendee as requiring special financial consideration'), - '#default_value' => (!_booking_person_studygroups_cleanup($data->booking_welfare_required) && $data->booking_welfare_required == 'Y') ? 1 : 0 + '#default_value' => (!empty($data->booking_welfare_required) && $data->booking_welfare_required == 'Y') ? 1 : 0 ); $form['your-details']['booking_committee_member'] = array( '#type' => 'checkbox', '#title' => t('Committee Member?'), '#description' => t('Select to identify this attendee as being on the committee'), - '#default_value' => (!_booking_person_studygroups_cleanup($data->booking_committee_member) && $data->booking_committee_member == 'Y') ? 1 : 0 + '#default_value' => (!empty($data->booking_committee_member) && $data->booking_committee_member == 'Y') ? 1 : 0 ); $form['your-details']['booking_amount_paid'] = array( @@ -176,7 +176,7 @@ function booking_form($node, &$form_state, $inserting = FALSE) { '#title' => t('Amount Paid'), '#maxlength' => 10, '#required' => FALSE, - '#default_value' => !_booking_person_studygroups_cleanup($data->booking_amount_paid) ? $data->booking_amount_paid : '' + '#default_value' => !empty($data->booking_amount_paid) ? $data->booking_amount_paid : '' ); $form['your-details']['booking_total_pay_reqd'] = array( @@ -184,21 +184,21 @@ function booking_form($node, &$form_state, $inserting = FALSE) { '#title' => t('Total Amount Due'), '#maxlength' => 10, '#required' => FALSE, - '#default_value' => !_booking_person_studygroups_cleanup($data->booking_total_pay_reqd) ? $data->booking_total_pay_reqd : '0.00' + '#default_value' => !empty($data->booking_total_pay_reqd) ? $data->booking_total_pay_reqd : '0.00' ); //refund info $form['your-details']['booking_refund_processed'] = array( '#type' => 'checkbox', '#title' => t('Refund Processed?'), '#description' => t('Select to mark the processing of any applicable refund as complete'), - '#default_value' => (!_booking_person_studygroups_cleanup($data->booking_refund_processed) && $data->booking_refund_processed == 'Y') ? 1 : 0 + '#default_value' => (!empty($data->booking_refund_processed) && $data->booking_refund_processed == 'Y') ? 1 : 0 ); $form['your-details']['booking_refund_due'] = array( '#type' => 'textfield', '#title' => t('Refund Amount Due'), '#maxlength' => 10, '#required' => FALSE, - '#default_value' => !_booking_person_studygroups_cleanup($data->booking_refund_due) ? $data->booking_refund_due : '0.00' + '#default_value' => !empty($data->booking_refund_due) ? $data->booking_refund_due : '0.00' ); } //end inserting check for booking status @@ -210,7 +210,7 @@ function booking_form($node, &$form_state, $inserting = FALSE) { '#type' => 'select', '#title' => t(variable_get('booking_tshirts_text_definition', 'Preferred hoodie size')), '#required' => FALSE, - '#default_value' => variable_get('booking_shirt_size', _booking_person_studygroups_cleanup($data->booking_shirt_size) ? '' : $data->booking_shirt_size), + '#default_value' => variable_get('booking_shirt_size', empty($data->booking_shirt_size) ? '' : $data->booking_shirt_size), '#options' => _get_tshirt_options(), ); } //end enable tshirts check @@ -220,12 +220,12 @@ function booking_form($node, &$form_state, $inserting = FALSE) { '#title' => t('Ecclesia'), '#maxlength' => 100, '#required' => FALSE, - '#default_value' => !_booking_person_studygroups_cleanup($data->booking_ecclesia) ? $data->booking_ecclesia : '' + '#default_value' => !empty($data->booking_ecclesia) ? $data->booking_ecclesia : '' ); $form['your-details']['booking_baptised'] = array( '#type' => 'checkbox', '#title' => t('I am baptised'), - '#default_value' => (!_booking_person_studygroups_cleanup($data->booking_baptised) && $data->booking_baptised == 'Y') ? 1 : 0 + '#default_value' => (!empty($data->booking_baptised) && $data->booking_baptised == 'Y') ? 1 : 0 ); 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( '#type' => 'checkbox', '#title' => t('I am married'), - '#default_value' => (!_booking_person_studygroups_cleanup($data->booking_married) && $data->booking_married == 'Y') ? 1 : 0 + '#default_value' => (!empty($data->booking_married) && $data->booking_married == 'Y') ? 1 : 0 ); $form['your-details']['booking_partner_name'] = array( '#type' => 'textfield', @@ -247,7 +247,7 @@ function booking_form($node, &$form_state, $inserting = FALSE) { ':input[name="booking_married"]' => array('checked' => TRUE), ), ), - '#default_value' => !_booking_person_studygroups_cleanup($data->booking_partner_name) ? $data->booking_partner_name : '' + '#default_value' => !empty($data->booking_partner_name) ? $data->booking_partner_name : '' ); if ($inserting == TRUE) @@ -265,12 +265,12 @@ function booking_form($node, &$form_state, $inserting = FALSE) { ':input[name="booking_married"]' => array('checked' => TRUE), ), ), - '#default_value' => !_booking_person_studygroups_cleanup($data->booking_partner_name) ? $data->booking_partner_name : '' + '#default_value' => !empty($data->booking_partner_name) ? $data->booking_partner_name : '' ); } else //not inserting so allow administrator to choose a person { - //add the _booking_person_studygroups_cleanup element first + //add the empty element first $partner_options[] = ''; //get a list of possible partners @@ -296,7 +296,7 @@ function booking_form($node, &$form_state, $inserting = FALSE) { '#maxlength' => 15, '#size' => 4, '#required' => FALSE, - '#default_value' => !_booking_person_studygroups_cleanup($data->booking_bf_gf_nid) ? $data->booking_bf_gf_nid : '', + '#default_value' => !empty($data->booking_bf_gf_nid) ? $data->booking_bf_gf_nid : '', ); } } //end allow couples check @@ -312,7 +312,7 @@ function booking_form($node, &$form_state, $inserting = FALSE) { ( '#type' => 'checkbox', '#title' => t('Regularly Attend CYC '), - '#default_value' => _booking_person_studygroups_cleanup($data->booking_agreement) ? 0 : $data->booking_agreement, + '#default_value' => empty($data->booking_agreement) ? 0 : $data->booking_agreement, '#title' => t('I regularly attend CYC events/activities'), ); */ @@ -320,7 +320,7 @@ function booking_form($node, &$form_state, $inserting = FALSE) { ( '#type' => 'checkbox', '#title' => t('Aims and Expectations'), - '#default_value' => _booking_person_studygroups_cleanup($data->booking_agreement) ? 0 : $data->booking_agreement, + '#default_value' => empty($data->booking_agreement) ? 0 : $data->booking_agreement, /* '#states' => array( // Only show this field when the checkbox is unchecked. @@ -347,7 +347,7 @@ function booking_form($node, &$form_state, $inserting = FALSE) { '#maxlength' => 30, '#size' => 30, '#required' => FALSE, - '#default_value' => !_booking_person_studygroups_cleanup($data->booking_barcode) ? $data->booking_barcode : '' + '#default_value' => !empty($data->booking_barcode) ? $data->booking_barcode : '' ); $form['your-details']['booking_luckynum'] = array( @@ -356,14 +356,14 @@ function booking_form($node, &$form_state, $inserting = FALSE) { '#maxlength' => 30, '#size' => 30, '#required' => FALSE, - '#default_value' => !_booking_person_studygroups_cleanup($data->booking_luckynum) ? $data->booking_luckynum : '' + '#default_value' => !empty($data->booking_luckynum) ? $data->booking_luckynum : '' ); $form['your-details']['booking_readinggroup'] = array( '#type' => 'textfield', '#title' => t('Reading Group Allocation'), '#maxlength' => 100, - '#default_value' => !_booking_person_studygroups_cleanup($data->booking_readinggroup) ? $data->booking_readinggroup : '', + '#default_value' => !empty($data->booking_readinggroup) ? $data->booking_readinggroup : '', ); } //end not-inserting check @@ -378,26 +378,26 @@ function booking_form($node, &$form_state, $inserting = FALSE) { '#title' => t('Passport Number'), '#maxlength' => 45, '#required' => FALSE, - '#default_value' => !_booking_person_studygroups_cleanup($data->booking_passport_num) ? $data->booking_passport_num : '' + '#default_value' => !empty($data->booking_passport_num) ? $data->booking_passport_num : '' ); $form['passport-details']['booking_passport_issue_location'] = array( '#type' => 'textfield', '#title' => t('City of Issue (eg Sydney)'), '#maxlength' => 120, '#required' => FALSE, - '#default_value' => !_booking_person_studygroups_cleanup($data->booking_passport_issue_location) ? $data->booking_passport_issue_location : '' + '#default_value' => !empty($data->booking_passport_issue_location) ? $data->booking_passport_issue_location : '' ); $form['passport-details']['booking_passport_issue_name'] = array( '#type' => 'textfield', '#title' => t('Exact name as listed on passport'), '#maxlength' => 120, '#required' => FALSE, - '#default_value' => !_booking_person_studygroups_cleanup($data->booking_passport_issue_name) ? $data->booking_passport_issue_name : '' + '#default_value' => !empty($data->booking_passport_issue_name) ? $data->booking_passport_issue_name : '' ); $form['passport-details']['booking_passport_expiry_date'] = array( '#type' => 'date_select', '#title' => t('Passport expiry date'), - '#default_value' => _booking_person_studygroups_cleanup($data->booking_passport_expiry_date) ? '' : date("Y-m-d H:i:s", $data->booking_passport_expiry_date), + '#default_value' => empty($data->booking_passport_expiry_date) ? '' : date("Y-m-d H:i:s", $data->booking_passport_expiry_date), '#required' => FALSE, '#date_format' => 'd/m/Y', //'#date_label_position' => 'within', @@ -408,7 +408,7 @@ function booking_form($node, &$form_state, $inserting = FALSE) { '#title' => t('Travel insurance policy details'), '#maxlength' => 120, '#required' => FALSE, - '#default_value' => !_booking_person_studygroups_cleanup($data->booking_travel_insurance) ? $data->booking_travel_insurance : '' + '#default_value' => !empty($data->booking_travel_insurance) ? $data->booking_travel_insurance : '' ); if ($inserting == FALSE) { @@ -417,7 +417,7 @@ function booking_form($node, &$form_state, $inserting = FALSE) { '#title' => t('Which country is this person going to?'), '#maxlength' => 120, '#required' => FALSE, - '#default_value' => !_booking_person_studygroups_cleanup($data->booking_destination_country) ? $data->booking_destination_country : '', + '#default_value' => !empty($data->booking_destination_country) ? $data->booking_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)'), '#maxlength' => 120, '#required' => FALSE, - '#default_value' => !_booking_person_studygroups_cleanup($data->booking_outflight_bookingnum) ? $data->booking_outflight_bookingnum : '', + '#default_value' => !empty($data->booking_outflight_bookingnum) ? $data->booking_outflight_bookingnum : '', ); $form['outbound-flight-details']['booking_outflight_flightnum'] = array( '#type' => 'textfield', '#title' => t('Internal Flight Number (departing conference week)'), '#maxlength' => 120, '#required' => FALSE, - '#default_value' => !_booking_person_studygroups_cleanup($data->booking_outflight_flightnum) ? $data->booking_outflight_flightnum : '', + '#default_value' => !empty($data->booking_outflight_flightnum) ? $data->booking_outflight_flightnum : '', ); $form['outbound-flight-details']['booking_outflight_origin'] = array( '#type' => 'textfield', '#title' => t('Internal Flight Origin to Destination (departing conference week)'), '#maxlength' => 120, '#required' => FALSE, - '#default_value' => !_booking_person_studygroups_cleanup($data->booking_outflight_origin) ? $data->booking_outflight_origin : '', + '#default_value' => !empty($data->booking_outflight_origin) ? $data->booking_outflight_origin : '', ); $form['outbound-flight-details']['booking_outflight_origin_ts'] = array( '#type' => 'date_select', '#title' => t('Internal flight departure time (local timezone)'), '#description' => t('Note: 24 hour time - 12:00 is midday'), - '#default_value' => _booking_person_studygroups_cleanup($data->booking_outflight_origin_ts) ? '' : date("Y-m-d H:i:s", $data->booking_outflight_origin_ts), + '#default_value' => empty($data->booking_outflight_origin_ts) ? '' : date("Y-m-d H:i:s", $data->booking_outflight_origin_ts), '#date_format' => 'd/m/Y H:i', '#date_year_range' => '0:+1', ); @@ -459,20 +459,20 @@ function booking_form($node, &$form_state, $inserting = FALSE) { '#title' => t('Connecting Flight Number (if applicable)'), '#maxlength' => 120, '#required' => FALSE, - '#default_value' => !_booking_person_studygroups_cleanup($data->booking_outflight_connecting_flightnum) ? $data->booking_outflight_connecting_flightnum : '', + '#default_value' => !empty($data->booking_outflight_connecting_flightnum) ? $data->booking_outflight_connecting_flightnum : '', ); $form['outbound-flight-details']['booking_outflight_destination'] = array( '#type' => 'textfield', '#title' => t('Connecting Flight Origin to Destination'), '#maxlength' => 120, '#required' => FALSE, - '#default_value' => !_booking_person_studygroups_cleanup($data->booking_outflight_destination) ? $data->booking_outflight_destination : '', + '#default_value' => !empty($data->booking_outflight_destination) ? $data->booking_outflight_destination : '', ); $form['outbound-flight-details']['booking_outflight_destination_ts'] = array( '#type' => 'date_select', '#title' => t('Internal flight arrival time (local timezone)'), '#description' => t('Note: 24 hour time - 12:00 is midday'), - '#default_value' => _booking_person_studygroups_cleanup($data->booking_outflight_destination_ts) ? '' : date("Y-m-d H:i:s", $data->booking_outflight_destination_ts), + '#default_value' => empty($data->booking_outflight_destination_ts) ? '' : date("Y-m-d H:i:s", $data->booking_outflight_destination_ts), '#date_format' => 'd/m/Y H:i', '#date_year_range' => '0:+1', ); @@ -487,27 +487,27 @@ function booking_form($node, &$form_state, $inserting = FALSE) { '#title' => t('Internal Flight Booking Reference (returning to conference)'), '#maxlength' => 120, '#required' => FALSE, - '#default_value' => !_booking_person_studygroups_cleanup($data->booking_rtrnflight_bookingnum) ? $data->booking_rtrnflight_bookingnum : '', + '#default_value' => !empty($data->booking_rtrnflight_bookingnum) ? $data->booking_rtrnflight_bookingnum : '', ); $form['inbound-flight-details']['booking_rtrnflight_flightnum'] = array( '#type' => 'textfield', '#title' => t('Internal Flight Number (returning to conference)'), '#maxlength' => 120, '#required' => FALSE, - '#default_value' => !_booking_person_studygroups_cleanup($data->booking_rtrnflight_flightnum) ? $data->booking_rtrnflight_flightnum : '', + '#default_value' => !empty($data->booking_rtrnflight_flightnum) ? $data->booking_rtrnflight_flightnum : '', ); $form['inbound-flight-details']['booking_rtrnflight_origin'] = array( '#type' => 'textfield', '#title' => t('Internal Flight Origin to Destination (returning to conference)'), '#maxlength' => 120, '#required' => FALSE, - '#default_value' => !_booking_person_studygroups_cleanup($data->booking_rtrnflight_origin) ? $data->booking_rtrnflight_origin : '', + '#default_value' => !empty($data->booking_rtrnflight_origin) ? $data->booking_rtrnflight_origin : '', ); $form['inbound-flight-details']['booking_rtrnflight_origin_ts'] = array( '#type' => 'date_select', '#title' => t('Internal flight departure time (local timezone)'), '#description' => t('Note: 24 hour time - 12:00 is midday'), - '#default_value' => _booking_person_studygroups_cleanup($data->booking_rtrnflight_origin_ts) ? '' : date("Y-m-d H:i:s", $data->booking_rtrnflight_origin_ts), + '#default_value' => empty($data->booking_rtrnflight_origin_ts) ? '' : date("Y-m-d H:i:s", $data->booking_rtrnflight_origin_ts), '#date_format' => 'd/m/Y H:i', '#date_year_range' => '0:+1', ); @@ -516,20 +516,20 @@ function booking_form($node, &$form_state, $inserting = FALSE) { '#title' => t('Connecting Flight Number (if applicable)'), '#maxlength' => 120, '#required' => FALSE, - '#default_value' => !_booking_person_studygroups_cleanup($data->booking_rtrnflight_connecting_flightnum) ? $data->booking_rtrnflight_connecting_flightnum : '', + '#default_value' => !empty($data->booking_rtrnflight_connecting_flightnum) ? $data->booking_rtrnflight_connecting_flightnum : '', ); $form['inbound-flight-details']['booking_rtrnflight_destination'] = array( '#type' => 'textfield', '#title' => t('Connecting Flight Origin to Destination'), '#maxlength' => 120, '#required' => FALSE, - '#default_value' => !_booking_person_studygroups_cleanup($data->booking_rtrnflight_destination) ? $data->booking_rtrnflight_destination : '', + '#default_value' => !empty($data->booking_rtrnflight_destination) ? $data->booking_rtrnflight_destination : '', ); $form['inbound-flight-details']['booking_rtrnflight_destination_ts'] = array( '#type' => 'date_select', '#title' => t('Internal flight arrival time (local timezone)'), '#description' => t('Note: 24 hour time - 12:00 is midday'), - '#default_value' => _booking_person_studygroups_cleanup($data->booking_rtrnflight_destination_ts) ? '' : date("Y-m-d H:i:s", $data->booking_rtrnflight_destination_ts), + '#default_value' => empty($data->booking_rtrnflight_destination_ts) ? '' : date("Y-m-d H:i:s", $data->booking_rtrnflight_destination_ts), '#date_format' => 'd/m/Y H:i', '#date_year_range' => '0:+1', ); @@ -545,7 +545,7 @@ function booking_form($node, &$form_state, $inserting = FALSE) { '#title' => t('E-mail address'), '#maxlength' => 100, '#required' => TRUE, - '#default_value' => !_booking_person_studygroups_cleanup($data->booking_email) ? $data->booking_email : '' + '#default_value' => !empty($data->booking_email) ? $data->booking_email : '' ); $form['contact-details']['booking_phone'] = array( @@ -554,7 +554,7 @@ function booking_form($node, &$form_state, $inserting = FALSE) { '#maxlength' => 30, '#size' => 35, '#required' => FALSE, - '#default_value' => !_booking_person_studygroups_cleanup($data->booking_phone) ? $data->booking_phone : '' + '#default_value' => !empty($data->booking_phone) ? $data->booking_phone : '' ); $form['contact-details']['booking_mobile'] = array( '#type' => 'textfield', @@ -562,7 +562,7 @@ function booking_form($node, &$form_state, $inserting = FALSE) { '#size' => 35, '#maxlength' => 30, '#required' => FALSE, - '#default_value' => !_booking_person_studygroups_cleanup($data->booking_mobile) ? $data->booking_mobile : '' + '#default_value' => !empty($data->booking_mobile) ? $data->booking_mobile : '' ); $form['contact-details']['booking_street'] = array( @@ -570,14 +570,14 @@ function booking_form($node, &$form_state, $inserting = FALSE) { '#title' => t('Street Address'), '#maxlength' => 50, '#required' => TRUE, - '#default_value' => !_booking_person_studygroups_cleanup($data->booking_street) ? $data->booking_street : '' + '#default_value' => !empty($data->booking_street) ? $data->booking_street : '' ); $form['contact-details']['booking_suburb'] = array( '#type' => 'textfield', '#title' => t('Suburb'), '#maxlength' => 50, '#required' => TRUE, - '#default_value' => !_booking_person_studygroups_cleanup($data->booking_suburb) ? $data->booking_suburb : '' + '#default_value' => !empty($data->booking_suburb) ? $data->booking_suburb : '' ); @@ -587,7 +587,7 @@ function booking_form($node, &$form_state, $inserting = FALSE) { '#type' => 'select', '#title' => t('State'), '#required' => TRUE, - '#default_value' => !_booking_person_studygroups_cleanup($data->booking_state) ? $data->booking_state : BOOKING_DEFAULT_STATE, + '#default_value' => !empty($data->booking_state) ? $data->booking_state : BOOKING_DEFAULT_STATE, '#options' => _booking_state_options(), ); $form['contact-details']['booking_other_state'] = array( @@ -608,7 +608,7 @@ function booking_form($node, &$form_state, $inserting = FALSE) { '#type' => 'textfield', '#title' => t('State'), '#maxlength' => 50, - '#default_value' => !_booking_person_studygroups_cleanup($data->booking_state) ? $data->booking_state : '', + '#default_value' => !empty($data->booking_state) ? $data->booking_state : '', ); } @@ -619,13 +619,13 @@ function booking_form($node, &$form_state, $inserting = FALSE) { '#maxlength' => 8, '#size' => 10, '#required' => TRUE, - '#default_value' => !_booking_person_studygroups_cleanup($data->booking_postcode) ? $data->booking_postcode : '' + '#default_value' => !empty($data->booking_postcode) ? $data->booking_postcode : '' ); $form['contact-details']['booking_country'] = array( '#type' => 'select', '#title' => t('Country'), '#required' => TRUE, - '#default_value' => variable_get('booking_country', _booking_person_studygroups_cleanup($data->booking_country) ? variable_get('booking_default_country') : $data->booking_country), + '#default_value' => variable_get('booking_country', empty($data->booking_country) ? variable_get('booking_default_country') : $data->booking_country), '#options' => _booking_country_options(), ); @@ -640,13 +640,13 @@ function booking_form($node, &$form_state, $inserting = FALSE) { '#title' => t('Parent/Guardian Name'), '#maxlength' => 100, '#required' => TRUE, - '#default_value' => _booking_person_studygroups_cleanup($data->booking_guardian_name) ? '' : $data->booking_guardian_name + '#default_value' => empty($data->booking_guardian_name) ? '' : $data->booking_guardian_name ); $form['emergency']['booking_guardian_type'] = array( '#type' => 'radios', '#title' => t('Relation to you'), '#options' => $emergency_contact_type_options, - '#default_value' => _booking_person_studygroups_cleanup($data->booking_guardian_type) ? 'parent' : $data->booking_guardian_type, + '#default_value' => empty($data->booking_guardian_type) ? 'parent' : $data->booking_guardian_type, '#required' => TRUE ); $form['emergency']['booking_guardian_phone'] = array( @@ -655,7 +655,7 @@ function booking_form($node, &$form_state, $inserting = FALSE) { '#maxlength' => 30, '#size' => 30, '#required' => TRUE, - '#default_value' => _booking_person_studygroups_cleanup($data->booking_guardian_phone) ? '' : $data->booking_guardian_phone + '#default_value' => empty($data->booking_guardian_phone) ? '' : $data->booking_guardian_phone ); $form['emergency']['booking_guardian_phone_alt'] = array( '#type' => 'textfield', @@ -663,7 +663,7 @@ function booking_form($node, &$form_state, $inserting = FALSE) { '#maxlength' => 30, '#size' => 30, '#required' => FALSE, - '#default_value' => _booking_person_studygroups_cleanup($data->booking_guardian_phone_alt) ? '' : $data->booking_guardian_phone_alt + '#default_value' => empty($data->booking_guardian_phone_alt) ? '' : $data->booking_guardian_phone_alt ); if (variable_get('booking_enable_medicare', 1) == 1) @@ -674,7 +674,7 @@ function booking_form($node, &$form_state, $inserting = FALSE) { '#maxlength' => 15, '#size' => 15, '#required' => FALSE, - '#default_value' => _booking_person_studygroups_cleanup($data->booking_medicare) ? '' : $data->booking_medicare + '#default_value' => empty($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)'), '#maxlength' => 200, '#required' => FALSE, - '#default_value' => !_booking_person_studygroups_cleanup($data->booking_help_music) ? $data->booking_help_music : '' + '#default_value' => !empty($data->booking_help_music) ? $data->booking_help_music : '' ); $form['help-areas']['booking_help_reading'] = array( '#type' => 'checkbox', '#title' => t('I can help with reading'), - '#default_value' => (!_booking_person_studygroups_cleanup($data->booking_help_reading) && $data->booking_help_reading == 'Y') ? 1 : 0 + '#default_value' => (!empty($data->booking_help_reading) && $data->booking_help_reading == 'Y') ? 1 : 0 ); $form['help-areas']['booking_help_chairing'] = array( '#type' => 'checkbox', '#title' => t('I can help with chairing'), - '#default_value' => (!_booking_person_studygroups_cleanup($data->booking_help_chairing) && $data->booking_help_chairing == 'Y') ? 1 : 0 + '#default_value' => (!empty($data->booking_help_chairing) && $data->booking_help_chairing == 'Y') ? 1 : 0 ); $form['help-areas']['booking_help_praying'] = array( '#type' => 'checkbox', '#title' => t('I can help with praying'), - '#default_value' => (!_booking_person_studygroups_cleanup($data->booking_help_praying) && $data->booking_help_praying == 'Y') ? 1 : 0 + '#default_value' => (!empty($data->booking_help_praying) && $data->booking_help_praying == 'Y') ? 1 : 0 ); $form['help-areas']['booking_help_meditations'] = array( '#type' => 'checkbox', '#title' => t('I can help with evening meditations'), - '#default_value' => (!_booking_person_studygroups_cleanup($data->booking_help_meditations) && $data->booking_help_meditations == 'Y') ? 1 : 0 + '#default_value' => (!empty($data->booking_help_meditations) && $data->booking_help_meditations == 'Y') ? 1 : 0 ); $form['help-areas']['booking_firstaid'] = array( '#type' => 'checkbox', '#title' => t('I am a qualified First Aid Officer'), - '#default_value' => (!_booking_person_studygroups_cleanup($data->booking_firstaid) && $data->booking_firstaid == 'Y') ? 1 : 0 + '#default_value' => (!empty($data->booking_firstaid) && $data->booking_firstaid == 'Y') ? 1 : 0 ); $form['help-areas']['booking_nurse'] = array( '#type' => 'checkbox', '#title' => t('I am a qualified Nurse'), - '#default_value' => (!_booking_person_studygroups_cleanup($data->booking_nurse) && $data->booking_nurse == 'Y') ? 1 : 0 + '#default_value' => (!empty($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( '#type' => 'checkbox', '#title' => t('I have previous mission work experience'), - '#default_value' => (!_booking_person_studygroups_cleanup($data->booking_has_mission_experience) && $data->booking_has_mission_experience == 'Y') ? 1 : 0 + '#default_value' => (!empty($data->booking_has_mission_experience) && $data->booking_has_mission_experience == 'Y') ? 1 : 0 ); $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), ), ), - '#default_value' => !_booking_person_studygroups_cleanup($data->booking_mission_experience_details) ? $data->booking_mission_experience_details : '' + '#default_value' => !empty($data->booking_mission_experience_details) ? $data->booking_mission_experience_details : '' ); $form['skill-areas'] = array( '#type' => 'fieldset', @@ -757,22 +757,22 @@ function booking_form($node, &$form_state, $inserting = FALSE) { $form['skill-areas']['booking_skills_builder'] = array( '#type' => 'checkbox', '#title' => t('I am an experienced builder'), - '#default_value' => (!_booking_person_studygroups_cleanup($data->booking_skills_builder) && $data->booking_skills_builder == 'Y') ? 1 : 0 + '#default_value' => (!empty($data->booking_skills_builder) && $data->booking_skills_builder == 'Y') ? 1 : 0 ); $form['skill-areas']['booking_skills_cooking'] = array( '#type' => 'checkbox', '#title' => t('I can assist with cooking'), - '#default_value' => (!_booking_person_studygroups_cleanup($data->booking_skills_cooking) && $data->booking_skills_cooking == 'Y') ? 1 : 0 + '#default_value' => (!empty($data->booking_skills_cooking) && $data->booking_skills_cooking == 'Y') ? 1 : 0 ); $form['skill-areas']['booking_skills_childminding'] = array( '#type' => 'checkbox', '#title' => t('I have child minding experience or am happy to work with children and sunday school students'), - '#default_value' => (!_booking_person_studygroups_cleanup($data->booking_skills_childminding) && $data->booking_skills_childminding == 'Y') ? 1 : 0 + '#default_value' => (!empty($data->booking_skills_childminding) && $data->booking_skills_childminding == 'Y') ? 1 : 0 ); $form['skill-areas']['booking_skills_language'] = array( '#type' => 'checkbox', '#title' => t('I can speak multiple languages'), - '#default_value' => (!_booking_person_studygroups_cleanup($data->booking_skills_language) && $data->booking_skills_language == 'Y') ? 1 : 0 + '#default_value' => (!empty($data->booking_skills_language) && $data->booking_skills_language == 'Y') ? 1 : 0 ); $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), ), ), - '#default_value' => !_booking_person_studygroups_cleanup($data->booking_skills_language_details) ? $data->booking_skills_language_details : '' + '#default_value' => !empty($data->booking_skills_language_details) ? $data->booking_skills_language_details : '' ); $form['skill-areas']['booking_skills_other'] = array( '#type' => 'checkbox', '#title' => t('I have other skills that can assist in preaching activities'), - '#default_value' => (!_booking_person_studygroups_cleanup($data->booking_skills_other) && $data->booking_skills_other == 'Y') ? 1 : 0 + '#default_value' => (!empty($data->booking_skills_other) && $data->booking_skills_other == 'Y') ? 1 : 0 ); $form['skill-areas']['booking_skills_other_details'] = array( '#type' => 'textfield', @@ -803,7 +803,7 @@ function booking_form($node, &$form_state, $inserting = FALSE) { ':input[name="booking_skills_other"]' => array('checked' => TRUE), ), ), - '#default_value' => !_booking_person_studygroups_cleanup($data->booking_skills_other_details) ? $data->booking_skills_other_details : '' + '#default_value' => !empty($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( '#type' => 'checkbox', '#title' => t('Special dietary requirements'), - '#default_value' => (!_booking_person_studygroups_cleanup($data->booking_dietary) && $data->booking_dietary == 'Y') ? 1 : 0 + '#default_value' => (!empty($data->booking_dietary) && $data->booking_dietary == 'Y') ? 1 : 0 ); 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), ), ), - '#default_value' => !_booking_person_studygroups_cleanup($data->booking_dietary) ? $data->booking_dietary : '' + '#default_value' => !empty($data->booking_dietary) ? $data->booking_dietary : '' ); } else @@ -853,7 +853,7 @@ function booking_form($node, &$form_state, $inserting = FALSE) { $form['misc-areas']['booking_medical_conditions_check'] = array( '#type' => 'checkbox', '#title' => t('Special medical conditions'), - '#default_value' => (!_booking_person_studygroups_cleanup($data->booking_medical_conditions) && $data->booking_medical_conditions == 'Y') ? 1 : 0 + '#default_value' => (!empty($data->booking_medical_conditions) && $data->booking_medical_conditions == 'Y') ? 1 : 0 ); $form['misc-areas']['booking_medical_conditions'] = array( '#type' => 'textfield', @@ -865,7 +865,7 @@ function booking_form($node, &$form_state, $inserting = FALSE) { ':input[name="booking_medical_conditions_check"]' => array('checked' => TRUE), ), ), - '#default_value' => !_booking_person_studygroups_cleanup($data->booking_medical_conditions) ? $data->booking_medical_conditions : '' + '#default_value' => !empty($data->booking_medical_conditions) ? $data->booking_medical_conditions : '' ); } else { @@ -873,13 +873,13 @@ function booking_form($node, &$form_state, $inserting = FALSE) { '#type' => 'textfield', '#title' => t('Please describe your dietary requirements.'), '#maxlength' => 120, - '#default_value' => !_booking_person_studygroups_cleanup($data->booking_dietary) ? $data->booking_dietary : '' + '#default_value' => !empty($data->booking_dietary) ? $data->booking_dietary : '' ); $form['misc-areas']['booking_medical_conditions'] = array( '#type' => 'textfield', '#title' => t('Please list any medical conditions we need to be aware of.'), '#maxlength' => 120, - '#default_value' => !_booking_person_studygroups_cleanup($data->booking_medical_conditions) ? $data->booking_medical_conditions : '' + '#default_value' => !empty($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'), '#maxlength' => 200, '#required' => FALSE, - '#default_value' => !_booking_person_studygroups_cleanup($data->booking_room_mate1) ? $data->booking_room_mate1 : '', + '#default_value' => !empty($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 //passport details - $node->booking_passport_num = _booking_person_studygroups_cleanup($values['booking_passport_num']) ? '' : $values['booking_passport_num']; - $node->booking_passport_issue_location = _booking_person_studygroups_cleanup($values['booking_passport_issue_location']) ? '' : $values['booking_passport_issue_location']; - $node->booking_passport_issue_name = _booking_person_studygroups_cleanup($values['booking_passport_issue_name']) ? '' : $values['booking_passport_issue_name']; - $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 = _booking_person_studygroups_cleanup($values['booking_destination_country']) ? '' : $values['booking_destination_country']; - $node->booking_travel_insurance = _booking_person_studygroups_cleanup($values['booking_travel_insurance']) ? '' : $values['booking_travel_insurance']; + $node->booking_passport_num = empty($values['booking_passport_num']) ? '' : $values['booking_passport_num']; + $node->booking_passport_issue_location = empty($values['booking_passport_issue_location']) ? '' : $values['booking_passport_issue_location']; + $node->booking_passport_issue_name = empty($values['booking_passport_issue_name']) ? '' : $values['booking_passport_issue_name']; + $node->booking_passport_expiry_date = empty($values['booking_passport_expiry_date']) ? '0' : _datearray_to_ts($values['booking_passport_expiry_date']); + $node->booking_destination_country = empty($values['booking_destination_country']) ? '' : $values['booking_destination_country']; + $node->booking_travel_insurance = empty($values['booking_travel_insurance']) ? '' : $values['booking_travel_insurance']; //flight info, which may not be present - $node->booking_outflight_bookingnum = _booking_person_studygroups_cleanup($values['booking_outflight_bookingnum']) ? '' : $values['booking_outflight_bookingnum']; - $node->booking_outflight_flightnum = _booking_person_studygroups_cleanup($values['booking_outflight_flightnum']) ? '' : $values['booking_outflight_flightnum']; - $node->booking_outflight_origin = _booking_person_studygroups_cleanup($values['booking_outflight_origin']) ? '' : $values['booking_outflight_origin']; - $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 = _booking_person_studygroups_cleanup($values['booking_outflight_connecting_flightnum']) ? '' : $values['booking_outflight_connecting_flightnum']; - $node->booking_outflight_destination = _booking_person_studygroups_cleanup($values['booking_outflight_destination']) ? '' : $values['booking_outflight_destination']; - $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_outflight_bookingnum = empty($values['booking_outflight_bookingnum']) ? '' : $values['booking_outflight_bookingnum']; + $node->booking_outflight_flightnum = empty($values['booking_outflight_flightnum']) ? '' : $values['booking_outflight_flightnum']; + $node->booking_outflight_origin = empty($values['booking_outflight_origin']) ? '' : $values['booking_outflight_origin']; + $node->booking_outflight_origin_ts = empty($values['booking_outflight_origin_ts']) ? '0' : _datetime_array_to_ts($values['booking_outflight_origin_ts']); + $node->booking_outflight_connecting_flightnum = empty($values['booking_outflight_connecting_flightnum']) ? '' : $values['booking_outflight_connecting_flightnum']; + $node->booking_outflight_destination = empty($values['booking_outflight_destination']) ? '' : $values['booking_outflight_destination']; + $node->booking_outflight_destination_ts = empty($values['booking_outflight_destination_ts']) ? '0' : _datetime_array_to_ts($values['booking_outflight_destination_ts']); - $node->booking_rtrnflight_bookingnum = _booking_person_studygroups_cleanup($values['booking_rtrnflight_bookingnum']) ? '' : $values['booking_rtrnflight_bookingnum']; - $node->booking_rtrnflight_flightnum = _booking_person_studygroups_cleanup($values['booking_rtrnflight_flightnum']) ? '' : $values['booking_rtrnflight_flightnum']; - $node->booking_rtrnflight_origin = _booking_person_studygroups_cleanup($values['booking_rtrnflight_origin']) ? '' : $values['booking_rtrnflight_origin']; - $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 = _booking_person_studygroups_cleanup($values['booking_rtrnflight_connecting_flightnum']) ? '' : $values['booking_rtrnflight_connecting_flightnum']; - $node->booking_rtrnflight_destination = _booking_person_studygroups_cleanup($values['booking_rtrnflight_destination']) ? '' : $values['booking_rtrnflight_destination']; - $node->booking_rtrnflight_destination_ts = _booking_person_studygroups_cleanup($values['booking_rtrnflight_destination_ts']) ? '0' : _datetime_array_to_ts($values['booking_rtrnflight_destination_ts']); + $node->booking_rtrnflight_bookingnum = empty($values['booking_rtrnflight_bookingnum']) ? '' : $values['booking_rtrnflight_bookingnum']; + $node->booking_rtrnflight_flightnum = empty($values['booking_rtrnflight_flightnum']) ? '' : $values['booking_rtrnflight_flightnum']; + $node->booking_rtrnflight_origin = empty($values['booking_rtrnflight_origin']) ? '' : $values['booking_rtrnflight_origin']; + $node->booking_rtrnflight_origin_ts = empty($values['booking_rtrnflight_origin_ts']) ? '0' : _datetime_array_to_ts($values['booking_rtrnflight_origin_ts']); + $node->booking_rtrnflight_connecting_flightnum = empty($values['booking_rtrnflight_connecting_flightnum']) ? '' : $values['booking_rtrnflight_connecting_flightnum']; + $node->booking_rtrnflight_destination = empty($values['booking_rtrnflight_destination']) ? '' : $values['booking_rtrnflight_destination']; + $node->booking_rtrnflight_destination_ts = empty($values['booking_rtrnflight_destination_ts']) ? '0' : _datetime_array_to_ts($values['booking_rtrnflight_destination_ts']); //payment details $node->booking_payment_id = $values['booking_payment_id']; @@ -1109,8 +1109,8 @@ function booking_form_submit($form, &$form_state) { $node->booking_baptised = ($values['booking_baptised'] == 1 ? 'Y' : 'N'); $node->booking_married = ($values['booking_married'] == 1 ? 'Y' : 'N'); $node->booking_partner_name = ucwords($values['booking_partner_name']); - $node->booking_partner_id = _booking_person_studygroups_cleanup($values['booking_partner_id']) ? 0 : $values['booking_partner_id']; - $node->booking_bf_gf_nid = _booking_person_studygroups_cleanup($values['booking_bf_gf_nid']) ? 0 : $values['booking_bf_gf_nid']; + $node->booking_partner_id = empty($values['booking_partner_id']) ? 0 : $values['booking_partner_id']; + $node->booking_bf_gf_nid = empty($values['booking_bf_gf_nid']) ? 0 : $values['booking_bf_gf_nid']; //allow for user-entered value if the state is not already listed if ($values['booking_state'] == 'Other') { @@ -1124,46 +1124,46 @@ function booking_form_submit($form, &$form_state) { $node->booking_guardian_type = $values['booking_guardian_type']; $node->booking_guardian_phone = $values['booking_guardian_phone']; $node->booking_guardian_phone_alt = $values['booking_guardian_phone_alt']; - $node->booking_medicare = _booking_person_studygroups_cleanup($values['booking_medicare']) ? 0 : $values['booking_medicare']; + $node->booking_medicare = empty($values['booking_medicare']) ? 0 : $values['booking_medicare']; //fields that may or may not have been present in the initial form - $node->booking_barcode = _booking_person_studygroups_cleanup($values['booking_barcode']) ? '' : $values['booking_barcode']; - $node->booking_luckynum = _booking_person_studygroups_cleanup($values['booking_luckynum']) ? 0 : $values['booking_luckynum']; - $node->booking_welfare_required = _booking_person_studygroups_cleanup($values['booking_welfare_required']) ? 'N' : ($values['booking_welfare_required'] == 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 = _booking_person_studygroups_cleanup($values['booking_refund_processed']) ? 'N' : ($values['booking_refund_processed'] == 1 ? 'Y' : 'N'); - $node->booking_refund_due = _booking_person_studygroups_cleanup($values['booking_refund_due']) ? 0 : $values['booking_refund_due']; - $node->booking_help_music = _booking_person_studygroups_cleanup($values['booking_help_music']) ? '' : $values['booking_help_music']; - $node->booking_help_meditations = _booking_person_studygroups_cleanup($values['booking_help_meditations']) ? '' : $values['booking_help_meditations']; - $node->booking_help_praying = _booking_person_studygroups_cleanup($values['booking_help_praying']) ? '' : $values['booking_help_praying']; - $node->booking_help_reading = _booking_person_studygroups_cleanup($values['booking_help_reading']) ? 'N' : ($values['booking_help_reading'] == 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 = _booking_person_studygroups_cleanup($values['booking_help_readgroup_lead']) ? 'N' : ($values['booking_help_readgroup_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 = _booking_person_studygroups_cleanup($values['booking_firstaid']) ? 'N' : ($values['booking_firstaid'] == 1 ? 'Y' : 'N'); - $node->booking_nurse = _booking_person_studygroups_cleanup($values['booking_nurse']) ? 'N' : ($values['booking_nurse'] == 1 ? 'Y' : 'N'); - $node->booking_lifesaver = _booking_person_studygroups_cleanup($values['booking_lifesaver']) ? 'N' : ($values['booking_lifesaver'] == 1 ? 'Y' : 'N'); - $node->booking_doctor = _booking_person_studygroups_cleanup($values['booking_doctor']) ? 'N' : ($values['booking_doctor'] == 1 ? 'Y' : 'N'); - $node->booking_dietary = _booking_person_studygroups_cleanup($values['booking_dietary']) ? 'N/A' : $values['booking_dietary']; - $node->booking_medical_conditions = _booking_person_studygroups_cleanup($values['booking_medical_conditions']) ? 'N/A' : $values['booking_medical_conditions']; - $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 = _booking_person_studygroups_cleanup($values['booking_has_mission_experience']) ? 'N' : ($values['booking_has_mission_experience'] == 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 = _booking_person_studygroups_cleanup($values['booking_skills_cooking']) ? 'N' : ($values['booking_skills_cooking'] == 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 = _booking_person_studygroups_cleanup($values['booking_skills_language']) ? 'N' : ($values['booking_skills_language'] == 1 ? 'Y' : 'N'); - $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 = _booking_person_studygroups_cleanup($values['booking_skills_other']) ? 'N' : ($values['booking_skills_other'] == 1 ? 'Y' : 'N'); - $node->booking_skills_other_details = _booking_person_studygroups_cleanup($values['booking_skills_other_details']) ? 'N/A' : $values['booking_skills_other_details']; + $node->booking_barcode = empty($values['booking_barcode']) ? '' : $values['booking_barcode']; + $node->booking_luckynum = empty($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_committee_member = empty($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_due = empty($values['booking_refund_due']) ? 0 : $values['booking_refund_due']; + $node->booking_help_music = empty($values['booking_help_music']) ? '' : $values['booking_help_music']; + $node->booking_help_meditations = empty($values['booking_help_meditations']) ? '' : $values['booking_help_meditations']; + $node->booking_help_praying = empty($values['booking_help_praying']) ? '' : $values['booking_help_praying']; + $node->booking_help_reading = empty($values['booking_help_reading']) ? 'N' : ($values['booking_help_reading'] == 1 ? 'Y' : 'N'); + $node->booking_help_chairing = empty($values['booking_help_chairing']) ? 'N' : ($values['booking_help_chairing'] == 1 ? 'Y' : 'N'); + $node->booking_help_readgroup_lead = empty($values['booking_help_readgroup_lead']) ? 'N' : ($values['booking_help_readgroup_lead'] == 1 ? 'Y' : 'N'); + $node->booking_help_discussgroup_lead = empty($values['booking_help_discussgroup_lead']) ? 'N' : ($values['booking_help_discussgroup_lead'] == 1 ? 'Y' : 'N'); + $node->booking_firstaid = empty($values['booking_firstaid']) ? 'N' : ($values['booking_firstaid'] == 1 ? 'Y' : 'N'); + $node->booking_nurse = empty($values['booking_nurse']) ? 'N' : ($values['booking_nurse'] == 1 ? 'Y' : 'N'); + $node->booking_lifesaver = empty($values['booking_lifesaver']) ? 'N' : ($values['booking_lifesaver'] == 1 ? 'Y' : 'N'); + $node->booking_doctor = empty($values['booking_doctor']) ? 'N' : ($values['booking_doctor'] == 1 ? 'Y' : 'N'); + $node->booking_dietary = empty($values['booking_dietary']) ? 'N/A' : $values['booking_dietary']; + $node->booking_medical_conditions = empty($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_has_mission_experience = empty($values['booking_has_mission_experience']) ? 'N' : ($values['booking_has_mission_experience'] == 1 ? 'Y' : 'N'); + $node->booking_skills_builder = empty($values['booking_skills_builder']) ? 'N' : ($values['booking_skills_builder'] == 1 ? 'Y' : 'N'); + $node->booking_skills_cooking = empty($values['booking_skills_cooking']) ? 'N' : ($values['booking_skills_cooking'] == 1 ? 'Y' : 'N'); + $node->booking_skills_childminding = empty($values['booking_skills_childminding']) ? 'N' : ($values['booking_skills_childminding'] == 1 ? 'Y' : 'N'); + $node->booking_skills_language = empty($values['booking_skills_language']) ? 'N' : ($values['booking_skills_language'] == 1 ? 'Y' : 'N'); + $node->booking_skills_language_details = empty($values['booking_skills_language_details']) ? 'N/A' : $values['booking_skills_language_details']; + $node->booking_skills_other = empty($values['booking_skills_other']) ? 'N' : ($values['booking_skills_other'] == 1 ? 'Y' : 'N'); + $node->booking_skills_other_details = empty($values['booking_skills_other_details']) ? 'N/A' : $values['booking_skills_other_details']; //potential fields for future //$node->booking_payment_method = $payment_method; - $node->booking_room_mate1 = _booking_person_studygroups_cleanup($values['booking_room_mate1']) ? '' : $values['booking_room_mate1']; - $node->booking_room_mate2 = _booking_person_studygroups_cleanup($values['booking_room_mate2']) ? '' : $values['booking_room_mate2']; - $node->booking_shirt_size = _booking_person_studygroups_cleanup($values['booking_shirt_size']) ? 'N/A' : $values['booking_shirt_size']; + $node->booking_room_mate1 = empty($values['booking_room_mate1']) ? '' : $values['booking_room_mate1']; + $node->booking_room_mate2 = empty($values['booking_room_mate2']) ? '' : $values['booking_room_mate2']; + $node->booking_shirt_size = empty($values['booking_shirt_size']) ? 'N/A' : $values['booking_shirt_size']; //fields only configured by admin - $node->booking_readinggroup = !_booking_person_studygroups_cleanup($values['booking_readinggroup']) ? $values['booking_readinggroup'] : ''; + $node->booking_readinggroup = !empty($values['booking_readinggroup']) ? $values['booking_readinggroup'] : ''; $node->booking_timestamp = REQUEST_TIME; //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_room_mate1' => $node->booking_room_mate1, 'booking_room_mate2' => $node->booking_room_mate2, - 'booking_shirt_size' => _booking_person_studygroups_cleanup($node->booking_shirt_size) ? 'N/A' : $node->booking_shirt_size, + 'booking_shirt_size' => empty($node->booking_shirt_size) ? 'N/A' : $node->booking_shirt_size, 'booking_help_music' => $node->booking_help_music, 'booking_help_praying' => $node->booking_help_praying, 'booking_help_meditations' => $node->booking_help_meditations, @@ -1388,7 +1388,7 @@ function _booking_insert($node) { 'booking_guardian_type' => $node->booking_guardian_type, 'booking_guardian_phone' => $node->booking_guardian_phone, 'booking_guardian_phone_alt' => $node->booking_guardian_phone_alt, - 'booking_medicare' => _booking_person_studygroups_cleanup($node->booking_medicare) ? '' : $node->booking_medicare, + 'booking_medicare' => empty($node->booking_medicare) ? '' : $node->booking_medicare, 'booking_lifesaver' => $node->booking_lifesaver, 'booking_firstaid' => $node->booking_firstaid, 'booking_nurse' => $node->booking_nurse, @@ -1558,7 +1558,7 @@ function _booking_update($node) { _booking_person_studygroups_cleanup($node->nid); //Remove from any rooms allocated - _booking_rooms_cleanup($node->nid); + _booking_person_rooms_cleanup($node->nid); //check if there is room on the booked-in list if (_booking_check_bookings_full() == False) @@ -1617,7 +1617,7 @@ function _booking_update($node) { _booking_person_studygroups_cleanup($node->nid); //Remove from any rooms allocated - _booking_rooms_cleanup($node->nid); + _booking_person_rooms_cleanup($node->nid); //check if there is room on the booked-in list if (_booking_check_bookings_full() == False) @@ -1959,7 +1959,7 @@ function booking_view($node, $view_mode) { } //add the travel info if it has been defined for this attendee - if (! _booking_person_studygroups_cleanup($node->tid)) + if (! empty($node->tid)) { $travel_heading = t("
!link
", array('!link' => l(t('Edit Travel Details'), t('node/!id/edit', array('!id' => $node->tid))) diff --git a/booking.reports.inc b/booking.reports.inc index e1b9429..7ac8caf 100644 --- a/booking.reports.inc +++ b/booking.reports.inc @@ -166,7 +166,7 @@ function booking_report_summary() { //travel form completed? - if (! _booking_person_studygroups_cleanup($person->tid)) + if (! empty($person->tid)) $travelform_count++; //booking status