Invoice Workflow Fixes
Index page header layout, save redirect, PO Number field relocation
Overview
Three targeted fixes to the admin invoice workflow plus a decision about where PO numbers live in the data model: they belong on ProjectInvoice, not on Project.
What Changed
Invoice Index Page Header Layout (v3.7.2)
The project-specific invoice list page had its "Invoices - <address>" heading rendering to the right of the "Generate Invoice" / "Back to Project" action buttons and overflowing off the screen.
Root cause: the template at crud/project_specific_invoice/index.html.twig was overriding content_header_wrapper wholesale with a custom d-flex layout that fought EasyAdmin's own styling.
Fix: stopped overriding content_header_wrapper and now only overrides the page_actions block. EasyAdmin renders the title in its normal position and the two custom buttons appear in the actions area.
Invoice Save Redirect (v3.7.2)
After saving a project-specific invoice, users were redirected back to the /admin?crudAction=new&... URL - the same URL they came from - giving the impression that nothing had saved.
Root cause: getRedirectResponseAfterSave() read projectId from the query string, but on some POST cycles the query string wasn't preserved, so it fell through to a default that redirected back to the form URL.
Fix: pull projectId from the saved invoice entity's getProject() relationship (reliable after persist). Only fall back to the query-string param. Build a direct URL to the Project edit page via adminUrlGenerator.
PO Number Field Relocation (v3.7.2)
Release 3.6 exposed a purchaseOrder field on the admin project new + edit forms. The PO number semantically belongs on invoices, not projects: it's captured at invoice-create time and should appear on the invoice view. This release reverses that decision.
Removed:
TextField::new('purchaseOrder', 'PO Number')fromProjectCrudController::configureNewFields()andconfigureEditFields().
Retained / already in place:
ProjectInvoice::$purchaseOrderNumber- captured on invoice create/edit.- PO number row on the invoice View modal (added between Customer Job Number and Line Items in v3.6, both admin and ordering templates).
Files Touched
| File | Change |
|---|---|
app/templates/crud/project_specific_invoice/index.html.twig | Override only page_actions, not content_header_wrapper |
app/src/Controller/Admin/ProjectInvoiceCrudController.php | getRedirectResponseAfterSave uses entity.getProject() |
app/src/Controller/Admin/ProjectCrudController.php | Removed purchaseOrder field from new + edit |
Changelog Reference
- fix(admin): correct invoice index page header layout (v3.7.2) (9ccf0be1)
- fix(admin): redirect to project edit page after saving project invoice (v3.7.2) (66af6925)
- fix(admin): remove PO Number field from project CRUD forms (v3.7.2) (6ad16790)
- fix: show Purchase Order Number on invoice view modal (shipped v3.7.0) (4fc65b6f)