Fix inverted modifier groups auto-adding unchecked defaults
attachDefaultChildren now detects IsInvertedGroup=1 on parent items and skips auto-adding defaults. The Android client explicitly sends only the modifiers the user kept checked, so auto-adding was re-inserting items the user had unchecked (e.g., Mustard). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
a8257b2509
commit
8440888024
1 changed files with 14 additions and 0 deletions
|
|
@ -49,6 +49,20 @@
|
|||
</cfif>
|
||||
<cfset arrayAppend(request.attachDebug, "attachDefaultChildren: OrderID=#arguments.OrderID#, ParentLI=#arguments.ParentLineItemID#, ParentItemID=#arguments.ParentItemID#")>
|
||||
|
||||
<!--- Check if this parent is an inverted group — if so, skip auto-adding defaults.
|
||||
Inverted groups have all children pre-selected by default, but the client
|
||||
explicitly sends only the ones the user kept checked. Auto-adding would
|
||||
re-add items the user unchecked. --->
|
||||
<cfset var qParentInfo = queryTimed(
|
||||
"SELECT IsInvertedGroup FROM Items WHERE ID = ? LIMIT 1",
|
||||
[ { value = arguments.ParentItemID, cfsqltype = "cf_sql_integer" } ],
|
||||
{ datasource = "payfrit" }
|
||||
)>
|
||||
<cfif qParentInfo.recordCount GT 0 AND val(qParentInfo.IsInvertedGroup) EQ 1>
|
||||
<cfset arrayAppend(request.attachDebug, " -> SKIP inverted group ##" & arguments.ParentItemID & " (client sends selections explicitly)")>
|
||||
<cfreturn>
|
||||
</cfif>
|
||||
|
||||
<!--- Find ALL immediate children (to recurse into groups) --->
|
||||
<cfset var qAllKids = queryTimed(
|
||||
"
|
||||
|
|
|
|||
Reference in a new issue