Loads of changes
This commit is contained in:
@@ -43,11 +43,6 @@ function booking_travel_page() {
|
||||
|
||||
if ($travelform)
|
||||
{
|
||||
/*
|
||||
$output .= t("<p><br />Hi !firstname !lastname. Our records indicate you or your spouse have already completed the travel details form for !event. " .
|
||||
"Please contact us if you need change any of your travel details.</p>",
|
||||
array('!firstname' => $person->booking_firstname, '!lastname' => $person->booking_lastname, '!event' => $event->booking_eventname));
|
||||
*/
|
||||
$output = token_replace(variable_get('booking_travelform_completed_page'), $tokens);
|
||||
$return_array[] = array('paragraph' => array('#type' => 'markup', '#markup' => $output));
|
||||
}
|
||||
@@ -93,7 +88,7 @@ function travel_form($node, &$form_state, $inserting = FALSE, $nid = 0)
|
||||
{
|
||||
$data = $form_state['input'];
|
||||
//check for existing booking_person data to use in the form
|
||||
$person = db_query("SELECT booking_dietary, booking_medical_conditions, booking_bf_gf " .
|
||||
$person = db_query("SELECT booking_dietary, booking_medical_conditions, booking_bf_gf, booking_partner_id " .
|
||||
"FROM {booking_person} " .
|
||||
"WHERE nid = :nid ",
|
||||
array(':nid' => $nid))
|
||||
@@ -128,8 +123,8 @@ function travel_form($node, &$form_state, $inserting = FALSE, $nid = 0)
|
||||
'#type' => 'radios',
|
||||
'#title' => t('Transport Type'),
|
||||
'#options' => $transport_type_options,
|
||||
'#default_value' => !empty($data->booking_transport_type) ? $data->booking_transport_type : '',
|
||||
'#required' => TRUE,
|
||||
'#default_value' => !empty($data->booking_transport_type) ? $data->booking_transport_type : '0',
|
||||
//'#required' => TRUE,
|
||||
);
|
||||
|
||||
/*
|
||||
@@ -264,13 +259,18 @@ 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,
|
||||
);
|
||||
$form['requirements']['booking_bf_gf'] = array(
|
||||
'#type' => 'textfield',
|
||||
'#title' => t('Boyfriend/Girlfriend that you want to be in the same discussion groups as you.'),
|
||||
'#maxlength' => 180,
|
||||
'#required' => FALSE,
|
||||
'#default_value' => !empty($data->booking_bf_gf) ? $data->booking_bf_gf : $booking_bf_gf,
|
||||
);
|
||||
//only show this field if this person isn't married
|
||||
//TODO: Get their registration ID instead of their name
|
||||
if ((variable_get('booking_enable_combined_pricing', 0) == 1) && $person->booking_partner_id == 0)
|
||||
{
|
||||
$form['requirements']['booking_bf_gf'] = array(
|
||||
'#type' => 'textfield',
|
||||
'#title' => t('Boyfriend/Girlfriend that you want to be in the same discussion groups as you.'),
|
||||
'#maxlength' => 180,
|
||||
'#required' => FALSE,
|
||||
'#default_value' => !empty($data->booking_bf_gf) ? $data->booking_bf_gf : $booking_bf_gf,
|
||||
);
|
||||
}
|
||||
|
||||
if ($inserting == TRUE) {
|
||||
$form['submit'] = array(
|
||||
@@ -282,6 +282,13 @@ function travel_form($node, &$form_state, $inserting = FALSE, $nid = 0)
|
||||
}
|
||||
|
||||
function travel_form_validate($form, &$form_state) {
|
||||
watchdog('booking', 'Travel form: @info', array('@info' => var_export($form_state, TRUE)));
|
||||
//check that a transport choice has been made
|
||||
if (isset($form_state['booking_transport_type']) && $form_state['booking_transport_type'] == 0)
|
||||
{
|
||||
form_set_error('booking_transport_type', t('You must select a transport type.'));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function travel_form_submit($form, &$form_state) {
|
||||
@@ -333,26 +340,15 @@ function travel_form_submit($form, &$form_state) {
|
||||
//booking_person related fields
|
||||
$node->booking_dietary = $values['booking_dietary'];
|
||||
$node->booking_medical_conditions = $values['booking_medical_conditions'];
|
||||
$node->booking_bf_gf = $values['booking_bf_gf'];
|
||||
|
||||
$node->booking_bf_gf = empty($values['booking_bf_gf']) ? 'N/A' : $values['booking_bf_gf'];
|
||||
|
||||
//store the node
|
||||
$foo = node_submit(&$node);
|
||||
$blah = node_save($foo);
|
||||
|
||||
//send a confirmation email
|
||||
_booking_travelform_confirmation_email($node);
|
||||
|
||||
//TODO: Put this back in after testing
|
||||
/*
|
||||
//clear the temp id
|
||||
db_update('booking_person')
|
||||
->fields(array(
|
||||
'booking_tempid' => '',
|
||||
))
|
||||
->condition('nid', $values['personid'])
|
||||
->execute();
|
||||
|
||||
*/
|
||||
drupal_set_message("Thanks for submitting your travel details. You should receive a confirmation email shortly.", $type = 'status');
|
||||
$form_state['redirect'] = array('content/travel');
|
||||
|
||||
@@ -470,11 +466,11 @@ function travel_view($node, $view_mode) {
|
||||
global $event;
|
||||
|
||||
//fetch details about the person
|
||||
$person = db_query("SELECT booking_firstname, booking_lastname " .
|
||||
"FROM {booking_person} " .
|
||||
"WHERE nid = :nid ",
|
||||
array(':nid' => $node->booking_person_nid))
|
||||
->fetchObject();
|
||||
$person = db_query("SELECT p.*, t.* from {booking_person} p " .
|
||||
"left outer join {booking_travel} t on p.nid = t.booking_person_nid " .
|
||||
"where p.nid = :nid",
|
||||
array(':nid' => $node->booking_person_nid))
|
||||
->fetchObject();
|
||||
|
||||
$header = array('Attribute', 'Value');
|
||||
$rows = array();
|
||||
|
Reference in New Issue
Block a user