From 3ec33c6054b8fbf326b3d5c86775776c4d6af778 Mon Sep 17 00:00:00 2001 From: yuri Date: Fri, 29 Jun 2018 15:36:34 +0300 Subject: [PATCH] fix currency converted hook --- application/Espo/Hooks/Common/CurrencyConverted.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/application/Espo/Hooks/Common/CurrencyConverted.php b/application/Espo/Hooks/Common/CurrencyConverted.php index 42eddceec4..caad177efc 100644 --- a/application/Espo/Hooks/Common/CurrencyConverted.php +++ b/application/Espo/Hooks/Common/CurrencyConverted.php @@ -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);