Add comment field and tweak email logging
This commit is contained in:
@@ -143,15 +143,19 @@ function booking_manual_email()
|
||||
|
||||
function booking_manual_email_submit($form, &$form_state) {
|
||||
$counter = 0;
|
||||
$update_messages = array();
|
||||
$checkboxes = $form_state['values']['table']; //$values['booking_price_active'];
|
||||
//watchdog('booking', 'Formstate when setting buttons: @info', array ('@info' => var_export($form_state['values'], TRUE)));
|
||||
//watchdog('booking', 'Checkboxes when setting buttons: @info', array ('@info' => var_export($checkboxes, TRUE)));
|
||||
|
||||
foreach($checkboxes as $key => $value)
|
||||
{
|
||||
$message = "";
|
||||
|
||||
//do a sanity check on the key => value pair from the form submission
|
||||
if (is_numeric($key) && $value != 0)
|
||||
{
|
||||
//check if they exist in the database first
|
||||
//check the person exists in the database
|
||||
$person = db_query("SELECT person.nid " .
|
||||
"FROM {booking_person} person " .
|
||||
"WHERE nid = :nid",
|
||||
@@ -162,50 +166,63 @@ function booking_manual_email_submit($form, &$form_state) {
|
||||
{
|
||||
if ($form_state['values']['email-type'] == 'registration')
|
||||
{
|
||||
watchdog('booking', 'Processing a manual registration email to id @info', array ('@info' => $key));
|
||||
$message = t('Processing a manual registration email to id @info', array ('@info' => $key));
|
||||
//watchdog('booking', 'Processing a manual registration email to id @info', array ('@info' => $key));
|
||||
_booking_registration_email($key, false, true);
|
||||
}
|
||||
elseif ($form_state['values']['email-type'] == 'travelrequired')
|
||||
{
|
||||
watchdog('booking', 'Processing a manual travel form request email to id @info', array ('@info' => $key));
|
||||
$message = t('Processing a manual travel form request email to id @info', array ('@info' => $key));
|
||||
//watchdog('booking', 'Processing a manual travel form request email to id @info', array ('@info' => $key));
|
||||
_booking_travelform_request_email($key);
|
||||
}
|
||||
elseif ($form_state['values']['email-type'] == 'balance')
|
||||
{
|
||||
watchdog('booking', 'Processing a manual outstanding balance email to id @info', array ('@info' => $key));
|
||||
$message = t('Processing a manual outstanding balance email to id @info', array ('@info' => $key));
|
||||
//watchdog('booking', 'Processing a manual outstanding balance email to id @info', array ('@info' => $key));
|
||||
_booking_balance_payment_email($key);
|
||||
}
|
||||
elseif ($form_state['values']['email-type'] == 'complete')
|
||||
{
|
||||
watchdog('booking', 'Processing a manual registration complete email to id @info', array ('@info' => $key));
|
||||
$message = t('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);
|
||||
}
|
||||
elseif ($form_state['values']['email-type'] == 'travelcomplete')
|
||||
{
|
||||
watchdog('booking', 'Processing a manual travelform complete email to id @info', array ('@info' => $key));
|
||||
$message = t('Processing a manual travelform complete email to id @info', array ('@info' => $key));
|
||||
//watchdog('booking', 'Processing a manual travelform complete email to id @info', array ('@info' => $key));
|
||||
_booking_travelform_confirmation_email($key);
|
||||
}
|
||||
elseif ($form_state['values']['email-type'] == 'withdrawal')
|
||||
{
|
||||
watchdog('booking', 'Processing a manual withdrawal email to id @info', array ('@info' => $key));
|
||||
$message = t('Processing a manual withdrawal email to id @info', array ('@info' => $key));
|
||||
//watchdog('booking', 'Processing a manual withdrawal email to id @info', array ('@info' => $key));
|
||||
_booking_demoted_to_notcoming_email($key);
|
||||
}
|
||||
elseif ($form_state['values']['email-type'] == 'missedpayment')
|
||||
{
|
||||
watchdog('booking', 'Processing a manual missedpayment email to id @info', array ('@info' => $key));
|
||||
$message = t('Processing a manual missedpayment email to id @info', array ('@info' => $key));
|
||||
//watchdog('booking', 'Processing a manual missedpayment email to id @info', array ('@info' => $key));
|
||||
_booking_missedpayment_email($key);
|
||||
}
|
||||
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));
|
||||
$message = t('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));
|
||||
_booking_custom_email($key, $form_state['values']['email-type']);
|
||||
}
|
||||
//increase the counter of people we've emailed
|
||||
$counter++;
|
||||
//store info about the email
|
||||
$update_messages[] = $message;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
drupal_set_message("Sent manual email for $counter people.", 'status', FALSE);
|
||||
$final_message = "Sent manual email for $counter people.";
|
||||
drupal_set_message($final_message, 'status', FALSE);
|
||||
watchdog('booking', "<pre>" . $final_message . "\n" . implode("\n", $update_messages) . "</pre>");
|
||||
//watchdog('booking', "Sent manual email for $counter people.");
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user