function uc_order_log_changes in Ubercart 6.2
Same name and namespace in other branches
- 5 uc_order/uc_order.module \uc_order_log_changes()
- 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. Two formats are allowed:
- 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. These will be converted into a changed message.
- A pre-formatted string describing the change. This is useful for logging details like payments.
Return value
TRUE or FALSE depending on whether or not changes were logged.
7 calls to uc_order_log_changes()
- uc_order_edit_form_submit in uc_order/
uc_order.admin.inc - Form submission handler for uc_order_edit_form().
- uc_order_edit_products in uc_order/
uc_order.admin.inc - Populates the product add/edit div on the order edit screen.
- uc_order_mail_invoice_form_submit in uc_order/
uc_order.admin.inc - Form submission handler for uc_order_mail_invoice_form().
- uc_order_update_status in uc_order/
uc_order.module - Update an order's status as long as no one objects.
- uc_payment_delete in payment/
uc_payment/ uc_payment.module - Deletes a payment from the database.
File
- uc_order/
uc_order.module, line 1422
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;
}