Fix FK references on OrderLineItems incorrectly changed to ID
- setLineItem.cfm: WHERE ID→WHERE OrderID on 3 OrderLineItems queries that filter by order (FK), not by line item PK - setLineItem.cfm: qKids.ItemID→qKids.ID, qTemplateKids.ItemID→ qTemplateKids.ID (query only selects ID column from Items) - abandonOrder.cfm: DELETE FROM OrderLineItems WHERE ID→WHERE OrderID (was deleting one line item by PK instead of all items for the order) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
8dff081407
commit
94ee89d1f3
2 changed files with 6 additions and 6 deletions
|
|
@ -52,7 +52,7 @@
|
||||||
|
|
||||||
<!--- Delete line items --->
|
<!--- Delete line items --->
|
||||||
<cfset queryExecute(
|
<cfset queryExecute(
|
||||||
"DELETE FROM OrderLineItems WHERE ID = ?",
|
"DELETE FROM OrderLineItems WHERE OrderID = ?",
|
||||||
[{ value = OrderID, cfsqltype = "cf_sql_integer" }],
|
[{ value = OrderID, cfsqltype = "cf_sql_integer" }],
|
||||||
{ datasource = "payfrit" }
|
{ datasource = "payfrit" }
|
||||||
)>
|
)>
|
||||||
|
|
|
||||||
|
|
@ -82,13 +82,13 @@
|
||||||
<!--- Process direct children --->
|
<!--- Process direct children --->
|
||||||
<cfloop query="qKids">
|
<cfloop query="qKids">
|
||||||
<cfset arrayAppend(request.attachDebug, " -> direct child: ItemID=#qKids.ID#")>
|
<cfset arrayAppend(request.attachDebug, " -> direct child: ItemID=#qKids.ID#")>
|
||||||
<cfset processDefaultChild(arguments.OrderID, arguments.ParentLineItemID, qKids.ItemID, qKids.Price)>
|
<cfset processDefaultChild(arguments.OrderID, arguments.ParentLineItemID, qKids.ID, qKids.Price)>
|
||||||
</cfloop>
|
</cfloop>
|
||||||
|
|
||||||
<!--- Process template children --->
|
<!--- Process template children --->
|
||||||
<cfloop query="qTemplateKids">
|
<cfloop query="qTemplateKids">
|
||||||
<cfset arrayAppend(request.attachDebug, " -> template child: ItemID=#qTemplateKids.ID#")>
|
<cfset arrayAppend(request.attachDebug, " -> template child: ItemID=#qTemplateKids.ID#")>
|
||||||
<cfset processDefaultChild(arguments.OrderID, arguments.ParentLineItemID, qTemplateKids.ItemID, qTemplateKids.Price)>
|
<cfset processDefaultChild(arguments.OrderID, arguments.ParentLineItemID, qTemplateKids.ID, qTemplateKids.Price)>
|
||||||
</cfloop>
|
</cfloop>
|
||||||
</cffunction>
|
</cffunction>
|
||||||
|
|
||||||
|
|
@ -103,7 +103,7 @@
|
||||||
"
|
"
|
||||||
SELECT ID
|
SELECT ID
|
||||||
FROM OrderLineItems
|
FROM OrderLineItems
|
||||||
WHERE ID = ?
|
WHERE OrderID = ?
|
||||||
AND ParentOrderLineItemID = ?
|
AND ParentOrderLineItemID = ?
|
||||||
AND ItemID = ?
|
AND ItemID = ?
|
||||||
LIMIT 1
|
LIMIT 1
|
||||||
|
|
@ -375,7 +375,7 @@
|
||||||
"
|
"
|
||||||
UPDATE OrderLineItems
|
UPDATE OrderLineItems
|
||||||
SET IsDeleted = b'1'
|
SET IsDeleted = b'1'
|
||||||
WHERE ID = ?
|
WHERE OrderID = ?
|
||||||
AND ParentOrderLineItemID = ?
|
AND ParentOrderLineItemID = ?
|
||||||
AND ItemID != ?
|
AND ItemID != ?
|
||||||
AND IsDeleted = b'0'
|
AND IsDeleted = b'0'
|
||||||
|
|
@ -401,7 +401,7 @@
|
||||||
"
|
"
|
||||||
SELECT ID
|
SELECT ID
|
||||||
FROM OrderLineItems
|
FROM OrderLineItems
|
||||||
WHERE ID = ?
|
WHERE OrderID = ?
|
||||||
AND ParentOrderLineItemID = ?
|
AND ParentOrderLineItemID = ?
|
||||||
AND ItemID = ?
|
AND ItemID = ?
|
||||||
LIMIT 1
|
LIMIT 1
|
||||||
|
|
|
||||||
Reference in a new issue