// Fixed references to a "conversion rate" that was in fact the "exchange rate"

This commit is contained in:
Damien Metzger
2013-07-01 12:14:50 +02:00
parent f824b537cf
commit 56aab3c676
5 changed files with 15 additions and 15 deletions
@@ -264,8 +264,8 @@
{if (!$order->valid && sizeof($currencies) > 1)}
<form method="post" action="{$currentIndex}&vieworder&id_order={$order->id}&token={$smarty.get.token|escape:'htmlall':'UTF-8'}">
<p class="warn">{l s='Don\'t forget to update your conversion rate before making this change.'}</p>
<label>{l s='Don\'t forget to update your conversion rate before making this change.'}</label>
<p class="warn">{l s='Do not forget to update your exchange rate before making this change.'}</p>
<label>{l s='Do not forget to update your exchange rate before making this change.'}</label>
<select name="new_currency">
{foreach from=$currencies item=currency_change}
{if $currency_change['id_currency'] != $order->id_currency}
+8 -8
View File
@@ -43,7 +43,7 @@ class CurrencyCore extends ObjectModel
/** @var int bool used for displaying blank between sign and price */
public $blank;
/** @var string Conversion rate from euros */
/** @var string exchange rate from euros */
public $conversion_rate;
/** @var boolean True if currency has been deleted (staying in database as deleted) */
@@ -326,23 +326,23 @@ class CurrencyCore extends ObjectModel
}
/**
* Refresh the currency conversion rate
* The XML file define conversion rate for each from a default currency ($isoCodeSource).
* Refresh the currency exchange rate
* The XML file define exchange rate for each from a default currency ($isoCodeSource).
*
* @param $data XML content which contains all the conversion rates
* @param $data XML content which contains all the exchange rates
* @param $isoCodeSource The default currency used in the XML file
* @param $defaultCurrency The default currency object
*/
public function refreshCurrency($data, $isoCodeSource, $defaultCurrency)
{
// fetch the conversion rate of the default currency
$conversion_rate = 1;
// fetch the exchange rate of the default currency
$exchange_rate = 1;
if ($defaultCurrency->iso_code != $isoCodeSource)
{
foreach ($data->currency as $currency)
if ($currency['iso_code'] == $defaultCurrency->iso_code)
{
$conversion_rate = round((float)$currency['rate'], 6);
$exchange_rate = round((float)$currency['rate'], 6);
break;
}
}
@@ -364,7 +364,7 @@ class CurrencyCore extends ObjectModel
}
if (isset($rate))
$this->conversion_rate = round($rate / $conversion_rate, 6);
$this->conversion_rate = round($rate / $exchange_rate, 6);
}
$this->update();
}
+1 -1
View File
@@ -63,7 +63,7 @@ class OrderCore extends ObjectModel
/** @var string Payment module */
public $module;
/** @var float Currency conversion rate */
/** @var float Currency exchange rate */
public $conversion_rate;
/** @var boolean Customer is ok for a recyclable package */
@@ -38,7 +38,7 @@ class AdminCurrenciesControllerCore extends AdminController
'iso_code' => array('title' => $this->l('ISO code'), 'align' => 'center', 'width' => 80),
'iso_code_num' => array('title' => $this->l('ISO code number'), 'align' => 'center', 'width' => 120),
'sign' => array('title' => $this->l('Symbol'), 'width' => 20, 'align' => 'center', 'orderby' => false, 'search' => false),
'conversion_rate' => array('title' => $this->l('Conversion rate'), 'type' => 'float', 'align' => 'center', 'width' => 130, 'search' => false),
'conversion_rate' => array('title' => $this->l('Exchange rate'), 'type' => 'float', 'align' => 'center', 'width' => 130, 'search' => false),
'active' => array('title' => $this->l('Enabled'), 'width' => 25, 'align' => 'center', 'active' => 'status', 'type' => 'bool', 'orderby' => false),
);
@@ -130,12 +130,12 @@ class AdminCurrenciesControllerCore extends AdminController
),
array(
'type' => 'text',
'label' => $this->l('Conversion rate:'),
'label' => $this->l('Exchange rate:'),
'name' => 'conversion_rate',
'size' => 3,
'maxlength' => 11,
'required' => true,
'desc' => $this->l('Conversion rates are calculated from one unit of your shop\'s default currency. For example, if the default currency is euros and your chosen currency is dollars, type "1.20"').' 1&euro; = $1.20',
'desc' => $this->l('Exchange rates are calculated from one unit of your shop\'s default currency. For example, if the default currency is euros and your chosen currency is dollars, type "1.20"').' 1&euro; = $1.20',
),
array(
'type' => 'select',
+1 -1
View File
@@ -976,7 +976,7 @@ class AdminOrdersControllerCore extends AdminController
// Update currency in order
$order->id_currency = $currency->id;
// Update conversion rate
// Update exchange rate
$order->conversion_rate = (float)$currency->conversion_rate;
$order->update();
}