mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
commit
7959dc4d1d
@ -1 +1 @@
|
|||||||
5.8.8
|
5.8.9
|
@ -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;
|
||||||
|
@ -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),
|
||||||
|
@ -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;
|
||||||
|
@ -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
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user