You are here

function uc_order_comments_load in Ubercart 8.4

Same name and namespace in other branches
  1. 5 uc_order/uc_order.module \uc_order_comments_load()
  2. 6.2 uc_order/uc_order.module \uc_order_comments_load()
  3. 7.3 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()
AdminComments::buildForm in uc_order/src/Plugin/Ubercart/OrderPane/AdminComments.php
Form constructor.
AdminComments::view in uc_order/src/Plugin/Ubercart/OrderPane/AdminComments.php
Returns the contents of an order pane as a store administrator.
OrderComments::view in uc_order/src/Plugin/Ubercart/OrderPane/OrderComments.php
Returns the contents of an order pane as a store administrator.

File

uc_order/uc_order.module, line 270
Handles all things concerning Ubercart orders.

Code

function uc_order_comments_load($order_id, $admin = FALSE) {
  $table = $admin ? 'uc_order_admin_comments' : 'uc_order_comments';
  $connection = \Drupal::database();
  $query = $connection
    ->select($table, 'oc')
    ->fields('oc')
    ->condition('order_id', $order_id)
    ->orderBy('oc.created')
    ->orderBy('oc.comment_id');
  $comments = $query
    ->execute()
    ->fetchAll();
  return $comments;
}