You are here

function uc_order_comments_load in Ubercart 7.3

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. 6.2 uc_order/uc_order.module \uc_order_comments_load()

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

3 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_callback in uc_order/uc_order.api.php
Builds and processes an order pane defined by hook_uc_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 1338

Code

function uc_order_comments_load($order_id, $admin = FALSE) {
  $table = $admin ? 'uc_order_admin_comments' : 'uc_order_comments';
  $query = db_select($table, 'oc')
    ->fields('oc')
    ->condition('order_id', $order_id)
    ->orderBy('oc.created')
    ->orderBy('oc.comment_id');
  if (!$admin) {
    $query
      ->leftJoin('uc_order_statuses', 'os', 'oc.order_status = os.order_status_id');
    $query
      ->fields('os');
  }
  $comments = $query
    ->execute()
    ->fetchAll();
  return $comments;
}