Fix displaysubnet.asp PC lookup to use Phase 2 schema

The PC IP lookup was using the deprecated pc_network_interfaces table
which no longer exists. Updated to use the communications table and
machines table with proper Phase 2 joins.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
cproudlock
2026-01-05 10:52:44 -05:00
parent b0b300babd
commit dd8729393f

View File

@@ -43,17 +43,19 @@
rsPrinterCheck.Close
Set rsPrinterCheck = Nothing
' Check if this IP belongs to a PC
' Check if this IP belongs to a PC (Phase 2: uses communications table)
Dim rsPCCheck, strPCSQL
strPCSQL = "SELECT pcid FROM pc_network_interfaces WHERE ipaddress = ?"
strPCSQL = "SELECT m.machineid FROM machines m " & _
"INNER JOIN communications c ON m.machineid = c.machineid " & _
"WHERE c.address = ? AND m.pctypeid IS NOT NULL AND c.isactive = 1"
Set rsPCCheck = ExecuteParameterizedQuery(objConn, strPCSQL, Array(search))
IF NOT rsPCCheck.EOF THEN
Dim pcRedirectId
pcRedirectId = rsPCCheck("pcid")
pcRedirectId = rsPCCheck("machineid")
rsPCCheck.Close
Set rsPCCheck = Nothing
objConn.Close
Response.Redirect("./displaypc.asp?pcid=" & pcRedirectId)
Response.Redirect("./displaypc.asp?machineid=" & pcRedirectId)
Response.End
END IF
rsPCCheck.Close