- setLineItem.cfm: Attach default children from ItemTemplateLinks (fixes drink choices not being saved for combos) - listForKDS.cfm: Include ItemParentName for modifier categories - kds.js: Display modifiers as "Category: Selection" format - Various other accumulated fixes for menu builder, orders, and admin Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
70 lines
2 KiB
Text
70 lines
2 KiB
Text
<cfsetting showdebugoutput="false">
|
|
<cfsetting enablecfoutputonly="true">
|
|
<cfcontent type="application/json; charset=utf-8" reset="true">
|
|
|
|
<cfscript>
|
|
data = {};
|
|
try {
|
|
requestBody = toString(getHttpRequestData().content);
|
|
if (len(requestBody)) data = deserializeJSON(requestBody);
|
|
} catch (any e) {}
|
|
|
|
phone = structKeyExists(data, "Phone") ? data.Phone : "";
|
|
// Strip non-digits
|
|
phone = reReplace(phone, "[^0-9]", "", "all");
|
|
|
|
if (len(phone) == 0) {
|
|
writeOutput(serializeJSON({ "OK": false, "ERROR": "missing_phone" }));
|
|
abort;
|
|
}
|
|
|
|
// Find user by phone
|
|
qUser = queryExecute("
|
|
SELECT UserID, UserFirstName, UserLastName, UserEmailAddress, UserContactNumber
|
|
FROM Users
|
|
WHERE REPLACE(REPLACE(REPLACE(UserContactNumber, '-', ''), '(', ''), ')', '') LIKE ?
|
|
OR UserContactNumber LIKE ?
|
|
", [
|
|
{ value: "%" & phone & "%", cfsqltype: "cf_sql_varchar" },
|
|
{ value: "%" & phone & "%", cfsqltype: "cf_sql_varchar" }
|
|
], { datasource: "payfrit" });
|
|
|
|
if (qUser.recordCount == 0) {
|
|
writeOutput(serializeJSON({ "OK": false, "ERROR": "user_not_found", "PHONE": phone }));
|
|
abort;
|
|
}
|
|
|
|
userId = qUser.UserID;
|
|
|
|
// Get all employee records for this user
|
|
qEmployees = queryExecute("
|
|
SELECT e.EmployeeID, e.BusinessID, e.EmployeeStatusID,
|
|
CAST(e.EmployeeIsActive AS UNSIGNED) AS EmployeeIsActive,
|
|
b.BusinessName
|
|
FROM lt_Users_Businesses_Employees e
|
|
JOIN Businesses b ON e.BusinessID = b.BusinessID
|
|
WHERE e.UserID = ?
|
|
", [{ value: userId, cfsqltype: "cf_sql_integer" }], { datasource: "payfrit" });
|
|
|
|
employees = [];
|
|
for (row in qEmployees) {
|
|
arrayAppend(employees, {
|
|
"EmployeeID": row.EmployeeID,
|
|
"BusinessID": row.BusinessID,
|
|
"BusinessName": row.BusinessName,
|
|
"StatusID": row.EmployeeStatusID,
|
|
"IsActive": row.EmployeeIsActive
|
|
});
|
|
}
|
|
|
|
writeOutput(serializeJSON({
|
|
"OK": true,
|
|
"USER": {
|
|
"UserID": qUser.UserID,
|
|
"Name": trim(qUser.UserFirstName & " " & qUser.UserLastName),
|
|
"Email": qUser.UserEmailAddress,
|
|
"Phone": qUser.UserContactNumber
|
|
},
|
|
"EMPLOYEES": employees
|
|
}));
|
|
</cfscript>
|