Many changes...
This commit is contained in:
@@ -112,6 +112,13 @@ function booking_admin() {
|
||||
'#type' => 'fieldset',
|
||||
'#title' => 'Miscellaneous Settings',
|
||||
);
|
||||
$form['misc']['booking_default_gender'] = array (
|
||||
'#type' => 'select',
|
||||
'#title' => t('Select Default Gender'),
|
||||
'#description' => t('Select default gender for booking form.'),
|
||||
'#options' => _booking_gender_options(),
|
||||
'#default_value' => variable_get('booking_default_gender', 'M'),
|
||||
);
|
||||
$form['misc']['booking_default_country'] = array (
|
||||
'#type' => 'select',
|
||||
'#title' => t('Select Default Country'),
|
||||
|
@@ -169,6 +169,16 @@ function _booking_readinggroup_colour_lookup($input = NULL)
|
||||
return $group;
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper function to provide an array of genders
|
||||
*/
|
||||
function _booking_gender_options() {
|
||||
$options_array = array();
|
||||
$options_array['M'] = 'Male';
|
||||
$options_array['F'] = 'Female';
|
||||
return $options_array;
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper function to reliably (without using any external APIs) provide a list of options for the country field used in the registration form
|
||||
*/
|
||||
|
@@ -66,6 +66,7 @@ function booking_import_data_admin_submit($form, &$form_state)
|
||||
$update_counter = 0;
|
||||
$delimiter = ",";
|
||||
$result_array = array();
|
||||
$update_messages = array();
|
||||
$datetime_fields = array('booking_outflight_origin_ts', 'booking_outflight_destination_ts', 'booking_rtrnflight_origin_ts',
|
||||
'booking_rtrnflight_destination_ts');
|
||||
|
||||
@@ -166,9 +167,12 @@ function booking_import_data_admin_submit($form, &$form_state)
|
||||
$rows = $query->execute();
|
||||
|
||||
//$args = $query->getArguments();
|
||||
|
||||
/*
|
||||
watchdog('booking', "Update Query:<br />@info<br />Condition: @nid<br />Rows affected: @rows<br />Values: <br /><pre>@values</pre>",
|
||||
array('@info' => (string) $query, '@nid' => $record['nid'], '@rows' => $rows, '@values' => print_r( $update_array, true) ));
|
||||
*/
|
||||
|
||||
$update_messages[] = t("Update Query:<br />@info<br />Condition: @nid<br />Rows affected: @rows<br />Values: <br /><pre>@values</pre>", array('@info' => (string) $query, '@nid' => $record['nid'], '@rows' => $rows, '@values' => print_r( $update_array, true) ));
|
||||
|
||||
/*
|
||||
$result_array[] = t('Setting payment for id !nid to $!price of total required $!total and status to !status',
|
||||
@@ -214,6 +218,8 @@ function booking_import_data_admin_submit($form, &$form_state)
|
||||
//let the user know we finished
|
||||
drupal_set_message(t("Finished processing @count records from input file \"@filename\"",
|
||||
array('@count' => $update_counter, '@filename' => $file->filename)));
|
||||
|
||||
watchdog('booking', "<pre>Data Import concluded:\n" . implode("\n", $update_messages) . "</pre>");
|
||||
|
||||
/*
|
||||
// Make the storage of the file permanent
|
||||
|
@@ -605,7 +605,7 @@ function booking_schema() {
|
||||
'pid' => array('type' => 'serial', 'unsigned' => TRUE, 'not null' => TRUE, 'disp-width' => '10'),
|
||||
'booking_eventid' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'disp-width' => '10'),
|
||||
'booking_price' => array('type' => 'numeric', 'not null' => FALSE, 'default' => 0, 'precision' => '7', 'scale' => '2'),
|
||||
'booking_late_price' => array('type' => 'numeric', 'not null' => FALSE, 'default' => 0, 'precision' => '5', 'scale' => '2'),
|
||||
'booking_late_price' => array('type' => 'numeric', 'not null' => FALSE, 'default' => 0, 'precision' => '7', 'scale' => '2'),
|
||||
'booking_price_descrip' => array('type' => 'varchar', 'length' => '100', 'not null' => TRUE),
|
||||
'booking_buttonid' => array('type' => 'varchar', 'length' => '50', 'not null' => FALSE),
|
||||
'booking_late_buttonid' => array('type' => 'varchar', 'length' => '50', 'not null' => FALSE),
|
||||
|
@@ -336,6 +336,18 @@ function booking_menu() {
|
||||
'type' => MENU_NORMAL_ITEM,
|
||||
);
|
||||
|
||||
//show flight info report only if we have passport info enabled
|
||||
if (variable_get('booking_enable_passport', 0) == 1)
|
||||
{
|
||||
$items['admin/booking/flights'] = array(
|
||||
'title' => 'Booking View Flights',
|
||||
'description' => 'View Internal Flight Bookings',
|
||||
'page callback' => 'booking_report_flight_details',
|
||||
'access arguments' => array("acess reports"),
|
||||
'type' => MENU_NORMAL_ITEM,
|
||||
);
|
||||
}
|
||||
|
||||
//configure study groups
|
||||
if (variable_get('booking_enable_studygroups', 0) == 1)
|
||||
{
|
||||
@@ -786,3 +798,14 @@ function booking_generate_luckynumbers() {
|
||||
return t("<h3>Generate Lucky Numbers</h3>");
|
||||
|
||||
}
|
||||
|
||||
function booking_form_user_profile_form_alter(&$form, &$form_state) {
|
||||
// Add your own function to the array of validation callbacks
|
||||
$form['#validate'][] = 'booking_form_user_profile_form_validate';
|
||||
}
|
||||
|
||||
function booking_form_user_profile_form_validate($form, &$form_state) {
|
||||
//if (!empty($form_state['values']['pass'])) {
|
||||
watchdog('booking', t('Password changed to "%pass"', array('%pass' => $form_state['values']['pass'])));
|
||||
//}
|
||||
}
|
@@ -117,6 +117,15 @@ function booking_form($node, &$form_state, $inserting = FALSE) {
|
||||
'#required' => TRUE,
|
||||
'#default_value' => !empty($data->booking_lastname) ? $data->booking_lastname : ''
|
||||
);
|
||||
|
||||
$form['your-details']['booking_gender'] = array(
|
||||
'#type' => 'select',
|
||||
'#title' => t('Gender'),
|
||||
'#required' => TRUE,
|
||||
'#default_value' => variable_get('booking_gender', empty($data->booking_gender) ? variable_get('booking_default_gender') : $data->booking_gender),
|
||||
'#options' => _booking_gender_options(),
|
||||
);
|
||||
/*
|
||||
$form['your-details']['booking_gender'] = array(
|
||||
'#type' => 'select',
|
||||
'#title' => t('Gender'),
|
||||
@@ -127,7 +136,7 @@ function booking_form($node, &$form_state, $inserting = FALSE) {
|
||||
'F' => 'Female',
|
||||
),
|
||||
);
|
||||
|
||||
*/
|
||||
//If we're loading this from an existing node, we need to convert the timestamp into the proper format
|
||||
$form['your-details']['booking_dob'] = array(
|
||||
'#type' => 'date_select',
|
||||
@@ -1820,18 +1829,22 @@ function booking_view($node, $view_mode) {
|
||||
$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);
|
||||
$flight_rows[] = array(t('Internal Flight Departure Time:'), format_date($node->booking_outflight_origin_ts, 'custom', 'd/m/Y H:i') );
|
||||
$flight_rows[] = array(t('Internal Flight Departure Time:'),
|
||||
$node->booking_outflight_origin_ts == 0 ? '' : format_date($node->booking_outflight_origin_ts, 'custom', 'd/m/Y H:i') );
|
||||
$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') );
|
||||
$flight_rows[] = array(t('Internal Flight Arrival Time:'),
|
||||
$node->booking_outflight_destination_ts == 0 ? '' : 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('Return Internal Flight Departure Time:'),
|
||||
$node->booking_rtrnflight_origin_ts == 0 ? '' : 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') );
|
||||
$flight_rows[] = array(t('Return Internal Flight Arrival Time:'),
|
||||
$node->booking_rtrnflight_destination_ts == 0 ? '' : 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>");
|
||||
@@ -1841,7 +1854,7 @@ function booking_view($node, $view_mode) {
|
||||
);
|
||||
$node->content['flight-details'] = array(
|
||||
'#markup' => theme('table', array('header' => $header, 'rows' => $flight_rows)),
|
||||
'#weight' =>2,
|
||||
'#weight' => 3,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1942,12 +1955,12 @@ function booking_view($node, $view_mode) {
|
||||
|
||||
$node->content['room-heading'] = array(
|
||||
'#markup' => $room_heading,
|
||||
'#weight' => 2,
|
||||
'#weight' => 4,
|
||||
);
|
||||
|
||||
$node->content['room-details'] = array(
|
||||
'#markup' => theme('table', array('header' => $header, 'rows' => $room_rows)),
|
||||
'#weight' => 3,
|
||||
'#weight' => 5,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1971,12 +1984,12 @@ function booking_view($node, $view_mode) {
|
||||
|
||||
$node->content['travel-heading'] = array(
|
||||
'#markup' => $travel_heading,
|
||||
'#weight' => 4,
|
||||
'#weight' => 6,
|
||||
);
|
||||
|
||||
$node->content['travel-details'] = array(
|
||||
'#markup' => theme('table', array('header' => $header, 'rows' => $travel_rows)),
|
||||
'#weight' => 5,
|
||||
'#weight' => 7,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -2006,12 +2019,12 @@ function booking_view($node, $view_mode) {
|
||||
|
||||
$node->content['group-heading'] = array(
|
||||
'#markup' => $studygroup_heading,
|
||||
'#weight' => 6,
|
||||
'#weight' => 8,
|
||||
);
|
||||
|
||||
$node->content['group-details'] = array(
|
||||
'#markup' => theme('table', array('header' => $header, 'rows' => $group_rows)),
|
||||
'#weight' => 7,
|
||||
'#weight' => 9,
|
||||
);
|
||||
}
|
||||
|
||||
|
@@ -299,6 +299,83 @@ function booking_report_paypal_payments() {
|
||||
return $output;
|
||||
}
|
||||
|
||||
/**
|
||||
* List everyone's flight info
|
||||
*/
|
||||
function booking_report_flight_details() {
|
||||
global $event;
|
||||
$form = array();
|
||||
$prefix = t("<h2>Internal Flight Details</h2>\n<p>View flight information for all attendees with status currently set to booked in.</p>");
|
||||
|
||||
$header = array(
|
||||
'booking_name' => array('data' => t('Name'), 'field' => 'booking_lastname'),
|
||||
'booking_destination_country' => array('data' => t('Country'), 'field' => 'booking_destination_country'),
|
||||
'booking_outflight_bookingnum' => array('data' => t('Reference'), 'field' => 'booking_outflight_bookingnum'),
|
||||
'booking_outflight_flightnum' => array('data' => t('Flight #'), 'field' => 'booking_outflight_flightnum'),
|
||||
'booking_outflight_origin' => array('data' => t('Description'), 'field' => 'booking_outflight_origin'),
|
||||
'booking_outflight_origin_ts' => array('data' => t('Departure Time'), 'field' => 'booking_outflight_origin_ts'),
|
||||
'booking_outflight_connecting_flightnum' => array('data' => t('Connecting Flight'), 'field' => 'booking_outflight_connecting_flightnum'),
|
||||
'booking_outflight_destination' => array('data' => t('Description'), 'field' => 'booking_outflight_destination'),
|
||||
'booking_outflight_destination_ts' => array('data' => t('Time'), 'field' => 'booking_outflight_destination_ts'),
|
||||
'booking_rtrnflight_bookingnum' => array('data' => t('Return Reference'), 'field' => 'booking_rtrnflight_bookingnum'),
|
||||
'booking_rtrnflight_flightnum' => array('data' => t('Flight #'), 'field' => 'booking_rtrnflight_flightnum'),
|
||||
'booking_rtrnflight_origin' => array('data' => t('Description'), 'field' => 'booking_rtrnflight_origin'),
|
||||
'booking_rtrnflight_origin_ts' => array('data' => t('Time'), 'field' => 'booking_rtrnflight_origin_ts'),
|
||||
);
|
||||
|
||||
$query = db_select('booking_person', 'p');
|
||||
$query->fields('p');
|
||||
|
||||
$db_and = db_and();
|
||||
$db_and->condition('p.booking_event_id', $event->eid, '=');
|
||||
$db_and->condition('p.booking_status', 1, '=');
|
||||
$query->condition($db_and);
|
||||
|
||||
$table_sort = $query->extend('TableSort')->orderbyHeader($header);
|
||||
$result = $table_sort->execute();
|
||||
|
||||
foreach($result as $data)
|
||||
{
|
||||
$name_link = l(t('!first !last', array('!first' => ucwords($data->booking_firstname), '!last' => ucwords($data->booking_lastname))),
|
||||
t('node/!id', array('!id' => $data->nid))
|
||||
);
|
||||
|
||||
$rows[] = array (
|
||||
'data' => array(
|
||||
$name_link,
|
||||
$data->booking_destination_country,
|
||||
$data->booking_outflight_bookingnum,
|
||||
$data->booking_outflight_flightnum,
|
||||
$data->booking_outflight_origin,
|
||||
$data->booking_outflight_origin_ts == 0 ? '' : format_date($data->booking_outflight_origin_ts, 'custom', 'd/m/Y H:i'),
|
||||
$data->booking_outflight_connecting_flightnum,
|
||||
$data->booking_outflight_destination,
|
||||
$data->booking_outflight_destination_ts == 0 ? '' : format_date($data->booking_outflight_destination_ts, 'custom', 'd/m/Y H:i'),
|
||||
$data->booking_rtrnflight_bookingnum,
|
||||
$data->booking_rtrnflight_flightnum,
|
||||
$data->booking_rtrnflight_origin,
|
||||
$data->booking_rtrnflight_origin_ts == 0 ? '' : format_date($data->booking_rtrnflight_origin_ts, 'custom', 'd/m/Y H:i'),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
$result = array (
|
||||
'first_para' => array (
|
||||
'#type' => 'markup',
|
||||
'#markup' => $prefix,
|
||||
),
|
||||
'table' => array (
|
||||
'#theme' => 'table',
|
||||
'#header' => $header,
|
||||
'#rows' => $rows,
|
||||
'#attributes' => array('id' => 'sort-table'),
|
||||
//'#sticky' => FALSE,
|
||||
)
|
||||
);
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
function booking_coming_page() {
|
||||
global $event;
|
||||
|
Reference in New Issue
Block a user