updates to travel form and add calls to _booking_node_create_mysqlview
This commit is contained in:
@@ -9,6 +9,16 @@ function booking_admin()
|
||||
//regenerate all our menu hooks when loading this form
|
||||
menu_rebuild();
|
||||
|
||||
//create the mysql view booking_person_view if necessary
|
||||
$sqlview_check = db_query("SELECT 1 FROM {booking_person_view}")->fetchAssoc();
|
||||
if (! $sqlview_check) {
|
||||
watchdog('booking_debug', "SQL View booking_person_view check does not exist");
|
||||
_booking_node_create_mysqlview();
|
||||
}
|
||||
else {
|
||||
watchdog('booking_debug', "<pre>SQL View booking_person_view check\n@info</pre>", array('@info' => print_r( $sqlview_check, true)));
|
||||
}
|
||||
|
||||
$form = array();
|
||||
|
||||
$form['email'] = array(
|
||||
|
@@ -531,13 +531,17 @@ function booking_update_7232() {
|
||||
db_change_field('booking_person', 'booking_event_id', 'booking_eventid', $spec);
|
||||
}
|
||||
|
||||
/**
|
||||
* Ensure SQL View booking_person_view is created
|
||||
*/
|
||||
function booking_update_7233() {
|
||||
_booking_node_create_mysqlview();
|
||||
}
|
||||
|
||||
/**
|
||||
* Implementation of hook_install().
|
||||
*/
|
||||
function booking_install() {
|
||||
//create the sql view we use
|
||||
_booking_node_create_mysqlview();
|
||||
|
||||
// Create some sample data
|
||||
// TODO: Set default values for the config pages too
|
||||
$result = db_insert('booking_price')
|
||||
@@ -550,7 +554,7 @@ $result = db_insert('booking_price')
|
||||
'booking_depositonly' => 1,
|
||||
))
|
||||
->execute();
|
||||
|
||||
//earlybird close is 31st Jan 2012 at 13:59:59 UTC
|
||||
$result = db_insert('booking_event')
|
||||
->fields(array(
|
||||
'booking_eventname' => 'Sample Event',
|
||||
@@ -561,7 +565,8 @@ $result = db_insert('booking_event')
|
||||
))
|
||||
->execute();
|
||||
|
||||
//earlybird close is 31st Jan 2012 at 13:59:59 UTC
|
||||
//create the sql view booking_person_view when first installing this module
|
||||
_booking_node_create_mysqlview();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -69,7 +69,7 @@ function booking_travel_page()
|
||||
);
|
||||
//actual form
|
||||
$return_array[] = array(
|
||||
'form' => drupal_get_form('travel_form', true, $node->nid)
|
||||
'form' => drupal_get_form('travel_form', true, $node, $tokens)
|
||||
);
|
||||
//text after form
|
||||
/*
|
||||
@@ -92,7 +92,7 @@ function booking_travel_page()
|
||||
|
||||
}
|
||||
|
||||
function travel_form($node, &$form_state, $inserting = FALSE, $nid = 0)
|
||||
function travel_form($node, &$form_state, $inserting = FALSE, $node = NULL, $tokens = NULL)
|
||||
{
|
||||
global $event;
|
||||
date_default_timezone_set(date_default_timezone(FALSE));
|
||||
@@ -105,7 +105,7 @@ function travel_form($node, &$form_state, $inserting = FALSE, $nid = 0)
|
||||
$transport_type_options = array(
|
||||
'Driving' => 'Driving',
|
||||
//'Train' => 'Train',
|
||||
'Flying' => 'Flying'
|
||||
'Flying' => 'Flying',
|
||||
);
|
||||
|
||||
//there's already info in $node so use that
|
||||
@@ -118,9 +118,9 @@ function travel_form($node, &$form_state, $inserting = FALSE, $nid = 0)
|
||||
}
|
||||
|
||||
//get info about this person from the relevant node id
|
||||
$person = db_query("SELECT booking_dietary, booking_medical_conditions, booking_bf_gf_nid, booking_partner_id, booking_room_mate1 " . "FROM {booking_person} " . "WHERE nid = :nid ", array(
|
||||
':nid' => $nid <> 0 ? $nid : $data->booking_person_nid
|
||||
))->fetchObject();
|
||||
$person = db_query("SELECT booking_dietary, booking_medical_conditions, booking_bf_gf_nid, booking_partner_id, booking_room_mate1 " .
|
||||
"FROM {booking_person} " . "WHERE nid = :nid ",
|
||||
array(':nid' => $node->nid <> NULL ? $node->nid : $data->booking_person_nid))->fetchObject();
|
||||
|
||||
if ($person) {
|
||||
$booking_dietary = $person->booking_dietary;
|
||||
@@ -134,12 +134,12 @@ function travel_form($node, &$form_state, $inserting = FALSE, $nid = 0)
|
||||
//store the node id
|
||||
$form['personid'] = array(
|
||||
'#type' => 'hidden',
|
||||
'#value' => $nid
|
||||
'#value' => $node->nid,
|
||||
);
|
||||
|
||||
$form['travel'] = array(
|
||||
'#type' => 'fieldset',
|
||||
'#title' => 'Travel details'
|
||||
'#title' => 'Travel details',
|
||||
);
|
||||
$form['travel']['booking_transport_type'] = array(
|
||||
'#type' => 'radios',
|
||||
@@ -298,6 +298,8 @@ function travel_form($node, &$form_state, $inserting = FALSE, $nid = 0)
|
||||
'#default_value' => !empty($data->booking_dietary) ? $data->booking_dietary : $booking_dietary
|
||||
);
|
||||
}
|
||||
//display the medical conditions question if it is enabled
|
||||
if (variable_get('booking_enable_medcond', 0) == 1) {
|
||||
$form['requirements']['booking_medical_conditions'] = array(
|
||||
'#type' => 'textfield',
|
||||
'#title' => t('Please describe any medical condition we need to know about.'),
|
||||
@@ -306,6 +308,7 @@ function travel_form($node, &$form_state, $inserting = FALSE, $nid = 0)
|
||||
'#required' => FALSE,
|
||||
'#default_value' => !empty($data->booking_medical_conditions) ? $data->booking_medical_conditions : $booking_medical_conditions
|
||||
);
|
||||
}
|
||||
//only show the room mate field if we're allowed to
|
||||
if (variable_get('booking_enable_roommate', 0) == 1 || $inserting == FALSE) {
|
||||
//married people won't need to select a room mate
|
||||
|
Reference in New Issue
Block a user