Merge pull request #9133 from turbo124/v5-develop

v5.8.9
This commit is contained in:
David Bomba 2024-01-11 00:19:46 +11:00 committed by GitHub
commit 7959dc4d1d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 33 additions and 6 deletions

View File

@ -1 +1 @@
5.8.8 5.8.9

View File

@ -316,7 +316,7 @@ class BaseTransformer
{ {
if (array_key_exists($field, $data)) { if (array_key_exists($field, $data)) {
//$number = preg_replace('/[^0-9-.]+/', '', $data[$field]); //$number = preg_replace('/[^0-9-.]+/', '', $data[$field]);
return Number::parseStringFloat($data[$field]); return Number::parseFloat($data[$field]);
} else { } else {
//$number = 0; //$number = 0;
return 0; return 0;
@ -334,7 +334,7 @@ class BaseTransformer
public function getFloatOrOne($data, $field) public function getFloatOrOne($data, $field)
{ {
if (array_key_exists($field, $data)) { if (array_key_exists($field, $data)) {
return Number::parseStringFloat($data[$field]) > 0 ? Number::parseStringFloat($data[$field]) : 1; return Number::parseFloat($data[$field]) > 0 ? Number::parseFloat($data[$field]) : 1;
} }
return 1; return 1;

View File

@ -17,8 +17,8 @@ return [
'require_https' => env('REQUIRE_HTTPS', true), 'require_https' => env('REQUIRE_HTTPS', true),
'app_url' => rtrim(env('APP_URL', ''), '/'), 'app_url' => rtrim(env('APP_URL', ''), '/'),
'app_domain' => env('APP_DOMAIN', 'invoicing.co'), 'app_domain' => env('APP_DOMAIN', 'invoicing.co'),
'app_version' => env('APP_VERSION', '5.8.8'), 'app_version' => env('APP_VERSION', '5.8.9'),
'app_tag' => env('APP_TAG', '5.8.8'), 'app_tag' => env('APP_TAG', '5.8.9'),
'minimum_client_version' => '5.0.16', 'minimum_client_version' => '5.0.16',
'terms_version' => '1.0.1', 'terms_version' => '1.0.1',
'api_secret' => env('API_SECRET', false), 'api_secret' => env('API_SECRET', false),

View File

@ -20,6 +20,34 @@ use Tests\TestCase;
*/ */
class NumberTest extends TestCase class NumberTest extends TestCase
{ {
public function testConvertDecimalCommaFloats()
{
$value = '22,00';
$res = Number::parseFloat($value);
$this->assertEquals(22.0, $res);
$value = '22.00';
$res = Number::parseFloat($value);
$this->assertEquals(22.0, $res);
$value = '1,000.00';
$res = Number::parseFloat($value);
$this->assertEquals(1000.0, $res);
$value = '1.000,00';
$res = Number::parseFloat($value);
$this->assertEquals(1000.0, $res);
}
public function testFloatPrecision() public function testFloatPrecision()
{ {
$value = 1.1; $value = 1.1;

View File

@ -20,7 +20,6 @@ use Tests\TestCase;
class WithTypeHelpersTest extends TestCase class WithTypeHelpersTest extends TestCase
{ {
use DatabaseMigrations;
public function testIsImageHelper(): void public function testIsImageHelper(): void
{ {