diff --git a/booking.emails.inc b/booking.emails.inc index f494baa..80f889c 100644 --- a/booking.emails.inc +++ b/booking.emails.inc @@ -390,7 +390,7 @@ function _booking_travelform_confirmation_email($nid) watchdog('booking', 'Sending travelform confirmation email to !first !last', array('!first' => $node->booking_firstname, '!last' => $node->booking_lastname)); //calculate the from email address - $from = t('!event Registrations ', array('!event' => $event->booking_eventname, + $from = t('!event Travel ', array('!event' => $event->booking_eventname, '!email' => variable_get('booking_logistics_email', variable_get('site_mail', ini_get('sendmail_from'))) )); diff --git a/booking.helper.inc b/booking.helper.inc index e5d0aff..da2db51 100644 --- a/booking.helper.inc +++ b/booking.helper.inc @@ -702,6 +702,14 @@ function _booking_total_due($person) { $total_due = 0.00; + //check for a spouse + if ($person->booking_partner_id > 0 && variable_get('booking_enable_combined_pricing', 0) == 1) + { + //watchdog('booking', "Calculating total amount due for a married couple."); + + //TODO: figure out if anything special is needed here + } + //determine what rate this person needs to pay if ($person->booking_welfare_required == 'Y' || $person->booking_committee_member == 'Y') { diff --git a/booking.register.inc b/booking.register.inc index dd2f46c..e87534b 100644 --- a/booking.register.inc +++ b/booking.register.inc @@ -1276,7 +1276,7 @@ function _booking_update($node) { 'booking_payment_id' => $node->booking_payment_id, 'booking_total_pay_reqd' => $node->booking_total_pay_reqd, 'booking_amount_paid' => $node->booking_amount_paid, - 'booking_refund_due' => $node->booking_refund_due, + 'booking_refund_due' => $node->booking_refund_due == '' ? 0 : $node->booking_refund_due, 'booking_guardian_name' => $node->booking_guardian_name, 'booking_guardian_type' => $node->booking_guardian_type, 'booking_guardian_phone' => $node->booking_guardian_phone, @@ -1505,16 +1505,21 @@ function _booking_update($node) { ->execute() ->fetchObject(); + /* //check for early bird rate or full rate if (_booking_is_earlybird() == TRUE) $total_due = $price->booking_price; else $total_due = $price->booking_late_price; + */ + + //always set the payment required to the "early" price, since the late price is calculated dynamically if required + //update the person with the new total pay required db_update('booking_person') ->fields(array( - 'booking_total_pay_reqd' => $total_due, + 'booking_total_pay_reqd' => $price->booking_price, )) ->condition('nid', $node->nid) ->execute(); diff --git a/booking.travel.inc b/booking.travel.inc index 7b03009..720d46d 100644 --- a/booking.travel.inc +++ b/booking.travel.inc @@ -154,6 +154,7 @@ function travel_form($node, &$form_state, $inserting = FALSE, $nid = 0) $form['travel']['booking_flight_datetime_inbound'] = array( '#type' => 'date_select', '#title' => t('Date and Time of flight arrival into Sydney Airport'), + '#description' => t('Note: 24 hour time - 12:00 is midday'), '#default_value' => empty($data->booking_flight_datetime_inbound) ? '' : date("Y-m-d H:i:s", $data->booking_flight_datetime_inbound), '#date_format' => 'd/m/Y H:i', '#date_year_range' => '0:0', @@ -177,6 +178,7 @@ function travel_form($node, &$form_state, $inserting = FALSE, $nid = 0) $form['travel']['booking_flight_datetime_outbound'] = array( '#type' => 'date_select', '#title' => t('Date and Time of flight departure from Sydney Airport'), + '#description' => t('Note: 24 hour time - 12:00 is midday'), '#default_value' => empty($data->booking_flight_datetime_outbound) ? '' : date("Y-m-d H:i:s", $data->booking_flight_datetime_outbound), '#date_format' => 'd/m/Y H:i', '#date_year_range' => '0:0', @@ -349,6 +351,14 @@ function travel_form_validate($form, &$form_state) { //check to make sure flight info is entered if it is selected if (isset($form_state['values']['booking_transport_type']) && $form_state['values']['booking_transport_type'] == 'Flying') { + $arrival_time = _datetime_to_ts($form_state['values']['booking_flight_datetime_inbound']); + $departure_time = _datetime_to_ts($form_state['values']['booking_flight_datetime_outbound']); + + watchdog('booking', "Travel form flying arrival ts !arrival, departing ts !depart", array('!arrival' => $arrival_time, '!depart' => $departure_time)); + watchdog('booking', "
Travel form raw data:\n@info", + array('@info' => print_r( $form_state['values'], true))); + + if ( (! isset($form_state['values']['booking_flightnum_inbound'])) || ($form_state['values']['booking_flightnum_inbound'] == '') ) { form_set_error('booking_flightnum_inbound', @@ -395,7 +405,16 @@ function travel_form_validate($form, &$form_state) { watchdog('booking', "
Travel form missing flight departure time\n@info", array('@info' => print_r( $form_state['values'], true))); } - } + //check for arrival time after departure time + if (_datetime_to_ts($form_state['values']['booking_flight_datetime_inbound']) > _datetime_to_ts($form_state['values']['booking_flight_datetime_outbound'])) + { + form_set_error('booking_flight_datetime_inbound', + t('You have entered an arrival flight time that is after your departure flight time.') + ); + watchdog('booking', "
Travel form seems to have arrival flight after departure flight\n@info", array('@info' => print_r( $form_state['values'], true))); + } + + } //end check for flying }