? .svn
? currencies.patch
? translations/.svn
Index: money.module
===================================================================
RCS file: /cvs/drupal/contributions/modules/money/money.module,v
retrieving revision 1.1.4.5
diff -u -p -r1.1.4.5 money.module
--- money.module	19 Nov 2008 17:10:49 -0000	1.1.4.5
+++ money.module	16 Feb 2009 04:51:39 -0000
@@ -265,25 +265,33 @@ function money_get_widget_currencies($fi
   // Currently implemented modes: code, name. See money_widget_settings().
   $mode = $field['widget']['currency_select_mode'];
 
-  if (empty($field['widget']['allowed_currencies']) || !is_array($field['widget']['allowed_currencies'])) {
+  if (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();
+  }
+
+  if (empty($allowed_currencies)) {
+    // No currencies have been turned on.  Use all available currencies.
     $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 == 'code') {
-      $allowed_currencies = array_filter($field['widget']['allowed_currencies']);
-    }
-    else {
-      $allowed_currencies = array_intersect_key(currency_api_get_list(), array_filter($field['widget']['allowed_currencies']));
-    }
+    // Filter all available currencies for the ones that are turned on.
+    $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;
