Skip to content

Commit

Permalink
[不具合] PHP8対応:金額計算時にエラーになる #927 (#928)
Browse files Browse the repository at this point in the history
* PHP8対応:選択肢の連動設定がエラーになっていたため修正

* [不具合] PHP8対応:金額計算時にエラーになる #927

---------

Co-authored-by: Jun Matsuda <{ID}+{username}@users.noreply.github.com>
  • Loading branch information
junmt and Jun Matsuda authored Dec 12, 2023
1 parent c1a7b03 commit 9f80aef
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions include/fields/CurrencyField.php
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@ public function getDBInsertedValue($user=null, $skipConversion=false) {
}
//$value = round($value, $this->maxNumberOfDecimals);

return $value;
return (float)$value;
}

/**
Expand Down Expand Up @@ -415,15 +415,15 @@ 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.
* param $amount - amount to be converted.
* param $crate - conversion rate.
*/
public static function convertFromMasterCurrency($amount, $conversionRate) {
return $amount * $conversionRate;
return (float)$amount * (float)$conversionRate;
}

function currencyDecimalFormat($value, $user = null){
Expand Down Expand Up @@ -464,4 +464,3 @@ function currencyDecimalFormat($value, $user = null){
}
}
}
?>

0 comments on commit 9f80aef

Please sign in to comment.