Tweaks for trave lform
This commit is contained in:
@@ -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));
|
watchdog('booking', 'Sending travelform confirmation email to !first !last', array('!first' => $node->booking_firstname, '!last' => $node->booking_lastname));
|
||||||
|
|
||||||
//calculate the from email address
|
//calculate the from email address
|
||||||
$from = t('!event Registrations <!email>', array('!event' => $event->booking_eventname,
|
$from = t('!event Travel <!email>', array('!event' => $event->booking_eventname,
|
||||||
'!email' => variable_get('booking_logistics_email', variable_get('site_mail', ini_get('sendmail_from')))
|
'!email' => variable_get('booking_logistics_email', variable_get('site_mail', ini_get('sendmail_from')))
|
||||||
));
|
));
|
||||||
|
|
||||||
|
@@ -702,6 +702,14 @@ function _booking_total_due($person)
|
|||||||
{
|
{
|
||||||
$total_due = 0.00;
|
$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
|
//determine what rate this person needs to pay
|
||||||
if ($person->booking_welfare_required == 'Y' || $person->booking_committee_member == 'Y')
|
if ($person->booking_welfare_required == 'Y' || $person->booking_committee_member == 'Y')
|
||||||
{
|
{
|
||||||
|
@@ -1276,7 +1276,7 @@ function _booking_update($node) {
|
|||||||
'booking_payment_id' => $node->booking_payment_id,
|
'booking_payment_id' => $node->booking_payment_id,
|
||||||
'booking_total_pay_reqd' => $node->booking_total_pay_reqd,
|
'booking_total_pay_reqd' => $node->booking_total_pay_reqd,
|
||||||
'booking_amount_paid' => $node->booking_amount_paid,
|
'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_name' => $node->booking_guardian_name,
|
||||||
'booking_guardian_type' => $node->booking_guardian_type,
|
'booking_guardian_type' => $node->booking_guardian_type,
|
||||||
'booking_guardian_phone' => $node->booking_guardian_phone,
|
'booking_guardian_phone' => $node->booking_guardian_phone,
|
||||||
@@ -1505,16 +1505,21 @@ function _booking_update($node) {
|
|||||||
->execute()
|
->execute()
|
||||||
->fetchObject();
|
->fetchObject();
|
||||||
|
|
||||||
|
/*
|
||||||
//check for early bird rate or full rate
|
//check for early bird rate or full rate
|
||||||
if (_booking_is_earlybird() == TRUE)
|
if (_booking_is_earlybird() == TRUE)
|
||||||
$total_due = $price->booking_price;
|
$total_due = $price->booking_price;
|
||||||
else
|
else
|
||||||
$total_due = $price->booking_late_price;
|
$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
|
//update the person with the new total pay required
|
||||||
db_update('booking_person')
|
db_update('booking_person')
|
||||||
->fields(array(
|
->fields(array(
|
||||||
'booking_total_pay_reqd' => $total_due,
|
'booking_total_pay_reqd' => $price->booking_price,
|
||||||
))
|
))
|
||||||
->condition('nid', $node->nid)
|
->condition('nid', $node->nid)
|
||||||
->execute();
|
->execute();
|
||||||
|
@@ -154,6 +154,7 @@ function travel_form($node, &$form_state, $inserting = FALSE, $nid = 0)
|
|||||||
$form['travel']['booking_flight_datetime_inbound'] = array(
|
$form['travel']['booking_flight_datetime_inbound'] = array(
|
||||||
'#type' => 'date_select',
|
'#type' => 'date_select',
|
||||||
'#title' => t('Date and Time of flight arrival into Sydney Airport'),
|
'#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),
|
'#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_format' => 'd/m/Y H:i',
|
||||||
'#date_year_range' => '0:0',
|
'#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(
|
$form['travel']['booking_flight_datetime_outbound'] = array(
|
||||||
'#type' => 'date_select',
|
'#type' => 'date_select',
|
||||||
'#title' => t('Date and Time of flight departure from Sydney Airport'),
|
'#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),
|
'#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_format' => 'd/m/Y H:i',
|
||||||
'#date_year_range' => '0:0',
|
'#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
|
//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')
|
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', "<pre>Travel form raw data:\n@info</pre>",
|
||||||
|
array('@info' => print_r( $form_state['values'], true)));
|
||||||
|
|
||||||
|
|
||||||
if ( (! isset($form_state['values']['booking_flightnum_inbound'])) || ($form_state['values']['booking_flightnum_inbound'] == '') )
|
if ( (! isset($form_state['values']['booking_flightnum_inbound'])) || ($form_state['values']['booking_flightnum_inbound'] == '') )
|
||||||
{
|
{
|
||||||
form_set_error('booking_flightnum_inbound',
|
form_set_error('booking_flightnum_inbound',
|
||||||
@@ -395,8 +405,17 @@ function travel_form_validate($form, &$form_state) {
|
|||||||
watchdog('booking', "<pre>Travel form missing flight departure time\n@info</pre>", array('@info' => print_r( $form_state['values'], true)));
|
watchdog('booking', "<pre>Travel form missing flight departure time\n@info</pre>", 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', "<pre>Travel form seems to have arrival flight after departure flight\n@info</pre>", array('@info' => print_r( $form_state['values'], true)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} //end check for flying
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function travel_form_submit($form, &$form_state) {
|
function travel_form_submit($form, &$form_state) {
|
||||||
|
Reference in New Issue
Block a user