Fix customer lookup: treat Order.UserID=0 as NULL
COALESCE treats 0 as valid, so Order.UserID=0 was matching User 0 (Payfrit Network) instead of falling back to Task.UserID. Use NULLIF to convert 0 to NULL before the fallback. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
e1000dbe19
commit
624264ad2e
1 changed files with 1 additions and 1 deletions
|
|
@ -74,7 +74,7 @@
|
|||
LEFT JOIN Businesses b ON b.ID = t.BusinessID
|
||||
LEFT JOIN ServicePoints sp ON sp.ID = o.ServicePointID
|
||||
LEFT JOIN ServicePoints tsp ON tsp.ID = t.ServicePointID
|
||||
LEFT JOIN Users u ON u.ID = COALESCE(o.UserID, t.UserID)
|
||||
LEFT JOIN Users u ON u.ID = COALESCE(NULLIF(o.UserID, 0), t.UserID)
|
||||
WHERE t.ID = ?
|
||||
", [ { value = TaskID, cfsqltype = "cf_sql_integer" } ], { datasource = "payfrit" })>
|
||||
|
||||
|
|
|
|||
Reference in a new issue