Index: money.module
===================================================================
RCS file: /cvs/drupal/contributions/modules/money/money.module,v
retrieving revision 1.1.4.8
diff -u -p -r1.1.4.8 money.module
--- money.module	7 Dec 2008 19:25:57 -0000	1.1.4.8
+++ money.module	16 Feb 2009 05:21:50 -0000
@@ -274,31 +274,34 @@ function money_get_widget_currencies($fi
   // Currently implemented modes: code, name. See money_widget_settings().
   $mode = $field['widget']['currency_select_mode'];
 
-  // Make sure we have an array of allowed currencies.
+  // Initialize: Make sure we have an array of allowed currencies.
   if (isset($field['widget']['allowed_currencies']) && is_array($field['widget']['allowed_currencies'])) {
     $allowed_currencies = array_filter($field['widget']['allowed_currencies']);
   }
   else {
+    // @todo: Document under what circumstances widget[allowed_currencies]
+    // might not be set or not be an array.
     $allowed_currencies = array();
   }
 
-  // When no currency has been specified in widget settings we allow them all.
   if (empty($allowed_currencies)) {
+    // When no currency has been specified in widget settings we allow them all.
     $allowed_currencies = currency_api_get_list();
-    if ($mode == 'code') {
-      $allowed_currencies = array_keys($allowed_currencies);
-      $allowed_currencies = array_combine($allowed_currencies, $allowed_currencies);
-    }
   }
   else {
-    if ($mode == 'name') {
-      $allowed_currencies = array_intersect_key(currency_api_get_list(), $allowed_currencies);
-    }
+    // Filter all available currencies for the ones that are enabled.
+    $allowed_currencies = array_intersect_key(currency_api_get_list(), $allowed_currencies);
+  }
+
+  // Display the currency code instead of the currency's name.
+  if ('code' == $mode) {
+    $allowed_currencies = array_combine($allowed_currencies, array_keys($allowed_currencies));
   }
 
   // When field is not required, an additional empty currency is pushed on top of the resulting list.
   if (!$field['required']) {
-    $allowed_currencies = array('' => ($mode == 'code' ? '---' : t('-- Select currency --'))) + $allowed_currencies;
+    $empty_option = ($mode == 'code' ? '---' : t('-- Select currency --'));
+    $allowed_currencies = array('' => $empty_option) + $allowed_currencies;
   }
 
   return $allowed_currencies;
