Debug hidden option MAIN_MULTICURRENCY_ALLOW_SYNCHRONIZATION
This commit is contained in:
parent
e5777f64f4
commit
5145680279
@ -249,7 +249,7 @@ if (!empty($conf->global->MAIN_MULTICURRENCY_ALLOW_SYNCHRONIZATION))
|
||||
print '<td>'.$form->textwithpicto($langs->trans("CurrencyLayerAccount"), $langs->trans("CurrencyLayerAccount_help_to_synchronize", $urlforapilayer)).'</td>'."\n";
|
||||
print '<td class="right">';
|
||||
print '<textarea id="response" class="hideobject" name="response"></textarea>';
|
||||
print $langs->trans("Value").' <input type="button" id="bt_sync" name="bt_sync_apilayer" class="button" value="'.$langs->trans('Synchronize').'" />';
|
||||
print $langs->trans("Value").' <input type="submit" id="bt_sync" name="bt_sync_apilayer" class="button" value="'.$langs->trans('Synchronize').'" />';
|
||||
print '<input type="submit" name="modify_apilayer" class="button" value="'.$langs->trans("Modify").'">';
|
||||
print '</td></tr>';
|
||||
|
||||
@ -328,6 +328,15 @@ foreach ($TCurrency as &$currency)
|
||||
print '</table>';
|
||||
print '</div>';
|
||||
|
||||
print '
|
||||
<script type="text/javascript">
|
||||
function getRates()
|
||||
{
|
||||
$("#bt_sync").attr("disabled", true);
|
||||
return true;
|
||||
}
|
||||
</script>
|
||||
';
|
||||
|
||||
// End of page
|
||||
llxFooter();
|
||||
|
||||
@ -626,14 +626,18 @@ class MultiCurrency extends CommonObject
|
||||
/**
|
||||
* 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
|
||||
* @return void
|
||||
*/
|
||||
public static function syncRates($key)
|
||||
public static function syncRates($key, $addifnotfound = 0)
|
||||
{
|
||||
global $conf, $db, $langs;
|
||||
|
||||
$urlendpoint = 'http://apilayer.net/api/live?access_key='.$key;
|
||||
//$urlendpoint.='&format=1';
|
||||
$urlendpoint.=(empty($conf->global->MULTICURRENCY_APP_SOURCE) ? '' : '&source='.$conf->global->MULTICURRENCY_APP_SOURCE);
|
||||
|
||||
dol_syslog("Call url endpoint ".$urlendpoint);
|
||||
|
||||
// TODO Use getURLContent() function instead.
|
||||
@ -658,7 +662,7 @@ class MultiCurrency extends CommonObject
|
||||
{
|
||||
$obj->updateRate($rate);
|
||||
}
|
||||
else
|
||||
elseif ($addifnotfound)
|
||||
{
|
||||
self::addRateFromDolibarr($code, $rate);
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user