Commit 4cda3c67 authored by David Metzler's avatar David Metzler
Browse files

#2363295 Email array fix

parent 0f0b7a73
...@@ -63,19 +63,19 @@ class FrxEmailMergeDoc extends FrxDocument { ...@@ -63,19 +63,19 @@ class FrxEmailMergeDoc extends FrxDocument {
} }
$count = count($docs); $count = count($docs);
if ($count) { if ($count) {
$form = drupal_get_form('forena_confirm_email', $emails, $count, $prompt_subject, $prompt_body); $content = drupal_get_form('forena_confirm_email', $emails, $count, $prompt_subject, $prompt_body);
$output = drupal_render($form);
} }
else { else {
drupal_set_message(t('No mail merge information in report. Displaying report instead.'), 'error'); drupal_set_message(t('No mail merge information in report. Displaying report instead.'), 'error');
$output = $body;
}
$content = array( $content = array(
'content' => array('#markup' => $output), 'content' => array('#markup' => $body),
); );
}
return $content; return $content;
} }
public function output(&$output) {
return FALSE;
}
} }
\ No newline at end of file
...@@ -237,6 +237,7 @@ function forena_confirm_email_submit($form, &$form_state) { ...@@ -237,6 +237,7 @@ function forena_confirm_email_submit($form, &$form_state) {
$test_send = @$form_state['values']['send']=='test' ? TRUE : variable_get('forena_email_override', FALSE); $test_send = @$form_state['values']['send']=='test' ? TRUE : variable_get('forena_email_override', FALSE);
$max = (integer)$form_state['values']['max']; $max = (integer)$form_state['values']['max'];
$i = 0; $i = 0;
$sent = 0;
if (isset($form_state['values']['body']['value'])) { if (isset($form_state['values']['body']['value'])) {
$body = check_markup($form_state['values']['body']['value'],$form_state['values']['body']['format']); $body = check_markup($form_state['values']['body']['value'],$form_state['values']['body']['format']);
} }
...@@ -256,9 +257,18 @@ function forena_confirm_email_submit($form, &$form_state) { ...@@ -256,9 +257,18 @@ function forena_confirm_email_submit($form, &$form_state) {
// Remove bcc and cc // Remove bcc and cc
unset($doc['parms']['headers']); unset($doc['parms']['headers']);
} }
if ($i <= $max) drupal_mail('forena', 'mailmerge', $to, language_default(), $doc['parms'], $from, TRUE); if ($i <= $max) {
$sent++;
drupal_mail('forena', 'mailmerge', $to, language_default(), $doc['parms'], $from, TRUE);
} }
}
drupal_set_message(t('Sent %count messages ', array('%count' => $sent)));
if ($form_state['values']['send'] == 'test') {
$form_state['rebuild'] = TRUE; $form_state['rebuild'] = TRUE;
}
else {
$form_state['redirect'] = 'forena';
}
} }
/** /**
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment