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/debugBigDeansTemplates.cfm
John 16a3b7c9a3 Replace queryExecute with queryTimed across all endpoints for perf tracking
Converts 200+ endpoint files to use queryTimed() wrapper which tracks
DB query count and execution time. Restores perf dashboard files that
were accidentally moved to _scripts/. Includes portal UI updates.
2026-02-02 00:28:37 -08:00

64 lines
1.6 KiB
Text

<cfsetting showdebugoutput="false">
<cfsetting enablecfoutputonly="true">
<cfcontent type="application/json; charset=utf-8" reset="true">
<cfscript>
bizId = 27;
// Get all template links for Big Dean's
qLinks = queryTimed("
SELECT
tl.ItemID as MenuItemID,
mi.Name as MenuName,
mi.ParentItemID as MenuItemParentID,
tl.TemplateItemID,
t.Name as TemplateName,
t.IsActive as TemplateActive,
tl.SortOrder
FROM lt_ItemID_TemplateItemID tl
JOIN Items mi ON mi.ID = tl.ItemID
JOIN Items t ON t.ItemID = tl.TemplateItemID
WHERE mi.BusinessID = :bizId
ORDER BY mi.Name, tl.SortOrder
", { bizId: bizId }, { datasource: "payfrit" });
links = [];
for (row in qLinks) {
arrayAppend(links, {
"MenuItemID": row.MenuItemID,
"MenuName": row.MenuName,
"MenuItemParentID": row.MenuItemParentID,
"TemplateItemID": row.TemplateItemID,
"TemplateName": row.TemplateName,
"TemplateActive": row.TemplateActive,
"SortOrder": row.SortOrder
});
}
// Get all templates that exist for this business
qTemplates = queryTimed("
SELECT ID, Name, IsActive, ParentItemID
FROM Items
WHERE BusinessID = :bizId
AND IsCollapsible = 1
ORDER BY Name
", { bizId: bizId }, { datasource: "payfrit" });
templates = [];
for (row in qTemplates) {
arrayAppend(templates, {
"ItemID": row.ID,
"Name": row.Name,
"IsActive": row.IsActive,
"ParentID": row.ParentItemID
});
}
writeOutput(serializeJSON({
"OK": true,
"TemplateLinksCount": arrayLen(links),
"TemplateLinks": links,
"TemplatesCount": arrayLen(templates),
"Templates": templates
}));
</cfscript>