=== modified file 'payment/uc_2checkout/uc_2checkout.module' --- payment/uc_2checkout/uc_2checkout.module 2009-01-09 19:46:02 +0000 +++ payment/uc_2checkout/uc_2checkout.module 2009-04-17 18:52:19 +0000 @@ -179,9 +179,19 @@ $country = array(0 => array('country_iso_code_3' => 'USA')); } + $context = array( + 'revision' => 'formatted', + 'location' => '2checkout-form', + ); + $options = array( + 'sign' => FALSE, + 'dec' => '.', + 'thou' => FALSE, + ); + $data = array( 'sid' => variable_get('uc_2checkout_sid', ''), - 'total' => uc_currency_format($order->order_total, FALSE, FALSE, '.'), + 'total' => uc_price($order->order_total, $context, $options), 'cart_order_id' => $order->order_id, 'demo' => variable_get('uc_2checkout_demo', TRUE) ? 'Y' : 'N', 'fixed' => 'Y', @@ -207,7 +217,7 @@ $data['c_prod_'. $i] = $product->model .','. $product->qty; $data['c_name_'. $i] = $product->title; $data['c_description_'. $i] = $desc; - $data['c_price_'. $i] = uc_currency_format($product->price, FALSE, FALSE, '.'); + $data['c_price_'. $i] = uc_price($product->price, $context, $options); } $form['#action'] = _2checkout_post_url(variable_get('uc_2checkout_checkout_type', 'multi')); === modified file 'payment/uc_authorizenet/uc_authorizenet.module' --- payment/uc_authorizenet/uc_authorizenet.module 2009-02-13 20:06:02 +0000 +++ payment/uc_authorizenet/uc_authorizenet.module 2009-04-17 18:54:23 +0000 @@ -335,7 +335,11 @@ // Build info message. $types = uc_credit_transaction_types(); - $comment[] = t('@type: @amount', array('@type' => $types[$data['txn_type']], '@amount' => uc_currency_format($amount))); + $context = array( + 'revision' => 'formatted', + 'location' => 'cim-profile-charge', + ); + $comment[] = t('@type: @amount', array('@type' => $types[$data['txn_type']], '@amount' => uc_price($amount, $context))); // Save a comment to the order. uc_order_comment_save($order->order_id, $user->uid, implode('
', $comment), 'admin'); @@ -424,6 +428,16 @@ $billing_country = uc_get_country_data(array('country_id' => $order->billing_country)); $delivery_country = uc_get_country_data(array('country_id' => $order->delivery_country)); + $context = array( + 'revision' => 'formatted', + 'location' => 'authorize.net-charge', + ); + $options = array( + 'sign' => FALSE, + 'thou' => FALSE, + 'dec' => '.', + ); + // Build the POST data for the transaction. $submit_data = array( // Merchant Information @@ -436,7 +450,7 @@ // 'x_method' => $order->payment_method == 'credit' ? 'CC' : 'ECHECK', 'x_method' => 'CC', // 'x_recurring_billing' => 'FALSE', - 'x_amount' => uc_currency_format($amount, FALSE, FALSE, '.'), + 'x_amount' => uc_price($amount, $context, $options), 'x_card_num' => $order->payment_details['cc_number'], 'x_exp_date' => $order->payment_details['cc_exp_month'] .'/'. $order->payment_details['cc_exp_year'], 'x_card_code' => $order->payment_details['cc_cvv'], @@ -584,8 +598,12 @@ } // Build an admin order comment. + $context = array( + 'revision' => 'formatted', + 'location' => 'authorize.net-charge-comment', + ); $comment = t('@type
@status: @message
Amount: @amount
AVS response: @avs', - array('@type' => _uc_authorizenet_txn_type($response[11]), '@status' => $result['success'] ? t('ACCEPTED') : t('REJECTED'), '@message' => $response[3], '@amount' => uc_currency_format($response[9]), '@avs' => _uc_authorizenet_avs($response[5]))); + array('@type' => _uc_authorizenet_txn_type($response[11]), '@status' => $result['success'] ? t('ACCEPTED') : t('REJECTED'), '@message' => $response[3], '@amount' => uc_price($response[9], $context), '@avs' => _uc_authorizenet_avs($response[5]))); // Add the CVV response if enabled. if (variable_get('uc_credit_cvv_enabled', TRUE)) { === modified file 'payment/uc_credit/test_gateway.module' --- payment/uc_credit/test_gateway.module 2008-10-13 18:26:36 +0000 +++ payment/uc_credit/test_gateway.module 2009-04-17 18:45:52 +0000 @@ -45,7 +45,11 @@ // drupal_set_message('
'. print_r($order->payment_details, TRUE) .'
'); if ($success) { - $message = t('Credit card charged: !amount', array('!amount' => uc_currency_format($amount))); + $context = array( + 'revision' => 'formatted', + 'location' => 'test-gateway-charge-comment', + ); + $message = t('Credit card charged: !amount', array('!amount' => uc_price($amount, $context))); uc_order_comment_save($order_id, $user->uid, $message, 'admin'); } else { === modified file 'payment/uc_credit/uc_credit.admin.inc' --- payment/uc_credit/uc_credit.admin.inc 2008-11-07 16:51:20 +0000 +++ payment/uc_credit/uc_credit.admin.inc 2009-04-17 18:56:04 +0000 @@ -17,10 +17,17 @@ $output .= '

'. t('Be warned that credit card data will automatically be converted to the last 4 digits of the card once a transaction has occurred. As such, subsequent charges after a partial payment will not have any stored credit card information to use.') .'

'; } - $output .= '
'. t('Order total: @total', array('@total' => uc_currency_format($order->order_total))) .'
' - .'
'. t('Balance: @balance', array('@balance' => uc_currency_format(uc_payment_balance($order)))) .'
'; + $context = array( + 'revision' => 'formatted', + 'location' => 'credit-card-terminal', + 'subject' => array( + 'order' => $order, + ), + ); + $output .= '
'. t('Order total: @total', array('@total' => uc_price($order->order_total, $context))) .'
' + .'
'. t('Balance: @balance', array('@balance' => uc_price(uc_payment_balance($order), $context))) .'
'; - $output .= drupal_get_form('uc_credit_terminal_form', $order, $balance); + $output .= drupal_get_form('uc_credit_terminal_form', $order); return $output; } @@ -38,11 +45,21 @@ $balance = uc_payment_balance($order); + $context = array( + 'revision' => 'formatted', + 'location' => 'credit-card-form', + ); + $options = array( + 'sign' => FALSE, + 'thou' => FALSE, + 'dec' => '.', + ); + // Let the administrator set the amount to charge. $form['amount'] = array( '#type' => 'textfield', '#title' => t('Charge Amount'), - '#default_value' => $balance > 0 ? uc_currency_format($balance, FALSE, FALSE) : 0, + '#default_value' => $balance > 0 ? uc_price($balance, $context, $options) : 0, '#size' => 10, '#disabled' => $lock_amount, '#field_prefix' => variable_get('uc_sign_after_amount', FALSE) ? '' : variable_get('uc_currency_sign', '$'), @@ -99,7 +116,7 @@ foreach ((array) $order->data['cc_txns']['authorizations'] as $auth_id => $data) { if (empty($data['captured'])) { - $options[$auth_id] = t('@auth_id - @date - @amount authorized', array('@auth_id' => strtoupper($auth_id), '@date' => format_date($data['authorized'], 'small'), '@amount' => uc_currency_format($data['amount']))); + $options[$auth_id] = t('@auth_id - @date - @amount authorized', array('@auth_id' => strtoupper($auth_id), '@date' => format_date($data['authorized'], 'small'), '@amount' => uc_price($data['amount'], $context))); } } === modified file 'payment/uc_cybersource/uc_cybersource.module' --- payment/uc_cybersource/uc_cybersource.module 2008-12-31 15:29:51 +0000 +++ payment/uc_cybersource/uc_cybersource.module 2009-04-17 19:07:31 +0000 @@ -218,7 +218,17 @@ $order = uc_order_load($order_id); - $amount = uc_currency_format($amount, FALSE, FALSE, '.'); + $context = array( + 'revision' => 'formatted', + 'location' => 'cybersource-charge', + ); + $options = array( + 'sign' => FALSE, + 'thou' => FALSE, + 'dec' => '.', + ); + + $amount = uc_price($amount, $context, $options); $cc_type = NULL; if (isset($order->payment_details['cc_type'])) { @@ -370,7 +380,11 @@ } // Create the order and payment ledger comments. - $o_comment = t('Credit card !type: !amount
Decision: @decision
Reason: !reason', array('!type' => variable_get('uc_cybersource_transaction_type', 'sale'), '!amount' => uc_currency_format($nvp['orderAmount']), '@decision' => $nvp['decision'], '!reason' => _parse_cs_reason_code($nvp['reasonCode']))); + $context = array( + 'revision' => 'formatted', + 'location' => 'cybersource-post-charge', + ); + $o_comment = t('Credit card !type: !amount
Decision: @decision
Reason: !reason', array('!type' => variable_get('uc_cybersource_transaction_type', 'sale'), '!amount' => uc_price($nvp['orderAmount'], $context), '@decision' => $nvp['decision'], '!reason' => _parse_cs_reason_code($nvp['reasonCode']))); $p_comment = t('!id
!decision, Reason: !reason', array('!id' => $nvp['orderPage_serialNumber'], '!decision' => $nvp['decision'], '!reason' => $nvp['reasonCode'])); if (!empty($nvp['ccAuthReply_avsCode'])) { $o_comment .= t('
AVS: !avs', array('!avs' => _parse_cs_avs_code($nvp['ccAuthReply_avsCode']))); @@ -593,7 +607,11 @@ $types = uc_credit_transaction_types(); // Create the order and payment ledger comments. - $o_comment = t('@type: @amount
Decision: @decision
Reason: !reason', array('@type' => $types[$data['txn_type']], '@amount' => uc_currency_format($amount), '@decision' => $reply->decision, '!reason' => _parse_cs_reason_code($reply->reasonCode))); + $context = array( + 'revision' => 'formatted', + 'location' => 'cybersource-soap-charge', + ); + $o_comment = t('@type: @amount
Decision: @decision
Reason: !reason', array('@type' => $types[$data['txn_type']], '@amount' => uc_price($amount, $context), '@decision' => $reply->decision, '!reason' => _parse_cs_reason_code($reply->reasonCode))); $p_comment = t('@type:
@id
@decision, Reason: !reason', array('@type' => $types[$data['txn_type']], '@id' => $reply->requestID, '@decision' => $reply->decision, '!reason' => $reply->reasonCode)); if (!empty($reply->ccAuthReply->avsCode)) { @@ -674,10 +692,18 @@ // Fetch the taxes for the order. $data = uc_cybersource_calculate_tax($order); + $context = array( + 'revision' => 'formatted', + 'location' => 'cybersource-tax-test', + ); + // Build an item list for the taxes. $items = array(); foreach ($data as $tax) { - $items[] = t('@tax: @amount', array('@tax' => $tax['name'], '@amount' => uc_currency_format($tax['amount']))); + $context['subject'] = array( + 'tax' => $tax, + ); + $items[] = t('@tax: @amount', array('@tax' => $tax['name'], '@amount' => uc_price($tax['amount'], $context))); } // Display a message if there are no taxes. @@ -885,7 +911,11 @@ // If it doesn't, log an error message and simply return the total. if ($total != floatval($reply->taxReply->totalTaxAmount)) { - watchdog('uc_cybersource', 'Tax calculation produced uneven results. Expected a total of @total, received the following: @dump', array('@total' => uc_currency_format($reply->taxReply->totalTaxAmount), '@dump' => '
'. print_r($result, TRUE) .'
'), WATCHDOG_ERROR); + $context = array( + 'revision' => 'formatted', + 'location' => 'cybersource-calculate-tax', + ); + watchdog('uc_cybersource', 'Tax calculation produced uneven results. Expected a total of @total, received the following: @dump', array('@total' => uc_price($reply->taxReply->totalTaxAmount, $context), '@dump' => '
'. print_r($result, TRUE) .'
'), WATCHDOG_ERROR); $result = array( array( === modified file 'payment/uc_google_checkout/uc_google_checkout.admin.inc' --- payment/uc_google_checkout/uc_google_checkout.admin.inc 2008-11-07 20:19:07 +0000 +++ payment/uc_google_checkout/uc_google_checkout.admin.inc 2009-04-17 19:07:32 +0000 @@ -312,16 +312,20 @@ } } $balance = uc_payment_balance($order); + $context = array( + 'revision' => 'formatted', + 'location' => 'google-checkout-terminal', + ); $output .= '

'. t('Use this terminal to process credit card payments:') .'

' .'' .'
'. t('Order total:') .' ' - . uc_currency_format($order->order_total) .'
' + . uc_price($order->order_total, $context) .'
' .''. t('Balance:') .' ' - . uc_currency_format($balance) .'
' + . uc_price($balance, $context) .'
' . t('Google Checkout total:') .'' - . uc_currency_format($order->gc_total) .'
' + . uc_price($order->gc_total, $context) .'
' . t('Google Checkout balance:') .'' - . uc_currency_format($gc_balance) .'
'; + . uc_prcie($gc_balance, $context) .''; if (in_array($order->financial_state, array('REVIEWING', 'CHARGEABLE', 'CHARGED'))) { $output .= drupal_get_form('uc_google_checkout_terminal_form', $order, $gc_balance); @@ -360,10 +364,21 @@ '#value' => 'charge', ); } + + $context = array( + 'revision' => 'formatted', + 'location' => 'google-checkout-terminal-form', + ); + $options = array( + 'sign' => FALSE, + 'thou' => FALSE, + 'dec' => '.', + ); + $form['amount'] = array( '#type' => 'textfield', '#title' => t('Amount'), - '#default_value' => uc_currency_format($amount, FALSE, FALSE), + '#default_value' => uc_price($amount, $context, $options), '#size' => 10, '#weight' => 0, '#field_prefix' => variable_get('uc_sign_after_amount', FALSE) ? '' : variable_get('uc_currency_sign', '$'), === modified file 'payment/uc_google_checkout/uc_google_checkout.module' --- payment/uc_google_checkout/uc_google_checkout.module 2009-04-09 19:36:17 +0000 +++ payment/uc_google_checkout/uc_google_checkout.module 2009-04-17 19:07:33 +0000 @@ -497,7 +497,16 @@ $shipping_options .= ''. $settings['pickup'] .''; $shipping_options .= ''. $services[$key] .''; if ($settings['fixed_charge']) { - $shipping_options .= ''. number_format($settings['fixed_charge'], 2, '.', '') .''; + $context = array( + 'revision' => 'formatted', + 'location' => 'google-checkout-cart-request', + ); + $options = array( + 'sign' => FALSE, + 'thou' => FALSE, + 'dec' => '.', + ); + $shipping_options .= ''. uc_price($settings['fixed_charge'], $context, $options) .''; } if ($settings['percent_adjustment']) { $shipping_options .= ''. (float)$settings['percent_adjustment'] .''; @@ -926,7 +935,11 @@ if ($order_id) { uc_payment_enter($order_id, 'google_checkout', $charge->{'latest-charge-amount'}, 0, '', t('Payment received by Google Checkout')); - uc_order_comment_save($order_id, 0, t('Payment of %amount received by Google Checkout.', array('%amount' => uc_currency_format($charge->{'latest-charge-amount'}))), 'admin', 'chargeable'); + $context = array( + 'revision' => 'formatted', + 'location' => 'google-checkout-charge-comment', + ); + uc_order_comment_save($order_id, 0, t('Payment of %amount received by Google Checkout.', array('%amount' => uc_price($charge->{'latest-charge-amount'}, $context))), 'admin', 'chargeable'); uc_google_checkout_notification_acknowledgement($charge['serial-number']); } else { @@ -957,7 +970,11 @@ if ($order_id) { uc_payment_enter($order_id, 'google_checkout', -$refund->{'latest-refund-amount'}, 0, '', t('Refund received by Google Checkout')); - uc_order_comment_save($order_id, 0, t('Refund of %amount received by Google Checkout.', array('%amount' => uc_currency_format($refund->{'latest-refund-amount'}))), + $context = array( + 'revision' => 'formatted', + 'location' => 'google-checkout-refund-comment', + ); + uc_order_comment_save($order_id, 0, t('Refund of %amount received by Google Checkout.', array('%amount' => uc_price($refund->{'latest-refund-amount'}, $context))), 'admin', 'processing'); uc_google_checkout_notification_acknowledgement($refund['serial-number']); } === modified file 'payment/uc_payment_pack/uc_payment_pack.admin.inc' --- payment/uc_payment_pack/uc_payment_pack.admin.inc 2009-03-27 15:51:12 +0000 +++ payment/uc_payment_pack/uc_payment_pack.admin.inc 2009-04-17 19:00:24 +0000 @@ -12,7 +12,15 @@ */ function uc_payment_pack_receive_check_form($form_state, $order) { $balance = uc_payment_balance($order); - $form['balance'] = array('#value' => uc_currency_format($balance)); + $context = array( + 'location' => 'receive-check-form', + ); + $options = array( + 'sign' => FALSE, + 'thou' => FALSE, + 'dec' => '.', + ); + $form['balance'] = array('#value' => uc_price($balance, $context)); $form['order_id'] = array( '#type' => 'hidden', '#value' => $order->order_id, @@ -22,10 +30,11 @@ '#title' => t('Check has already cleared.'), '#attributes' => array('onclick' => 'receive_check_toggle(this.checked);'), ); + $context['revision'] = 'formatted'; $form['amount'] = array( '#type' => 'textfield', '#title' => t('Amount'), - '#default_value' => uc_currency_format($balance, FALSE, FALSE), + '#default_value' => uc_price($balance, $context, $options), '#size' => 10, '#field_prefix' => variable_get('uc_sign_after_amount', FALSE) ? '' : variable_get('uc_currency_sign', '$'), '#field_suffix' => variable_get('uc_sign_after_amount', FALSE) ? variable_get('uc_currency_sign', '$') : '', === modified file 'payment/uc_payment_pack/uc_payment_pack.module' --- payment/uc_payment_pack/uc_payment_pack.module 2009-03-27 15:51:12 +0000 +++ payment/uc_payment_pack/uc_payment_pack.module 2009-04-17 18:45:46 +0000 @@ -135,7 +135,11 @@ case 'cart-details': $details = variable_get('uc_cod_policy', t('Full payment is expected upon delivery or prior to pick-up.')); if (($max = variable_get('uc_cod_max_order', 0)) > 0 && is_numeric($max)) { - $details .= '

'. t('Orders totalling more than !number are not eligible for COD.', array('!number' => uc_currency_format($max))) .'

'; + $context = array( + 'revision' => 'formatted', + 'location' => 'cod-cart-details', + ); + $details .= '

'. t('Orders totalling more than !number are not eligible for COD.', array('!number' => uc_price($max, $context))) .'

'; } if (variable_get('uc_cod_delivery_date', FALSE)) { $details .= uc_strip_form(drupal_get_form('uc_payment_method_cod_form', $arg1)); === modified file 'payment/uc_paypal/uc_paypal.module' --- payment/uc_paypal/uc_paypal.module 2009-04-11 22:44:25 +0000 +++ payment/uc_paypal/uc_paypal.module 2009-04-17 19:07:34 +0000 @@ -279,11 +279,21 @@ $order = uc_order_load($order_id); + $context = array( + 'revision' => 'formatted', + 'location' => 'paypal-wpp-charge', + ); + $options = array( + 'sign' => FALSE, + 'thou' => FALSE, + 'dec' => '.', + ); + if ($data['txn_type'] == UC_CREDIT_PRIOR_AUTH_CAPTURE) { $nvp_request = array( 'METHOD' => 'DoCapture', 'AUTHORIZATIONID' => $data['auth_id'], - 'AMT' => uc_currency_format($amount, FALSE, FALSE, '.'), + 'AMT' => uc_price($amount, $context, $options), 'CURRENCYCODE' => variable_get('uc_paypal_wpp_currency', 'USD'), 'COMPLETETYPE' => 'Complete', ); @@ -339,7 +349,7 @@ 'METHOD' => 'DoDirectPayment', 'PAYMENTACTION' => $data['txn_type'] == UC_CREDIT_AUTH_ONLY ? 'Authorization' : 'Sale', 'IPADDRESS' => ip_address(), - 'AMT' => uc_currency_format($amount, FALSE, FALSE, '.'), + 'AMT' => uc_price($amount, $context, $options), 'CREDITCARDTYPE' => $cc_type, 'ACCT' => $order->payment_details['cc_number'], 'EXPDATE' => $expdate, @@ -397,7 +407,7 @@ ); } else { - $message = t('@type
Success: @amount @currency', array('@type' => $types[$data['txn_type']], '@amount' => uc_currency_format($nvp_response['AMT'], FALSE), '@currency' => $nvp_response['CURRENCYCODE'])); + $message = t('@type
Success: @amount @currency', array('@type' => $types[$data['txn_type']], '@amount' => uc_price($nvp_response['AMT'], $context, array('sign' => FALSE)), '@currency' => $nvp_response['CURRENCYCODE'])); if ($data['txn_type'] != UC_CREDIT_PRIOR_AUTH_CAPTURE) { $message .= '
'. t('Address: @avscode', array('@avscode' => _uc_paypal_avscode_message($nvp_response['AVSCODE']))); if (variable_get('uc_credit_cvv_enabled', TRUE)) { @@ -589,11 +599,21 @@ $country = array(0 => array('country_iso_code_2' => 'US')); } + $context = array( + 'revision' => 'formatted', + 'location' => 'paypal-ec-checkout', + ); + $options = array( + 'sign' => FALSE, + 'thou' => FALSE, + 'dec' => '.', + ); + $nvp_request = array( 'METHOD' => 'SetExpressCheckout', 'RETURNURL' => url('cart/echeckout/selected', array('absolute' => TRUE)), 'CANCELURL' => url('uc_paypal/wps/cancel', array('absolute' => TRUE)), - 'AMT' => uc_currency_format($order->order_total, FALSE, FALSE, '.'), + 'AMT' => uc_price($order->order_total, $checkout, $options), 'CURRENCYCODE' => variable_get('uc_paypal_wpp_currency', 'USD'), 'PAYMENTACTION' => variable_get('uc_paypal_wpp_payment_action', 'Sale'), 'DESC' => substr($desc, 0, 127), @@ -668,11 +688,21 @@ $order = uc_order_new($user->uid); + $context = array( + 'revision' => 'formatted', + 'location' => 'paypal-ec-form-submit', + ); + $options = array( + 'sign' => FALSE, + 'thou' => FALSE, + 'dec' => '.', + ); + $nvp_request = array( 'METHOD' => 'SetExpressCheckout', 'RETURNURL' => url('cart/echeckout/review', array('absolute' => TRUE)), 'CANCELURL' => url('uc_paypal/wps/cancel', array('absolute' => TRUE)), - 'AMT' => uc_currency_format($subtotal, FALSE, FALSE, '.'), + 'AMT' => uc_price($subtotal, $context, $options), 'CURRENCYCODE' => variable_get('uc_paypal_wpp_currency', 'USD'), 'PAYMENTACTION' => variable_get('uc_paypal_wpp_payment_action', 'Sale'), 'DESC' => substr($desc, 0, 127), @@ -726,19 +756,29 @@ $country = array(0 => array('country_iso_code_2' => 'US')); } + $context = array( + 'revision' => 'formatted', + 'location' => 'paypal-ec-submit-form-submit', + ); + $options = array( + 'sign' => FALSE, + 'thou' => FALSE, + 'dec' => '.', + ); + $nvp_request = array( 'METHOD' => 'DoExpressCheckoutPayment', 'TOKEN' => $_SESSION['TOKEN'], 'PAYMENTACTION' => variable_get('uc_paypal_wpp_payment_action', 'Sale'), 'PAYERID' => $_SESSION['PAYERID'], - 'AMT' => uc_currency_format($order->order_total, FALSE, FALSE, '.'), + 'AMT' => uc_price($order->order_total, $context, $options), 'DESC' => substr($desc, 0, 127), 'INVNUM' => $order->order_id .'-'. time(), 'BUTTONSOURCE' => 'Ubercart_ShoppingCart_EC_US', 'NOTIFYURL' => url('uc_paypal/ipn/'. $order->order_id, array('absolute' => TRUE)), - 'ITEMAMT' => uc_currency_format($subtotal, FALSE, FALSE, '.'), - 'SHIPPINGAMT' => uc_currency_format($shipping, FALSE, FALSE, '.'), - 'TAXAMT' => uc_currency_format($tax, FALSE, FALSE, '.'), + 'ITEMAMT' => uc_price($subtotal, $context, $options), + 'SHIPPINGAMT' => uc_price($shipping, $context, $options), + 'TAXAMT' => uc_price($tax, $context, $options), 'CURRENCYCODE' => variable_get('uc_paypal_wpp_currency', 'USD'), ); @@ -795,6 +835,16 @@ $phone_c = substr($phone, 6, 4); } + $context = array( + 'revision' => 'formatted', + 'location' => 'paypal-wps-form', + ); + $options = array( + 'sign' => FALSE, + 'thou' => FALSE, + 'dec' => '.', + ); + $data = array( // PayPal command variable 'cmd' => '_cart', @@ -811,9 +861,9 @@ // Transaction information 'currency_code' => variable_get('uc_paypal_wps_currency', 'USD'), - 'handling_cart' => uc_currency_format($shipping, FALSE, FALSE, '.'), + 'handling_cart' => uc_price($shipping, $context, $options), 'invoice' => $order->order_id .'-'. time(), - 'tax_cart' => uc_currency_format($tax, FALSE, FALSE, '.'), + 'tax_cart' => uc_price($tax, $context, $options), // Shopping cart specific variables 'business' => variable_get('uc_paypal_wps_email', ''), @@ -850,7 +900,7 @@ $i = 0; foreach ($order->products as $item) { $i++; - $data['amount_'. $i] = uc_currency_format($item->price, FALSE, FALSE, '.'); + $data['amount_'. $i] = uc_price($item->price, $context, $options); $data['item_name_'. $i] = $item->title; $data['item_number_'. $i] = $item->model; $data['quantity_'. $i] = $item->qty; @@ -868,7 +918,7 @@ } else { // List the whole cart as a single item to account for fees/discounts - $data['amount_1'] = uc_currency_format($order->order_total - $shipping - $tax, FALSE, FALSE, '.'); + $data['amount_1'] = uc_price($order->order_total - $shipping - $tax, $context, $options); $data['item_name_1'] = t('Order @order_id at !store', array('@order_id' => $order->order_id, '!store' => variable_get('uc_store_name', url('', array('absolute' => TRUE))))); $data['on0_1'] = t('Product count'); $data['os0_1'] = count($order->products); === modified file 'payment/uc_paypal/uc_paypal.pages.inc' --- payment/uc_paypal/uc_paypal.pages.inc 2009-02-19 14:28:38 +0000 +++ payment/uc_paypal/uc_paypal.pages.inc 2009-04-17 18:45:44 +0000 @@ -78,17 +78,25 @@ db_query("INSERT INTO {uc_payment_paypal_ipn} (order_id, txn_id, txn_type, mc_gross, status, receiver_email, payer_email, received) VALUES (%d, '%s', '%s', '%s', '%s', '%s', '%s', %d)", $order_id, $txn_id, $txn_type, $payment_amount, $payment_status, $receiver_email, $payer_email, time()); + $context = array( + 'revision' => 'formatted', + 'location' => 'paypal-ipn', + ); + $options = array( + 'sign' => FALSE, + ); + switch ($payment_status) { case 'Canceled_Reversal': - uc_order_comment_save($order_id, 0, t('PayPal has cancelled the reversal and returned !amount !currency to your account.', array('!amount' => uc_currency_format($payment_amount, FALSE), '!currency' => $payment_currency)), 'admin'); + uc_order_comment_save($order_id, 0, t('PayPal has cancelled the reversal and returned !amount !currency to your account.', array('!amount' => uc_price($payment_amount, $context, $options), '!currency' => $payment_currency)), 'admin'); break; case 'Completed': $comment = t('PayPal transaction ID: @txn_id', array('@txn_id' => $txn_id)); uc_payment_enter($order_id, 'paypal_wps', $payment_amount, $order->uid, NULL, $comment); uc_cart_complete_sale($order); - uc_order_comment_save($order_id, 0, t('Payment of @amount @currency submitted through PayPal.', array('@amount' => uc_currency_format($payment_amount, FALSE), '@currency' => $payment_currency)), 'order', 'payment_received'); - uc_order_comment_save($order_id, 0, t('PayPal IPN reported a payment of @amount @currency.', array('@amount' => uc_currency_format($payment_amount, FALSE), '@currency' => $payment_currency))); + uc_order_comment_save($order_id, 0, t('Payment of @amount @currency submitted through PayPal.', array('@amount' => uc_price($payment_amount, $context, $options), '@currency' => $payment_currency)), 'order', 'payment_received'); + uc_order_comment_save($order_id, 0, t('PayPal IPN reported a payment of @amount @currency.', array('@amount' => uc_price($payment_amount, $context, $options), '@currency' => $payment_currency))); break; case 'Denied': === modified file 'payment/uc_recurring/uc_recurring.admin.inc' --- payment/uc_recurring/uc_recurring.admin.inc 2008-10-06 18:28:05 +0000 +++ payment/uc_recurring/uc_recurring.admin.inc 2009-04-17 18:45:43 +0000 @@ -34,6 +34,10 @@ $result = pager_query("SELECT * FROM {uc_recurring_users} AS ru" . tablesort_sql($header), 30); } + $context = array( + 'location' => 'recurring-admin', + ); + while ($fee = db_fetch_array($result)) { $ops = array(); @@ -46,7 +50,7 @@ $rows[] = array( l($fee['rfid'], 'admin/store/orders/recurring/view/fee/'. $fee['rfid']), l($fee['order_id'], 'admin/store/orders/'. $fee['order_id']), - uc_currency_format($fee['fee_amount']), + uc_price($fee['fee_amount'], $context), $fee['remaining_intervals'] == 0 ? '-' : format_date($fee['next_charge'], 'small'), array('data' => check_plain($fee['regular_interval']), 'nowrap' => 'nowrap'), $fee['remaining_intervals'], @@ -102,8 +106,12 @@ // Confirm a recurring fee charge. function uc_recurring_admin_charge_form() { $fee = uc_recurring_fee_load('user', arg(4)); + $context = array( + 'revision' => 'formatted', + 'location' => 'recurring-charge-form', + ); $form['message'] = array( - '#value' => '
'. t('Are you sure you want to charge the customer !amount at this time?', array('!amount' => uc_currency_format($fee['fee_amount']))) .'
', + '#value' => '
'. t('Are you sure you want to charge the customer !amount at this time?', array('!amount' => uc_price($fee['fee_amount'], $context))) .'
', ); $form['submit'] = array( '#type' => 'submit', === modified file 'payment/uc_recurring/uc_recurring.module' --- payment/uc_recurring/uc_recurring.module 2009-03-20 07:18:57 +0000 +++ payment/uc_recurring/uc_recurring.module 2009-04-17 18:45:41 +0000 @@ -571,9 +571,14 @@ 'number_intervals' => intval($form_state['values']['number_intervals']), ); + $context = array( + 'revision' => 'formatted', + 'location' => 'recurring-feature-submit', + ); + $args = array( '@product' => empty($fee['model']) ? t('this product') : t('product @model', array('@model' => $fee['model'])), - '!amount' => uc_currency_format($fee['fee_amount']), + '!amount' => uc_price($fee['fee_amount'], $context), '!initial' => $fee['initial_charge'], '!regular' => $fee['regular_interval'], '!intervals' => t('!num times', array('!num' => $fee['number_intervals'] - 1)), @@ -651,6 +656,10 @@ // Set up a header array for the table. $header = array(t('Order'), t('Amount'), t('Interval'), t('Next charge'), t('Remaining'), t('Operations')); + $context = array( + 'location' => 'recurring-user-table', + ); + // Loop through the fees sorted by the order ID descending. $result = db_query("SELECT * FROM {uc_recurring_users} WHERE uid = %d AND remaining_intervals > 0 ORDER BY order_id DESC", $uid); while ($fee = db_fetch_array($result)) { @@ -665,7 +674,7 @@ // Add the row to the table for display. $rows[] = array( l($fee['order_id'], 'user/'. $uid .'/order/'. $fee['order_id']), - uc_currency_format($fee['fee_amount']), + uc_price($fee['fee_amount'], $context), array('data' => check_plain($fee['regular_interval']), 'nowrap' => 'nowrap'), $fee['remaining_intervals'] == 0 ? '-' : format_date($fee['next_charge'], 'small'), $fee['remaining_intervals'], @@ -886,7 +895,11 @@ // Handle the result. if ($result['success'] === TRUE) { uc_payment_enter($fee['order_id'], 'credit', $fee['fee_amount'], 0, $result['data'], t('Recurring fee payment.') .'
'. $result['comment']); - uc_order_comment_save($fee['order_id'], 0, t('!amount recurring fee collected for @model. (ID: !fee)', array('!url' => url('admin/store/orders/recurring/view/fee/'. $fee['rfid']), '!fee' => $fee['rfid'], '!amount' => uc_currency_format($fee['fee_amount']), '@model' => $fee['data']['model']))); + $context = array( + 'revision' => 'formatted', + 'location' => 'recurring-charge-comment', + ); + uc_order_comment_save($fee['order_id'], 0, t('!amount recurring fee collected for @model. (ID: !fee)', array('!url' => url('admin/store/orders/recurring/view/fee/'. $fee['rfid']), '!fee' => $fee['rfid'], '!amount' => uc_price($fee['fee_amount'], $context), '@model' => $fee['data']['model']))); // Modules can hook into the charge process using hook_recurring_api(). module_invoke_all('recurring_api', 'charge', $fee);