mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Merge pull request #8337 from turbo124/v5-develop
Improve rounding for negative numbers
This commit is contained in:
commit
7b7ce234c9
@ -32,6 +32,7 @@ class UpdateBankIntegrationRequest extends Request
|
|||||||
{
|
{
|
||||||
/* Ensure we have a client name, and that all emails are unique*/
|
/* Ensure we have a client name, and that all emails are unique*/
|
||||||
$rules = [
|
$rules = [
|
||||||
|
'bank_account_name' => 'bail|sometimes|min:3',
|
||||||
'auto_sync' => 'sometimes|bool'
|
'auto_sync' => 'sometimes|bool'
|
||||||
];
|
];
|
||||||
|
|
||||||
|
@ -94,7 +94,6 @@ class BaseImport
|
|||||||
$csv = base64_decode($base64_encoded_csv);
|
$csv = base64_decode($base64_encoded_csv);
|
||||||
$csv = Reader::createFromString($csv);
|
$csv = Reader::createFromString($csv);
|
||||||
$csvdelimiter = self::detectDelimiter($csv);
|
$csvdelimiter = self::detectDelimiter($csv);
|
||||||
nlog("delmiter = {$csvdelimiter}");
|
|
||||||
|
|
||||||
$csv->setDelimiter($csvdelimiter);
|
$csv->setDelimiter($csvdelimiter);
|
||||||
$stmt = new Statement();
|
$stmt = new Statement();
|
||||||
|
@ -231,12 +231,15 @@ class Number
|
|||||||
|
|
||||||
/* 08-01-2022 allow increased precision for unit price*/
|
/* 08-01-2022 allow increased precision for unit price*/
|
||||||
$v = rtrim(sprintf('%f', $value), '0');
|
$v = rtrim(sprintf('%f', $value), '0');
|
||||||
|
$parts = explode('.', $v);
|
||||||
|
|
||||||
/* 08-02-2023 special if block to render $0.5 to $0.50*/
|
/* 08-02-2023 special if block to render $0.5 to $0.50*/
|
||||||
if ($v < 1 && strlen($v) == 3) {
|
if ($v < 1 && strlen($v) == 3) {
|
||||||
$precision = 2;
|
$precision = 2;
|
||||||
} elseif ($v < 1) {
|
} elseif ($v < 1) {
|
||||||
$precision = strlen($v) - strrpos($v, '.') - 1;
|
$precision = strlen($v) - strrpos($v, '.') - 1;
|
||||||
|
} elseif(is_array($parts) && $parts[0] != 0) {
|
||||||
|
$precision = 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
$value = number_format($v, $precision, $decimal, $thousand);
|
$value = number_format($v, $precision, $decimal, $thousand);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user