From 68d6479f0d0f2aaa0ce95b63358a0b34f9ea5adf Mon Sep 17 00:00:00 2001 From: objecttothis Date: Tue, 12 Mar 2024 18:07:27 +0400 Subject: [PATCH] Decimal changes - Format percentage per locale rules - Format sequence as integer, not per quantity rules - Minor formatting changes --- app/Helpers/locale_helper.php | 6 +++--- app/Views/item_kits/form.php | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/app/Helpers/locale_helper.php b/app/Helpers/locale_helper.php index 2ef0b2ab0..245682262 100644 --- a/app/Helpers/locale_helper.php +++ b/app/Helpers/locale_helper.php @@ -435,7 +435,7 @@ function to_decimals(?float $number, string $decimals = null, int $type = Number { if(!isset($number)) { - return ""; + return ''; } $config = config(OSPOS::class)->settings; @@ -481,9 +481,9 @@ function parse_decimals(string $number, int $decimals = null) { return $number; } - + $locale_safe_number = prepare_decimal($number); - + if ($locale_safe_number > MAX_PRECISION) //TODO: This breaks when the string passed does not use . as the decimal separator. { return false; diff --git a/app/Views/item_kits/form.php b/app/Views/item_kits/form.php index 2f461ef41..03005bb1f 100644 --- a/app/Views/item_kits/form.php +++ b/app/Views/item_kits/form.php @@ -89,7 +89,7 @@ 'maxlength' => '5', 'id' => 'kit_discount', 'class' => 'form-control input-sm', - 'value' => $item_kit_info->kit_discount + 'value' => $item_kit_info->kit_discount_type === FIXED ? to_currency_no_money($item_kit_info->kit_discount) : to_decimals($item_kit_info->kit_discount) ]) ?> @@ -197,7 +197,7 @@ ?> - ' name=item_kit_seq[] value=""/> + ' name=item_kit_seq[] value=""/> ' name=item_kit_qty[] value=""/> @@ -287,7 +287,7 @@ $(document).ready(function() { url: '', type: 'POST', - data: + data: { 'item_kit_id' : "item_kit_id ?>", 'item_kit_number' : function()