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 <noreply@anthropic.com>
This commit is contained in:
parent
d8565deda1
commit
407f68655e
3 changed files with 36 additions and 5 deletions
|
|
@ -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" });
|
||||
|
|
|
|||
|
|
@ -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 @@
|
|||
<cfset taskDetails = qTasks.Details>
|
||||
</cfif>
|
||||
|
||||
<cfset customerName = "">
|
||||
<cfif NOT isNull(qTasks.CustomerFirstName) AND len(trim(qTasks.CustomerFirstName))>
|
||||
<cfset customerName = qTasks.CustomerFirstName>
|
||||
<cfif NOT isNull(qTasks.CustomerLastName) AND len(trim(qTasks.CustomerLastName))>
|
||||
<cfset customerName = customerName & " " & qTasks.CustomerLastName>
|
||||
</cfif>
|
||||
</cfif>
|
||||
|
||||
<cfset arrayAppend(tasks, {
|
||||
"TaskID": qTasks.ID,
|
||||
"BusinessID": qTasks.BusinessID,
|
||||
|
|
@ -133,7 +145,9 @@
|
|||
"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
|
||||
"ServicePointName": isNull(qTasks.ServicePointName) ? "" : qTasks.ServicePointName,
|
||||
"CustomerID": val(qTasks.UserID),
|
||||
"CustomerName": customerName
|
||||
})>
|
||||
</cfloop>
|
||||
|
||||
|
|
|
|||
|
|
@ -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 @@
|
|||
|
||||
<cfset taskDetails = len(trim(qTasks.Details)) ? qTasks.Details : "">
|
||||
|
||||
<cfset customerName = "">
|
||||
<cfif NOT isNull(qTasks.CustomerFirstName) AND len(trim(qTasks.CustomerFirstName))>
|
||||
<cfset customerName = qTasks.CustomerFirstName>
|
||||
<cfif NOT isNull(qTasks.CustomerLastName) AND len(trim(qTasks.CustomerLastName))>
|
||||
<cfset customerName = customerName & " " & qTasks.CustomerLastName>
|
||||
</cfif>
|
||||
</cfif>
|
||||
|
||||
<cfset arrayAppend(tasks, {
|
||||
"TaskID": qTasks.ID,
|
||||
"BusinessID": qTasks.BusinessID,
|
||||
|
|
@ -113,7 +125,9 @@
|
|||
"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
|
||||
"ServicePointName": isNull(qTasks.ServicePointName) ? "" : qTasks.ServicePointName,
|
||||
"CustomerID": val(qTasks.UserID),
|
||||
"CustomerName": customerName
|
||||
})>
|
||||
</cfloop>
|
||||
|
||||
|
|
|
|||
Reference in a new issue