Index: money.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/money/money.module,v
retrieving revision 1.1.4.15
diff -u -p -r1.1.4.15 money.module
--- money.module	9 Apr 2009 07:11:39 -0000	1.1.4.15
+++ money.module	24 Apr 2009 20:30:14 -0000
@@ -24,6 +24,7 @@ function money_theme() {
     'money_formatter_default' => array('arguments' => array('element' => NULL), 'function' => 'theme_money_formatter_generic'),
     'money_formatter_nozeros' => array('arguments' => array('element' => NULL), 'function' => 'theme_money_formatter_generic'),
     'money_formatter_unformatted' => array('arguments' => array('element' => NULL)),
+    'money_field' => array('arguments' => array('amount' => NULL, 'currency' => NULL, 'display_options' => NULL, 'separator' => NULL)),
   );
 }
 
@@ -402,33 +403,7 @@ function theme_money_formatter_unformatt
   $currency = $element['#item']['currency'];
 
   // Format the whole field based on widget display options.
-  $output = '';
-  $display_options = explode('|', $field['widget']['currency_display_mode']);
-  foreach ($display_options as $option) {
-    switch ($option) {
-      case 'a':
-        // raw number.
-        $output .= $amount;
-        break;
-      case 's':
-        // Currency symbol.
-        $currency_symbols = currency_api_get_symbols();
-        if (isset($currency_symbols[$currency])) {
-          $output .= $currency_symbols[$currency];
-          break;
-        }
-        // Fall back to currency code.
-      case 'c':
-        // Currency code.
-        $output .= $currency;
-        break;
-      case '+':
-        // Whitespace.
-        $output .= ' ';
-        break;
-    }
-  }
-  return $output;
+  return theme('money_field', $amount, $currency, $field['widget']['currency_display_mode'], ' ');
 }
 
 /**
@@ -469,13 +444,31 @@ function theme_money_formatter_generic($
   $formatted_number = format_number($amount, $decimals);
 
   // Format the whole field based on widget display options.
+  return theme('money_field', $formatted_number, $currency, $field['widget']['currency_display_mode']);
+}
+
+/**
+ * Display an amount and currency with the given display options.
+ *
+ * @param $amount
+ *   The amount (raw or formatted).
+ * @param $currency
+ *   The currency code.
+ * @param $display_options
+ *   The string that provides display options as configured in widget settings.
+ * @param $separator
+ *   The character used as a separator when specified by '+' is display options.
+ *   Defaults to non-break space.
+ *
+ * @ingroup themeable
+ */
+function theme_money_field($amount, $currency, $display_options, $separator = "\xC2\xA0") {
   $output = '';
-  $display_options = explode('|', $field['widget']['currency_display_mode']);
-  foreach ($display_options as $option) {
+  foreach (explode('|', $display_options) as $option) {
     switch ($option) {
       case 'a':
-        // Formatted number.
-        $output .= $formatted_number;
+        // The amount.
+        $output .= $amount;
         break;
       case 's':
         // Currency symbol.
@@ -490,8 +483,8 @@ function theme_money_formatter_generic($
         $output .= $currency;
         break;
       case '+':
-        // Non-break space.
-        $output .= "\xC2\xA0";
+        // Separator.
+        $output .= $separator;
         break;
     }
   }
Index: modules/money_conversion_dialog/money_conversion_dialog.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/money/modules/money_conversion_dialog/Attic/money_conversion_dialog.module,v
retrieving revision 1.1.2.3
diff -u -p -r1.1.2.3 money_conversion_dialog.module
--- modules/money_conversion_dialog/money_conversion_dialog.module	27 Nov 2008 23:19:08 -0000	1.1.2.3
+++ modules/money_conversion_dialog/money_conversion_dialog.module	24 Apr 2009 19:00:04 -0000
@@ -49,14 +49,16 @@ function money_conversion_dialog_ajax_ca
   $settings = explode('|', $arg);
 
   // Validate amount, decimals and currency_display_mode.
-  if (!is_numeric($settings[0]) || !is_numeric($settings[1]) || !in_array($settings[2], array('code', 'symbol'))) {
-    return drupal_json(array('error' => t('Invalid operation settings: @settings', array('@settings' => $arg))));
+  $display_mode = str_replace(array(':', ' '), array('|', '+'), $settings[2]);
+  $display_modes = money_get_display_modes();
+  if (!is_numeric($settings[0]) || !is_numeric($settings[1]) || !isset($display_modes[$display_mode])) {
+    return drupal_json(array('error' => t('Invalid money data in operation settings: @settings', array('@settings' => $arg))));
   }
 
   // Validate from_currency and to_currency.
   $currency_symbols = currency_api_get_symbols();
   if (!isset($currency_symbols[$settings[3]]) || !isset($currency_symbols[$settings[4]])) {
-    return drupal_json(array('error' => t('Invalid operation settings: @settings', array('@settings' => $arg))));
+    return drupal_json(array('error' => t('Invalid currencies in operation settings: @settings', array('@settings' => $arg))));
   }
 
   // Use the Currency API to perform the conversion.
@@ -65,9 +67,12 @@ function money_conversion_dialog_ajax_ca
     return drupal_json(array('error' => t('Currency exchange error: ') . t($ret['message'])));
   }
 
+  // Format the amount.
+  $formatted_number = format_number($ret['value'], (int)$settings[1]);
+
   // Build formatted result.
   return drupal_json(array(
-    'money' => format_number($ret['value'], (int)$settings[1]) ."\xC2\xA0". theme('money_currency', $settings[4], $settings[2]),
+    'money' => theme('money_field', $formatted_number, $settings[4], $display_mode),
     'from' => $settings[3],
     'to' => $settings[4],
   ));
@@ -147,7 +152,7 @@ function theme_money_conversion_dialog($
   $settings = implode('|', array(
     $element['#item']['amount'],
     (isset($field['decimals']) ? (int)$field['decimals'] : 0),
-    $field['widget']['currency_display_mode'],
+    str_replace('|', ':', $field['widget']['currency_display_mode']),
     $element['#item']['currency'],
   ));
