Skip to content

Keep read-only fields of customer groups, product reviews and message templates out of their edit forms (2.4.x) - #1096

Merged
KrzysztofPajak merged 6 commits into
2.4.xfrom
fix/2.4.x-edit-form-fields
Nov 23, 2026
Merged

KrzysztofPajak merged 6 commits into
2.4.xfrom
fix/2.4.x-edit-form-fields

Conversation

@KrzysztofPajak

@KrzysztofPajak KrzysztofPajak commented Nov 23, 2026 •

Copy link
Copy Markdown
Member

Type: bugfix

Issue

A few edit screens posted back values that are shown read-only, and the mapping copied them onto the stored entity:

  • customer group: IsSystem (also in the API, where Patch checked the flag after applying the patch);
  • product review: ProductId, CustomerId and Rating — the review totals were then recalculated for the posted product id, also in Approve / Disapprove selected on the list;
  • message template: Name, the key templates are sent by.

When a message template form was shown again after a validation error, the Has attached download switch was also reset from the stored attachment instead of keeping the posted value.

Ports #1085, #1086 and #1087 to 2.4.x.

Solution

  • CustomerGroupModel.IsSystem is [BindNever] and ignored in the admin and API mappings; the API Patch checks the stored group.
  • ProductReviewModel.ProductId, CustomerId and Rating are [BindNever] and ignored in the mapping; bulk approve/disapprove use the stored review's product.
  • The message template edit keeps the stored name; the attachment switch stays as posted when the form is shown again.
  • The hidden inputs for these fields are removed from the forms.
  • The API Put checks the stored group too, instead of the IsSystem value in the request body. An unknown id returns 404 and an empty id 400. The same change goes to develop in Check the stored customer group before an API update #1108.
  • The product review list links no longer carry the unused ProductId query string.

Breaking changes

None in the UI. API PUT /CustomerGroup on a system group now returns 400 whatever IsSystem says in the body.

Testing

  1. Admin → Customers → Customer groups → Administrators: change Free shipping and save — the group stays a system group.
  2. Admin → Catalog → Product reviews: approve a review from the edit page and with Approve selected — its product's approved review count goes up.
  3. Admin → Content management → Message templates: change a subject and save — the name stays; clear the subject with Has attached download turned off — after the error the switch is still off.
  4. API: PUT the Administrators group with IsSystem: false. Expect 400 and no change.
  5. dotnet test src/Tests/Grand.Web.Admin.Tests, src/Tests/Grand.Mapping.Tests and src/Tests/Grand.Module.Api.Tests pass.

@KrzysztofPajak
KrzysztofPajak merged commit faa81fd into 2.4.x Nov 23, 2026
3 checks passed
@KrzysztofPajak
KrzysztofPajak deleted the fix/2.4.x-edit-form-fields branch November 23, 2026 20:05
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.

1 participant