From 9c263eae9518e2588be436e26e53c412f2a8e9bd Mon Sep 17 00:00:00 2001 From: Nathan Coad Date: Sat, 11 Jun 2016 15:14:57 +1000 Subject: [PATCH] refactor booking form --- booking.regn_form.inc | 192 +++--------------------------------------- 1 file changed, 12 insertions(+), 180 deletions(-) diff --git a/booking.regn_form.inc b/booking.regn_form.inc index 1903da3..b16aaab 100644 --- a/booking.regn_form.inc +++ b/booking.regn_form.inc @@ -558,6 +558,17 @@ function booking_form($node, &$form_state, $inserting = FALSE) '#title' => 'Emergency Contact Details', '#description' => 'Please enter contact details for use in case of emergency' ); + if (variable_get('booking_enable_medicare', 1) == 1) { + $form['emergency']['booking_medicare'] = array( + '#type' => 'textfield', + '#title' => t('Your Medicare Number'), + '#maxlength' => 15, + '#size' => 15, + //'#required' => FALSE, + '#required' => variable_get('booking_enforce_medicare_verification', 1) == 1 ? TRUE : FALSE, + '#default_value' => empty($data->booking_medicare) ? '' : $data->booking_medicare + ); + } $form['emergency']['booking_guardian_name'] = array( '#type' => 'textfield', '#title' => t('Parent/Guardian Name'), @@ -607,186 +618,7 @@ function booking_form($node, &$form_state, $inserting = FALSE) '#required' => FALSE, '#default_value' => empty($data->booking_guardian_phone_alt) ? '' : $data->booking_guardian_phone_alt ); - - if (variable_get('booking_enable_medicare', 1) == 1) { - $form['emergency']['booking_medicare'] = array( - '#type' => 'textfield', - '#title' => t('Your Medicare Number'), - '#maxlength' => 15, - '#size' => 15, - '#required' => FALSE, - //'#required' => variable_get('booking_enforce_medicare_verification', 1) == 1 ? TRUE : FALSE, - '#default_value' => empty($data->booking_medicare) ? '' : $data->booking_medicare - ); - } - /* - if (variable_get('booking_enable_passport', 0) == 1) { - $form['passport-details'] = array( - '#type' => 'fieldset', - '#title' => 'Passport Details' - ); - $form['passport-details']['booking_passport_num'] = array( - '#type' => 'textfield', - '#title' => t('Passport Number'), - '#maxlength' => 45, - '#required' => FALSE, - '#default_value' => !empty($data->booking_passport_num) ? $data->booking_passport_num : '' - ); - $form['passport-details']['booking_passport_issue_location'] = array( - '#type' => 'textfield', - '#title' => t('City of Issue (eg Sydney)'), - '#maxlength' => 120, - '#required' => FALSE, - '#default_value' => !empty($data->booking_passport_issue_location) ? $data->booking_passport_issue_location : '' - ); - $form['passport-details']['booking_passport_issue_name'] = array( - '#type' => 'textfield', - '#title' => t('Exact name as listed on passport'), - '#maxlength' => 120, - '#required' => FALSE, - '#default_value' => !empty($data->booking_passport_issue_name) ? $data->booking_passport_issue_name : '' - ); - $form['passport-details']['booking_passport_expiry_date'] = array( - '#type' => 'date_select', - '#title' => t('Passport expiry date'), - '#default_value' => empty($data->booking_passport_expiry_date) ? '' : date("Y-m-d H:i:s", $data->booking_passport_expiry_date), - '#required' => FALSE, - '#date_format' => 'd/m/Y', - //'#date_label_position' => 'within', - '#date_year_range' => '+0:+13' - ); - $form['passport-details']['booking_travel_insurance'] = array( - '#type' => 'textfield', - '#title' => t('Travel insurance policy details'), - '#maxlength' => 120, - '#required' => FALSE, - '#default_value' => !empty($data->booking_travel_insurance) ? $data->booking_travel_insurance : '' - ); - if ($inserting == FALSE) { - $form['passport-details']['booking_destination_country'] = array( - '#type' => 'textfield', - '#title' => t('Which country is this person going to?'), - '#maxlength' => 120, - '#required' => FALSE, - '#default_value' => !empty($data->booking_destination_country) ? $data->booking_destination_country : '' - ); - - //flights from the conference week to the destination country - $form['outbound-flight-details'] = array( - '#type' => 'fieldset', - '#title' => 'Flight Details (Conference To Destination Country)' - ); - $form['outbound-flight-details']['booking_outflight_bookingnum'] = array( - '#type' => 'textfield', - '#title' => t('Internal Flight Booking Reference (departing conference week)'), - '#maxlength' => 120, - '#required' => FALSE, - '#default_value' => !empty($data->booking_outflight_bookingnum) ? $data->booking_outflight_bookingnum : '' - ); - $form['outbound-flight-details']['booking_outflight_flightnum'] = array( - '#type' => 'textfield', - '#title' => t('Internal Flight Number (departing conference week)'), - '#maxlength' => 120, - '#required' => FALSE, - '#default_value' => !empty($data->booking_outflight_flightnum) ? $data->booking_outflight_flightnum : '' - ); - $form['outbound-flight-details']['booking_outflight_origin'] = array( - '#type' => 'textfield', - '#title' => t('Internal Flight Origin to Destination (departing conference week)'), - '#maxlength' => 120, - '#required' => FALSE, - '#default_value' => !empty($data->booking_outflight_origin) ? $data->booking_outflight_origin : '' - ); - $form['outbound-flight-details']['booking_outflight_origin_ts'] = array( - '#type' => 'date_select', - '#title' => t('Internal flight departure time (local timezone)'), - '#description' => t('Note: 24 hour time - 12:00 is midday'), - '#default_value' => empty($data->booking_outflight_origin_ts) ? '' : date("Y-m-d H:i:s", $data->booking_outflight_origin_ts), - '#date_format' => 'd/m/Y H:i', - '#date_year_range' => '0:+1' - ); - $form['outbound-flight-details']['booking_outflight_connecting_flightnum'] = array( - '#type' => 'textfield', - '#title' => t('Connecting Flight Number (if applicable)'), - '#maxlength' => 120, - '#required' => FALSE, - '#default_value' => !empty($data->booking_outflight_connecting_flightnum) ? $data->booking_outflight_connecting_flightnum : '' - ); - $form['outbound-flight-details']['booking_outflight_destination'] = array( - '#type' => 'textfield', - '#title' => t('Connecting Flight Origin to Destination'), - '#maxlength' => 120, - '#required' => FALSE, - '#default_value' => !empty($data->booking_outflight_destination) ? $data->booking_outflight_destination : '' - ); - $form['outbound-flight-details']['booking_outflight_destination_ts'] = array( - '#type' => 'date_select', - '#title' => t('Internal flight arrival time (local timezone)'), - '#description' => t('Note: 24 hour time - 12:00 is midday'), - '#default_value' => empty($data->booking_outflight_destination_ts) ? '' : date("Y-m-d H:i:s", $data->booking_outflight_destination_ts), - '#date_format' => 'd/m/Y H:i', - '#date_year_range' => '0:+1' - ); - - //flights from the destination country back to conference - $form['inbound-flight-details'] = array( - '#type' => 'fieldset', - '#title' => 'Flight Details (Destination Country Back To Conference)' - ); - $form['inbound-flight-details']['booking_rtrnflight_bookingnum'] = array( - '#type' => 'textfield', - '#title' => t('Internal Flight Booking Reference (returning to conference)'), - '#maxlength' => 120, - '#required' => FALSE, - '#default_value' => !empty($data->booking_rtrnflight_bookingnum) ? $data->booking_rtrnflight_bookingnum : '' - ); - $form['inbound-flight-details']['booking_rtrnflight_flightnum'] = array( - '#type' => 'textfield', - '#title' => t('Internal Flight Number (returning to conference)'), - '#maxlength' => 120, - '#required' => FALSE, - '#default_value' => !empty($data->booking_rtrnflight_flightnum) ? $data->booking_rtrnflight_flightnum : '' - ); - $form['inbound-flight-details']['booking_rtrnflight_origin'] = array( - '#type' => 'textfield', - '#title' => t('Internal Flight Origin to Destination (returning to conference)'), - '#maxlength' => 120, - '#required' => FALSE, - '#default_value' => !empty($data->booking_rtrnflight_origin) ? $data->booking_rtrnflight_origin : '' - ); - $form['inbound-flight-details']['booking_rtrnflight_origin_ts'] = array( - '#type' => 'date_select', - '#title' => t('Internal flight departure time (local timezone)'), - '#description' => t('Note: 24 hour time - 12:00 is midday'), - '#default_value' => empty($data->booking_rtrnflight_origin_ts) ? '' : date("Y-m-d H:i:s", $data->booking_rtrnflight_origin_ts), - '#date_format' => 'd/m/Y H:i', - '#date_year_range' => '0:+1' - ); - $form['inbound-flight-details']['booking_rtrnflight_connecting_flightnum'] = array( - '#type' => 'textfield', - '#title' => t('Connecting Flight Number (if applicable)'), - '#maxlength' => 120, - '#required' => FALSE, - '#default_value' => !empty($data->booking_rtrnflight_connecting_flightnum) ? $data->booking_rtrnflight_connecting_flightnum : '' - ); - $form['inbound-flight-details']['booking_rtrnflight_destination'] = array( - '#type' => 'textfield', - '#title' => t('Connecting Flight Origin to Destination'), - '#maxlength' => 120, - '#required' => FALSE, - '#default_value' => !empty($data->booking_rtrnflight_destination) ? $data->booking_rtrnflight_destination : '' - ); - $form['inbound-flight-details']['booking_rtrnflight_destination_ts'] = array( - '#type' => 'date_select', - '#title' => t('Internal flight arrival time (local timezone)'), - '#description' => t('Note: 24 hour time - 12:00 is midday'), - '#default_value' => empty($data->booking_rtrnflight_destination_ts) ? '' : date("Y-m-d H:i:s", $data->booking_rtrnflight_destination_ts), - '#date_format' => 'd/m/Y H:i', - '#date_year_range' => '0:+1' - ); - } - } //end passport only fields - */ + if (variable_get('booking_enable_helpareas', 1) == 1) { $form['help-areas'] = array( '#type' => 'fieldset',