Conversation
Ledger > Settings > Accounting (base currency) and Invoice (default currency) never saved a chosen currency: CurrencySelect calls @onCurrencyChange with the ISO code first (then the currency object), but both handlers read `.code` off that argument. The string has no `.code`, so the field was set to null and saved as null, and after a reload the page fell back to the organisation default. Both handlers now take the code. Fixes fleetbase/fleetbase#678
Editing a wallet (for example to change its currency) failed with a 400: "Column 'balance' cannot be null". The console sends the whole record back, including the balance, and the update wrote it straight into the wallet. - The wallet serializer no longer sends balance or formatted_balance. - The wallet update endpoint drops them too, so an edit can never overwrite a balance that should only move through transactions (credit, top-up, payout, transfer). Part of fleetbase/fleetbase#678
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #24 +/- ##
=============================================
- Coverage 100.00% 99.97% -0.03%
- Complexity 1249 1253 +4
=============================================
Files 74 74
Lines 6981 6990 +9
=============================================
+ Hits 6981 6988 +7
- Misses 0 2 +2
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This was referenced Sep 25, 2026
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes fleetbase/fleetbase#678.
Base and invoice currency never saved
In Ledger → Settings → Accounting (base currency) and Settings → Invoice (default currency), a chosen currency looked saved but was back to the default after a reload.
CurrencySelectcalls@onCurrencyChange(code, currency), with the ISO code first. Both settings controllers readcurrency?.codefrom that first argument. A string has no.code, so the field becamenull, Save storednull, and on reload the page fell back to the organisation default (or USD). Both handlers now take the code.Wallet currency couldn't be changed
Editing a wallet, for example to change its currency, failed with a 400:
Column 'balance' cannot be null. The console sends the whole record back, balance included, and the generic update wrote it into the wallet.ledger-walletserializer no longer sendsbalanceorformatted_balance.WalletController::updateRecorddrops those fields too. An edit can then never overwrite a balance that should only move through transactions (credit, top-up, payout, transfer). Before this, any wallet update request could set the balance directly.Verification
base_currencycorrectly, so the loss happened in the UI handler. Editing a wallet from the UI returned the 400 above.base_currency: "CAD", and CAD is still selected after a reload.WalletControllerTestpasses (11 tests). The new test checks thatbalance/formatted_balanceare stripped with and without thewalletpayload key. php-cs-fixer is clean.