From 3192a82a0b6531bec850467d27665463bb3c59fd Mon Sep 17 00:00:00 2001
From: longwave <longwave@246492.no-reply.drupal.org>
Date: Tue, 20 Dec 2011 11:35:06 -0500
Subject: [PATCH 1/3] Issue #1376702: Add theme('uc_qty') to consistently render product quantities.

---
 payment/uc_paypal/uc_paypal.module   |    2 +-
 uc_cart/uc_cart.module               |    2 +-
 uc_cart/uc_cart_checkout_pane.inc    |    4 ++--
 uc_order/uc_order.order_pane.inc     |    4 ++--
 uc_product_kit/uc_product_kit.module |    2 +-
 uc_store/uc_store.module             |   16 ++++++++++++++++
 6 files changed, 23 insertions(+), 7 deletions(-)

diff --git a/payment/uc_paypal/uc_paypal.module b/payment/uc_paypal/uc_paypal.module
index b312e57..9d44128 100644
--- a/payment/uc_paypal/uc_paypal.module
+++ b/payment/uc_paypal/uc_paypal.module
@@ -1020,7 +1020,7 @@ function _uc_paypal_product_details($items) {
       if (!empty($desc)) {
         $desc .= ' / ';
       }
-      $desc .= $item->qty . '× ' . $item->title;
+      $desc .= theme('uc_qty', array('qty' => $item->qty)) . ' ' . $item->title;
       $subtotal += $item->qty * $item->price;
     }
   }
diff --git a/uc_cart/uc_cart.module b/uc_cart/uc_cart.module
index d42eb2c..c854efa 100644
--- a/uc_cart/uc_cart.module
+++ b/uc_cart/uc_cart.module
@@ -309,7 +309,7 @@ function uc_cart_block_view($delta = '') {
           if (!empty($display_item)) {
             $items[] = array(
               'nid' => $display_item['nid']['#value'],
-              'qty' => t('@qty&times;', array('@qty' => $display_item['qty']['#default_value'])),
+              'qty' => theme('uc_qty', array('qty' => $display_item['qty']['#default_value'])),
               'title' => $display_item['title']['#markup'],
               'price' => $display_item['#total'],
               'desc' => isset($display_item['description']['#markup']) ? $display_item['description']['#markup'] : FALSE,
diff --git a/uc_cart/uc_cart_checkout_pane.inc b/uc_cart/uc_cart_checkout_pane.inc
index 2cea671..208c1b6 100644
--- a/uc_cart/uc_cart_checkout_pane.inc
+++ b/uc_cart/uc_cart_checkout_pane.inc
@@ -498,7 +498,7 @@ function theme_uc_cart_review_table($variables) {
       if (!empty($display_item['description']['#markup'])) {
         $description .= $display_item['description']['#markup'];
       }
-      $qty = t('@qty&times;', array('@qty' => $display_item['qty']['#default_value']));
+      $qty = theme('uc_qty', array('qty' => $display_item['qty']['#default_value']));
       $suffix = !empty($display_item['#suffix']) ? $display_item['#suffix'] : '';
 
       $rows[] = array(
@@ -554,7 +554,7 @@ function theme_uc_checkout_pane_cart_review($variables) {
   foreach ($variables['items'] as $item) {
     $desc = check_plain($item->title) . uc_product_get_description($item);
 
-    $output .= '<tr valign="top"><td>' . $item->qty . '&times;</td><td width="100%">' . $desc
+    $output .= '<tr valign="top"><td nowrap="nowrap">' . theme('uc_qty', array('qty' => $item->qty)) . '</td><td width="100%">' . $desc
               . '</td><td nowrap="nowrap">' . theme('uc_price', array('price' => $item->price * $item->qty)) . '</td></tr>';
   }
   $output .= '</table>';
diff --git a/uc_order/uc_order.order_pane.inc b/uc_order/uc_order.order_pane.inc
index 77774c7..cc47d12 100644
--- a/uc_order/uc_order.order_pane.inc
+++ b/uc_order/uc_order.order_pane.inc
@@ -1122,7 +1122,7 @@ function uc_op_products_view_table($order) {
     foreach ($order->products as $product) {
       $data = array();
       $data['qty'] = array(
-        '#markup' => $product->qty . '&times;',
+        '#markup' => theme('uc_qty', array('qty' => $product->qty)),
         '#cell_attributes' => array('align' => 'right'),
       );
       $node = node_load($product->nid);
@@ -1226,7 +1226,7 @@ function uc_op_products_customer_table($order) {
     foreach ($order->products as $product) {
       $data = array();
       $data['qty'] = array(
-        '#markup' => $product->qty . '&times;',
+        '#markup' => theme('uc_qty', array('qty' => $product->qty)),
         '#cell_attributes' => array('align' => 'right'),
       );
       $node = node_load($product->nid);
diff --git a/uc_product_kit/uc_product_kit.module b/uc_product_kit/uc_product_kit.module
index 845c264..ef20005 100644
--- a/uc_product_kit/uc_product_kit.module
+++ b/uc_product_kit/uc_product_kit.module
@@ -756,7 +756,7 @@ function theme_uc_product_kit_list_item($variables) {
     $title = check_plain($product->title);
   }
 
-  return $product->qty . ' × ' . $title;
+  return theme('uc_qty', array('qty' => $product->qty)) . ' ' . $title;
 }
 
 /**
diff --git a/uc_store/uc_store.module b/uc_store/uc_store.module
index c88ee03..7f573ce 100644
--- a/uc_store/uc_store.module
+++ b/uc_store/uc_store.module
@@ -522,6 +522,9 @@ function uc_store_theme() {
     'uc_qty_label' => array(
       'variables' => array(),
     ),
+    'uc_qty' => array(
+      'variables' => array('qty' => 1),
+    ),
     'uc_uid' => array(
       'variables' => array('uid' => 0),
     ),
@@ -717,6 +720,19 @@ function theme_uc_qty_label() {
 }
 
 /**
+ * Displays a quantity.
+ *
+ * @param $variables
+ *   An associative array containing:
+ *   - qty: The quantity to display.
+ *
+ * @ingroup themeable
+ */
+function theme_uc_qty($variables) {
+  return $variables['qty'] . ' ×';
+}
+
+/**
  * Displays a username in the standard format and with consistent markup.
  *
  * @param $variables
-- 
1.7.3.4


From 69b1f30ad0b2c8f5a003fd03a4c794a6f7f4e26d Mon Sep 17 00:00:00 2001
From: Chris Oden <wodenx@gmail.com>
Date: Tue, 20 Dec 2011 11:41:23 -0500
Subject: [PATCH 2/3] Issue #1376702: Replace 'nowrap' attribute with CSS to ensure no line-break in qty columns.

---
 uc_cart/uc_cart_checkout_pane.inc |    4 ++--
 uc_store/uc_store.css             |    4 +++-
 uc_store/uc_store.module          |    2 +-
 3 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/uc_cart/uc_cart_checkout_pane.inc b/uc_cart/uc_cart_checkout_pane.inc
index 208c1b6..e23e5c5 100644
--- a/uc_cart/uc_cart_checkout_pane.inc
+++ b/uc_cart/uc_cart_checkout_pane.inc
@@ -554,8 +554,8 @@ function theme_uc_checkout_pane_cart_review($variables) {
   foreach ($variables['items'] as $item) {
     $desc = check_plain($item->title) . uc_product_get_description($item);
 
-    $output .= '<tr valign="top"><td nowrap="nowrap">' . theme('uc_qty', array('qty' => $item->qty)) . '</td><td width="100%">' . $desc
-              . '</td><td nowrap="nowrap">' . theme('uc_price', array('price' => $item->price * $item->qty)) . '</td></tr>';
+    $output .= '<tr valign="top"><td>' . theme('uc_qty', array('qty' => $item->qty)) . '</td><td width="100%">' . $desc
+              . '</td><td>' . theme('uc_price', array('price' => $item->price * $item->qty)) . '</td></tr>';
   }
   $output .= '</table>';
 
diff --git a/uc_store/uc_store.css b/uc_store/uc_store.css
index b5a2f18..dc2d765 100644
--- a/uc_store/uc_store.css
+++ b/uc_store/uc_store.css
@@ -3,7 +3,9 @@
  * Styles for uc_store module.
  */
 
-.uc-price {
+.uc-price,
+.uc-qty
+{
   white-space: nowrap;
 }
 
diff --git a/uc_store/uc_store.module b/uc_store/uc_store.module
index 7f573ce..335b9c5 100644
--- a/uc_store/uc_store.module
+++ b/uc_store/uc_store.module
@@ -729,7 +729,7 @@ function theme_uc_qty_label() {
  * @ingroup themeable
  */
 function theme_uc_qty($variables) {
-  return $variables['qty'] . ' ×';
+  return '<span class="uc-qty">' . $variables['qty'] . ' ×</span>';
 }
 
 /**
-- 
1.7.3.4


From 7543f0276ff24eb9ad34f53c64a3a34030b96b20 Mon Sep 17 00:00:00 2001
From: Chris Oden <wodenx@gmail.com>
Date: Tue, 20 Dec 2011 11:42:04 -0500
Subject: [PATCH 3/3] Issue #1376702: Replace '#markup' with '#theme'=>'uc_qty' in order view tables.

---
 uc_order/uc_order.order_pane.inc |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/uc_order/uc_order.order_pane.inc b/uc_order/uc_order.order_pane.inc
index cc47d12..f54a254 100644
--- a/uc_order/uc_order.order_pane.inc
+++ b/uc_order/uc_order.order_pane.inc
@@ -1122,7 +1122,8 @@ function uc_op_products_view_table($order) {
     foreach ($order->products as $product) {
       $data = array();
       $data['qty'] = array(
-        '#markup' => theme('uc_qty', array('qty' => $product->qty)),
+        '#theme' => 'uc_qty',
+        '#qty' => $product->qty,
         '#cell_attributes' => array('align' => 'right'),
       );
       $node = node_load($product->nid);
@@ -1226,7 +1227,8 @@ function uc_op_products_customer_table($order) {
     foreach ($order->products as $product) {
       $data = array();
       $data['qty'] = array(
-        '#markup' => theme('uc_qty', array('qty' => $product->qty)),
+        '#theme' => 'uc_qty',
+        '#qty' => $product->qty,
         '#cell_attributes' => array('align' => 'right'),
       );
       $node = node_load($product->nid);
-- 
1.7.3.4

