Add travel info to booking node view

This commit is contained in:
2014-02-28 17:17:18 +11:00
parent 2a773cee4d
commit 397448d47c
6 changed files with 55 additions and 20 deletions

View File

@@ -114,7 +114,7 @@ function booking_admin() {
$form['misc']['booking_auto_confirm_email'] = array ( $form['misc']['booking_auto_confirm_email'] = array (
'#type' => 'radios', '#type' => 'radios',
'#title' => t('Automatic Registration Email'), '#title' => t('Automatic Registration Email'),
'#description' => t('Automatically send a confirmation email when a user registers for an event? (If No, email will be sent when status manually changed from Not Coming to Paid). Recommended to set this to Yes if "Show on lists once booked in" is set to No.'), '#description' => t('Automatically send a confirmation email when a user registers for an event? (If No, email will be sent when status changed from Not Coming to Paid, either manually or via paypal plugin). Recommended to set this to Yes if "Show on lists once booked in" is set to No and paypal is not being used.'),
'#options' => array (0 => t('No'), t('Yes')), '#options' => array (0 => t('No'), t('Yes')),
'#default_value' => variable_get('booking_auto_confirm_email', 0), '#default_value' => variable_get('booking_auto_confirm_email', 0),
); );
@@ -240,6 +240,7 @@ function booking_manual_email()
$email_options_array['registration'] = 'Manual Registration'; $email_options_array['registration'] = 'Manual Registration';
$email_options_array['balance'] = 'Manual Balance Outstanding'; $email_options_array['balance'] = 'Manual Balance Outstanding';
$email_options_array['complete'] = 'Manual Payment Complete'; $email_options_array['complete'] = 'Manual Payment Complete';
$email_options_array['travelcomplete'] = 'Manual Travel Form Complete';
//add in the custom email types //add in the custom email types
for ($i = 1; $i <= CUSTOM_EMAIL_COUNT; $i++) for ($i = 1; $i <= CUSTOM_EMAIL_COUNT; $i++)
@@ -337,6 +338,11 @@ function booking_manual_email_submit($form, &$form_state) {
watchdog('booking', 'Processing a manual registration complete email to id @info', array ('@info' => $key)); watchdog('booking', 'Processing a manual registration complete email to id @info', array ('@info' => $key));
_booking_registration_email($key, true, true); _booking_registration_email($key, true, true);
} }
elseif ($form_state['values']['email-type'] == 'travelcomplete')
{
watchdog('booking', 'Processing a manual travelform complete email to id @info', array ('@info' => $key));
_booking_travelform_confirmation_email($key);
}
elseif (strpos($form_state['values']['email-type'], 'custom') !== false) elseif (strpos($form_state['values']['email-type'], 'custom') !== false)
{ {
watchdog('booking', 'Processing a @custom type email to id @info', array ('@custom' => $form_state['values']['email-type'], '@info' => $key)); watchdog('booking', 'Processing a @custom type email to id @info', array ('@custom' => $form_state['values']['email-type'], '@info' => $key));

View File

@@ -19,7 +19,7 @@
//load the node matching this id //load the node matching this id
$node = node_load($nid); $node = node_load($nid);
watchdog('booking', 'Sending notification email to !first !last', array('!first' => $node->booking_firstname, '!last' => $node->booking_lastname)); watchdog('booking', 'Sending registration email to !first !last', array('!first' => $node->booking_firstname, '!last' => $node->booking_lastname));
//waiting list has already been calculated, stored in node //waiting list has already been calculated, stored in node
$waiting_list = $node->booking_status == 2 ? TRUE : FALSE; $waiting_list = $node->booking_status == 2 ? TRUE : FALSE;
@@ -63,6 +63,8 @@
global $user; global $user;
$language = user_preferred_language($user); $language = user_preferred_language($user);
watchdog('booking', 'Sending notification 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 Registrations <!email>', array('!event' => $event->booking_eventname,
'!email' => variable_get('booking_contact_email', variable_get('site_mail', ini_get('sendmail_from'))) '!email' => variable_get('booking_contact_email', variable_get('site_mail', ini_get('sendmail_from')))

View File

@@ -606,7 +606,7 @@ function _booking_amount_owing($nid, $amount_paid = 0)
else else
{ {
$amount_owing = $amount_owing / (1 - 0.034); $amount_owing = $amount_owing / (1 - 0.034);
watchdog('booking', "This is an international registration."); //watchdog('booking', "This is an international registration.");
} }
} }
else else

View File

@@ -122,7 +122,7 @@ function _booking_process_payment($data) {
return; return;
} }
watchdog('booking', 'Adding payment for user with node id: !id; event id: !eid', array('!id' => $nid, '!eid' => $eid)); //watchdog('booking', 'Adding payment for user with node id: !id; event id: !eid', array('!id' => $nid, '!eid' => $eid));
$result = db_insert('booking_payment') $result = db_insert('booking_payment')
->fields(array( ->fields(array(
@@ -146,10 +146,6 @@ function _booking_process_payment($data) {
->execute(); ->execute();
//Get the person's info //Get the person's info
//$payment = db_query("SELECT booking_amount_paid, booking_status, booking_total_pay_reqd, booking_partner_id FROM {booking_person} where nid = :nid",
// array(':nid' => $nid))
// ->fetchObject();
$payment = db_select('booking_person', 'p') $payment = db_select('booking_person', 'p')
->condition('p.nid', $nid, '=') ->condition('p.nid', $nid, '=')
->fields('p', array('booking_amount_paid', 'booking_status', 'booking_total_pay_reqd', 'booking_partner_id')) ->fields('p', array('booking_amount_paid', 'booking_status', 'booking_total_pay_reqd', 'booking_partner_id'))
@@ -241,16 +237,22 @@ function _booking_process_payment($data) {
//send an email to the spouse //send an email to the spouse
_booking_registration_email($payment->booking_partner_id, TRUE); _booking_registration_email($payment->booking_partner_id, TRUE);
} }
/*
elseif (variable_get('booking_enable_combined_pricing', 0) == 1) elseif (variable_get('booking_enable_combined_pricing', 0) == 1)
{ {
watchdog('booking', 'Combined pricing is enabled, but this person has a partner id of !id.', array('!id' => $payment->booking_partner_id)); watchdog('booking', 'Combined pricing is enabled, but this person has a partner id of !id.', array('!id' => $payment->booking_partner_id));
} //end spouse check } //end spouse check
*/
} }
//if this was an initial payment we need to send a notification //if this was an initial payment we might need to send a notification
elseif ($balance_payment == FALSE) elseif ($balance_payment == FALSE)
{
//send a notification email if we didn't automatically send one earlier
if (variable_get('booking_auto_confirm_email', 0) == 0)
{ {
_booking_registration_email($nid, FALSE); _booking_registration_email($nid, FALSE);
} }
}
else //this person still has an outstanding balance so just send a confirmation email else //this person still has an outstanding balance so just send a confirmation email
{ {
watchdog('booking', 'This balance payment of !payment was insufficient for !id to completely pay the total outstanding of !outstanding.', watchdog('booking', 'This balance payment of !payment was insufficient for !id to completely pay the total outstanding of !outstanding.',

View File

@@ -1009,12 +1009,13 @@ function booking_form_submit($form, &$form_state) {
} }
} }
//check whether we should send an automatic email //check whether we should send an automatic email even though they haven't paid yet
if (variable_get('booking_auto_confirm_email', 0) == 1) if (variable_get('booking_auto_confirm_email', 0) == 1)
{ {
//send the person an email //send the person an email
_booking_registration_email($node->nid, FALSE, FALSE); _booking_registration_email($node->nid, FALSE, FALSE);
} else }
else
{ {
//just send a notification email //just send a notification email
_booking_regn_notifyonly_email($node, FALSE); _booking_regn_notifyonly_email($node, FALSE);
@@ -1047,7 +1048,7 @@ function booking_load($nodes) {
//add that data to the array of node references //add that data to the array of node references
foreach ($result as $record) foreach ($result as $record)
{ {
//watchdog('booking', "<pre>Loading node:\n@info</pre>", array('@info' => print_r( $record, true))); watchdog('booking', "<pre>Loading node:\n@info</pre>", array('@info' => print_r( $record, true)));
// run through each result row and add in the needed attributes // run through each result row and add in the needed attributes
foreach ($record as $key => $value) foreach ($record as $key => $value)
{ {
@@ -1491,6 +1492,20 @@ 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
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',
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',
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');
}
$rows[] = array(t('Temporary UUID:'), $node->booking_tempid); $rows[] = array(t('Temporary UUID:'), $node->booking_tempid);

View File

@@ -525,8 +525,10 @@ function booking_studygroups_calculate() {
$age = _booking_get_age_years($working_list[$person->booking_node_id]->booking_dob); $age = _booking_get_age_years($working_list[$person->booking_node_id]->booking_dob);
booking_assign_attendee_group($person->booking_node_id, $person->booking_session_id, 'male', $age, $working_list, $session_count); booking_assign_attendee_group($person->booking_node_id, $person->booking_session_id, 'male', $age, $working_list, $session_count);
//get any potential spouse info //get any potential spouse or boyfriend/girlfriend
$spouse_id = $working_list[$person->booking_node_id]->booking_partner_id; $spouse_id = $working_list[$person->booking_node_id]->booking_partner_id;
$bf_gf_id = $working_list[$person->booking_node_id]->booking_bf_gf_nid;
if ($spouse_id > 0) if ($spouse_id > 0)
{ {
drupal_set_message(t('Spouse with id !id assigned to session !session (currently with !num people).', drupal_set_message(t('Spouse with id !id assigned to session !session (currently with !num people).',
@@ -537,9 +539,16 @@ function booking_studygroups_calculate() {
$age = _booking_get_age_years($working_list[$spouse_id]->booking_dob); $age = _booking_get_age_years($working_list[$spouse_id]->booking_dob);
booking_assign_attendee_group($spouse_id, $person->booking_session_id, 'female', $age, $working_list, $session_count); booking_assign_attendee_group($spouse_id, $person->booking_session_id, 'female', $age, $working_list, $session_count);
} }
elseif ($bf_gf_id > 0)
//TODO: search for a boyfriend/girlfriend {
drupal_set_message(t('BF/GF with id !id assigned to session !session (currently with !num people).',
array('!id' => $spouse_id, '!session' => $person->booking_session_id,
'!num' => $session_count[$person->booking_session_id]['total'])
));
//allocate the boyfriend/girlfriend to the same session
booking_assign_attendee_group($bf_gf_id, $person->booking_session_id, $working_list[$bf_gf_id]->booking_gender == 'M' ? 'male' : 'female',
_booking_get_age_years($working_list[$bf_gf_id]->booking_dob), $working_list, $session_count);
}
} }
} }
@@ -658,6 +667,7 @@ function booking_studygroups_calculate() {
foreach($working_list as $person) foreach($working_list as $person)
{ {
//watchdog('booking', "<pre>Working list person:\n@info</pre>", array('@info' => print_r( $person, true)));
//TODO: a check to update existing records rather than inserting new one //TODO: a check to update existing records rather than inserting new one
// if already in $group_mapping then just run an update query here // if already in $group_mapping then just run an update query here