From b1a263bb3603b805f6a5a992d18ce9db4fdbe188 Mon Sep 17 00:00:00 2001 From: John Mizerek Date: Fri, 6 Feb 2026 17:46:04 -0800 Subject: [PATCH] Fix task APIs to get ServicePointName from Task.ServicePointID - Use COALESCE(t.ServicePointID, o.ServicePointID) in JOIN - Add ServicePointID to JSON response - Fixes service bell tasks showing table name Co-Authored-By: Claude Opus 4.5 --- api/tasks/listMine.cfm | 4 +++- api/tasks/listPending.cfm | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/api/tasks/listMine.cfm b/api/tasks/listMine.cfm index 344d29b..350596a 100644 --- a/api/tasks/listMine.cfm +++ b/api/tasks/listMine.cfm @@ -83,13 +83,14 @@ tt.Icon AS TaskTypeIcon, tt.Color AS TaskTypeColor, b.Name AS BusinessName, + t.ServicePointID, sp.Name AS ServicePointName FROM Tasks t LEFT JOIN TaskCategories tc ON tc.ID = t.CategoryID LEFT JOIN tt_TaskTypes tt ON tt.ID = t.TaskTypeID LEFT JOIN Businesses b ON b.ID = t.BusinessID LEFT JOIN Orders o ON o.ID = t.OrderID - LEFT JOIN ServicePoints sp ON sp.ID = o.ServicePointID + LEFT JOIN ServicePoints sp ON sp.ID = COALESCE(t.ServicePointID, o.ServicePointID) WHERE #whereSQL# ORDER BY t.ClaimedOn DESC ", params, { datasource = "payfrit" })> @@ -131,6 +132,7 @@ "TaskTypeName": len(trim(qTasks.TaskTypeName)) ? qTasks.TaskTypeName : "", "TaskTypeIcon": len(trim(qTasks.TaskTypeIcon)) ? qTasks.TaskTypeIcon : "notifications", "TaskTypeColor": len(trim(qTasks.TaskTypeColor)) ? qTasks.TaskTypeColor : "##9C27B0", + "ServicePointID": val(qTasks.ServicePointID), "ServicePointName": isNull(qTasks.ServicePointName) ? "" : qTasks.ServicePointName })> diff --git a/api/tasks/listPending.cfm b/api/tasks/listPending.cfm index e74861b..7fb5d46 100644 --- a/api/tasks/listPending.cfm +++ b/api/tasks/listPending.cfm @@ -70,12 +70,13 @@ tt.Name AS TaskTypeName, tt.Icon AS TaskTypeIcon, tt.Color AS TaskTypeColor, + t.ServicePointID, sp.Name AS ServicePointName FROM Tasks t LEFT JOIN TaskCategories tc ON tc.ID = t.CategoryID LEFT JOIN tt_TaskTypes tt ON tt.ID = t.TaskTypeID LEFT JOIN Orders o ON o.ID = t.OrderID - LEFT JOIN ServicePoints sp ON sp.ID = o.ServicePointID + LEFT JOIN ServicePoints sp ON sp.ID = COALESCE(t.ServicePointID, o.ServicePointID) WHERE #whereSQL# ORDER BY t.CreatedOn ASC ", params, { datasource = "payfrit" })> @@ -111,6 +112,7 @@ "TaskTypeName": len(trim(qTasks.TaskTypeName)) ? qTasks.TaskTypeName : "", "TaskTypeIcon": len(trim(qTasks.TaskTypeIcon)) ? qTasks.TaskTypeIcon : "notifications", "TaskTypeColor": len(trim(qTasks.TaskTypeColor)) ? qTasks.TaskTypeColor : "##9C27B0", + "ServicePointID": val(qTasks.ServicePointID), "ServicePointName": isNull(qTasks.ServicePointName) ? "" : qTasks.ServicePointName })>