fix currency converted hook

This commit is contained in:
yuri
2018-06-29 15:36:34 +03:00
parent eb7c0da40c
commit 3ec33c6054
@@ -76,8 +76,8 @@ class CurrencyConverted extends \Espo\Core\Hooks\Base
$targetValue = $value;
} else {
$targetValue = $value;
$targetValue = $targetValue * (isset($rates[$defaultCurrency]) ? $rates[$defaultCurrency] : 1.0);
$targetValue = $targetValue / (isset($rates[$currency]) ? $rates[$currency] : 1.0);
$targetValue = $targetValue / (isset($rates[$baseCurrency]) ? $rates[$baseCurrency] : 1.0);
$targetValue = $targetValue * (isset($rates[$currency]) ? $rates[$currency] : 1.0);
$targetValue = round($targetValue, 2);
}
$entity->set($fieldName, $targetValue);