You are here

function _uc_stock_send_mail in Ubercart 5

Same name and namespace in other branches
  1. 8.4 uc_stock/uc_stock.module \_uc_stock_send_mail()
  2. 6.2 uc_stock/uc_stock.module \_uc_stock_send_mail()
  3. 7.3 uc_stock/uc_stock.module \_uc_stock_send_mail()

Emails administrator regarding any stock level thresholds hit.

Parameters

$order: The order object that tripped the threshold limit.

$product: The product object that is associated with the SKU.

$stock: The stock level object that contains the stock level and SKU.

Return value

The result of drupal_mail().

1 call to _uc_stock_send_mail()
uc_stock_action_decrement_stock in uc_stock/uc_stock_workflow.inc

File

uc_stock/uc_stock.module, line 406

Code

function _uc_stock_send_mail($order, $stock) {
  $token_filters = array(
    'global' => NULL,
    'order' => $order,
    'stock' => $stock,
  );
  $to = variable_get('uc_stock_threshold_notification_recipients', variable_get('uc_store_email', ini_get('sendmail_from')));
  $from = uc_store_email_from();
  $subject = variable_get('uc_stock_threshold_notification_subject', uc_get_message('uc_stock_threshold_notification_subject'));
  $subject = token_replace_multiple($subject, $token_filters);
  $body = variable_get('uc_stock_threshold_notification_message', uc_get_message('uc_stock_threshold_notification_message'));
  $body = token_replace_multiple($body, $token_filters);
  return drupal_mail('uc_stock', $to, $subject, $body, $from);
}