Revert inverted deselect logic - back to simple delete
This commit is contained in:
parent
5e01bcd989
commit
6ffc77fcaf
1 changed files with 10 additions and 51 deletions
|
|
@ -457,57 +457,16 @@
|
|||
<cfset attachDefaultChildren(OrderID, qExisting.ID, ItemID)>
|
||||
<cfset arrayAppend(request.attachDebug, "AFTER attachDefaultChildren call")>
|
||||
<cfelse>
|
||||
<!--- 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>
|
||||
<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 = val(qItem.ParentItemID), cfsqltype = "cf_sql_integer" } ],
|
||||
{ datasource = "payfrit" }
|
||||
)>
|
||||
<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" }
|
||||
)>
|
||||
<cfif qItemDefault.recordCount GT 0 AND val(qItemDefault.IsCheckedByDefault) EQ 1>
|
||||
<cfset isInvertedDefault = true>
|
||||
</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 --->
|
||||
<cfset queryTimed(
|
||||
"
|
||||
UPDATE OrderLineItems
|
||||
SET Quantity = 0, IsDeleted = b'0'
|
||||
WHERE ID = ?
|
||||
",
|
||||
[ { value = qExisting.ID, cfsqltype = "cf_sql_integer" } ],
|
||||
{ datasource = "payfrit" }
|
||||
)>
|
||||
<cfelse>
|
||||
<!--- Normal deselect: mark as deleted --->
|
||||
<cfset queryTimed(
|
||||
"
|
||||
UPDATE OrderLineItems
|
||||
SET IsDeleted = b'1'
|
||||
WHERE ID = ?
|
||||
",
|
||||
[ { value = qExisting.ID, cfsqltype = "cf_sql_integer" } ],
|
||||
{ datasource = "payfrit" }
|
||||
)>
|
||||
</cfif>
|
||||
<!--- Deselecting: mark as deleted --->
|
||||
<cfset queryTimed(
|
||||
"
|
||||
UPDATE OrderLineItems
|
||||
SET IsDeleted = b'1'
|
||||
WHERE ID = ?
|
||||
",
|
||||
[ { value = qExisting.ID, cfsqltype = "cf_sql_integer" } ],
|
||||
{ datasource = "payfrit" }
|
||||
)>
|
||||
</cfif>
|
||||
<cfelse>
|
||||
<!--- Insert new if selecting, otherwise no-op --->
|
||||
|
|
|
|||
Reference in a new issue