Show the Service Agreements amount in Danish kroner - #96
Merged
Conversation
API Specification - Non-breaking changesNo changelog changes |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #96 +/- ##
=============================================
- Coverage 37.14% 36.30% -0.84%
- Complexity 948 1064 +116
=============================================
Files 133 140 +7
Lines 2972 3374 +402
=============================================
+ Hits 1104 1225 +121
- Misses 1868 2149 +281
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:
|
…form-addons # Conflicts: # src/Controller/Admin/SecurityContractCrudController.php
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.
Link to ticket
TODO: no ticket linked yet — please add before review.
Description
The Service Agreements amounts are Danish kroner, and the admin never said so anywhere. This makes it say it:
12.500,50 kr.on index and detail.Why not the 5.5 addons, which is where this started.
prepend()/append()render inside a form input and, per the bundle's own docblock, "only on form pages and ignored for fields whose form control is not a single-line input". This CRUD calls->disable(Action::DELETE, Action::NEW, Action::EDIT), so index and detail are the only pages it has — an addon here would render nowhere.So the value is formatted instead, through Intl for
da_DK. That also fixes the grouping: the field followed the application locale (en) and rendered12,500.5. Intl gives Danish grouping, the comma decimal separator, and the unit in one call, rather than a suffix pasted onto a number formatted for the wrong locale.quarterlyHoursis gone from this form (removed in #83), and if it returns, its label already says hours — an addon reading "Quarterly hours … hours" would be noise. If NEW or EDIT is ever re-enabled here,->append('kr.')is the one-line form-page equivalent of this change.Screenshot of the result
Verified through the rendered page rather than a screenshot: the dev database has no service agreements, and the deployed one sits behind Traefik basic auth. The new test asserts what a reader sees — for a contract with
monthlyPrice = 12500.5, the index page carries12.500,50andkr..Checklist
SecurityContractCurrencyTestis new, and it is the first test to touch this controller at all:AdminSmokeTest's provider lists 16 CRUD controllers and this is not one of them. 46 tests, PHPStan, PHP-CS-Fixer, twig-cs-fixer and markdownlint pass locally.Additional comments or questions
While writing this I found that
/admin/security-contractthrew on every load ondevelop:syncAll()is wired throughlinkToCrudAction(), and since EasyAdmin 5 such a method needs#[AdminRoute]orActionFactorythrows aRuntimeExceptionwhile rendering the "Sync all" button, taking the index page with it. The attribute's import was already at the top of the file, unused — a half-finished upgrade. #83 has since merged and carries that fix, so this PR no longer contains it; the only trace left is the docblock abovesyncAll()explaining what the attribute is for.That page throwing since June went unnoticed because no test covers this controller. Adding
SecurityContractCrudController— andRepoAdvisoryControllerfrom #83 — toAdminSmokeTest's provider would have caught it. Left out of this PR to keep it about the currency, but it is a cheap follow-up worth doing.