Browse Source

[ZF-9498] Zend_Currency:

- fixed options array

git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@21601 44c647ce-9c0f-0410-b52a-842ac1e357ba
thomas 16 years ago
parent
commit
aa1519f80a

+ 1 - 1
documentation/manual/en/module_specs/Zend_Currency-Exchange.xml

@@ -31,7 +31,7 @@ class SimpleExchange implements Zend_Currency_CurrencyInterface
 
         switch ($to) {
             case 'EUR':
-                return 0.5;
+                return 2;
             case 'JPE':
                 return 0.7;
        }

+ 10 - 7
library/Zend/Currency.php

@@ -91,14 +91,15 @@ class Zend_Currency
     public function __construct($options = null, $locale = null)
     {
         if (is_array($options)) {
+            $this->setLocale($locale);
             $this->setFormat($options);
         } else if (Zend_Locale::isLocale($options, false, false)) {
-            $temp    = $locale;
-            $locale  = $options;
-            $options = $temp;
+            $this->setLocale($options);
+            $options = $locale;
+        } else {
+            $this->setLocale($locale);
         }
 
-        $this->setLocale($locale);
         // Get currency details
         if (!isset($this->_options['currency']) || !is_array($options)) {
             $this->_options['currency'] = self::getShortName($options, $this->_options['locale']);
@@ -745,11 +746,13 @@ class Zend_Currency
     protected function _exchangeCurrency($value, $currency)
     {
         if ($value instanceof Zend_Currency) {
-            $value = $value->getValue();
+            $currency = $value->getShortName();
+            $value    = $value->getValue();
+        } else {
+            $currency = $this->getShortName($currency);
         }
 
-        $currency = $this->getShortName($currency);
-        $rate     = 1;
+        $rate = 1;
         if ($currency !== $this->getShortName()) {
             $service = $this->getService();
             if (!($service instanceof Zend_Currency_CurrencyInterface)) {