You are here

function uc_order_comments_load in Ubercart 6.2

Same name and namespace in other branches
  1. 8.4 uc_order/uc_order.module \uc_order_comments_load()
  2. 5 uc_order/uc_order.module \uc_order_comments_load()
  3. 7.3 uc_order/uc_order.module \uc_order_comments_load()

Return an array of comments or admin comments for an order.

2 calls to uc_order_comments_load()
uc_order_pane_admin_comments in uc_order/uc_order.order_pane.inc
Handles the "Admin Comments" order pane.
uc_order_pane_order_comments in uc_order/uc_order.order_pane.inc
Handles the "Order Comments" order pane.

File

uc_order/uc_order.module, line 1265

Code

function uc_order_comments_load($order_id, $admin = FALSE) {
  $comments = array();
  $join = '';
  if (!$admin) {
    $join = " LEFT JOIN {uc_order_statuses} AS os ON oc.order_status = os.order_status_id";
  }
  $result = db_query("SELECT * FROM {" . ($admin ? 'uc_order_admin_comments' : 'uc_order_comments') . "} AS oc" . $join . " WHERE oc.order_id = %d ORDER BY oc.created, oc.comment_id", $order_id);
  while ($comment = db_fetch_object($result)) {
    $comments[] = $comment;
  }
  return $comments;
}