You are here

function uc_order_log_changes in Ubercart 5

Same name and namespace in other branches
  1. 6.2 uc_order/uc_order.module \uc_order_log_changes()
  2. 7.3 uc_order/uc_order.module \uc_order_log_changes()

Log changes made to an order.

Parameters

$order_id: The ID of the order that was changed.

$changes: An array of changes with the keys being the name of the field changed and the values being associative arrays with the keys 'old' and 'new' to represent the old and new values of the field.

Return value

TRUE or FALSE depending on whether or not changes were logged.

9 calls to uc_order_log_changes()
uc_notify_checkout in uc_notify/uc_notify.module
Send new order confirmation e-mail to customer and/or administrator.
uc_notify_order_update in uc_notify/uc_notify.module
uc_order_edit_form_submit in uc_order/uc_order.module
uc_order_edit_products in uc_order/uc_order.module
Populate the product add/edit div on the order edit screen.
uc_order_mail_invoice_form_submit in uc_order/uc_order.module

... See full list

File

uc_order/uc_order.module, line 2765

Code

function uc_order_log_changes($order_id, $changes) {
  global $user;
  if (count($changes) == 0) {
    return FALSE;
  }
  foreach ($changes as $key => $value) {
    if (is_array($value)) {
      $items[] = t('@key changed from %old to %new.', array(
        '@key' => $key,
        '%old' => $value['old'],
        '%new' => $value['new'],
      ));
    }
    elseif (is_string($value)) {
      $items[] = $value;
    }
  }
  db_query("INSERT INTO {uc_order_log} (order_id, uid, changes, created) VALUES " . "(%d, %d, '%s', %d)", $order_id, $user->uid, theme('item_list', $items), time());
  return TRUE;
}