=== modified file 'payment/uc_payment/uc_payment.admin.inc'
--- payment/uc_payment/uc_payment.admin.inc 2009-04-13 14:34:21 +0000
+++ payment/uc_payment/uc_payment.admin.inc 2009-04-14 16:54:04 +0000
@@ -426,8 +426,16 @@
drupal_goto('admin/store/orders/'. $order->order_id .'/payments');
}
+ $context = array(
+ 'revision' => 'formatted',
+ 'location' => 'payment-delete',
+ 'subject' => array(
+ 'payment' => $payment,
+ ),
+ );
+
$desc = ''. t('Payment information:') .' '
- . t('@method payment of @amount received on @date.', array('@method' => $payment->method, '@amount' => uc_currency_format($payment->amount), '@date' => format_date($payment->received, 'short')));
+ . t('@method payment of @amount received on @date.', array('@method' => $payment->method, '@amount' => uc_price($payment->amount, $context), '@date' => format_date($payment->received, 'short')));
$form['order_id'] = array(
'#type' => 'value',
=== modified file 'payment/uc_payment/uc_payment.ca.inc'
--- payment/uc_payment/uc_payment.ca.inc 2009-01-09 18:46:09 +0000
+++ payment/uc_payment/uc_payment.ca.inc 2009-04-14 16:54:48 +0000
@@ -176,7 +176,11 @@
}
function uc_payment_condition_order_balance_form($form_state, $settings = array()) {
- $zero = array('!zero' => uc_currency_format(0));
+ $context = array(
+ 'revision' => 'formatted',
+ 'location' => 'zero-balance',
+ );
+ $zero = array('!zero' => uc_price(0, $context));
$options = array(
'less' => t('Balance is less than !zero.', $zero),
'less_equal' => t('Balance is less than or equal to !zero.', $zero),
=== modified file 'payment/uc_payment/uc_payment.module'
--- payment/uc_payment/uc_payment.module 2009-04-13 14:34:21 +0000
+++ payment/uc_payment/uc_payment.module 2009-04-14 16:57:55 +0000
@@ -141,7 +141,12 @@
if (empty($values['order-payment-method'])) {
$values['order-payment-method'] = _payment_method_data($order->payment_method, 'name');
}
- $values['order-payment-balance'] = uc_currency_format(uc_payment_balance($order));
+
+ $context = array(
+ 'revision' => 'formatted',
+ 'location' => 'payment-balance-token',
+ );
+ $values['order-payment-balance'] = uc_price(uc_payment_balance($order), $context);
break;
}
@@ -576,7 +581,11 @@
if (variable_get('uc_payment_logging', TRUE)) {
global $user;
- $log_message = t('@method payment for @amount entered by @user.', array('@method' => $method_name, '@amount' => uc_currency_format($amount), '@user' => uc_get_initials($user->uid)));
+ $context = array(
+ 'revision' => 'formatted',
+ 'location' => 'payment-log',
+ );
+ $log_message = t('@method payment for @amount entered by @user.', array('@method' => $method_name, '@amount' => uc_price($amount, $context), '@user' => uc_get_initials($user->uid)));
uc_order_log_changes($order_id, array($log_message));
}
@@ -597,7 +606,14 @@
if (variable_get('uc_payment_logging', TRUE)) {
global $user;
$payment = uc_payment_load($receipt_id);
- $log_message = t('@method payment for @amount deleted by @user.', array('@method' => $payment->method, '@amount' => uc_currency_format($payment->amount), '@user' => uc_get_initials($user->uid)));
+ $context = array(
+ 'revision' => 'formatted',
+ 'location' => 'payment-delete-log',
+ 'subject' => array(
+ 'payment' => $payment,
+ ),
+ );
+ $log_message = t('@method payment for @amount deleted by @user.', array('@method' => $payment->method, '@amount' => uc_price($payment->amount, $context), '@user' => uc_get_initials($user->uid)));
uc_order_log_changes($payment->order_id, array($log_message));
}
=== modified file 'uc_attribute/uc_attribute.admin.inc'
--- uc_attribute/uc_attribute.admin.inc 2009-04-01 15:17:04 +0000
+++ uc_attribute/uc_attribute.admin.inc 2009-04-14 17:06:40 +0000
@@ -454,9 +454,17 @@
if ($view == 'overview') {
$form['#tree'] = TRUE;
+ $context = array(
+ 'revision' => 'formatted',
+ 'location' => 'attribute-form-default-option',
+ );
if (count($attributes) > 0) {
foreach ($attributes as $attribute) {
$option = $attribute->options[$attribute->default_option];
+ $context['subject'] = array(
+ 'attribute' => $attribute,
+ 'option' => $option,
+ );
$form['attributes'][$attribute->aid] = array(
'remove' => array(
@@ -467,7 +475,7 @@
'#value' => check_plain($attribute->name),
),
'option' => array(
- '#value' => $option ? (check_plain($option->name) .' ('. uc_currency_format($option->price) .')' ) : t('n/a'),
+ '#value' => $option ? (check_plain($option->name) .' ('. uc_price($option->price, $context) .')' ) : t('n/a'),
),
'required' => array(
'#type' => 'checkbox',
=== modified file 'uc_cart/uc_cart.admin.inc'
--- uc_cart/uc_cart.admin.inc 2009-02-18 15:29:36 +0000
+++ uc_cart/uc_cart.admin.inc 2009-04-14 17:09:33 +0000
@@ -50,11 +50,16 @@
'#size' => 32,
'#field_prefix' => url(NULL, array('absolute' => TRUE)) . (variable_get('clean_url', 0) ? '' : '?q='),
);
+
+ $context = array(
+ 'revision' => 'formatted',
+ 'location' => 'minimum-subtotal-summary'
+ );
$form['general']['uc_minimum_subtotal'] = array(
'#type' => 'textfield',
'#title' => t('Minimum order subtotal'),
'#description' => t('Optionally specify a minimum allowed subtotal for a cart to proceed to checkout.'),
- '#summary' => t('The minimum subtotal is @subtotal', array('@subtotal' => uc_currency_format(variable_get('uc_minimum_subtotal', 0)))),
+ '#summary' => t('The minimum subtotal is @subtotal', array('@subtotal' => uc_price(variable_get('uc_minimum_subtotal', 0), $context))),
'#default_value' => variable_get('uc_minimum_subtotal', 0),
'#size' => 16,
'#field_prefix' => variable_get('uc_sign_after_amount', FALSE) ? '' : variable_get('uc_currency_sign', '$'),
=== modified file 'uc_cart/uc_cart.pages.inc'
--- uc_cart/uc_cart.pages.inc 2009-04-13 14:34:21 +0000
+++ uc_cart/uc_cart.pages.inc 2009-04-14 17:11:04 +0000
@@ -69,7 +69,11 @@
}
}
if ($subtotal < $min) {
- drupal_set_message(variable_get('uc_minimum_subtotal_text', t('The minimum order subtotal for checkout is !min.', array('!min' => uc_currency_format($min)))), 'error');
+ $context = array(
+ 'revision' => 'formatted',
+ 'location' => 'minimum-subtotal-message',
+ );
+ drupal_set_message(variable_get('uc_minimum_subtotal_text', t('The minimum order subtotal for checkout is !min.', array('!min' => uc_price($min, $context)))), 'error');
drupal_goto('cart');
}
}
=== modified file 'uc_catalog/uc_catalog.module'
--- uc_catalog/uc_catalog.module 2009-02-16 19:25:34 +0000
+++ uc_catalog/uc_catalog.module 2009-04-14 17:12:28 +0000
@@ -686,8 +686,12 @@
function theme_uc_catalog_product_grid($products) {
$product_table = '
';
$count = 0;
+ $context = array(
+ 'location' => 'catalog-grid-product',
+ );
foreach ($products as $nid) {
$product = node_load($nid);
+ $context['subject'] = array('node' => $product);
if ($count == 0) {
$product_table .= "";
@@ -713,7 +717,7 @@
}
$product_table .= ''. $imagelink .'';
if (variable_get('uc_catalog_grid_display_sell_price', TRUE)) {
- $product_table .= ''. uc_currency_format($product->sell_price) .'';
+ $product_table .= ''. uc_price($product->sell_price, $context) .'';
}
if (variable_get('uc_catalog_grid_display_add_to_cart', TRUE)) {
if (variable_get('uc_catalog_grid_display_attributes', TRUE)) {
=== modified file 'uc_order/uc_order.admin.inc'
--- uc_order/uc_order.admin.inc 2009-04-13 14:34:21 +0000
+++ uc_order/uc_order.admin.inc 2009-04-14 17:13:51 +0000
@@ -954,9 +954,12 @@
);
$result = pager_query("SELECT o.order_id, o.created, os.title, SUM(op.qty) AS products, o.order_total AS total FROM {uc_orders} AS o LEFT JOIN {uc_order_statuses} AS os ON o.order_status = os.order_status_id LEFT JOIN {uc_order_products} AS op ON o.order_id = op.order_id WHERE o.uid = %d AND o.order_status IN ". uc_order_status_list('general', TRUE) ." GROUP BY o.order_id, o.created, os.title, o.order_total". tablesort_sql($header), 20, 0, "SELECT COUNT(*) FROM {uc_orders} WHERE uid = %d AND order_status NOT IN ". uc_order_status_list('specific', TRUE), $user->uid);
-
+ $context = array(
+ 'location' => 'order-history',
+ );
// Build a table based on the customer's orders.
while ($order = db_fetch_object($result)) {
+ $context['subject'] = array('order' => $order);
$link = l($order->order_id, 'user/'. $user->uid .'/order/'. $order->order_id);
if (user_access('view all orders')) {
$link .= ''. uc_order_actions($order, TRUE) .'';
@@ -966,7 +969,7 @@
array('data' => $link, 'nowrap' => 'nowrap'),
array('data' => $order->title),
array('data' => (!is_null($order->products) ? $order->products : 0), 'align' => 'center'),
- array('data' => uc_currency_format($order->total, TRUE), 'align' => 'right'),
+ array('data' => uc_price($order->total, $context), 'align' => 'right'),
);
}
=== modified file 'uc_product/views/uc_product_handler_field_price.inc'
--- uc_product/views/uc_product_handler_field_price.inc 2008-10-14 20:54:22 +0000
+++ uc_product/views/uc_product_handler_field_price.inc 2009-04-14 18:07:35 +0000
@@ -11,6 +11,20 @@
*/
class uc_product_handler_field_price extends views_handler_field {
function render($values) {
- return uc_currency_format($values->{$this->field_alias});
+ $context = array(
+ 'location' => 'views-price-handler',
+ 'class' => $this->field,
+ 'subject' => array(
+ 'node' => $values,
+ 'field' => $this->real_field,
+ ),
+ );
+ $table_alias_len = strlen($this->table_alias);
+ foreach ($values as $key => $value) {
+ if (substr($key, 0, $table_alias_len) == $this->table_alias) {
+ $values->{substr($key, $table_alias_len + 1)} = $value;
+ }
+ }
+ return uc_price($values->{$this->field_alias}, $context);
}
}
=== modified file 'uc_product_kit/uc_product_kit.module'
--- uc_product_kit/uc_product_kit.module 2009-04-02 20:53:12 +0000
+++ uc_product_kit/uc_product_kit.module 2009-04-14 18:14:19 +0000
@@ -431,6 +431,10 @@
$total = 0;
$base_total = 0;
$form['base']['items'] = array('#tree' => TRUE, '#weight' => 1);
+ $context = array(
+ 'revision' => 'formatted',
+ 'location' => 'product-kit-form-item-discount',
+ );
if (isset($node->products)) {
foreach ($node->products as $i => $product) {
$form['base']['items'][$i] = array('#type' => 'fieldset',
@@ -448,11 +452,11 @@
'#title' => t('List position'),
'#default_value' => isset($product->ordering) ? $product->ordering : 0,
);
- $item = node_load($i);
+ $context['subject'] = array('node' => $product);
$form['base']['items'][$i]['discount'] = array('#type' => 'textfield',
'#title' => t('Discount'),
'#description' => t('Enter a positive or negative value to raise or lower the item price by that amount. This change is applied to each %product in the kit.', array('%product' => $product->title)),
- '#field_prefix' => t('@price + ', array('@price' => uc_currency_format($product->sell_price))),
+ '#field_prefix' => t('@price + ', array('@price' => uc_price($product->sell_price, $context))),
'#default_value' => isset($product->discount) ? number_format($product->discount, 3, '.', '') : 0,
'#size' => 5,
);
@@ -472,11 +476,15 @@
$form['base']['items'][$i]['discount']['#default_value'] = number_format($discount, 3, '.', '');
}
}
+ $context = array(
+ 'revision' => 'formatted',
+ 'location' => 'product-kit-form-total',
+ );
$form['base']['kit_total'] = array(
'#type' => 'textfield',
'#title' => t('Total price'),
'#default_value' => $node->synchronized ? '' : $total,
- '#description' => t('If this field is set, the discounts of the individual products will be recalculated to equal this value. Currently, the total sell price is %price.', array('%price' => uc_currency_format($total))),
+ '#description' => t('If this field is set, the discounts of the individual products will be recalculated to equal this value. Currently, the total sell price is %price.', array('%price' => uc_price($total, $context))),
'#weight' => 0,
'#size' => 20,
'#maxlength' => 35,
@@ -531,13 +539,25 @@
'add_to_cart' => 10,
));
+ $context = array(
+ 'location' => 'product-kit-view',
+ 'class' => array(
+ 'product-kit',
+ ),
+ 'subject' => array(
+ 'node' => $node,
+ ),
+ );
+
if (module_exists('imagecache') && ($field = variable_get('uc_image_product_kit', '')) && isset($node->$field) && file_exists($node->{$field}[0]['filepath'])) {
$node->content['image'] = array('#value' => theme('uc_product_image', $node->$field),
'#access' => $enabled['image'],
'#weight' => $weight['image'],
);
}
- $node->content['display_price'] = array('#value' => theme('uc_product_price', $node->sell_price, 'display-price', TRUE),
+ $context['class'][1] = 'display';
+ $context['subject']['field'] = 'sell_price';
+ $node->content['display_price'] = array('#value' => uc_price($node->sell_price, $context),
'#access' => $enabled['display_price'],
'#weight' => $weight['display_price'],
);
@@ -547,11 +567,17 @@
'#weight' => $weight['model'],
);
$node->content['body']['#weight'] = 1;
- $node->content['list_price'] = array('#value' => theme('uc_product_price', $node->list_price, 'list-price'),
+
+ $context['class'][1] = 'list';
+ $context['subject']['field'] = 'list_price';
+ $node->content['list_price'] = array('#value' => uc_price($node->list_price, $context),
'#access' => $enabled['list_price'],
'#weight' => $weight['list_price'],
);
- $node->content['cost'] = array('#value' => theme('uc_product_price', $node->cost, 'cost'),
+
+ $context['class'][1] = 'cost';
+ $context['subject']['field'] = 'cost';
+ $node->content['cost'] = array('#value' => uc_price($node->cost, $context),
'#access' => $enabled['cost'] && user_access('administer products'),
'#weight' => $weight['cost'],
);
@@ -560,7 +586,9 @@
$node->content['#attributes'] = array('style' => 'display: inline');
}
- $node->content['sell_price'] = array('#value' => theme('uc_product_price', $node->sell_price, 'sell-price', $teaser),
+ $context['class'][1] = 'sell';
+ $context['subject']['field'] = 'sell_price';
+ $node->content['sell_price'] = array('#value' => uc_price($node->sell_price, $context, array('label' => !$teaser)),
'#access' => $enabled['sell_price'],
'#weight' => $weight['sell_price'],
);
=== modified file 'uc_store/includes/uc_price.inc'
--- uc_store/includes/uc_price.inc 2009-04-13 18:37:31 +0000
+++ uc_store/includes/uc_price.inc 2009-04-14 17:43:22 +0000
@@ -283,7 +283,7 @@
* display settings.
*/
function uc_store_price_handler_format($price, $options) {
- $output = '';
+ $output = '~';
// If the value is less than the minimum precision, zero it.
if ($options['prec'] > 0 && abs($price) < 1 / pow(10, $options['prec'])) {
=== modified file 'uc_store/uc_store.admin.inc'
--- uc_store/uc_store.admin.inc 2009-04-12 02:11:38 +0000
+++ uc_store/uc_store.admin.inc 2009-04-14 17:33:53 +0000
@@ -695,11 +695,16 @@
'#maxlength' => 3,
'#size' => 5,
);
+
+ $context = array(
+ 'revision' => 'formatted',
+ 'location' => 'currency-format-form',
+ );
$form['currency']['example'] = array(
'#type' => 'textfield',
'#title' => t('Current format'),
- '#value' => uc_currency_format(1000.1234),
- '#summary' => t('Currency format: @format', array('@format' => uc_currency_format(1000.1234))),
+ '#value' => uc_price(1000.1234, $context),
+ '#summary' => t('Currency format: @format', array('@format' => uc_price(1000.1234, $context))),
'#disabled' => TRUE,
'#size' => 10,
);
@@ -898,6 +903,9 @@
$header = array(t('View'), t('Order ID'), t('Date'), t('Billing name'),
t('Shipping name'), t('Items'), t('Total'));
+ $context = array(
+ 'location' => 'customer-orders',
+ );
$totals = array('orders' => 0, 'items' => 0, 'total' => 0);
while ($order = db_fetch_object($result)) {
$icons = l(uc_store_get_icon('file:order_view'),
@@ -926,6 +934,7 @@
$totals['items'] += $item_count['COUNT(*)'];
$totals['total'] += $order->order_total;
+ $context['subject'] = array('order' => $order);
$rows[] = array(
'data' => array(
array('data' => $icons),
@@ -934,7 +943,7 @@
array('data' => check_plain($bname)),
array('data' => check_plain($sname)),
array('data' => $item_count['COUNT(*)']),
- array('data' => uc_currency_format($order->order_total), 'nowrap' => 'nowrap')),
+ array('data' => uc_price($order->order_total, $context), 'nowrap' => 'nowrap')),
'id' => 'order-'. $order->order_id,
);
}
@@ -946,12 +955,15 @@
drupal_add_js(drupal_get_path('module', 'uc_store') .'/uc_store.js');
+ $context = array(
+ 'location' => 'customer-orders-total',
+ );
$output = ''. l(t('Create an order for this customer.'),
'admin/store/orders/create/'. $uid) .'
';
$output .= ''. t('!totals_orders orders shown match that account with !totals_items items purchased and !totals_total spent:',
array('!totals_orders' => $totals['orders'],
'!totals_items' => $totals['items'],
- '!totals_total' => uc_currency_format($totals['total']))) .'
'
+ '!totals_total' => uc_price($totals['total'], $context))) .''
. theme('table', $header, $rows, array('width' => '100%', 'class' => 'uc-cust-orders-table'))
.'
'. theme_pager(NULL, 50);
=== modified file 'uc_store/uc_store.module'
--- uc_store/uc_store.module 2009-04-13 14:32:10 +0000
+++ uc_store/uc_store.module 2009-04-13 20:22:51 +0000
@@ -768,8 +768,12 @@
function uc_store_js_util($func) {
switch ($func) {
case 'currency_format':
+ $context = array(
+ 'revision' => 'formatted',
+ 'location' => 'js-util-currency-format',
+ );
$amount = is_numeric($_POST['amount']) ? $_POST['amount'] : 0;
- $output = uc_currency_format($amount);
+ $output = uc_price($amount, $context);
break;
case 'zone_select':
$country_id = intval($_POST['country_id']) > 0 ? intval($_POST['country_id']) : uc_store_default_country();
=== modified file 'uc_tax_report/uc_tax_report.module'
--- uc_tax_report/uc_tax_report.module 2009-02-27 15:32:25 +0000
+++ uc_tax_report/uc_tax_report.module 2009-04-14 17:35:23 +0000
@@ -120,13 +120,17 @@
$amount = 0;
$star_legend = '';
+ $context = array(
+ 'revision' => 'formatted',
+ 'location' => 'tax-report',
+ );
foreach($totals as $line) {
$row = array(
$line['name'],
$line['jurisdiction'],
number_format($line['rate'] * 100, 3) . '%',
- uc_currency_format($line['taxable_amount']),
- uc_currency_format($line['amount']),
+ uc_price($line['taxable_amount'], $context),
+ uc_price($line['amount'], $context),
);
$rows[] = $row;
$csv_rows[] = $row;
@@ -140,7 +144,7 @@
'*',
'*',
'*',
- uc_currency_format($line['amount']),
+ uc_price($line['amount'], $context),
);
$rows[] = $row;
$csv_rows[] = $row;
@@ -154,8 +158,8 @@
t('Total'),
'',
'',
- uc_currency_format($taxable_amount),
- uc_currency_format($amount),
+ uc_price($taxable_amount, $context),
+ uc_price($amount, $context),
);
$rows[] = $row;
$csv_rows[] = $row;
=== modified file 'uc_taxes/uc_taxes.module'
--- uc_taxes/uc_taxes.module 2009-03-11 13:18:12 +0000
+++ uc_taxes/uc_taxes.module 2009-04-14 17:37:35 +0000
@@ -145,6 +145,13 @@
$changes = array();
$line_items = uc_line_item_tax('load', $arg1);
//$arg1->line_items = uc_order_load_line_items($arg1, TRUE);
+ $context = array(
+ 'revision' => 'formatted',
+ 'location' => 'tax-changes-log',
+ 'subject' => array(
+ 'order' => $arg1,
+ ),
+ );
if (is_array($arg1->line_items)) {
//drupal_set_message(''. var_export($arg1->line_items, TRUE) .'
');
foreach ($arg1->line_items as $i => $line) {
@@ -153,9 +160,10 @@
foreach ($line_items as $id => $new_line) {
if ($new_line['title'] == $line['title']) {
if ($new_line['amount'] != $line['amount']) {
+ $context['subject']['line_item'] = $new_line;
uc_order_update_line_item($line['line_item_id'], $new_line['title'], $new_line['amount'], $new_line['data']);
$arg1->line_items[$i]['amount'] = $new_line['amount'];
- $changes[] = t('Changed %title to %amount.', array('%amount' => uc_currency_format($new_line['amount']), '%title' => $new_line['title']));
+ $changes[] = t('Changed %title to %amount.', array('%amount' => uc_price($new_line['amount'], $context), '%title' => $new_line['title']));
}
unset($line_items[$id]);
$delete = FALSE;
@@ -175,7 +183,8 @@
uc_order_line_item_add($arg1->order_id, $line['id'], $line['title'], $line['amount'], $line['weight'], $line['data']);
$line['type'] = 'tax';
$arg1->line_items[] = $line;
- $changes[] = t('Added %amount for %title.', array('%amount' => uc_currency_format($line['amount']), '%title' => $line['title']));
+ $context['subject']['line_item'] = $line;
+ $changes[] = t('Added %amount for %title.', array('%amount' => uc_price($line['amount'], $context), '%title' => $line['title']));
}
}
if (count($changes)) {