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 <noreply@anthropic.com>
This commit is contained in:
parent
8c247eb000
commit
b1a263bb36
2 changed files with 6 additions and 2 deletions
|
|
@ -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
|
||||
})>
|
||||
</cfloop>
|
||||
|
|
|
|||
|
|
@ -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
|
||||
})>
|
||||
</cfloop>
|
||||
|
|
|
|||
Reference in a new issue