Add error handling to inverted group check
This commit is contained in:
parent
503754e248
commit
5e01bcd989
1 changed files with 20 additions and 14 deletions
|
|
@ -460,24 +460,30 @@
|
||||||
<!--- Deselecting: check if this is a default from an inverted group --->
|
<!--- Deselecting: check if this is a default from an inverted group --->
|
||||||
<!--- If so, keep it with Quantity=0 for "NO X" display; otherwise delete --->
|
<!--- If so, keep it with Quantity=0 for "NO X" display; otherwise delete --->
|
||||||
<cfset var isInvertedDefault = false>
|
<cfset var isInvertedDefault = false>
|
||||||
<cfif qItem.recordCount GT 0>
|
<cftry>
|
||||||
<cfset var qParentItem = queryTimed(
|
<cfif qItem.recordCount GT 0 AND val(qItem.ParentItemID) GT 0>
|
||||||
"SELECT IsInvertedGroup FROM Items WHERE ID = ? LIMIT 1",
|
<cfset var qParentItem = queryTimed(
|
||||||
[ { value = qItem.ParentItemID, cfsqltype = "cf_sql_integer" } ],
|
"SELECT IsInvertedGroup FROM Items WHERE ID = ? LIMIT 1",
|
||||||
{ datasource = "payfrit" }
|
[ { value = val(qItem.ParentItemID), cfsqltype = "cf_sql_integer" } ],
|
||||||
)>
|
|
||||||
<cfif qParentItem.recordCount GT 0 AND val(qParentItem.IsInvertedGroup) EQ 1>
|
|
||||||
<!--- Check if item was a default --->
|
|
||||||
<cfset var qItemDefault = queryTimed(
|
|
||||||
"SELECT IsCheckedByDefault FROM Items WHERE ID = ? LIMIT 1",
|
|
||||||
[ { value = ItemID, cfsqltype = "cf_sql_integer" } ],
|
|
||||||
{ datasource = "payfrit" }
|
{ datasource = "payfrit" }
|
||||||
)>
|
)>
|
||||||
<cfif qItemDefault.recordCount GT 0 AND val(qItemDefault.IsCheckedByDefault) EQ 1>
|
<cfif qParentItem.recordCount GT 0 AND val(qParentItem.IsInvertedGroup) EQ 1>
|
||||||
<cfset isInvertedDefault = true>
|
<!--- Check if item was a default --->
|
||||||
|
<cfset var qItemDefault = queryTimed(
|
||||||
|
"SELECT IsCheckedByDefault FROM Items WHERE ID = ? LIMIT 1",
|
||||||
|
[ { value = ItemID, cfsqltype = "cf_sql_integer" } ],
|
||||||
|
{ datasource = "payfrit" }
|
||||||
|
)>
|
||||||
|
<cfif qItemDefault.recordCount GT 0 AND val(qItemDefault.IsCheckedByDefault) EQ 1>
|
||||||
|
<cfset isInvertedDefault = true>
|
||||||
|
</cfif>
|
||||||
</cfif>
|
</cfif>
|
||||||
</cfif>
|
</cfif>
|
||||||
</cfif>
|
<cfcatch>
|
||||||
|
<!--- On error, default to normal delete behavior --->
|
||||||
|
<cfset isInvertedDefault = false>
|
||||||
|
</cfcatch>
|
||||||
|
</cftry>
|
||||||
|
|
||||||
<cfif isInvertedDefault>
|
<cfif isInvertedDefault>
|
||||||
<!--- Keep in cart with Quantity=0 for "NO X" display --->
|
<!--- Keep in cart with Quantity=0 for "NO X" display --->
|
||||||
|
|
|
||||||
Reference in a new issue