diff --git a/booking.register.inc b/booking.register.inc index f6c8f68..57e2c5b 100644 --- a/booking.register.inc +++ b/booking.register.inc @@ -1365,13 +1365,13 @@ function _booking_delete($node) { function booking_view($node, $view_mode) { - + global $event; + $rows = array(); + $travel_rows = array(); + //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 ", - array(':pid' => $node->booking_payment_id)) - ->fetchObject(); - $price = _booking_is_earlybird() == true ? $price_lookup->booking_price : $price_lookup->booking_late_price; - $payment_type = $price_lookup->booking_price_descrip . ' ($' . $price . ')'; + $price = _booking_is_earlybird() == true ? $node->booking_price : $node->booking_late_price; + $payment_type = $node->booking_price_descrip . ' ($' . $price . ')'; //look up the actual name for a linked partner if ($node->booking_partner_id != 0) @@ -1395,8 +1395,14 @@ function booking_view($node, $view_mode) { else $bf_gf = "N/A"; - $header = array('Attribute', 'Value'); - $rows = array(); + //$header = array('Attribute', 'Value'); + + $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('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'))); @@ -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('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)) { - $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'); - $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('Transport Type:'), $node->booking_transport_type); + $travel_rows[] = array(t('Catching the train to Study Week:'), $node->booking_transport_from_morriset_reqd == 1 ? 'Yes' : 'No'); + $travel_rows[] = array(t('Inbound Flight Number:'), $node->booking_flightnum_inbound == '' ? 'N/A' : $node->booking_flightnum_inbound); + $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')))); - $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('Outbound Flight Number:'), $node->booking_flightnum_outbound == '' ? 'N/A' : $node->booking_flightnum_outbound); + $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')))); - $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 before Study Week Required:'), $node->booking_accom_before_reqd == 1 ? 'Yes' : 'No'); + $travel_rows[] = array(t('Accommodation after Study Week Required:'), $node->booking_accom_after_reqd == 1 ? 'Yes' : 'No'); + + $node->content['travel-heading'] = array( + '#markup' => "
Travel form:\n@info", 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 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'] )) { 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 $partner = db_query("SELECT person.nid " . "FROM {booking_person} person " .