Only keep Quantity=0 for modifiers, not root items
This commit is contained in:
parent
029279658d
commit
fc9bbd78be
1 changed files with 22 additions and 12 deletions
|
|
@ -457,21 +457,31 @@
|
|||
<cfset attachDefaultChildren(OrderID, qExisting.ID, ItemID)>
|
||||
<cfset arrayAppend(request.attachDebug, "AFTER attachDefaultChildren call")>
|
||||
<cfelse>
|
||||
<!--- Deselecting: check if this is a default-checked item --->
|
||||
<cfset var qItemCheck = queryTimed(
|
||||
"SELECT IsCheckedByDefault FROM Items WHERE ID = ? LIMIT 1",
|
||||
[ { value = ItemID, cfsqltype = "cf_sql_integer" } ],
|
||||
{ datasource = "payfrit" }
|
||||
)>
|
||||
<cfif qItemCheck.recordCount GT 0 AND val(qItemCheck.IsCheckedByDefault) EQ 1>
|
||||
<!--- Default item: keep with Quantity=0 for "NO X" display --->
|
||||
<cfset queryTimed(
|
||||
"UPDATE OrderLineItems SET Quantity = 0 WHERE ID = ?",
|
||||
[ { value = qExisting.ID, cfsqltype = "cf_sql_integer" } ],
|
||||
<!--- Deselecting: for modifiers that are default-checked, keep with Quantity=0 --->
|
||||
<!--- For root items or non-defaults, delete normally --->
|
||||
<cfif ParentLineItemID GT 0>
|
||||
<cfset var qItemCheck = queryTimed(
|
||||
"SELECT IsCheckedByDefault FROM Items WHERE ID = ? LIMIT 1",
|
||||
[ { value = ItemID, cfsqltype = "cf_sql_integer" } ],
|
||||
{ datasource = "payfrit" }
|
||||
)>
|
||||
<cfif qItemCheck.recordCount GT 0 AND val(qItemCheck.IsCheckedByDefault) EQ 1>
|
||||
<!--- Default modifier: keep with Quantity=0 for "NO X" display --->
|
||||
<cfset queryTimed(
|
||||
"UPDATE OrderLineItems SET Quantity = 0 WHERE ID = ?",
|
||||
[ { value = qExisting.ID, cfsqltype = "cf_sql_integer" } ],
|
||||
{ datasource = "payfrit" }
|
||||
)>
|
||||
<cfelse>
|
||||
<!--- Non-default modifier: mark as deleted --->
|
||||
<cfset queryTimed(
|
||||
"UPDATE OrderLineItems SET IsDeleted = b'1' WHERE ID = ?",
|
||||
[ { value = qExisting.ID, cfsqltype = "cf_sql_integer" } ],
|
||||
{ datasource = "payfrit" }
|
||||
)>
|
||||
</cfif>
|
||||
<cfelse>
|
||||
<!--- Normal item: mark as deleted --->
|
||||
<!--- Root item: always delete --->
|
||||
<cfset queryTimed(
|
||||
"UPDATE OrderLineItems SET IsDeleted = b'1' WHERE ID = ?",
|
||||
[ { value = qExisting.ID, cfsqltype = "cf_sql_integer" } ],
|
||||
|
|
|
|||
Reference in a new issue