Debug multicurrency

This commit is contained in:
Laurent Destailleur 2020-03-25 17:24:20 +01:00
parent f509c6a266
commit 3c572c1909
3 changed files with 13 additions and 4 deletions

View File

@ -148,7 +148,10 @@ elseif ($action == 'setapilayer')
} }
else else
{ {
MultiCurrency::syncRates($conf->global->MULTICURRENCY_APP_ID); $result = MultiCurrency::syncRates($conf->global->MULTICURRENCY_APP_ID);
if ($result > 0) {
setEventMessages($langs->trans("CurrencyRateSyncSucceed"), null, "mesgs");
}
} }
} }

View File

@ -18,3 +18,5 @@ MulticurrencyReceived=Received, original currency
MulticurrencyRemainderToTake=Remaining amount, original currency MulticurrencyRemainderToTake=Remaining amount, original currency
MulticurrencyPaymentAmount=Payment amount, original currency MulticurrencyPaymentAmount=Payment amount, original currency
AmountToOthercurrency=Amount To (in currency of receiving account) AmountToOthercurrency=Amount To (in currency of receiving account)
CurrencyRateSyncSucceed=Currency rate synchronization done successfuly
MULTICURRENCY_USE_CURRENCY_ON_DOCUMENT=Use the currency of the document for online payments

View File

@ -628,11 +628,11 @@ class MultiCurrency extends CommonObject
} }
/** /**
* Sync rates from api * Sync rates from API
* *
* @param string $key Key to use. Come from $conf->global->MULTICURRENCY_APP_ID. * @param string $key Key to use. Come from $conf->global->MULTICURRENCY_APP_ID.
* @param int $addifnotfound Add if not found * @param int $addifnotfound Add if not found
* @return void * @return int <0 if KO, >0 if OK
*/ */
public static function syncRates($key, $addifnotfound = 0) public static function syncRates($key, $addifnotfound = 0)
{ {
@ -672,11 +672,15 @@ class MultiCurrency extends CommonObject
} }
} }
} }
return 1;
} }
else else
{ {
dol_syslog("Failed to call endpoint ".$response->error->info, LOG_WARNING); dol_syslog("Failed to call endpoint ".$response->error->info, LOG_WARNING);
setEventMessages($langs->trans('multicurrency_syncronize_error', $response->error->info), null, 'errors'); setEventMessages($langs->trans('multicurrency_syncronize_error', $response->error->info), null, 'errors');
return -1;
} }
} }