Remove IsInvertedGroup feature from all APIs, KDS, and portal
Feature cancelled — modifier wording handles the use case instead. Removes IsInvertedGroup from SELECTs, JSON responses, RemovedDefaults computation, and KDS/portal display logic. DB column left in place. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
bace74aa23
commit
28c0de9f09
9 changed files with 22 additions and 140 deletions
|
|
@ -26,7 +26,6 @@ function buildOptionsTree(allOptions, parentId) {
|
||||||
"sortOrder": allOptions.SortOrder[i],
|
"sortOrder": allOptions.SortOrder[i],
|
||||||
"requiresSelection": isNull(allOptions.RequiresSelection[i]) ? false : (allOptions.RequiresSelection[i] == 1),
|
"requiresSelection": isNull(allOptions.RequiresSelection[i]) ? false : (allOptions.RequiresSelection[i] == 1),
|
||||||
"maxSelections": isNull(allOptions.MaxSelections[i]) ? 0 : allOptions.MaxSelections[i],
|
"maxSelections": isNull(allOptions.MaxSelections[i]) ? 0 : allOptions.MaxSelections[i],
|
||||||
"isInverted": structKeyExists(allOptions, "IsInvertedGroup") && !isNull(allOptions.IsInvertedGroup[i]) ? (allOptions.IsInvertedGroup[i] == 1) : false,
|
|
||||||
"options": children
|
"options": children
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
@ -196,8 +195,7 @@ try {
|
||||||
m.IsCheckedByDefault as IsDefault,
|
m.IsCheckedByDefault as IsDefault,
|
||||||
m.SortOrder,
|
m.SortOrder,
|
||||||
m.RequiresChildSelection as RequiresSelection,
|
m.RequiresChildSelection as RequiresSelection,
|
||||||
m.MaxNumSelectionReq as MaxSelections,
|
m.MaxNumSelectionReq as MaxSelections
|
||||||
m.IsInvertedGroup
|
|
||||||
FROM Items m
|
FROM Items m
|
||||||
WHERE m.BusinessID = :businessID
|
WHERE m.BusinessID = :businessID
|
||||||
AND m.IsActive = 1
|
AND m.IsActive = 1
|
||||||
|
|
@ -253,8 +251,7 @@ try {
|
||||||
m.IsCheckedByDefault as IsDefault,
|
m.IsCheckedByDefault as IsDefault,
|
||||||
m.SortOrder,
|
m.SortOrder,
|
||||||
m.RequiresChildSelection as RequiresSelection,
|
m.RequiresChildSelection as RequiresSelection,
|
||||||
m.MaxNumSelectionReq as MaxSelections,
|
m.MaxNumSelectionReq as MaxSelections
|
||||||
m.IsInvertedGroup
|
|
||||||
FROM Items m
|
FROM Items m
|
||||||
WHERE m.BusinessID = :businessID
|
WHERE m.BusinessID = :businessID
|
||||||
AND m.IsActive = 1
|
AND m.IsActive = 1
|
||||||
|
|
@ -292,8 +289,7 @@ try {
|
||||||
t.IsCheckedByDefault as IsDefault,
|
t.IsCheckedByDefault as IsDefault,
|
||||||
t.SortOrder,
|
t.SortOrder,
|
||||||
t.RequiresChildSelection as RequiresSelection,
|
t.RequiresChildSelection as RequiresSelection,
|
||||||
t.MaxNumSelectionReq as MaxSelections,
|
t.MaxNumSelectionReq as MaxSelections
|
||||||
t.IsInvertedGroup
|
|
||||||
FROM Items t
|
FROM Items t
|
||||||
WHERE t.BusinessID = :businessID
|
WHERE t.BusinessID = :businessID
|
||||||
AND (t.CategoryID = 0 OR t.CategoryID IS NULL)
|
AND (t.CategoryID = 0 OR t.CategoryID IS NULL)
|
||||||
|
|
@ -308,7 +304,7 @@ try {
|
||||||
arrayAppend(templateIds, qTemplates.ItemID[i]);
|
arrayAppend(templateIds, qTemplates.ItemID[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
qTemplateChildren = queryNew("ItemID,ParentItemID,Name,Price,IsDefault,SortOrder,RequiresSelection,MaxSelections,IsInvertedGroup");
|
qTemplateChildren = queryNew("ItemID,ParentItemID,Name,Price,IsDefault,SortOrder,RequiresSelection,MaxSelections");
|
||||||
if (arrayLen(templateIds) > 0) {
|
if (arrayLen(templateIds) > 0) {
|
||||||
qTemplateChildren = queryTimed("
|
qTemplateChildren = queryTimed("
|
||||||
SELECT
|
SELECT
|
||||||
|
|
@ -319,8 +315,7 @@ try {
|
||||||
c.IsCheckedByDefault as IsDefault,
|
c.IsCheckedByDefault as IsDefault,
|
||||||
c.SortOrder,
|
c.SortOrder,
|
||||||
c.RequiresChildSelection as RequiresSelection,
|
c.RequiresChildSelection as RequiresSelection,
|
||||||
c.MaxNumSelectionReq as MaxSelections,
|
c.MaxNumSelectionReq as MaxSelections
|
||||||
c.IsInvertedGroup
|
|
||||||
FROM Items c
|
FROM Items c
|
||||||
WHERE c.ParentItemID IN (:templateIds)
|
WHERE c.ParentItemID IN (:templateIds)
|
||||||
AND c.IsActive = 1
|
AND c.IsActive = 1
|
||||||
|
|
@ -343,7 +338,6 @@ try {
|
||||||
"isTemplate": true,
|
"isTemplate": true,
|
||||||
"requiresSelection": isNull(qTemplates.RequiresSelection[i]) ? false : (qTemplates.RequiresSelection[i] == 1),
|
"requiresSelection": isNull(qTemplates.RequiresSelection[i]) ? false : (qTemplates.RequiresSelection[i] == 1),
|
||||||
"maxSelections": isNull(qTemplates.MaxSelections[i]) ? 0 : qTemplates.MaxSelections[i],
|
"maxSelections": isNull(qTemplates.MaxSelections[i]) ? 0 : qTemplates.MaxSelections[i],
|
||||||
"isInverted": isNull(qTemplates.IsInvertedGroup[i]) ? false : (qTemplates.IsInvertedGroup[i] == 1),
|
|
||||||
"options": options
|
"options": options
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -208,7 +208,6 @@
|
||||||
i.RequiresChildSelection,
|
i.RequiresChildSelection,
|
||||||
i.MaxNumSelectionReq,
|
i.MaxNumSelectionReq,
|
||||||
i.IsCollapsible,
|
i.IsCollapsible,
|
||||||
i.IsInvertedGroup,
|
|
||||||
i.SortOrder,
|
i.SortOrder,
|
||||||
i.StationID,
|
i.StationID,
|
||||||
s.Name AS StationName,
|
s.Name AS StationName,
|
||||||
|
|
@ -263,7 +262,6 @@
|
||||||
i.RequiresChildSelection,
|
i.RequiresChildSelection,
|
||||||
i.MaxNumSelectionReq,
|
i.MaxNumSelectionReq,
|
||||||
i.IsCollapsible,
|
i.IsCollapsible,
|
||||||
i.IsInvertedGroup,
|
|
||||||
i.SortOrder,
|
i.SortOrder,
|
||||||
i.StationID,
|
i.StationID,
|
||||||
s.Name,
|
s.Name,
|
||||||
|
|
@ -301,7 +299,6 @@
|
||||||
i.RequiresChildSelection,
|
i.RequiresChildSelection,
|
||||||
i.MaxNumSelectionReq,
|
i.MaxNumSelectionReq,
|
||||||
i.IsCollapsible,
|
i.IsCollapsible,
|
||||||
i.IsInvertedGroup,
|
|
||||||
i.SortOrder,
|
i.SortOrder,
|
||||||
i.StationID,
|
i.StationID,
|
||||||
s.Name,
|
s.Name,
|
||||||
|
|
@ -354,7 +351,6 @@
|
||||||
"RequiresChildSelection": 0,
|
"RequiresChildSelection": 0,
|
||||||
"MaxNumSelectionReq": 0,
|
"MaxNumSelectionReq": 0,
|
||||||
"IsCollapsible": 0,
|
"IsCollapsible": 0,
|
||||||
"IsInvertedGroup": 0,
|
|
||||||
"SortOrder": qCategories.SortOrder,
|
"SortOrder": qCategories.SortOrder,
|
||||||
"MenuID": isNull(qCategories.MenuID) ? 0 : val(qCategories.MenuID),
|
"MenuID": isNull(qCategories.MenuID) ? 0 : val(qCategories.MenuID),
|
||||||
"StationID": "",
|
"StationID": "",
|
||||||
|
|
@ -419,7 +415,6 @@
|
||||||
"RequiresChildSelection": q.RequiresChildSelection,
|
"RequiresChildSelection": q.RequiresChildSelection,
|
||||||
"MaxNumSelectionReq": q.MaxNumSelectionReq,
|
"MaxNumSelectionReq": q.MaxNumSelectionReq,
|
||||||
"IsCollapsible": q.IsCollapsible,
|
"IsCollapsible": q.IsCollapsible,
|
||||||
"IsInvertedGroup": q.IsInvertedGroup,
|
|
||||||
"SortOrder": q.SortOrder,
|
"SortOrder": q.SortOrder,
|
||||||
"MenuID": itemMenuID,
|
"MenuID": itemMenuID,
|
||||||
"StationID": len(trim(q.StationID)) ? q.StationID : "",
|
"StationID": len(trim(q.StationID)) ? q.StationID : "",
|
||||||
|
|
@ -441,7 +436,6 @@
|
||||||
tmpl.RequiresChildSelection as TemplateRequired,
|
tmpl.RequiresChildSelection as TemplateRequired,
|
||||||
tmpl.MaxNumSelectionReq as TemplateMaxSelections,
|
tmpl.MaxNumSelectionReq as TemplateMaxSelections,
|
||||||
tmpl.IsCollapsible as TemplateIsCollapsible,
|
tmpl.IsCollapsible as TemplateIsCollapsible,
|
||||||
tmpl.IsInvertedGroup as TemplateIsInvertedGroup,
|
|
||||||
tl.SortOrder as TemplateSortOrder
|
tl.SortOrder as TemplateSortOrder
|
||||||
FROM lt_ItemID_TemplateItemID tl
|
FROM lt_ItemID_TemplateItemID tl
|
||||||
INNER JOIN Items tmpl ON tmpl.ID = tl.TemplateItemID AND tmpl.IsActive = 1
|
INNER JOIN Items tmpl ON tmpl.ID = tl.TemplateItemID AND tmpl.IsActive = 1
|
||||||
|
|
@ -526,7 +520,6 @@
|
||||||
"RequiresChildSelection": qTemplateLinks.TemplateRequired,
|
"RequiresChildSelection": qTemplateLinks.TemplateRequired,
|
||||||
"MaxNumSelectionReq": qTemplateLinks.TemplateMaxSelections,
|
"MaxNumSelectionReq": qTemplateLinks.TemplateMaxSelections,
|
||||||
"IsCollapsible": qTemplateLinks.TemplateIsCollapsible,
|
"IsCollapsible": qTemplateLinks.TemplateIsCollapsible,
|
||||||
"IsInvertedGroup": qTemplateLinks.TemplateIsInvertedGroup,
|
|
||||||
"SortOrder": qTemplateLinks.TemplateSortOrder,
|
"SortOrder": qTemplateLinks.TemplateSortOrder,
|
||||||
"StationID": "",
|
"StationID": "",
|
||||||
"ItemName": "",
|
"ItemName": "",
|
||||||
|
|
@ -551,7 +544,6 @@
|
||||||
"RequiresChildSelection": 0,
|
"RequiresChildSelection": 0,
|
||||||
"MaxNumSelectionReq": 0,
|
"MaxNumSelectionReq": 0,
|
||||||
"IsCollapsible": 0,
|
"IsCollapsible": 0,
|
||||||
"IsInvertedGroup": 0,
|
|
||||||
"SortOrder": opt.SortOrder,
|
"SortOrder": opt.SortOrder,
|
||||||
"StationID": "",
|
"StationID": "",
|
||||||
"ItemName": "",
|
"ItemName": "",
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,6 @@ function saveOptionsRecursive(options, parentID, businessID) {
|
||||||
var requiresSelection = (structKeyExists(opt, "requiresSelection") && opt.requiresSelection) ? 1 : 0;
|
var requiresSelection = (structKeyExists(opt, "requiresSelection") && opt.requiresSelection) ? 1 : 0;
|
||||||
var maxSelections = structKeyExists(opt, "maxSelections") ? val(opt.maxSelections) : 0;
|
var maxSelections = structKeyExists(opt, "maxSelections") ? val(opt.maxSelections) : 0;
|
||||||
var isDefault = (structKeyExists(opt, "isDefault") && opt.isDefault) ? 1 : 0;
|
var isDefault = (structKeyExists(opt, "isDefault") && opt.isDefault) ? 1 : 0;
|
||||||
var isInverted = (structKeyExists(opt, "isInverted") && opt.isInverted) ? 1 : 0;
|
|
||||||
var optionID = 0;
|
var optionID = 0;
|
||||||
|
|
||||||
if (optDbId > 0) {
|
if (optDbId > 0) {
|
||||||
|
|
@ -32,7 +31,6 @@ function saveOptionsRecursive(options, parentID, businessID) {
|
||||||
SortOrder = :sortOrder,
|
SortOrder = :sortOrder,
|
||||||
RequiresChildSelection = :requiresSelection,
|
RequiresChildSelection = :requiresSelection,
|
||||||
MaxNumSelectionReq = :maxSelections,
|
MaxNumSelectionReq = :maxSelections,
|
||||||
IsInvertedGroup = :isInverted,
|
|
||||||
ParentItemID = :parentID
|
ParentItemID = :parentID
|
||||||
WHERE ID = :optID
|
WHERE ID = :optID
|
||||||
", {
|
", {
|
||||||
|
|
@ -43,19 +41,18 @@ function saveOptionsRecursive(options, parentID, businessID) {
|
||||||
isDefault: isDefault,
|
isDefault: isDefault,
|
||||||
sortOrder: optSortOrder,
|
sortOrder: optSortOrder,
|
||||||
requiresSelection: requiresSelection,
|
requiresSelection: requiresSelection,
|
||||||
maxSelections: maxSelections,
|
maxSelections: maxSelections
|
||||||
isInverted: isInverted
|
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
queryTimed("
|
queryTimed("
|
||||||
INSERT INTO Items (
|
INSERT INTO Items (
|
||||||
BusinessID, ParentItemID, Name, Price,
|
BusinessID, ParentItemID, Name, Price,
|
||||||
IsCheckedByDefault, SortOrder, IsActive, AddedOn,
|
IsCheckedByDefault, SortOrder, IsActive, AddedOn,
|
||||||
RequiresChildSelection, MaxNumSelectionReq, IsInvertedGroup, CategoryID
|
RequiresChildSelection, MaxNumSelectionReq, CategoryID
|
||||||
) VALUES (
|
) VALUES (
|
||||||
:businessID, :parentID, :name, :price,
|
:businessID, :parentID, :name, :price,
|
||||||
:isDefault, :sortOrder, 1, NOW(),
|
:isDefault, :sortOrder, 1, NOW(),
|
||||||
:requiresSelection, :maxSelections, :isInverted, 0
|
:requiresSelection, :maxSelections, 0
|
||||||
)
|
)
|
||||||
", {
|
", {
|
||||||
businessID: businessID,
|
businessID: businessID,
|
||||||
|
|
@ -65,8 +62,7 @@ function saveOptionsRecursive(options, parentID, businessID) {
|
||||||
isDefault: isDefault,
|
isDefault: isDefault,
|
||||||
sortOrder: optSortOrder,
|
sortOrder: optSortOrder,
|
||||||
requiresSelection: requiresSelection,
|
requiresSelection: requiresSelection,
|
||||||
maxSelections: maxSelections,
|
maxSelections: maxSelections
|
||||||
isInverted: isInverted
|
|
||||||
});
|
});
|
||||||
|
|
||||||
var result = queryTimed("SELECT LAST_INSERT_ID() as newID");
|
var result = queryTimed("SELECT LAST_INSERT_ID() as newID");
|
||||||
|
|
@ -338,15 +334,13 @@ try {
|
||||||
UPDATE Items
|
UPDATE Items
|
||||||
SET Name = :name,
|
SET Name = :name,
|
||||||
RequiresChildSelection = :requiresSelection,
|
RequiresChildSelection = :requiresSelection,
|
||||||
MaxNumSelectionReq = :maxSelections,
|
MaxNumSelectionReq = :maxSelections
|
||||||
IsInvertedGroup = :isInverted
|
|
||||||
WHERE ID = :modID
|
WHERE ID = :modID
|
||||||
", {
|
", {
|
||||||
modID: modDbId,
|
modID: modDbId,
|
||||||
name: mod.name,
|
name: mod.name,
|
||||||
requiresSelection: requiresSelection,
|
requiresSelection: requiresSelection,
|
||||||
maxSelections: maxSelections,
|
maxSelections: maxSelections
|
||||||
isInverted: (structKeyExists(mod, "isInverted") && mod.isInverted) ? 1 : 0
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// Only save template options ONCE (first time we encounter this template)
|
// Only save template options ONCE (first time we encounter this template)
|
||||||
|
|
@ -366,7 +360,6 @@ try {
|
||||||
SortOrder = :sortOrder,
|
SortOrder = :sortOrder,
|
||||||
RequiresChildSelection = :requiresSelection,
|
RequiresChildSelection = :requiresSelection,
|
||||||
MaxNumSelectionReq = :maxSelections,
|
MaxNumSelectionReq = :maxSelections,
|
||||||
IsInvertedGroup = :isInverted,
|
|
||||||
ParentItemID = :parentID
|
ParentItemID = :parentID
|
||||||
WHERE ID = :modID
|
WHERE ID = :modID
|
||||||
", {
|
", {
|
||||||
|
|
@ -377,8 +370,7 @@ try {
|
||||||
isDefault: (mod.isDefault ?: false) ? 1 : 0,
|
isDefault: (mod.isDefault ?: false) ? 1 : 0,
|
||||||
sortOrder: modSortOrder,
|
sortOrder: modSortOrder,
|
||||||
requiresSelection: requiresSelection,
|
requiresSelection: requiresSelection,
|
||||||
maxSelections: maxSelections,
|
maxSelections: maxSelections
|
||||||
isInverted: (structKeyExists(mod, "isInverted") && mod.isInverted) ? 1 : 0
|
|
||||||
});
|
});
|
||||||
|
|
||||||
if (structKeyExists(mod, "options") && isArray(mod.options)) {
|
if (structKeyExists(mod, "options") && isArray(mod.options)) {
|
||||||
|
|
@ -390,11 +382,11 @@ try {
|
||||||
INSERT INTO Items (
|
INSERT INTO Items (
|
||||||
BusinessID, ParentItemID, Name, Price,
|
BusinessID, ParentItemID, Name, Price,
|
||||||
IsCheckedByDefault, SortOrder, IsActive, AddedOn,
|
IsCheckedByDefault, SortOrder, IsActive, AddedOn,
|
||||||
RequiresChildSelection, MaxNumSelectionReq, IsInvertedGroup, CategoryID
|
RequiresChildSelection, MaxNumSelectionReq, CategoryID
|
||||||
) VALUES (
|
) VALUES (
|
||||||
:businessID, :parentID, :name, :price,
|
:businessID, :parentID, :name, :price,
|
||||||
:isDefault, :sortOrder, 1, NOW(),
|
:isDefault, :sortOrder, 1, NOW(),
|
||||||
:requiresSelection, :maxSelections, :isInverted, 0
|
:requiresSelection, :maxSelections, 0
|
||||||
)
|
)
|
||||||
", {
|
", {
|
||||||
businessID: businessID,
|
businessID: businessID,
|
||||||
|
|
@ -404,8 +396,7 @@ try {
|
||||||
isDefault: (mod.isDefault ?: false) ? 1 : 0,
|
isDefault: (mod.isDefault ?: false) ? 1 : 0,
|
||||||
sortOrder: modSortOrder,
|
sortOrder: modSortOrder,
|
||||||
requiresSelection: requiresSelection,
|
requiresSelection: requiresSelection,
|
||||||
maxSelections: maxSelections,
|
maxSelections: maxSelections
|
||||||
isInverted: (structKeyExists(mod, "isInverted") && mod.isInverted) ? 1 : 0
|
|
||||||
});
|
});
|
||||||
|
|
||||||
modResult = queryTimed("SELECT LAST_INSERT_ID() as newModID");
|
modResult = queryTimed("SELECT LAST_INSERT_ID() as newModID");
|
||||||
|
|
|
||||||
|
|
@ -95,9 +95,7 @@
|
||||||
i.Name,
|
i.Name,
|
||||||
i.ParentItemID,
|
i.ParentItemID,
|
||||||
i.IsCheckedByDefault,
|
i.IsCheckedByDefault,
|
||||||
i.IsInvertedGroup,
|
parent.Name AS ItemParentName
|
||||||
parent.Name AS ItemParentName,
|
|
||||||
parent.IsInvertedGroup AS ParentIsInvertedGroup
|
|
||||||
FROM OrderLineItems oli
|
FROM OrderLineItems oli
|
||||||
INNER JOIN Items i ON i.ID = oli.ItemID
|
INNER JOIN Items i ON i.ID = oli.ItemID
|
||||||
LEFT JOIN Items parent ON parent.ID = i.ParentItemID
|
LEFT JOIN Items parent ON parent.ID = i.ParentItemID
|
||||||
|
|
@ -126,10 +124,7 @@
|
||||||
"Name": qLI.Name ?: "",
|
"Name": qLI.Name ?: "",
|
||||||
"ParentItemID": val(qLI.ParentItemID),
|
"ParentItemID": val(qLI.ParentItemID),
|
||||||
"ItemParentName": qLI.ItemParentName ?: "",
|
"ItemParentName": qLI.ItemParentName ?: "",
|
||||||
"IsCheckedByDefault": val(qLI.IsCheckedByDefault),
|
"IsCheckedByDefault": val(qLI.IsCheckedByDefault)
|
||||||
"IsInvertedGroup": val(qLI.IsInvertedGroup),
|
|
||||||
"ParentIsInvertedGroup": val(qLI.ParentIsInvertedGroup),
|
|
||||||
"_debug": "Qty=#val(qLI.Quantity)# IsChkDef=#val(qLI.IsCheckedByDefault)# ParentInv=#val(qLI.ParentIsInvertedGroup)#"
|
|
||||||
})>
|
})>
|
||||||
<!--- Add to subtotal (root items only - modifiers are included in parent price) --->
|
<!--- Add to subtotal (root items only - modifiers are included in parent price) --->
|
||||||
<cfif val(qLI.ParentOrderLineItemID) EQ 0>
|
<cfif val(qLI.ParentOrderLineItemID) EQ 0>
|
||||||
|
|
|
||||||
|
|
@ -124,10 +124,8 @@
|
||||||
i.Name,
|
i.Name,
|
||||||
i.ParentItemID,
|
i.ParentItemID,
|
||||||
i.IsCheckedByDefault,
|
i.IsCheckedByDefault,
|
||||||
i.IsInvertedGroup,
|
|
||||||
i.StationID,
|
i.StationID,
|
||||||
parent.Name AS ItemParentName,
|
parent.Name AS ItemParentName
|
||||||
COALESCE(parent.IsInvertedGroup, 0) AS ParentIsInvertedGroup
|
|
||||||
FROM OrderLineItems oli
|
FROM OrderLineItems oli
|
||||||
INNER JOIN Items i ON i.ID = oli.ItemID
|
INNER JOIN Items i ON i.ID = oli.ItemID
|
||||||
LEFT JOIN Items parent ON parent.ID = i.ParentItemID
|
LEFT JOIN Items parent ON parent.ID = i.ParentItemID
|
||||||
|
|
@ -149,47 +147,11 @@
|
||||||
"ParentItemID": qLineItems.ParentItemID,
|
"ParentItemID": qLineItems.ParentItemID,
|
||||||
"ItemParentName": qLineItems.ItemParentName,
|
"ItemParentName": qLineItems.ItemParentName,
|
||||||
"IsCheckedByDefault": qLineItems.IsCheckedByDefault,
|
"IsCheckedByDefault": qLineItems.IsCheckedByDefault,
|
||||||
"IsInvertedGroup": qLineItems.IsInvertedGroup,
|
|
||||||
"ParentIsInvertedGroup": qLineItems.ParentIsInvertedGroup,
|
|
||||||
"StationID": qLineItems.StationID,
|
"StationID": qLineItems.StationID,
|
||||||
"StatusID": val(qLineItems.StatusID)
|
"StatusID": val(qLineItems.StatusID)
|
||||||
})>
|
})>
|
||||||
</cfloop>
|
</cfloop>
|
||||||
|
|
||||||
<!--- For inverted modifier groups, compute removed defaults --->
|
|
||||||
<!--- The inverted group header may not be an order line item itself,
|
|
||||||
so we detect inverted groups by finding children whose parent item is inverted --->
|
|
||||||
<cfset invertedGroupsSeen = {}>
|
|
||||||
<cfloop array="#lineItems#" index="li">
|
|
||||||
<cfif li.ParentIsInvertedGroup AND NOT structKeyExists(invertedGroupsSeen, li.ParentItemID)>
|
|
||||||
<!--- First child of this inverted group — compute removed defaults once --->
|
|
||||||
<cfset invertedGroupsSeen[li.ParentItemID] = true>
|
|
||||||
<cfset qRemovedDefaults = queryTimed("
|
|
||||||
SELECT i.Name
|
|
||||||
FROM Items i
|
|
||||||
WHERE i.ParentItemID = ?
|
|
||||||
AND i.IsActive = 1
|
|
||||||
AND i.IsCheckedByDefault = b'1'
|
|
||||||
AND i.ID NOT IN (
|
|
||||||
SELECT oli2.ItemID FROM OrderLineItems oli2
|
|
||||||
WHERE oli2.OrderID = ? AND oli2.ParentOrderLineItemID = ? AND oli2.IsDeleted = b'0'
|
|
||||||
)
|
|
||||||
ORDER BY i.SortOrder
|
|
||||||
", [
|
|
||||||
{ value = li.ParentItemID, cfsqltype = "cf_sql_integer" },
|
|
||||||
{ value = qOrders.ID, cfsqltype = "cf_sql_integer" },
|
|
||||||
{ value = li.ParentOrderLineItemID, cfsqltype = "cf_sql_integer" }
|
|
||||||
], { datasource = "payfrit" })>
|
|
||||||
<cfset removedNames = []>
|
|
||||||
<cfloop query="qRemovedDefaults">
|
|
||||||
<cfset arrayAppend(removedNames, qRemovedDefaults.Name)>
|
|
||||||
</cfloop>
|
|
||||||
<!--- Attach RemovedDefaults to the first child so the JS can find it --->
|
|
||||||
<cfset li["RemovedDefaults"] = removedNames>
|
|
||||||
<cfset li["IsInvertedGroupProxy"] = true>
|
|
||||||
</cfif>
|
|
||||||
</cfloop>
|
|
||||||
|
|
||||||
<!--- Determine order type name --->
|
<!--- Determine order type name --->
|
||||||
<cfset orderTypeName = "">
|
<cfset orderTypeName = "">
|
||||||
<cfswitch expression="#qOrders.OrderTypeID#">
|
<cfswitch expression="#qOrders.OrderTypeID#">
|
||||||
|
|
|
||||||
|
|
@ -254,9 +254,7 @@
|
||||||
i.Name,
|
i.Name,
|
||||||
i.ParentItemID,
|
i.ParentItemID,
|
||||||
i.IsCheckedByDefault,
|
i.IsCheckedByDefault,
|
||||||
i.IsInvertedGroup,
|
parent.Name AS ItemParentName
|
||||||
parent.Name AS ItemParentName,
|
|
||||||
parent.IsInvertedGroup AS ParentIsInvertedGroup
|
|
||||||
FROM OrderLineItems oli
|
FROM OrderLineItems oli
|
||||||
INNER JOIN Items i ON i.ID = oli.ItemID
|
INNER JOIN Items i ON i.ID = oli.ItemID
|
||||||
LEFT JOIN Items parent ON parent.ID = i.ParentItemID
|
LEFT JOIN Items parent ON parent.ID = i.ParentItemID
|
||||||
|
|
@ -283,9 +281,7 @@
|
||||||
"Name": qLI.Name ?: "",
|
"Name": qLI.Name ?: "",
|
||||||
"ParentItemID": val(qLI.ParentItemID),
|
"ParentItemID": val(qLI.ParentItemID),
|
||||||
"ItemParentName": qLI.ItemParentName ?: "",
|
"ItemParentName": qLI.ItemParentName ?: "",
|
||||||
"IsCheckedByDefault": val(qLI.IsCheckedByDefault),
|
"IsCheckedByDefault": val(qLI.IsCheckedByDefault)
|
||||||
"IsInvertedGroup": val(qLI.IsInvertedGroup),
|
|
||||||
"ParentIsInvertedGroup": val(qLI.ParentIsInvertedGroup)
|
|
||||||
})>
|
})>
|
||||||
</cfloop>
|
</cfloop>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -167,8 +167,7 @@
|
||||||
i.Name AS ItemName,
|
i.Name AS ItemName,
|
||||||
i.ParentItemID,
|
i.ParentItemID,
|
||||||
i.Price AS ItemPrice,
|
i.Price AS ItemPrice,
|
||||||
i.IsCheckedByDefault,
|
i.IsCheckedByDefault
|
||||||
i.IsInvertedGroup
|
|
||||||
FROM OrderLineItems oli
|
FROM OrderLineItems oli
|
||||||
INNER JOIN Items i ON i.ID = oli.ItemID
|
INNER JOIN Items i ON i.ID = oli.ItemID
|
||||||
WHERE oli.OrderID = ?
|
WHERE oli.OrderID = ?
|
||||||
|
|
@ -187,39 +186,10 @@
|
||||||
"ItemPrice": qLineItems.LineItemPrice,
|
"ItemPrice": qLineItems.LineItemPrice,
|
||||||
"Quantity": qLineItems.Quantity,
|
"Quantity": qLineItems.Quantity,
|
||||||
"Remark": qLineItems.Remark,
|
"Remark": qLineItems.Remark,
|
||||||
"IsModifier": qLineItems.ParentOrderLineItemID GT 0,
|
"IsModifier": qLineItems.ParentOrderLineItemID GT 0
|
||||||
"IsCheckedByDefault": qLineItems.IsCheckedByDefault,
|
|
||||||
"IsInvertedGroup": qLineItems.IsInvertedGroup
|
|
||||||
})>
|
})>
|
||||||
</cfloop>
|
</cfloop>
|
||||||
|
|
||||||
<!--- For inverted modifier groups, compute removed defaults --->
|
|
||||||
<cfloop array="#result.LineItems#" index="li">
|
|
||||||
<cfif li.IsInvertedGroup>
|
|
||||||
<cfset qRemovedDefaults = queryExecute("
|
|
||||||
SELECT i.Name
|
|
||||||
FROM Items i
|
|
||||||
WHERE i.ParentItemID = ?
|
|
||||||
AND i.IsActive = 1
|
|
||||||
AND i.IsCheckedByDefault = b'1'
|
|
||||||
AND i.ID NOT IN (
|
|
||||||
SELECT oli2.ItemID FROM OrderLineItems oli2
|
|
||||||
WHERE oli2.OrderID = ? AND oli2.ParentOrderLineItemID = ? AND oli2.IsDeleted = b'0'
|
|
||||||
)
|
|
||||||
ORDER BY i.SortOrder
|
|
||||||
", [
|
|
||||||
{ value = li.ItemID, cfsqltype = "cf_sql_integer" },
|
|
||||||
{ value = qTask.OrderID, cfsqltype = "cf_sql_integer" },
|
|
||||||
{ value = li.LineItemID, cfsqltype = "cf_sql_integer" }
|
|
||||||
], { datasource = "payfrit" })>
|
|
||||||
<cfset removedNames = []>
|
|
||||||
<cfloop query="qRemovedDefaults">
|
|
||||||
<cfset arrayAppend(removedNames, qRemovedDefaults.Name)>
|
|
||||||
</cfloop>
|
|
||||||
<cfset li["RemovedDefaults"] = removedNames>
|
|
||||||
</cfif>
|
|
||||||
</cfloop>
|
|
||||||
|
|
||||||
<!--- Calculate order total: subtotal + tax + tip + delivery (if delivery) + platform fee --->
|
<!--- Calculate order total: subtotal + tax + tip + delivery (if delivery) + platform fee --->
|
||||||
<cfset taxAmount = subtotal * val(qTask.TaxRate)>
|
<cfset taxAmount = subtotal * val(qTask.TaxRate)>
|
||||||
<cfset tipAmount = val(qTask.TipAmount)>
|
<cfset tipAmount = val(qTask.TipAmount)>
|
||||||
|
|
|
||||||
17
kds/kds.js
17
kds/kds.js
|
|
@ -413,23 +413,6 @@ function renderAllModifiers(modifiers, allItems) {
|
||||||
const leafModifiers = [];
|
const leafModifiers = [];
|
||||||
function collectLeafModifiers(mods, depth = 0) {
|
function collectLeafModifiers(mods, depth = 0) {
|
||||||
mods.forEach(mod => {
|
mods.forEach(mod => {
|
||||||
// Inverted groups: show removed defaults with "NO" prefix instead of listing all selected defaults
|
|
||||||
// Check both the item itself (if group header is in order) and proxy (first child carries the data)
|
|
||||||
const isInverted = mod.IsInvertedGroup || mod.ISINVERTEDGROUP || mod.IsInvertedGroupProxy || mod.ISINVERTEDGROUPPROXY;
|
|
||||||
if (isInverted) {
|
|
||||||
const removed = mod.RemovedDefaults || mod.REMOVEDDEFAULTS || [];
|
|
||||||
if (removed.length > 0) {
|
|
||||||
const groupName = mod.ItemParentName || mod.Name;
|
|
||||||
removed.forEach(name => {
|
|
||||||
leafModifiers.push({ mod: { Name: 'NO ' + name, ItemParentName: groupName }, path: [] });
|
|
||||||
});
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Skip default modifiers inside inverted groups — handled above with "NO" prefix
|
|
||||||
if (mod.IsCheckedByDefault && (mod.ParentIsInvertedGroup || mod.PARENTISINVERTEDGROUP)) return;
|
|
||||||
|
|
||||||
const children = allItems.filter(item => item.ParentOrderLineItemID === mod.OrderLineItemID);
|
const children = allItems.filter(item => item.ParentOrderLineItemID === mod.OrderLineItemID);
|
||||||
if (children.length === 0) {
|
if (children.length === 0) {
|
||||||
const path = getModifierPath(mod);
|
const path = getModifierPath(mod);
|
||||||
|
|
|
||||||
|
|
@ -2419,7 +2419,6 @@
|
||||||
sortOrder: obj.sortOrder || 0,
|
sortOrder: obj.sortOrder || 0,
|
||||||
requiresSelection: obj.requiresSelection || false,
|
requiresSelection: obj.requiresSelection || false,
|
||||||
maxSelections: obj.maxSelections || 0,
|
maxSelections: obj.maxSelections || 0,
|
||||||
isInverted: obj.isInverted || false,
|
|
||||||
options: []
|
options: []
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
Reference in a new issue