Fixed an exception when a pricedetail has a currency without exchange rate.

Fixes issue #37
This commit is contained in:
Jan Böhmer 2020-04-08 16:06:32 +02:00
parent da83314d69
commit 887ac83f83

View file

@ -174,8 +174,12 @@ class PricedetailHelper
continue;
}
$avg = bcadd($avg, $this->convertMoneyToCurrency($pricedetail->getPricePerUnit(), $pricedetail->getCurrency(), $currency), Pricedetail::PRICE_PRECISION);
++$count;
$converted = $this->convertMoneyToCurrency($pricedetail->getPricePerUnit(), $pricedetail->getCurrency(), $currency);
//Ignore price informations that can not be converted to base currency.
if ($converted !== null) {
$avg = bcadd($avg, $converted, Pricedetail::PRICE_PRECISION);
++$count;
}
}
if (0 === $count) {