Skip to content

Show the Service Agreements amount in Danish kroner - #96

Merged
turegjorup merged 2 commits into
developfrom
feature/easyadmin-form-addons
Aug 26, 2026
Merged

Show the Service Agreements amount in Danish kroner#96
turegjorup merged 2 commits into
developfrom
feature/easyadmin-form-addons

Conversation

@turegjorup

@turegjorup turegjorup commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

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 rendered 12,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.

quarterlyHours is 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 carries 12.500,50 and kr..

Checklist

  • My code is covered by test cases.
  • My code passes our test (all our tests).
  • My code passes our static analysis suite.
  • My code passes our continuous integration process.

SecurityContractCurrencyTest is 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-contract threw on every load on develop: syncAll() is wired through linkToCrudAction(), and since EasyAdmin 5 such a method needs #[AdminRoute] or ActionFactory throws a RuntimeException while 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 above syncAll() explaining what the attribute is for.

That page throwing since June went unnoticed because no test covers this controller. Adding SecurityContractCrudController — and RepoAdvisoryController from #83 — to AdminSmokeTest'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.

@github-actions

Copy link
Copy Markdown

API Specification - Non-breaking changes

No changelog changes

@codecov-commenter

codecov-commenter commented Aug 26, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 80.00000% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 36.30%. Comparing base (bae8493) to head (630b266).
⚠️ Report is 42 commits behind head on develop.

Files with missing lines Patch % Lines
...ontroller/Admin/SecurityContractCrudController.php 80.00% 1 Missing ⚠️
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     
Flag Coverage Δ
unittests 36.30% <80.00%> (-0.84%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@turegjorup turegjorup self-assigned this Aug 26, 2026
…form-addons

# Conflicts:
#	src/Controller/Admin/SecurityContractCrudController.php
@turegjorup turegjorup changed the title Fix the Service Agreements page and show amounts in Danish kroner Show the Service Agreements amount in Danish kroner Aug 26, 2026
@turegjorup
turegjorup merged commit 3e34114 into develop Aug 26, 2026
11 checks passed
@turegjorup
turegjorup deleted the feature/easyadmin-form-addons branch August 26, 2026 10:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants