Skip to content

Fix unsaved parent order line used as ParentLineId reference - #73

Open
DWDBE wants to merge 2 commits into
mainfrom
dbe/29074-fix-unsaved-parent-order-line-id-check
Open

Fix unsaved parent order line used as ParentLineId reference#73
DWDBE wants to merge 2 commits into
mainfrom
dbe/29074-fix-unsaved-parent-order-line-id-check

Conversation

@DWDBE

@DWDBE DWDBE commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Summary

  • ProcessDiscountOrderLine and ProcessTaxOrderLine in OrderHandler.cs only saved the parent order line when parentLine.Id was null/empty, but a not-yet-persisted OrderLine created as part of a multi order line request can already carry a DW_NEWMULTIORDERLINEID_ placeholder Id.
  • That meant the parent line was silently never saved, and the child discount/tax line ended up with a ParentLineId pointing at a non-persisted, synthetic Id.
  • Added an IsUnsavedOrderLine helper (empty Id OR DW_NEWMULTIORDERLINEID_ prefix, case-insensitive) and used it at both call sites so the parent line is always saved before its real Id is used.

Related work item: https://dev.azure.com/dynamicwebsoftware/Dynamicweb/_workitems/edit/29074

Test plan

  • dotnet build succeeds with no new warnings/errors
  • Manual/integration test against an ERP response containing a multi-line product + discount/tax combo to confirm the parent line is persisted and ParentLineId resolves to a real Id

DWDBE and others added 2 commits August 6, 2026 11:30
OrderLine.Id can be pre-assigned a DW_NEWMULTIORDERLINEID_ placeholder
for lines created as part of a multi order line request before they
are actually persisted. The existing IsNullOrEmpty(Id) check missed
this case, so the parent line was never saved and discount/tax lines
ended up referencing a non-persisted ParentLineId.

Related: https://dev.azure.com/dynamicwebsoftware/Dynamicweb/_workitems/edit/29074

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@DWDBE
DWDBE requested review from a team as code owners August 6, 2026 08:32
@DWDBE DWDBE assigned MatthiasSort and unassigned MatthiasSort Aug 6, 2026
@DWDBE
DWDBE requested a review from MatthiasSort August 6, 2026 09:04
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