--- mp_orders.module
+++ (clipboard)
@@ -201,8 +201,8 @@
$breadcrumb[] = l(t('Orders'), 'user/'. arg(1) .'/selling/fulfill');
$breadcrumb[] = l(t('Order @order', array('@order' => $order_id)), 'user/'. arg(1) .'/selling/fulfill/'. $order_id);
drupal_set_breadcrumb($breadcrumb);
- $output .= '
Ship To:
'. uc_order_pane_ship_to('view', $order) .'
Products:
'. drupal_render(tapir_get_table('op_products_view_table', $order->products)) .'
';
- if (user_access('write own order comments')) {
+ $output .= 'Ship To:
'. uc_order_pane_ship_to('view', $order) .'
Products:
'. drupal_render(tapir_get_table('op_products_view_table', $order)) .'
';
+ if (user_access('write own order comments')) {
$comments = mp_orders_load_comments($uid, $order_id);
$output .= 'Order Comments:
'. drupal_render(tapir_get_table('mp_orders_comments_view_table', $comments)) .'
';
$output .= 'Write Comment:
'. drupal_get_form('uc_order_view_update_form', $order) .'
';
@@ -449,48 +449,61 @@
* Overrides op_order_comments_view_table().
* Return a table of comments for an order.
*/
-function mp_orders_comments_view_table($op, $comments = null) {
- switch ($op) {
- case 'fields':
- $fields[] = array(
- 'name' => 'date',
- 'title' => t('Date'),
- 'weight' => 0,
- 'enabled' => TRUE,
- 'attributes' => array('class' => 'text-center')
+function mp_orders_comments_view_table($comments) {
+
+ $table = array(
+ '#type' => 'tapir_table',
+ '#attributes' => array('class' => 'order-pane-table'),
+ );
+
+ $table['#columns']['date'] = array(
+ 'cell' => array('data' => t('Date'), 'class' => 'text-center'),
+ 'weight' => 0,
+ );
+ $table['#columns']['notified'] = array(
+ 'cell' => t('Notified'),
+ 'weight' => 2,
+ );
+ $table['#columns']['status'] = array(
+ 'cell' => array('data' => t('Status'), 'class' => 'text-center'),
+ 'weight' => 3,
+ );
+ $table['#columns']['comment'] = array(
+ 'cell' => array('data' => t('Comment'), 'width' => '80%'),
+ 'weight' => 4,
+ );
+
+ if (is_array($comments)) {
+ foreach ($comments as $comment) {
+ $data = array();
+ $data['date'] = array(
+ '#value' => format_date($comment->created, 'custom', variable_get('uc_date_format_default', 'm/d/Y') .'<\b\r />g:i:s A'),
+ '#cell_attributes' => array('align' => 'center', 'nowrap' => 'true'),
);
- $fields[] = array(
- 'name' => 'notified',
- 'title' => t('Customer Notified'),
- 'weight' => 2,
- 'enabled' => TRUE
+ $data['notified'] = array(
+ '#value' => (($comment->notified == 1)
+ ? '
'
+ : '
'),
+ '#cell_attributes' => array('align' => 'center'),
);
- $fields[] = array(
- 'name' => 'comment',
- 'title' => t('Comment'),
- 'weight' => 4,
- 'enabled' => TRUE,
- 'attributes' => array('width' => '80%')
+ $data['status'] = array(
+ '#value' => $comment->title,
+ '#cell_attributes' => array('align' => 'center'),
);
- return $fields;
-
- case 'data':
- if (is_array($comments)) {
- foreach ($comments as $comment) {
- $data['date'][] = array('data' => format_date($comment->created, 'custom', variable_get('uc_date_format_default', 'm/d/Y') .'<\b\r />g:i:s A'), 'align' => 'center', 'nowrap' => 'true');
- $data['notified'][] = array('data' => (($comment->notified == 1) ? '
': '
'), 'align' => 'center');
- $data['comment'][] = array('data' => filter_xss_admin($comment->message));
- }
- }
- else {
- $data['comment'][] = array('data' => t('This order has no comments associated with it.'), 'colspan' => 10);
- }
- return $data;
-
- case 'attributes':
- $attributes = array('class' => 'order-pane-table');
- return $attributes;
+ $data['comment'] = array(
+ '#value' => filter_xss_admin($comment->message),
+ );
+ $table['#rows'][] = $data;
+ }
+ }
+ else {
+ $data['comment'] = array(
+ '#value' => t('This order has no comments associated with it.'),
+ '#cell_attributes' => array('colspan' => 'full'),
+ );
+ $table['#rows'][] = $data;
}
+ return $table;
}
function mp_orders_print_packingslip($user, $order) {