add separate email for waiting list promotion fully paid

This commit is contained in:
Nathan Coad
2018-04-19 09:29:05 +10:00
parent 43a174db79
commit 50c464265d
2 changed files with 35 additions and 3 deletions

View File

@@ -390,7 +390,14 @@ function _booking_promoted_from_waitinglist_email($nid) {
$params['headers']['Bcc'] = BOOKING_EMAIL_DEV_NOTIFY; $params['headers']['Bcc'] = BOOKING_EMAIL_DEV_NOTIFY;
} }
$message_body = variable_get('booking_email_waitinglistpromotion'); if ($tokens['payment-required'] == 0) {
watchdog('booking_debug', 'This person has fully paid so sending Not sending promoted-from-waitinglist-fullypaid email.');
$message_body = variable_get('booking_email_waitinglistpromotion_fullypaid');
}
else {
$message_body = variable_get('booking_email_waitinglistpromotion');
}
//Use the value of the field if it is an array from a HTML textarea //Use the value of the field if it is an array from a HTML textarea
$message_body = isset($message_body['format']) ? $message_body['value'] : $message_body; $message_body = isset($message_body['format']) ? $message_body['value'] : $message_body;
$message_body = token_replace($message_body, $tokens); $message_body = token_replace($message_body, $tokens);

View File

@@ -148,12 +148,21 @@ function booking_emails_workflow_admin() {
'#format' => $form_format, '#format' => $form_format,
); );
$form['emails']['booking_email_waitinglistpromotion'] = array( $form['emails']['booking_email_waitinglistpromotion'] = array(
'#title' => t('Email text to send a person on the waiting list when a spot opens up for them'), '#title' => t('Email text to send a person on the waiting list when a spot opens up for them but they have an outstanding balance.'),
'#description' => t(''), '#description' => t(''),
'#default_value' => isset(variable_get('booking_email_waitinglistpromotion')['value']) ? variable_get('booking_email_waitinglistpromotion')['value'] : variable_get('booking_email_waitinglistpromotion', $booking_email_waitinglistpromotion), '#default_value' => isset(variable_get('booking_email_waitinglistpromotion')['value']) ? variable_get('booking_email_waitinglistpromotion')['value'] : variable_get('booking_email_waitinglistpromotion', $booking_email_waitinglistpromotion),
'#type' => $form_type, '#type' => $form_type,
'#format' => $form_format, '#format' => $form_format,
); );
$form['emails']['booking_email_waitinglistpromotion_fullypaid'] = array(
'#title' => t('Email text to send a person on the waiting list when a spot opens up for them and they have already fully paid.'),
'#description' => t(''),
'#default_value' => isset(variable_get('booking_email_waitinglistpromotion_fullypaid')['value']) ?
variable_get('booking_email_waitinglistpromotion_fullypaid')['value'] :
variable_get('booking_email_waitinglistpromotion_fullypaid', $booking_email_waitinglistpromotion_fullypaid),
'#type' => $form_type,
'#format' => $form_format,
);
$form['emails']['booking_email_notcoming_demotion_subject'] = array ( $form['emails']['booking_email_notcoming_demotion_subject'] = array (
'#type' => 'textfield', '#type' => 'textfield',
'#title' => t('Withdrawal Processed Email'), '#title' => t('Withdrawal Processed Email'),
@@ -445,6 +454,8 @@ function booking_manual_email_form($form, &$form_state)
$email_options_array['balance'] = 'Balance Outstanding Email'; $email_options_array['balance'] = 'Balance Outstanding Email';
$email_options_array['complete'] = 'Payment Complete Email'; $email_options_array['complete'] = 'Payment Complete Email';
$email_options_array['withdrawal'] = 'Withdrawal Processed Email'; $email_options_array['withdrawal'] = 'Withdrawal Processed Email';
$email_options_array['waitinglistpromotion'] = 'Position Available (Balance outstanding)';
$email_options_array['waitinglistpromotionfullypaid'] = 'Position Available (Fully Paid)';
$email_options_array['missedpayment'] = 'Missed Payment Email'; $email_options_array['missedpayment'] = 'Missed Payment Email';
$email_options_array['initialtravelrequired'] = 'Initial Travel Form Required Email'; $email_options_array['initialtravelrequired'] = 'Initial Travel Form Required Email';
$email_options_array['remindertravelrequired'] = 'Reminder Travel Form Required Email'; $email_options_array['remindertravelrequired'] = 'Reminder Travel Form Required Email';
@@ -684,7 +695,13 @@ function _booking_email_get_preview_callback($form, $form_state) {
break; break;
case "travelcomplete": case "travelcomplete":
$text = variable_get('booking_email_travel_complete_text'); $text = variable_get('booking_email_travel_complete_text');
break; break;
case "waitinglistpromotion":
$text = variable_get('booking_email_waitinglistpromotion');
break;
case "waitinglistpromotionfullypaid":
$text = variable_get('booking_email_waitinglistpromotion_fullypaid');
break;
} }
//handle custom email types //handle custom email types
if (strpos($emailtype, 'custom') !== false) { if (strpos($emailtype, 'custom') !== false) {
@@ -865,6 +882,14 @@ function booking_manual_email_form_submit($form, &$form_state) {
$message = t('Processing a manual missedpayment email to id @info', array ('@info' => $key)); $message = t('Processing a manual missedpayment email to id @info', array ('@info' => $key));
_booking_missedpayment_email($key); _booking_missedpayment_email($key);
} }
elseif ($form_state['values']['email-type'] == 'waitinglistpromotion') {
$message = t('Processing a manual waitinglistpromotion email to id @info', array ('@info' => $key));
_booking_promoted_from_waitinglist_email($key);
}
elseif ($form_state['values']['email-type'] == 'waitinglistpromotionfullypaid') {
$message = t('Processing a manual waitinglistpromotionfullypaid email to id @info', array ('@info' => $key));
_booking_promoted_from_waitinglist_email($key);
}
elseif (strpos($form_state['values']['email-type'], 'customlogistics') !== false) { elseif (strpos($form_state['values']['email-type'], 'customlogistics') !== false) {
$message = t('Processing a @custom type email from logistics to id @info', array ('@custom' => $form_state['values']['email-type'], '@info' => $key)); $message = t('Processing a @custom type email from logistics to id @info', array ('@custom' => $form_state['values']['email-type'], '@info' => $key));
_booking_custom_email($key, $form_state['values']['email-type'], 'logistics'); _booking_custom_email($key, $form_state['values']['email-type'], 'logistics');