Time of order comments is hardcoded to "g:i:s A" in functions op_order_comments_view_table and op_admin_comments_view_table, in uc_order.order_pane.inc.

This gives incorrect display for countries that are not using US time format.

Correct solutions would be to add a time format in UC settings, or to use the date_format_short value from Drupal settings, and replace the dash with line a break.

Since there is an Ubercart setting for date format, I think that first solution is better.

      $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'),
      );
      $data['date'] = array(
        '#value' => format_date(
          $comment->created, 
          'custom', 
          variable_get('uc_date_format_default', 'm/d/Y') .'<\b\r />'. variable_get('uc_time_format_default', 'g:i:s A')),
        '#cell_attributes' => array('align' => 'center', 'nowrap' => 'true'),
      );

Comments

flebas’s picture

Category: feature » bug

Changed category to bug report.

TR’s picture

Can you turn this into a patch so others can test it?

TR’s picture

Issue tags: +Ubercart theme layer

Tagging

eliosh’s picture

You can also use hook_tapir_table_alter in a custom module:


function CUSTOMMODULE_tapir_table_alter(&$table, $table_id) {
  if ($table_id == 'op_order_comments_view_table') {
    $comments = $table['#parameters'][1];
    $table['#rows'] = array();
    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 />H:i:s'),
          '#cell_attributes' => array('align' => 'center', 'nowrap' => 'true'),
        );
        $data['user'] = array(
          '#value' => uc_get_initials($comment->uid),
          '#cell_attributes' => array('align' => 'center'),
        );
        $data['notified'] = array(
          '#value' => (($comment->notified == 1)
            ? '<img src="'. base_path() . drupal_get_path('module', 'uc_order') .'/images/true-icon.gif" />'
            : '<img src="'. base_path() . drupal_get_path('module', 'uc_order') .'/images/false-icon.gif" />'),
          '#cell_attributes' => array('align' => 'center'),
        );
        $data['status'] = array(
          '#value' => $comment->title,
          '#cell_attributes' => array('align' => 'center'),
        );
        $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;
    }

  }
}

TR’s picture

Version: 6.x-2.x-dev » 7.x-3.x-dev

Moving to 7.x-3.x.

Island Usurper’s picture

Do we really even need that <br /> in that particular cell? Someone ought to see if word wrapping handles that well enough to begin with. Then we can just go to the normal short format that Drupal already provides.

longwave’s picture

Status: Active » Fixed

Removed the <br> and the nowrap attribute and used the 'short' date format instead, which looks fine to me.

Status: Fixed » Closed (fixed)
Issue tags: -Ubercart theme layer

Automatically closed -- issue fixed for 2 weeks with no activity.