Closed sapayth closed 2 months ago
The changes introduced in this pull request enhance input handling for decimal numbers in the SectionInputField.vue
file and improve billing amount precision in the Subscription
class. The input field now accepts the period key, allowing for decimal entries, while the billing amount is now processed as a float to prevent loss of precision in subscription billing calculations.
File | Change Summary |
---|---|
assets/js/components/subscriptions/... | Added the period key '.' to the processNumber function to allow decimal input. |
includes/Api/Subscription.php | Changed the handling of billing_amount from integer to float to preserve decimal values. |
Objective | Addressed | Explanation |
---|---|---|
Added form limit message and refactor form schedule message (#498) | ❌ | No changes related to form limits or messages were made. |
🐰 In fields where numbers dance,
A period now takes a chance.
With billing precise, no cents to lose,
Our input's enhanced, we gladly choose!
Hopping along, we celebrate,
These changes make our work first-rate! 🎉
assets/js/components/subscriptions/SectionInputField.vue (1)
`125-125`: **LGTM!** The addition of the period key to the allowed keys list enables decimal input in numeric fields, aligning with the PR objective. The change is localized and does not introduce any apparent issues.includes/Api/Subscription.php (1)
`394-394`: **Excellent update to preserve decimal precision in billing amounts!** Switching from `(int)` to `floatval()` for the `billing_amount` variable is a crucial improvement. It ensures that decimal values entered for subscription prices are accurately preserved throughout the billing calculations. This change is particularly important for subscription-based services where prices often include cents. Truncating to integers could lead to inaccuracies and confusion. Great catch and a valuable update!
fixes #498
Issue: Subscription pack pricing is not saving any decimal value.
Scenario: Subscription > Create New > Set Decimal Value > Save > Decimal value is not taken
Summary by CodeRabbit
New Features
Bug Fixes