Travel form bugfixes
This commit is contained in:
@@ -399,7 +399,8 @@ function booking_schema() {
|
||||
//relationships
|
||||
'booking_married' => array('type' => 'varchar', 'length' => '1', 'not null' => TRUE),
|
||||
'booking_partner_name' => array('type' => 'varchar', 'length' => '100', 'not null' => FALSE),
|
||||
'booking_partner_id' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => FALSE, 'disp-width' => '10'),
|
||||
'booking_partner_id' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => FALSE, 'disp-width' => '10'),
|
||||
'booking_bf_gf' => array('type' => 'varchar', 'length' => '100', 'not null' => FALSE),
|
||||
'booking_room_mate1' => array('type' => 'varchar', 'length' => '200', 'not null' => FALSE),
|
||||
'booking_room_mate2' => array('type' => 'varchar', 'length' => '200', 'not null' => FALSE),
|
||||
//helping areas
|
||||
@@ -496,6 +497,26 @@ function booking_schema() {
|
||||
),
|
||||
'primary key' => array('vid'),
|
||||
);
|
||||
|
||||
$schema['booking_travel'] = array(
|
||||
'fields' => array(
|
||||
'tid' => array('type' => 'serial', 'unsigned' => TRUE, 'not null' => TRUE, 'disp-width' => '10'),
|
||||
'booking_person_nid' => array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'disp-width' => '10'),
|
||||
'booking_transport_type' => array('type' => 'varchar', 'length' => '100', 'not null' => FALSE),
|
||||
'booking_transport_from_morriset_reqd' => array('type' => 'varchar', 'length' => '1', 'not null' => FALSE),
|
||||
'booking_transport_to_morriset_reqd' => array('type' => 'varchar', 'length' => '1', 'not null' => FALSE),
|
||||
'booking_flightnum_inbound' => array('type' => 'varchar', 'length' => '100', 'not null' => FALSE),
|
||||
'booking_flight_datetime_inbound' => array('type' => 'int', 'not null' => FALSE, 'disp-width' => '11'),
|
||||
'booking_flightnum_outbound' => array('type' => 'varchar', 'length' => '100', 'not null' => FALSE),
|
||||
'booking_flight_datetime_outbound' => array('type' => 'int', 'not null' => FALSE, 'disp-width' => '11'),
|
||||
'booking_accom_before_reqd' => array('type' => 'varchar', 'length' => '1', 'not null' => FALSE),
|
||||
'booking_accom_before_staying_with' => array('type' => 'varchar', 'length' => '200', 'not null' => FALSE),
|
||||
'booking_accom_after_reqd' => array('type' => 'varchar', 'length' => '1', 'not null' => FALSE),
|
||||
'booking_accom_after_staying_with' => array('type' => 'varchar', 'length' => '200', 'not null' => FALSE),
|
||||
),
|
||||
'primary key' => array('tid'),
|
||||
);
|
||||
|
||||
|
||||
return $schema;
|
||||
}
|
||||
|
@@ -55,6 +55,8 @@ module_load_include('inc', 'booking', 'booking.import_data');
|
||||
module_load_include('inc', 'booking', 'booking.variety');
|
||||
// Load the include for study group configuration
|
||||
module_load_include('inc', 'booking', 'booking.studygroups');
|
||||
// Load the include for the travel form
|
||||
module_load_include('inc', 'booking', 'booking.travel');
|
||||
|
||||
function booking_init() {
|
||||
date_default_timezone_set(TIMEZONE);
|
||||
|
@@ -289,11 +289,17 @@ $booking_registration_intro_text = variable_get('booking_registration_intro_text
|
||||
'#collapsed' => TRUE,
|
||||
);
|
||||
$form['travel']['booking_travelform_page'] = array(
|
||||
'#title' => t('Text to use at the start of the travel form.'),
|
||||
'#title' => t('Text to use at the start of the travel form for a non-married person.'),
|
||||
'#type' => 'textarea',
|
||||
'#description' => t(''),
|
||||
'#default_value' => variable_get('booking_travelform_page', ''),
|
||||
);
|
||||
$form['travel']['booking_travelform_married_page'] = array(
|
||||
'#title' => t('Text to use at the start of the travel form for a married couple. Only applies if combined pricing is enabled.'),
|
||||
'#type' => 'textarea',
|
||||
'#description' => t(''),
|
||||
'#default_value' => variable_get('booking_travelform_married_page', ''),
|
||||
);
|
||||
$form['travel']['booking_travelform_completed_page'] = array(
|
||||
'#title' => t('Text to use on the travel form if the form has already been submitted.'),
|
||||
'#type' => 'textarea',
|
||||
|
@@ -16,11 +16,18 @@ function booking_travel_page() {
|
||||
}
|
||||
|
||||
//fetch details about the person
|
||||
/*
|
||||
$person = db_query("SELECT * FROM {booking_person} " .
|
||||
"WHERE booking_tempid = :tempid ",
|
||||
array(':tempid' => arg(1)))
|
||||
->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.booking_event_id = :eid AND p.booking_tempid = :tempid",
|
||||
array(':tempid' => arg(1), ':eid' => $event->eid))
|
||||
->fetchObject();
|
||||
|
||||
if ($person)
|
||||
{
|
||||
$tokens = booking_define_personspecific_tokens($person);
|
||||
@@ -36,26 +43,26 @@ 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));
|
||||
}
|
||||
//they haven't submitted a travel form yet
|
||||
else
|
||||
{
|
||||
$output = token_replace(variable_get('booking_travelform_page'), $tokens);
|
||||
|
||||
|
||||
//check for married couple
|
||||
//if ($person->booking_partner_id > 0) {
|
||||
// $output .= t("<p><br />Hi Mr and Mrs !lastname. Please enter your travel details for !event below.</p>",
|
||||
// array('!lastname' => $person->booking_lastname, '!event' => $event->booking_eventname));
|
||||
//}
|
||||
//else {
|
||||
// $output .= t("<p><br />Hi !firstname !lastname. Please enter your travel details for !event below.</p>",
|
||||
// array('!firstname' => $person->booking_firstname, '!lastname' => $person->booking_lastname, '!event' => $event->booking_eventname));
|
||||
//}
|
||||
//Output different text if this is for a married couple
|
||||
if ((variable_get('booking_enable_combined_pricing', 0) == 1) && $person->booking_partner_id > 0)
|
||||
{
|
||||
$output = token_replace(variable_get('booking_travelform_married_page'), $tokens);
|
||||
}
|
||||
else
|
||||
{
|
||||
$output = token_replace(variable_get('booking_travelform_page'), $tokens);
|
||||
}
|
||||
|
||||
$return_array[] = array('paragraph' => array('#type' => 'markup', '#markup' => $output));
|
||||
$return_array[] = array('form' => drupal_get_form('travel_form', true, $person->nid));
|
||||
|
Reference in New Issue
Block a user