You are here

function uc_order_mail_invoice_form_submit in Ubercart 7.3

Same name and namespace in other branches
  1. 5 uc_order/uc_order.module \uc_order_mail_invoice_form_submit()
  2. 6.2 uc_order/uc_order.admin.inc \uc_order_mail_invoice_form_submit()

Form submission handler for uc_order_mail_invoice_form().

See also

uc_order_mail_invoice_form()

File

uc_order/uc_order.admin.inc, line 1268
Order administration menu items.

Code

function uc_order_mail_invoice_form_submit($form, &$form_state) {
  $order = uc_order_load($form_state['values']['order_id']);
  $recipient = check_plain($form_state['values']['email']);
  $params = array(
    'order' => $order,
  );
  $sent = drupal_mail('uc_order', 'invoice', $recipient, uc_store_mail_recipient_language($recipient), $params, uc_store_email_from());
  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,
    ));
  }
}