Fixes for values not set at initial registration form

This commit is contained in:
2015-03-09 15:32:05 +11:00
parent aad31946c6
commit a38d42b489
3 changed files with 57 additions and 46 deletions

View File

@@ -1253,45 +1253,52 @@ function _booking_details_email_summary($node) {
* Helper function to format travel form summary
*/
function _booking_travelform_email_summary($node) {
$output = '';
//look up the actual name if a boyfriend/girlfriend is defined
if ($node->booking_bf_gf_nid != 0)
{
$query = db_query("Select booking_firstname, booking_lastname from {booking_person} where nid = :nid",
array(':nid' => $node->booking_bf_gf_nid))
->fetchObject();
$bf_gf = $query->booking_firstname . " " . $query->booking_lastname;
}
else
$bf_gf = "N/A";
$rows = array();
$rows[] = t('Name: !first !last', array('!first' => $node->booking_firstname, '!last' => $node->booking_lastname));
$rows[] = t('Transport Type: !transport', array('!transport' => $node->booking_transport_type));
if ($node->booking_transport_type == 'Flying')
{
$rows[] = t('Catching the train to Study Week: !value', array('!value' => $node->booking_transport_from_morriset_reqd == 1 ? 'Yes' : 'No'));
$rows[] = t('Inbound Flight Number: ' . $node->booking_flightnum_inbound);
$rows[] = t('Flight Arrival: !date', array('!date' => format_date($node->booking_flight_datetime_inbound, 'custom', 'd/m/Y H:i')));
$rows[] = t('Outbound Flight Number: ' . $node->booking_flightnum_outbound);
$rows[] = t('Flight Departure: !date', array('!date' => format_date($node->booking_flight_datetime_outbound, 'custom', 'd/m/Y H:i')));
}
$rows[] = t('Accommodation before Study Week Required: !value', array('!value' => $node->booking_accom_before_reqd == 1 ? 'Yes' : 'No'));
$rows[] = t('Accommodation after Study Week Required: !value', array('!value' => $node->booking_accom_after_reqd == 1 ? 'Yes' : 'No'));
//fields from booking_person
if (variable_get('booking_enable_dietary', 0) == 1)
$rows[] = t('Special Dietary Requirements: ' . $node->booking_dietary);
if (variable_get('booking_enable_roommate', 0) == 1)
$rows[] = t('Special Medical Conditions: ' . $node->booking_medical_conditions);
$rows[] = t('Boyfriend/Girlfriend: ' . $bf_gf);
$rows[] = t('Requested room mate(s): ' . $node->booking_room_mate1);
global $event;
$rows = array();
if (! empty($node->tid))
{
//look up the actual name if a boyfriend/girlfriend is defined
if ($node->booking_bf_gf_nid != 0)
{
$query = db_query("Select booking_firstname, booking_lastname from {booking_person} where nid = :nid",
array(':nid' => $node->booking_bf_gf_nid))
->fetchObject();
$bf_gf = $query->booking_firstname . " " . $query->booking_lastname;
}
else
$bf_gf = "N/A";
foreach ($rows as $key => $value)
$rows[$key] = wordwrap($value);
$rows = array();
$rows[] = t('Name: !first !last', array('!first' => $node->booking_firstname, '!last' => $node->booking_lastname));
$rows[] = t('Transport Type: !transport', array('!transport' => $node->booking_transport_type));
if ($node->booking_transport_type == 'Flying')
{
$rows[] = t('Catching the train to Study Week: !value',
array('!value' => $node->booking_transport_from_morriset_reqd == 1 ? 'Yes' : 'No'));
$rows[] = t('Inbound Flight Number: ' . $node->booking_flightnum_inbound);
$rows[] = t('Flight Arrival: !date', array('!date' => format_date($node->booking_flight_datetime_inbound, 'custom', 'd/m/Y H:i')));
$rows[] = t('Outbound Flight Number: ' . $node->booking_flightnum_outbound);
$rows[] = t('Flight Departure: !date', array('!date' => format_date($node->booking_flight_datetime_outbound, 'custom', 'd/m/Y H:i')));
}
$rows[] = t('Accommodation before Study Week Required: !value', array('!value' => $node->booking_accom_before_reqd == 1 ? 'Yes' : 'No'));
$rows[] = t('Accommodation after Study Week Required: !value', array('!value' => $node->booking_accom_after_reqd == 1 ? 'Yes' : 'No'));
//fields from booking_person
if (variable_get('booking_enable_dietary', 0) == 1)
$rows[] = t('Special Dietary Requirements: ' . $node->booking_dietary);
if (variable_get('booking_enable_roommate', 0) == 1)
$rows[] = t('Special Medical Conditions: ' . $node->booking_medical_conditions);
$rows[] = t('Boyfriend/Girlfriend: ' . $bf_gf);
$rows[] = t('Requested room mate(s): ' . $node->booking_room_mate1);
foreach ($rows as $key => $value)
$rows[$key] = wordwrap($value);
}
return implode("\n", $rows);
}