From 407f68655e396d3553a5dbaa557f45e80a1bea1c Mon Sep 17 00:00:00 2001 From: John Mizerek Date: Fri, 6 Feb 2026 17:57:22 -0800 Subject: [PATCH] Add UserID and customer info to service bell tasks - Store UserID when creating service bell tasks - Return CustomerID and CustomerName in listPending and listMine - Join Users table to fetch customer first/last name Co-Authored-By: Claude Opus 4.5 --- api/tasks/create.cfm | 5 ++++- api/tasks/listMine.cfm | 18 ++++++++++++++++-- api/tasks/listPending.cfm | 18 ++++++++++++++++-- 3 files changed, 36 insertions(+), 5 deletions(-) diff --git a/api/tasks/create.cfm b/api/tasks/create.cfm index b947e8e..ee1a64e 100644 --- a/api/tasks/create.cfm +++ b/api/tasks/create.cfm @@ -44,7 +44,7 @@ try { // Use message as details taskDetails = message; - // Insert service bell task with ServicePointID + // Insert service bell task with ServicePointID and UserID queryTimed(" INSERT INTO Tasks ( BusinessID, @@ -52,6 +52,7 @@ try { TaskTypeID, CategoryID, OrderID, + UserID, Title, Details, CreatedOn, @@ -62,6 +63,7 @@ try { :taskTypeID, 0, :orderID, + :userID, :taskTitle, :taskDetails, NOW(), @@ -72,6 +74,7 @@ try { servicePointID: servicePointID, taskTypeID: taskTypeID, orderID: orderID, + userID: userID, taskTitle: taskTitle, taskDetails: taskDetails }, { datasource: "payfrit" }); diff --git a/api/tasks/listMine.cfm b/api/tasks/listMine.cfm index 350596a..8c37c22 100644 --- a/api/tasks/listMine.cfm +++ b/api/tasks/listMine.cfm @@ -77,6 +77,7 @@ t.ClaimedByUserID, t.ClaimedOn, t.CompletedOn, + t.UserID, tc.Name AS CategoryName, tc.Color AS CategoryColor, tt.Name AS TaskTypeName, @@ -84,13 +85,16 @@ tt.Color AS TaskTypeColor, b.Name AS BusinessName, t.ServicePointID, - sp.Name AS ServicePointName + sp.Name AS ServicePointName, + u.FirstName AS CustomerFirstName, + u.LastName AS CustomerLastName 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 = COALESCE(t.ServicePointID, o.ServicePointID) + LEFT JOIN Users u ON u.ID = t.UserID WHERE #whereSQL# ORDER BY t.ClaimedOn DESC ", params, { datasource = "payfrit" })> @@ -113,6 +117,14 @@ + + + + + + + + diff --git a/api/tasks/listPending.cfm b/api/tasks/listPending.cfm index 7fb5d46..d5d9f70 100644 --- a/api/tasks/listPending.cfm +++ b/api/tasks/listPending.cfm @@ -65,18 +65,22 @@ t.Details, t.CreatedOn, t.ClaimedByUserID, + t.UserID, tc.Name AS CategoryName, tc.Color AS CategoryColor, tt.Name AS TaskTypeName, tt.Icon AS TaskTypeIcon, tt.Color AS TaskTypeColor, t.ServicePointID, - sp.Name AS ServicePointName + sp.Name AS ServicePointName, + u.FirstName AS CustomerFirstName, + u.LastName AS CustomerLastName 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 = COALESCE(t.ServicePointID, o.ServicePointID) + LEFT JOIN Users u ON u.ID = t.UserID WHERE #whereSQL# ORDER BY t.CreatedOn ASC ", params, { datasource = "payfrit" })> @@ -96,6 +100,14 @@ + + + + + + + +