Updates to flight info handling
This commit is contained in:
@@ -105,6 +105,9 @@ function booking_permission() {
|
||||
'edit bookings' => array(
|
||||
'title' => t('Edit all bookings'),
|
||||
),
|
||||
'import bookings' => array(
|
||||
'title' => t('Bulk import booking data from csv'),
|
||||
),
|
||||
'view study groups' => array(
|
||||
'title' => t('View study groups'),
|
||||
),
|
||||
@@ -314,7 +317,7 @@ function booking_menu() {
|
||||
'description' => 'Upload a csv of containing payment data',
|
||||
'page callback' => 'drupal_get_form',
|
||||
'page arguments' => array('booking_import_data_admin'),
|
||||
'access arguments' => array('edit bookings'),
|
||||
'access arguments' => array('import bookings'),
|
||||
'type' => MENU_NORMAL_ITEM,
|
||||
);
|
||||
|
||||
|
@@ -414,22 +414,122 @@ function booking_form($node, &$form_state, $inserting = FALSE) {
|
||||
'#required' => FALSE,
|
||||
'#default_value' => !empty($data->booking_destination_country) ? $data->booking_destination_country : '',
|
||||
);
|
||||
$form['passport-details']['booking_internal_flight_outbound'] = array(
|
||||
'#type' => 'textfield',
|
||||
'#title' => t('Internal flight details leaving conference'),
|
||||
'#maxlength' => 120,
|
||||
'#required' => FALSE,
|
||||
'#default_value' => !empty($data->booking_internal_flight_outbound) ? $data->booking_internal_flight_outbound : '',
|
||||
|
||||
//flights from the conference week to the destination country
|
||||
$form['outbound-flight-details'] = array(
|
||||
'#type' => 'fieldset',
|
||||
'#title' => 'Flight Details (Conference To Destination Country)',
|
||||
);
|
||||
$form['passport-details']['booking_internal_flight_inbound'] = array(
|
||||
$form['outbound-flight-details']['booking_outflight_bookingnum'] = array(
|
||||
'#type' => 'textfield',
|
||||
'#title' => t('Internal flight details returning to conference'),
|
||||
'#title' => t('Internal Flight Booking Reference (departing conference week)'),
|
||||
'#maxlength' => 120,
|
||||
'#required' => FALSE,
|
||||
'#default_value' => !empty($data->booking_internal_flight_inbound) ? $data->booking_internal_flight_inbound : '',
|
||||
'#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
|
||||
|
||||
$form['contact-details'] = array(
|
||||
'#type' => 'fieldset',
|
||||
@@ -972,6 +1072,23 @@ function booking_form_submit($form, &$form_state) {
|
||||
$node->booking_destination_country = empty($values['booking_destination_country']) ? '' : $values['booking_destination_country'];
|
||||
$node->booking_travel_insurance = empty($values['booking_travel_insurance']) ? '' : $values['booking_travel_insurance'];
|
||||
|
||||
//flight info, which may not be present
|
||||
$node->booking_outflight_bookingnum = empty($values['booking_outflight_bookingnum']) ? '' : $values['booking_outflight_bookingnum'];
|
||||
$node->booking_outflight_flightnum = empty($values['booking_outflight_flightnum']) ? '' : $values['booking_outflight_flightnum'];
|
||||
$node->booking_outflight_origin = empty($values['booking_outflight_origin']) ? '' : $values['booking_outflight_origin'];
|
||||
$node->booking_outflight_origin_ts = empty($values['booking_outflight_origin_ts']) ? '0' : _datetime_array_to_ts($values['booking_outflight_origin_ts']);
|
||||
$node->booking_outflight_connecting_flightnum = empty($values['booking_outflight_connecting_flightnum']) ? '' : $values['booking_outflight_connecting_flightnum'];
|
||||
$node->booking_outflight_destination = empty($values['booking_outflight_destination']) ? '' : $values['booking_outflight_destination'];
|
||||
$node->booking_outflight_destination_ts = empty($values['booking_outflight_destination_ts']) ? '0' : _datetime_array_to_ts($values['booking_outflight_destination_ts']);
|
||||
|
||||
$node->booking_rtrnflight_bookingnum = empty($values['booking_rtrnflight_bookingnum']) ? '' : $values['booking_rtrnflight_bookingnum'];
|
||||
$node->booking_rtrnflight_flightnum = empty($values['booking_rtrnflight_flightnum']) ? '' : $values['booking_rtrnflight_flightnum'];
|
||||
$node->booking_rtrnflight_origin = empty($values['booking_rtrnflight_origin']) ? '' : $values['booking_rtrnflight_origin'];
|
||||
$node->booking_rtrnflight_origin_ts = empty($values['booking_rtrnflight_origin_ts']) ? '0' : _datetime_array_to_ts($values['booking_rtrnflight_origin_ts']);
|
||||
$node->booking_rtrnflight_connecting_flightnum = empty($values['booking_rtrnflight_connecting_flightnum']) ? '' : $values['booking_rtrnflight_connecting_flightnum'];
|
||||
$node->booking_rtrnflight_destination = empty($values['booking_rtrnflight_destination']) ? '' : $values['booking_rtrnflight_destination'];
|
||||
$node->booking_rtrnflight_destination_ts = empty($values['booking_rtrnflight_destination_ts']) ? '0' : _datetime_array_to_ts($values['booking_rtrnflight_destination_ts']);
|
||||
|
||||
//payment details
|
||||
$node->booking_payment_id = $values['booking_payment_id'];
|
||||
|
||||
@@ -1218,8 +1335,21 @@ function _booking_insert($node) {
|
||||
'booking_passport_expiry_date' => $node->booking_passport_expiry_date,
|
||||
'booking_destination_country' => $node->booking_destination_country,
|
||||
'booking_travel_insurance' => $node->booking_travel_insurance,
|
||||
'booking_internal_flight_outbound' => $node->booking_internal_flight_outbound,
|
||||
'booking_internal_flight_inbound' => $node->booking_internal_flight_inbound,
|
||||
'booking_outflight_bookingnum' => $node->booking_outflight_bookingnum,
|
||||
'booking_outflight_flightnum' => $node->booking_outflight_flightnum,
|
||||
'booking_outflight_bookingnum' => $node->booking_outflight_bookingnum,
|
||||
'booking_outflight_origin' => $node->booking_outflight_origin,
|
||||
'booking_outflight_origin_ts' => $node->booking_outflight_origin_ts,
|
||||
'booking_outflight_connecting_flightnum' => $node->booking_outflight_connecting_flightnum,
|
||||
'booking_outflight_destination' => $node->booking_outflight_destination,
|
||||
'booking_outflight_destination_ts' => $node->booking_outflight_destination_ts,
|
||||
'booking_rtrnflight_bookingnum' => $node->booking_rtrnflight_bookingnum,
|
||||
'booking_rtrnflight_flightnum' => $node->booking_rtrnflight_flightnum,
|
||||
'booking_rtrnflight_origin' => $node->booking_rtrnflight_origin,
|
||||
'booking_rtrnflight_origin_ts' => $node->booking_rtrnflight_origin_ts,
|
||||
'booking_rtrnflight_connecting_flightnum' => $node->booking_rtrnflight_connecting_flightnum,
|
||||
'booking_rtrnflight_destination' => $node->booking_rtrnflight_destination,
|
||||
'booking_rtrnflight_destination_ts' => $node->booking_rtrnflight_destination_ts,
|
||||
'booking_gender' => $node->booking_gender,
|
||||
'booking_street' => $node->booking_street,
|
||||
'booking_suburb' => $node->booking_suburb,
|
||||
@@ -1308,8 +1438,21 @@ function _booking_update($node) {
|
||||
'booking_passport_expiry_date' => _date_to_ts($node->booking_passport_expiry_date),
|
||||
'booking_destination_country' => $node->booking_destination_country,
|
||||
'booking_travel_insurance' => $node->booking_travel_insurance,
|
||||
'booking_internal_flight_outbound' => $node->booking_internal_flight_outbound,
|
||||
'booking_internal_flight_inbound' => $node->booking_internal_flight_inbound,
|
||||
'booking_outflight_bookingnum' => $node->booking_outflight_bookingnum,
|
||||
'booking_outflight_flightnum' => $node->booking_outflight_flightnum,
|
||||
'booking_outflight_bookingnum' => $node->booking_outflight_bookingnum,
|
||||
'booking_outflight_origin' => $node->booking_outflight_origin,
|
||||
'booking_outflight_origin_ts' => _datetime_to_ts($node->booking_outflight_origin_ts),
|
||||
'booking_outflight_connecting_flightnum' => $node->booking_outflight_connecting_flightnum,
|
||||
'booking_outflight_destination' => $node->booking_outflight_destination,
|
||||
'booking_outflight_destination_ts' => _datetime_to_ts($node->booking_outflight_destination_ts),
|
||||
'booking_rtrnflight_bookingnum' => $node->booking_rtrnflight_bookingnum,
|
||||
'booking_rtrnflight_flightnum' => $node->booking_rtrnflight_flightnum,
|
||||
'booking_rtrnflight_origin' => $node->booking_rtrnflight_origin,
|
||||
'booking_rtrnflight_origin_ts' => _datetime_to_ts($node->booking_rtrnflight_origin_ts),
|
||||
'booking_rtrnflight_connecting_flightnum' => $node->booking_rtrnflight_connecting_flightnum,
|
||||
'booking_rtrnflight_destination' => $node->booking_rtrnflight_destination,
|
||||
'booking_rtrnflight_destination_ts' => _datetime_to_ts($node->booking_rtrnflight_destination_ts),
|
||||
'booking_gender' => $node->booking_gender,
|
||||
'booking_street' => $node->booking_street,
|
||||
'booking_suburb' => $node->booking_suburb,
|
||||
@@ -1673,6 +1816,7 @@ function booking_view($node, $view_mode) {
|
||||
$rows[] = array(t('Destination Country:'), $node->booking_destination_country);
|
||||
$rows[] = array(t('Travel Insurance details:'), $node->booking_travel_insurance);
|
||||
|
||||
//outbound flight
|
||||
$flight_rows[] = array(t('Internal Flight Booking Reference:'), $node->booking_outflight_bookingnum);
|
||||
$flight_rows[] = array(t('Internal Flight Number:'), $node->booking_outflight_flightnum);
|
||||
$flight_rows[] = array(t('Internal Flight Origin to Destination:'), $node->booking_outflight_origin);
|
||||
@@ -1680,6 +1824,14 @@ function booking_view($node, $view_mode) {
|
||||
$flight_rows[] = array(t('Connecting Flight Number:'), $node->booking_outflight_connecting_flightnum);
|
||||
$flight_rows[] = array(t('Connecting Flight Origin to Destination:'), $node->booking_outflight_destination);
|
||||
$flight_rows[] = array(t('Internal Flight Arrival Time:'), format_date($node->booking_outflight_destination_ts, 'custom', 'd/m/Y H:i') );
|
||||
//return flight
|
||||
$flight_rows[] = array(t('Return Internal Flight Booking Reference:'), $node->booking_rtrnflight_bookingnum);
|
||||
$flight_rows[] = array(t('Return Internal Flight Number:'), $node->booking_rtrnflight_flightnum);
|
||||
$flight_rows[] = array(t('Return Internal Flight Origin to Destination:'), $node->booking_rtrnflight_origin);
|
||||
$flight_rows[] = array(t('Return Internal Flight Departure Time:'), format_date($node->booking_rtrnflight_origin_ts, 'custom', 'd/m/Y H:i') );
|
||||
$flight_rows[] = array(t('Connecting Flight Number:'), $node->booking_rtrnflight_connecting_flightnum);
|
||||
$flight_rows[] = array(t('Connecting Flight Origin to Destination:'), $node->booking_rtrnflight_destination);
|
||||
$flight_rows[] = array(t('Return Internal Flight Arrival Time:'), format_date($node->booking_rtrnflight_destination_ts, 'custom', 'd/m/Y H:i') );
|
||||
|
||||
//add the flight info to a new section
|
||||
$flight_heading = t("<h2>Internal Flight Details</h2>");
|
||||
|
Reference in New Issue
Block a user