From e81f10c79033ee9bcd4133e9cff2308918902692 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 2 May 2019 13:45:49 +0200 Subject: [PATCH] Debug hidden option MAIN_MULTICURRENCY_ALLOW_SYNCHRONIZATION --- htdocs/admin/multicurrency.php | 10 +++++----- htdocs/core/class/html.form.class.php | 12 ++++++++++-- htdocs/langs/en_US/multicurrency.lang | 2 +- htdocs/multicurrency/class/multicurrency.class.php | 4 ++-- 4 files changed, 18 insertions(+), 10 deletions(-) diff --git a/htdocs/admin/multicurrency.php b/htdocs/admin/multicurrency.php index 9602f9c383b..4a10f663e34 100644 --- a/htdocs/admin/multicurrency.php +++ b/htdocs/admin/multicurrency.php @@ -115,7 +115,7 @@ elseif ($action == 'setapilayer') { dolibarr_set_const($db, 'MULTICURRENCY_APP_ID', GETPOST('MULTICURRENCY_APP_ID', 'alpha')); dolibarr_set_const($db, 'MULTICURRENCY_APP_SOURCE', GETPOST('MULTICURRENCY_APP_SOURCE', 'alpha')); - dolibarr_set_const($db, 'MULTICURRENCY_ALTERNATE_SOURCE', GETPOST('MULTICURRENCY_ALTERNATE_SOURCE', 'alpha')); + //dolibarr_set_const($db, 'MULTICURRENCY_ALTERNATE_SOURCE', GETPOST('MULTICURRENCY_ALTERNATE_SOURCE', 'alpha')); } else { @@ -249,8 +249,8 @@ if (!empty($conf->global->MAIN_MULTICURRENCY_ALLOW_SYNCHRONIZATION)) print ''.$form->textwithpicto($langs->trans("CurrencyLayerAccount"), $langs->trans("CurrencyLayerAccount_help_to_synchronize", $urlforapilayer)).''."\n"; print ''; print ''; - print $langs->trans("Value").' '; print ''; + print ''; print ''; print ''; @@ -266,11 +266,11 @@ if (!empty($conf->global->MAIN_MULTICURRENCY_ALLOW_SYNCHRONIZATION)) print ''; print ''; - print ''; + /*print ''; print ''.$langs->transnoentitiesnoconv("multicurrency_alternateCurrencySource").''; print ''; print ' '; // Example: EUR - print ''; + print '';*/ print ''; print ''; @@ -292,7 +292,7 @@ print ''; print ''; print ''; -print ''.$form->selectCurrency('', 'code').''; +print ''.$form->selectCurrency('', 'code', 1).''; print ''; print ' '; print ''; diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 93cbdb138a0..3c4ac0b9804 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -4781,9 +4781,10 @@ class Form * * @param string $selected preselected currency code * @param string $htmlname name of HTML select list + * @param string $mode 0 = Add currency symbol into label, 1 = Add 3 letter iso code * @return string */ - public function selectCurrency($selected = '', $htmlname = 'currency_id') + public function selectCurrency($selected = '', $htmlname = 'currency_id', $mode = 0) { global $conf,$langs,$user; @@ -4805,7 +4806,14 @@ class Form $out.= ''; } $out.= ''; diff --git a/htdocs/langs/en_US/multicurrency.lang b/htdocs/langs/en_US/multicurrency.lang index 68791b41320..4dc04ff2622 100644 --- a/htdocs/langs/en_US/multicurrency.lang +++ b/htdocs/langs/en_US/multicurrency.lang @@ -7,7 +7,7 @@ multicurrency_syncronize_error=Synchronization error: %s MULTICURRENCY_USE_RATE_ON_DOCUMENT_DATE=Use the date of the document to find the currency rate, instead of using the latest known rate multicurrency_useOriginTx=When an object is created from another, keep the original rate from the source object (otherwise use the latest known rate) CurrencyLayerAccount=CurrencyLayer API -CurrencyLayerAccount_help_to_synchronize=You must create an account on website %s to use this functionality.
Get your API key.
If you use a free account you can't change the currency source (USD by default).
If your main currency is not USD you can use the alternate currency source to force your main currency.

You are limited to 1000 synchronizations per month. +CurrencyLayerAccount_help_to_synchronize=You must create an account on website %s to use this functionality.
Get your API key.
If you use a free account, you can't change the source currency (USD by default).
If your main currency is not USD, the application will automatically recalculate it.

You are limited to 1000 synchronizations per month. multicurrency_appId=API key multicurrency_appCurrencySource=Source currency multicurrency_alternateCurrencySource=Alternate source currency diff --git a/htdocs/multicurrency/class/multicurrency.class.php b/htdocs/multicurrency/class/multicurrency.class.php index faf05bdc571..a694b5396d7 100644 --- a/htdocs/multicurrency/class/multicurrency.class.php +++ b/htdocs/multicurrency/class/multicurrency.class.php @@ -603,9 +603,9 @@ class MultiCurrency extends CommonObject { global $conf; - if (!empty($conf->global->MULTICURRENCY_ALTERNATE_SOURCE)) + if ($conf->currency != $conf->global->MULTICURRENCY_APP_SOURCE) { - $alternate_source = 'USD'.$conf->global->MULTICURRENCY_ALTERNATE_SOURCE; + $alternate_source = 'USD'.$conf->currency; if (!empty($TRate->{$alternate_source})) { $coef = $TRate->USDUSD / $TRate->{$alternate_source};