Patch currency subunit conversion (#1484)

* added parentheses around the conversion

* updated finance test

updated the following test:
- journal operations

fixed the following tests:
- pirep finances
- pirep finances specific expense
- pirep finances expenses multi airline
This commit is contained in:
John Cheng
2022-10-09 21:13:11 +08:00
committed by GitHub
parent f30a3bc1ef
commit 2155979eb9
2 changed files with 11 additions and 11 deletions

View File

@@ -33,7 +33,7 @@ class Money
/**
* Create from a dollar amount
*
* @param mixed $amount The amount in pennies
* @param mixed $amount The amount in dollar
*
* @throws \UnexpectedValueException
* @throws \InvalidArgumentException
@@ -52,12 +52,12 @@ class Money
*
* @param mixed $amount
*
* @return float|int
* @return int
*/
public static function convertToSubunit($amount)
{
$currency = setting('units.currency', 'USD');
return (int) $amount * config('money.'.$currency.'.subunit');
return (int) ($amount * config('money.'.$currency.'.subunit'));
}
/**