This repository has been archived on 2026-03-21. You can view files and clone it, but cannot push or open issues or pull requests.
payfrit-biz/api/admin/_scripts/debugBigDeansTemplates3.cfm
John Mizerek 89ec86c9d2 Move 70 one-off admin scripts to api/admin/_scripts/ (gitignored)
Only quickTasks/ and scheduledTasks/ subdirectories remain tracked
since those are actively used by the portal.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-31 20:38:49 -08:00

75 lines
1.9 KiB
Text

<cfsetting showdebugoutput="false">
<cfsetting enablecfoutputonly="true">
<cfcontent type="application/json; charset=utf-8" reset="true">
<cfscript>
bizId = 27;
// Get the template items themselves
qTemplates = queryExecute("
SELECT ID, Name, IsCollapsible, IsActive, ParentItemID, BusinessID
FROM Items
WHERE ID IN (11267, 11251, 11246, 11224, 11233, 11230, 11240, 11243, 11237, 11227)
ORDER BY Name
", {}, { datasource: "payfrit" });
templates = [];
for (row in qTemplates) {
arrayAppend(templates, {
"ItemID": row.ID,
"Name": row.Name,
"IsCollapsible": row.IsCollapsible,
"IsActive": row.IsActive,
"ParentID": row.ParentItemID,
"BusinessID": row.BusinessID
});
}
// What templates are used by burgers vs all items?
qBurgerLinks = queryExecute("
SELECT mi.ID, mi.Name, GROUP_CONCAT(t.Name ORDER BY tl.SortOrder) as Templates
FROM Items mi
JOIN lt_ItemID_TemplateItemID tl ON tl.ItemID = mi.ID
JOIN Items t ON t.ItemID = tl.TemplateItemID
WHERE mi.BusinessID = :bizId
AND mi.ParentItemID = 11271
GROUP BY mi.ID, mi.Name
ORDER BY mi.Name
", { bizId: bizId }, { datasource: "payfrit" });
burgerLinks = [];
for (row in qBurgerLinks) {
arrayAppend(burgerLinks, {
"ItemID": row.ID,
"Name": row.Name,
"Templates": row.Templates
});
}
// Also check: are there templates that SHOULD be linked to burgers?
// (e.g., Add Cheese, etc.)
qCheeseTemplate = queryExecute("
SELECT ID, Name, ParentItemID, IsActive
FROM Items
WHERE BusinessID = :bizId
AND Name LIKE '%Cheese%'
ORDER BY Name
", { bizId: bizId }, { datasource: "payfrit" });
cheeseItems = [];
for (row in qCheeseTemplate) {
arrayAppend(cheeseItems, {
"ItemID": row.ID,
"Name": row.Name,
"ParentID": row.ParentItemID,
"IsActive": row.IsActive
});
}
writeOutput(serializeJSON({
"OK": true,
"TemplatesUsed": templates,
"BurgerTemplateLinks": burgerLinks,
"CheeseRelatedItems": cheeseItems
}));
</cfscript>