From 9f80aef84059dc70d9aef28ce4d19e3d502dd0be Mon Sep 17 00:00:00 2001 From: junmt <12598156+junmt@users.noreply.github.com> Date: Tue, 12 Dec 2023 15:25:57 +0900 Subject: [PATCH] =?UTF-8?q?[=E4=B8=8D=E5=85=B7=E5=90=88]=20PHP8=E5=AF=BE?= =?UTF-8?q?=E5=BF=9C=EF=BC=9A=E9=87=91=E9=A1=8D=E8=A8=88=E7=AE=97=E6=99=82?= =?UTF-8?q?=E3=81=AB=E3=82=A8=E3=83=A9=E3=83=BC=E3=81=AB=E3=81=AA=E3=82=8B?= =?UTF-8?q?=20#927=20(#928)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * PHP8対応:選択肢の連動設定がエラーになっていたため修正 * [不具合] PHP8対応:金額計算時にエラーになる #927 --------- Co-authored-by: Jun Matsuda <{ID}+{username}@users.noreply.github.com> --- include/fields/CurrencyField.php | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/include/fields/CurrencyField.php b/include/fields/CurrencyField.php index 44e9a735f..07ca672ab 100644 --- a/include/fields/CurrencyField.php +++ b/include/fields/CurrencyField.php @@ -363,7 +363,7 @@ public function getDBInsertedValue($user=null, $skipConversion=false) { } //$value = round($value, $this->maxNumberOfDecimals); - return $value; + return (float)$value; } /** @@ -415,7 +415,7 @@ public static function convertToDollar($amount, $conversionRate) { public static function convertFromDollar($amount, $conversionRate) { $currencyField = new CurrencyField($amount); - return round($amount * $conversionRate, $currencyField->maxNumberOfDecimals); + return round( (float)$amount * (float)$conversionRate, $currencyField->maxNumberOfDecimals); } /** This function returns the amount converted from master currency. @@ -423,7 +423,7 @@ public static function convertFromDollar($amount, $conversionRate) { * param $crate - conversion rate. */ public static function convertFromMasterCurrency($amount, $conversionRate) { - return $amount * $conversionRate; + return (float)$amount * (float)$conversionRate; } function currencyDecimalFormat($value, $user = null){ @@ -464,4 +464,3 @@ function currencyDecimalFormat($value, $user = null){ } } } -?> \ No newline at end of file