function uc_order_mail_invoice_form_submit in Ubercart 5
Same name and namespace in other branches
- 6.2 uc_order/uc_order.admin.inc \uc_order_mail_invoice_form_submit()
- 7.3 uc_order/uc_order.admin.inc \uc_order_mail_invoice_form_submit()
File
- uc_order/
uc_order.module, line 2080
Code
function uc_order_mail_invoice_form_submit($form_id, $form_values) {
$order = uc_order_load($form_values['order_id']);
if ($order === FALSE) {
drupal_set_message(t('Order @order_id does not exist.', array(
'@order_id' => $order_id,
)));
drupal_goto('admin/store/orders');
}
$output = uc_order_load_invoice($order, 'admin-mail', variable_get('uc_cust_order_invoice_template', 'customer'));
$recipient = check_plain($form_values['email']);
$sent = drupal_mail('invoice', $recipient, t('Your Order Invoice'), $output, uc_store_email_from(), array(
'Content-Type' => 'text/html; charset=UTF-8; format=flowed',
));
if (!$sent) {
drupal_set_message(t('E-mail failed.'));
}
else {
$message = t('Invoice e-mailed to @email.', array(
'@email' => $recipient,
));
drupal_set_message($message);
uc_order_log_changes($order->order_id, array(
$message,
));
}
}