Fix customer lookup: use NULLIF on both Order and Task UserID

When both OrderID and UserID are 0, dont join to User 0 (Payfrit Network).
Instead return no customer info, letting the app show Guest.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
John Mizerek 2026-02-06 18:46:00 -08:00
parent 624264ad2e
commit 7f6c8253d0

View file

@ -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(NULLIF(o.UserID, 0), t.UserID)
LEFT JOIN Users u ON u.ID = COALESCE(NULLIF(o.UserID, 0), NULLIF(t.UserID, 0))
WHERE t.ID = ?
", [ { value = TaskID, cfsqltype = "cf_sql_integer" } ], { datasource = "payfrit" })>