Some formatting of travel information
This commit is contained in:
@@ -1365,13 +1365,13 @@ function _booking_delete($node) {
|
|||||||
|
|
||||||
|
|
||||||
function booking_view($node, $view_mode) {
|
function booking_view($node, $view_mode) {
|
||||||
|
global $event;
|
||||||
|
$rows = array();
|
||||||
|
$travel_rows = array();
|
||||||
|
|
||||||
//calculate the price owed by this person
|
//calculate the price owed by this person
|
||||||
$price_lookup = db_query("SELECT booking_price_descrip, booking_price, booking_late_price FROM {booking_price} where pid = :pid ",
|
$price = _booking_is_earlybird() == true ? $node->booking_price : $node->booking_late_price;
|
||||||
array(':pid' => $node->booking_payment_id))
|
$payment_type = $node->booking_price_descrip . ' ($' . $price . ')';
|
||||||
->fetchObject();
|
|
||||||
$price = _booking_is_earlybird() == true ? $price_lookup->booking_price : $price_lookup->booking_late_price;
|
|
||||||
$payment_type = $price_lookup->booking_price_descrip . ' ($' . $price . ')';
|
|
||||||
|
|
||||||
//look up the actual name for a linked partner
|
//look up the actual name for a linked partner
|
||||||
if ($node->booking_partner_id != 0)
|
if ($node->booking_partner_id != 0)
|
||||||
@@ -1395,8 +1395,14 @@ function booking_view($node, $view_mode) {
|
|||||||
else
|
else
|
||||||
$bf_gf = "N/A";
|
$bf_gf = "N/A";
|
||||||
|
|
||||||
$header = array('Attribute', 'Value');
|
//$header = array('Attribute', 'Value');
|
||||||
$rows = array();
|
|
||||||
|
$header = array(
|
||||||
|
array('data' => t('Attribute'), 'width' => '40%'),
|
||||||
|
array('data' => t('Value'), 'width' => '60%'),
|
||||||
|
);
|
||||||
|
|
||||||
|
//now populate the table
|
||||||
$rows[] = array(t('Date/Time registered:'), t('!timestamp', array('!timestamp' => format_date($node->booking_timestamp, 'custom', 'd/m/Y H:i'))));
|
$rows[] = array(t('Date/Time registered:'), t('!timestamp', array('!timestamp' => format_date($node->booking_timestamp, 'custom', 'd/m/Y H:i'))));
|
||||||
$rows[] = array(t('Name:'), t('!first !last', array('!first' => $node->booking_firstname, '!last' => $node->booking_lastname)));
|
$rows[] = array(t('Name:'), t('!first !last', array('!first' => $node->booking_firstname, '!last' => $node->booking_lastname)));
|
||||||
$rows[] = array(t('Gender:'), t('!gender', array('!gender' => $node->booking_gender == 'M' ? 'Male' : 'Female')));
|
$rows[] = array(t('Gender:'), t('!gender', array('!gender' => $node->booking_gender == 'M' ? 'Male' : 'Female')));
|
||||||
@@ -1492,27 +1498,40 @@ function booking_view($node, $view_mode) {
|
|||||||
$rows[] = array(t('Mission related skills:'), t('!value', array('!value' => $skill_areas)));
|
$rows[] = array(t('Mission related skills:'), t('!value', array('!value' => $skill_areas)));
|
||||||
$rows[] = array(t('Previous Mission Experience:'), $node->booking_mission_experience_details);
|
$rows[] = array(t('Previous Mission Experience:'), $node->booking_mission_experience_details);
|
||||||
}
|
}
|
||||||
//print the travel info if it has been defined for this attendee
|
$rows[] = array(t('Temporary UUID:'), $node->booking_tempid);
|
||||||
|
|
||||||
|
//add the travel info if it has been defined for this attendee
|
||||||
if (! empty($node->tid))
|
if (! empty($node->tid))
|
||||||
{
|
{
|
||||||
$rows[] = array(t('Transport Type:'), $node->booking_transport_type);
|
$travel_rows[] = array(t('Transport Type:'), $node->booking_transport_type);
|
||||||
$rows[] = array(t('Catching the train to Study Week:'), $node->booking_transport_from_morriset_reqd == 1 ? 'Yes' : 'No');
|
$travel_rows[] = array(t('Catching the train to Study Week:'), $node->booking_transport_from_morriset_reqd == 1 ? 'Yes' : 'No');
|
||||||
$rows[] = array(t('Inbound Flight Number:'), $node->booking_flightnum_inbound == '' ? 'N/A' : $node->booking_flightnum_inbound);
|
$travel_rows[] = array(t('Inbound Flight Number:'), $node->booking_flightnum_inbound == '' ? 'N/A' : $node->booking_flightnum_inbound);
|
||||||
$rows[] = array(t('Flight Arrival:'), t('!date',
|
$travel_rows[] = array(t('Flight Arrival:'), t('!date',
|
||||||
array('!date' => $node->booking_flight_datetime_inbound == 0 ? 'N/A' : format_date($node->booking_flight_datetime_inbound, 'custom', 'd/m/Y H:i'))));
|
array('!date' => $node->booking_flight_datetime_inbound == 0 ? 'N/A' : format_date($node->booking_flight_datetime_inbound, 'custom', 'd/m/Y H:i'))));
|
||||||
$rows[] = array(t('Outbound Flight Number:'), $node->booking_flightnum_outbound == '' ? 'N/A' : $node->booking_flightnum_outbound);
|
$travel_rows[] = array(t('Outbound Flight Number:'), $node->booking_flightnum_outbound == '' ? 'N/A' : $node->booking_flightnum_outbound);
|
||||||
$rows[] = array(t('Flight Departure:'), t('!date',
|
$travel_rows[] = array(t('Flight Departure:'), t('!date',
|
||||||
array('!date' => $node->booking_flight_datetime_outbound == 0 ? 'N/A' : format_date($node->booking_flight_datetime_outbound, 'custom', 'd/m/Y H:i'))));
|
array('!date' => $node->booking_flight_datetime_outbound == 0 ? 'N/A' : format_date($node->booking_flight_datetime_outbound, 'custom', 'd/m/Y H:i'))));
|
||||||
$rows[] = array(t('Accommodation before Study Week Required:'), $node->booking_accom_before_reqd == 1 ? 'Yes' : 'No');
|
$travel_rows[] = array(t('Accommodation before Study Week Required:'), $node->booking_accom_before_reqd == 1 ? 'Yes' : 'No');
|
||||||
$rows[] = array(t('Accommodation after Study Week Required:'), $node->booking_accom_after_reqd == 1 ? 'Yes' : 'No');
|
$travel_rows[] = array(t('Accommodation after Study Week Required:'), $node->booking_accom_after_reqd == 1 ? 'Yes' : 'No');
|
||||||
}
|
|
||||||
|
|
||||||
$rows[] = array(t('Temporary UUID:'), $node->booking_tempid);
|
$node->content['travel-heading'] = array(
|
||||||
|
'#markup' => "<h2>Travel Details</h2>",
|
||||||
|
'#weight' => 2,
|
||||||
|
);
|
||||||
|
|
||||||
|
$node->content['travel-details'] = array(
|
||||||
|
'#markup' => theme('table', array('header' => $header, 'rows' => $travel_rows)),
|
||||||
|
'#weight' => 3,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
$node->content['details'] = array(
|
$node->content['details'] = array(
|
||||||
'#markup' => theme('table', array('header' => $header, 'rows' => $rows)),
|
'#markup' => theme('table', array('header' => $header, 'rows' => $rows)),
|
||||||
'#weight' => 1,
|
'#weight' => 1,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return $node;
|
return $node;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -306,17 +306,10 @@ function travel_form($node, &$form_state, $inserting = FALSE, $nid = 0)
|
|||||||
function travel_form_validate($form, &$form_state) {
|
function travel_form_validate($form, &$form_state) {
|
||||||
//watchdog('booking', "<pre>Travel form:\n@info</pre>", array('@info' => print_r( $form_state, true)));
|
//watchdog('booking', "<pre>Travel form:\n@info</pre>", array('@info' => print_r( $form_state, true)));
|
||||||
|
|
||||||
//check that a transport choice has been made
|
|
||||||
/*
|
|
||||||
if ((! isset($form_state['booking_transport_type'])) || $form_state['booking_transport_type'] == NULL)
|
|
||||||
{
|
|
||||||
form_set_error('booking_transport_type', t('You must select a transport type.'));
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
//verify boyfriend/girlfriend id is in the correct format
|
//verify boyfriend/girlfriend id is in the correct format
|
||||||
if (isset($form_state['values']['booking_bf_gf_nid']) && $form_state['values']['booking_bf_gf_nid'] != '')
|
if (isset($form_state['values']['booking_bf_gf_nid']) && $form_state['values']['booking_bf_gf_nid'] != '')
|
||||||
{
|
{
|
||||||
|
//make sure this is a node id not something else
|
||||||
if (! is_numeric($form_state['values']['booking_bf_gf_nid'] ))
|
if (! is_numeric($form_state['values']['booking_bf_gf_nid'] ))
|
||||||
{
|
{
|
||||||
form_set_error('booking_bf_gf_nid',
|
form_set_error('booking_bf_gf_nid',
|
||||||
@@ -325,6 +318,14 @@ function travel_form_validate($form, &$form_state) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//don't allow them to specify their own node id
|
||||||
|
if ($form_state['values']['personid'] == $form_state['values']['booking_bf_gf_nid'])
|
||||||
|
{
|
||||||
|
form_set_error('booking_bf_gf_nid',
|
||||||
|
t('You have entered your own registration id. Please ensure you enter only the registration reference number your boyfriend/girlfriend received via email when registering, not your own registration id.')
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
//check that the partner exists
|
//check that the partner exists
|
||||||
$partner = db_query("SELECT person.nid " .
|
$partner = db_query("SELECT person.nid " .
|
||||||
"FROM {booking_person} person " .
|
"FROM {booking_person} person " .
|
||||||
|
Reference in New Issue
Block a user