payfrit-works/api/admin/debugEmployees.cfm
2026-01-11 17:58:31 -08:00

40 lines
1.1 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) {}
businessId = structKeyExists(data, "BusinessID") ? val(data.BusinessID) : 17;
q = queryExecute("
SELECT EmployeeID, UserID, EmployeeStatusID, EmployeeIsActive,
CAST(EmployeeIsActive AS UNSIGNED) AS IsActiveInt
FROM lt_Users_Businesses_Employees
WHERE BusinessID = ?
", [{ value: businessId, cfsqltype: "cf_sql_integer" }], { datasource: "payfrit" });
rows = [];
for (r in q) {
arrayAppend(rows, {
"EmployeeID": r.EmployeeID,
"UserID": r.UserID,
"StatusID": r.EmployeeStatusID,
"RawIsActive": r.EmployeeIsActive,
"CastIsActive": r.IsActiveInt,
"ValRaw": val(r.EmployeeIsActive),
"ValCast": val(r.IsActiveInt),
"EqRaw1": r.EmployeeIsActive == 1,
"EqCast1": r.IsActiveInt == 1
});
}
writeOutput(serializeJSON({
"OK": true,
"ROWS": rows
}));
</cfscript>