Add error handling to inverted group check

This commit is contained in:
John Pinkyfloyd 2026-03-08 23:10:48 -07:00
parent 503754e248
commit 5e01bcd989

View file

@ -460,10 +460,11 @@
<!--- Deselecting: check if this is a default from an inverted group --->
<!--- If so, keep it with Quantity=0 for "NO X" display; otherwise delete --->
<cfset var isInvertedDefault = false>
<cfif qItem.recordCount GT 0>
<cftry>
<cfif qItem.recordCount GT 0 AND val(qItem.ParentItemID) GT 0>
<cfset var qParentItem = queryTimed(
"SELECT IsInvertedGroup FROM Items WHERE ID = ? LIMIT 1",
[ { value = qItem.ParentItemID, cfsqltype = "cf_sql_integer" } ],
[ { value = val(qItem.ParentItemID), cfsqltype = "cf_sql_integer" } ],
{ datasource = "payfrit" }
)>
<cfif qParentItem.recordCount GT 0 AND val(qParentItem.IsInvertedGroup) EQ 1>
@ -478,6 +479,11 @@
</cfif>
</cfif>
</cfif>
<cfcatch>
<!--- On error, default to normal delete behavior --->
<cfset isInvertedDefault = false>
</cfcatch>
</cftry>
<cfif isInvertedDefault>
<!--- Keep in cart with Quantity=0 for "NO X" display --->