Fix empty categories disappearing in unified schema menu builder
The unified schema query used INNER JOIN to children, which excluded categories with no items. Changed to direct query with NOT EXISTS template filter so empty categories persist after save+reload. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
6d157b44f7
commit
6a73752136
1 changed files with 5 additions and 5 deletions
|
|
@ -205,16 +205,16 @@ try {
|
||||||
", { businessID: businessID }, { datasource: "payfrit" });
|
", { businessID: businessID }, { datasource: "payfrit" });
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
// NEW UNIFIED SCHEMA: Categories are Items at ParentID=0 with children
|
// NEW UNIFIED SCHEMA: Categories are Items at ParentID=0, CategoryID=0, not templates
|
||||||
qCategories = queryTimed("
|
qCategories = queryTimed("
|
||||||
SELECT DISTINCT
|
SELECT
|
||||||
p.ID as CategoryID,
|
p.ID,
|
||||||
p.Name as Name,
|
p.Name,
|
||||||
p.SortOrder
|
p.SortOrder
|
||||||
FROM Items p
|
FROM Items p
|
||||||
INNER JOIN Items c ON c.ParentItemID = p.ID
|
|
||||||
WHERE p.BusinessID = :businessID
|
WHERE p.BusinessID = :businessID
|
||||||
AND p.ParentItemID = 0
|
AND p.ParentItemID = 0
|
||||||
|
AND (p.CategoryID = 0 OR p.CategoryID IS NULL)
|
||||||
AND p.IsActive = 1
|
AND p.IsActive = 1
|
||||||
AND NOT EXISTS (
|
AND NOT EXISTS (
|
||||||
SELECT 1 FROM lt_ItemID_TemplateItemID tl WHERE tl.TemplateItemID = p.ID
|
SELECT 1 FROM lt_ItemID_TemplateItemID tl WHERE tl.TemplateItemID = p.ID
|
||||||
|
|
|
||||||
Reference in a new issue