Fix unsaved parent order line used as ParentLineId reference - #73
Open
DWDBE wants to merge 2 commits into
Open
Conversation
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>
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.
Summary
ProcessDiscountOrderLineandProcessTaxOrderLineinOrderHandler.csonly saved the parent order line whenparentLine.Idwas null/empty, but a not-yet-persistedOrderLinecreated as part of a multi order line request can already carry aDW_NEWMULTIORDERLINEID_placeholder Id.ParentLineIdpointing at a non-persisted, synthetic Id.IsUnsavedOrderLinehelper (empty Id ORDW_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 buildsucceeds with no new warnings/errorsParentLineIdresolves to a real Id