From 659e8bad4b8df9eb644b93a18846e44c3f4e1c94 Mon Sep 17 00:00:00 2001 From: cproudlock Date: Mon, 8 Dec 2025 15:46:48 -0500 Subject: [PATCH] Update pages to use pctypeid instead of machinetypeid IN (33-43) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - PCs identified by pctypeid IS NOT NULL instead of machinetypeid list - Equipment identified by pctypeid IS NULL instead of NOT IN list - Fixed devicecamera.asp: IDF dropdown uses machinetypeid 17, not 34 - Fixed displaypcs.asp: measuring tool filter uses pctypeid = 7 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- addmachine.asp | 2 +- api.asp | 10 +++++----- computers.asp | 2 +- devicecamera.asp | 2 +- displaymachine.asp | 2 +- displaypc.asp | 4 ++-- displaypcs.asp | 6 +++--- displaysubnet.asp | 2 +- editdevice.asp | 2 +- editmachine.asp | 2 +- editpc.asp | 2 +- listpcs.asp | 2 +- machine_edit.asp | 2 +- pclist.asp | 2 +- pcs.asp | 2 +- savedevice.asp | 2 +- updatedevice.asp | 2 +- updatepc_direct.asp | 4 ++-- 18 files changed, 26 insertions(+), 26 deletions(-) diff --git a/addmachine.asp b/addmachine.asp index c59d537..3bb0e83 100644 --- a/addmachine.asp +++ b/addmachine.asp @@ -402,7 +402,7 @@ <% Dim rsControlPCs - strSQL = "SELECT machineid, machinenumber, hostname FROM machines WHERE machinetypeid IN (33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43) AND isactive = 1 ORDER BY machinenumber ASC" + strSQL = "SELECT machineid, machinenumber, hostname FROM machines WHERE pctypeid IS NOT NULL AND isactive = 1 ORDER BY machinenumber ASC" Set rsControlPCs = objconn.Execute(strSQL) While Not rsControlPCs.EOF Dim controlPCDisplay diff --git a/api.asp b/api.asp index 6d08906..3ef8e35 100644 --- a/api.asp +++ b/api.asp @@ -257,7 +257,7 @@ Sub UpdateCompleteAsset() ' Check if PC exists Dim strSQL, rsResult, safeHostname, safeSerial safeHostname = Replace(hostname, "'", "''") - strSQL = "SELECT machineid FROM machines WHERE hostname = '" & safeHostname & "' AND machinetypeid IN (33,34,35,36,37,38,39,40,41,42,43)" + strSQL = "SELECT machineid FROM machines WHERE hostname = '" & safeHostname & "' AND pctypeid IS NOT NULL" Set rsResult = objConn.Execute(strSQL) If Err.Number <> 0 Then SendError debugMsg & "8-PC check failed: " & Err.Description @@ -850,7 +850,7 @@ Function InsertOrUpdatePC(conn, hostname, serialnumber, manufacturer, model, pcT ' Check if PC already exists (Phase 2: identify PCs by machinetypeid 33,34,35) Dim strSQL, rsResult, safeHostname safeHostname = Replace(hostname, "'", "''") - strSQL = "SELECT machineid FROM machines WHERE hostname = '" & safeHostname & "' AND machinetypeid IN (33,34,35,36,37,38,39,40,41,42,43)" + strSQL = "SELECT machineid FROM machines WHERE hostname = '" & safeHostname & "' AND pctypeid IS NOT NULL" Set rsResult = objConn.Execute(strSQL) Dim machineid @@ -928,7 +928,7 @@ Function InsertOrUpdatePC(conn, hostname, serialnumber, manufacturer, model, pcT "osid = " & sqlOsId & ", " & _ "machinestatusid = " & sqlStatusId & ", " & _ "lastupdated = NOW() " & _ - "WHERE machineid = " & CLng(machineid) & " AND machinetypeid IN (33,34,35,36,37,38,39,40,41,42,43)" + "WHERE machineid = " & CLng(machineid) & " AND pctypeid IS NOT NULL" LogToFile "UPDATE SQL built: " & Left(strSQL, 200) & "..." @@ -1034,7 +1034,7 @@ Function GetMachineidByHostname(hostname) Dim strSQL, rsResult, safeHostname safeHostname = Replace(hostname, "'", "''") - strSQL = "SELECT machineid FROM machines WHERE hostname = '" & safeHostname & "' AND machinetypeid IN (33,34,35,36,37,38,39,40,41,42,43)" + strSQL = "SELECT machineid FROM machines WHERE hostname = '" & safeHostname & "' AND pctypeid IS NOT NULL" Set rsResult = objConn.Execute(strSQL) If Not rsResult.EOF Then @@ -1340,7 +1340,7 @@ Function CreatePCMachineRelationship(pcMachineid, machineNumber) ' Find equipment by machine number (Phase 2: PCs are machinetypeid 33-43, Equipment is 1-32) Dim strSQL, rsResult, safeMachineNumber safeMachineNumber = Replace(machineNumber, "'", "''") - strSQL = "SELECT machineid FROM machines WHERE machinenumber = '" & safeMachineNumber & "' AND machinetypeid NOT IN (33,34,35,36,37,38,39,40,41,42,43)" + strSQL = "SELECT machineid FROM machines WHERE machinenumber = '" & safeMachineNumber & "' AND pctypeid IS NULL" LogToFile "CreatePCMachineRelationship: Executing SQL: " & strSQL Set rsResult = objConn.Execute(strSQL) diff --git a/computers.asp b/computers.asp index d082539..a7c7a58 100644 --- a/computers.asp +++ b/computers.asp @@ -133,7 +133,7 @@ Set rsStatus = Nothing "LEFT JOIN communications c ON c.machineid = m.machineid AND c.isprimary = 1 " & _ "LEFT JOIN pctype ON m.pctypeid = pctype.pctypeid " & _ "LEFT JOIN machinestatus ON m.machinestatusid = machinestatus.machinestatusid " & _ - "WHERE m.isactive = 1 AND m.machinetypeid IN (33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43)" + "WHERE m.isactive = 1 AND m.pctypeid IS NOT NULL" ' Apply filters whereClause = "" diff --git a/devicecamera.asp b/devicecamera.asp index b522997..1cea2d9 100644 --- a/devicecamera.asp +++ b/devicecamera.asp @@ -161,7 +161,7 @@ <% Dim strSQL2, rsIDFs - strSQL2 = "SELECT machineid, alias AS idfname FROM machines WHERE machinetypeid = 34 AND isactive = 1 ORDER BY alias" + strSQL2 = "SELECT machineid, alias AS idfname FROM machines WHERE machinetypeid = 17 AND isactive = 1 ORDER BY alias" Set rsIDFs = objConn.Execute(strSQL2) If rsIDFs.EOF Then diff --git a/displaymachine.asp b/displaymachine.asp index e2cec22..e7faf22 100644 --- a/displaymachine.asp +++ b/displaymachine.asp @@ -419,7 +419,7 @@ End If "JOIN machines m ON (mr.machineid = m.machineid OR mr.related_machineid = m.machineid) " & _ "LEFT JOIN communications c ON m.machineid = c.machineid AND c.comstypeid IN (1, 3) AND c.isactive = 1 " & _ "WHERE (mr.machineid = ? OR mr.related_machineid = ?) AND mr.relationshiptypeid = 3 " & _ - " AND m.machinetypeid IN (33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43) AND m.machineid <> ? AND mr.isactive = 1 " & _ + " AND m.pctypeid IS NOT NULL AND m.machineid <> ? AND mr.isactive = 1 " & _ "GROUP BY m.machineid, m.machinenumber, m.hostname" Set rs2 = ExecuteParameterizedQuery(objConn, strSQL2, Array(machineid, machineid, machineid)) diff --git a/displaypc.asp b/displaypc.asp index 56dc9f0..8523f01 100644 --- a/displaypc.asp +++ b/displaypc.asp @@ -101,7 +101,7 @@ "LEFT JOIN functionalaccounts ON machinetypes.functionalaccountid = functionalaccounts.functionalaccountid " & _ "INNER JOIN vendors ON models.vendorid = vendors.vendorid " & _ "LEFT JOIN printers ON machines.printerid = printers.printerid " & _ - "WHERE machines.machineid = " & CLng(machineid) & " AND machines.machinetypeid IN (33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43)" + "WHERE machines.machineid = " & CLng(machineid) & " AND machines.pctypeid IS NOT NULL" Set rs = objConn.Execute(strSQL) @@ -502,7 +502,7 @@ End If "LEFT JOIN models mo ON m.modelnumberid = mo.modelnumberid " & _ "LEFT JOIN machinetypes mt ON mo.machinetypeid = mt.machinetypeid " & _ "WHERE (mr.machineid = ? OR mr.related_machineid = ?) AND mr.relationshiptypeid = 3 " & _ - " AND m.machinetypeid NOT IN (33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43) AND m.machineid <> ? AND mr.isactive = 1 " & _ + " AND m.pctypeid IS NULL AND m.machineid <> ? AND mr.isactive = 1 " & _ "ORDER BY machinenumber" Set rs2 = ExecuteParameterizedQuery(objConn, strSQL2, Array(machineid, machineid, machineid)) diff --git a/displaypcs.asp b/displaypcs.asp index 164bc0e..d16ef73 100644 --- a/displaypcs.asp +++ b/displaypcs.asp @@ -48,7 +48,7 @@ deviceTypeFilter = Request.QueryString("devicetype") Dim rsUnlinked, unlinkedCount unlinkedCount = 0 Set rsUnlinked = objConn.Execute("SELECT COUNT(*) as cnt FROM machines m " & _ - "WHERE m.machinetypeid IN (41, 42, 43) AND m.isactive = 1 " & _ + "WHERE m.pctypeid = 7 AND m.isactive = 1 " & _ "AND NOT EXISTS (SELECT 1 FROM machinerelationships mr WHERE (mr.machineid = m.machineid OR mr.related_machineid = m.machineid) AND mr.relationshiptypeid = 3 AND mr.isactive = 1)") If Not rsUnlinked.EOF Then unlinkedCount = CLng(rsUnlinked("cnt") & "") @@ -141,7 +141,7 @@ Set rsStatus = Nothing "LEFT JOIN machinestatus ON m.machinestatusid = machinestatus.machinestatusid " & _ "LEFT JOIN machinerelationships mr ON (mr.machineid = m.machineid OR mr.related_machineid = m.machineid) AND mr.isactive = 1 AND mr.relationshiptypeid = 3 " & _ "LEFT JOIN machines eq ON (eq.machineid = mr.related_machineid OR eq.machineid = mr.machineid) AND eq.machineid <> m.machineid AND eq.machinetypeid < 33 " & _ - "WHERE m.isactive = 1 AND m.machinetypeid IN (33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43)" + "WHERE m.isactive = 1 AND m.pctypeid IS NOT NULL" ' Apply filters whereClause = "" @@ -162,7 +162,7 @@ Set rsStatus = Nothing ' Filter for specialized PCs needing equipment relationships If needsRelationshipFilter = "1" Then - whereClause = whereClause & "AND m.machinetypeid IN (41, 42, 43) " & _ + whereClause = whereClause & "AND m.pctypeid = 7 " & _ "AND NOT EXISTS (SELECT 1 FROM machinerelationships mr WHERE (mr.machineid = m.machineid OR mr.related_machineid = m.machineid) AND mr.relationshiptypeid = 3 AND mr.isactive = 1) " End If diff --git a/displaysubnet.asp b/displaysubnet.asp index 1c476ec..861b90e 100644 --- a/displaysubnet.asp +++ b/displaysubnet.asp @@ -27,7 +27,7 @@ '-------------------------------------------------------Is this the IP address of a PC--------------------------------------------------- IF search <> "" THEN ' PHASE 2: Query communications table instead of pc_network_interfaces - strSQL = "SELECT c.machineid FROM communications c JOIN machines m ON c.machineid = m.machineid WHERE c.address='" &search &"' AND m.machinetypeid IN (33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43) LIMIT 1" + strSQL = "SELECT c.machineid FROM communications c JOIN machines m ON c.machineid = m.machineid WHERE c.address='" &search &"' AND m.pctypeid IS NOT NULL LIMIT 1" set rs = objconn.Execute(strSQL) IF NOT rs.EOF THEN machineid = rs("machineid") diff --git a/editdevice.asp b/editdevice.asp index ab06b82..ba0ce9c 100644 --- a/editdevice.asp +++ b/editdevice.asp @@ -34,7 +34,7 @@ "LEFT JOIN vendors v ON mo.vendorid = v.vendorid " &_ "LEFT JOIN businessunits bu ON m.businessunitid = bu.businessunitid " &_ "LEFT JOIN machinetypes mt ON mo.machinetypeid = mt.machinetypeid " &_ - "WHERE m.machineid = ? AND m.machinetypeid IN (33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43)" + "WHERE m.machineid = ? AND m.pctypeid IS NOT NULL" Dim cmd, rsMachine Set cmd = Server.CreateObject("ADODB.Command") diff --git a/editmachine.asp b/editmachine.asp index fe4e66d..6d0aaf7 100644 --- a/editmachine.asp +++ b/editmachine.asp @@ -559,7 +559,7 @@ <% Dim rsControlPCs - strSQL = "SELECT machineid, machinenumber, hostname FROM machines WHERE machinetypeid IN (33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43) AND isactive = 1 ORDER BY machinenumber ASC" + strSQL = "SELECT machineid, machinenumber, hostname FROM machines WHERE pctypeid IS NOT NULL AND isactive = 1 ORDER BY machinenumber ASC" Set rsControlPCs = objconn.Execute(strSQL) While Not rsControlPCs.EOF Dim controlPCDisplay, selectedControlPC diff --git a/editpc.asp b/editpc.asp index 35c8021..bc7c8f7 100644 --- a/editpc.asp +++ b/editpc.asp @@ -34,7 +34,7 @@ "LEFT JOIN vendors v ON mo.vendorid = v.vendorid " &_ "LEFT JOIN businessunits bu ON m.businessunitid = bu.businessunitid " &_ "LEFT JOIN machinetypes mt ON mo.machinetypeid = mt.machinetypeid " &_ - "WHERE m.machineid = ? AND m.machinetypeid IN (33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43)" + "WHERE m.machineid = ? AND m.pctypeid IS NOT NULL" Dim cmd, rsMachine Set cmd = Server.CreateObject("ADODB.Command") diff --git a/listpcs.asp b/listpcs.asp index 63af279..6dcf67d 100644 --- a/listpcs.asp +++ b/listpcs.asp @@ -133,7 +133,7 @@ Set rsStatus = Nothing "LEFT JOIN communications c ON c.machineid = m.machineid AND c.isprimary = 1 " & _ "LEFT JOIN pctype ON m.pctypeid = pctype.pctypeid " & _ "LEFT JOIN machinestatus ON m.machinestatusid = machinestatus.machinestatusid " & _ - "WHERE m.isactive = 1 AND m.machinetypeid IN (33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43)" + "WHERE m.isactive = 1 AND m.pctypeid IS NOT NULL" ' Apply filters whereClause = "" diff --git a/machine_edit.asp b/machine_edit.asp index bdad509..614572a 100644 --- a/machine_edit.asp +++ b/machine_edit.asp @@ -570,7 +570,7 @@ <% Dim rsControlPCs - strSQL = "SELECT machineid, machinenumber, hostname FROM machines WHERE machinetypeid IN (33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43) AND isactive = 1 ORDER BY machinenumber ASC" + strSQL = "SELECT machineid, machinenumber, hostname FROM machines WHERE pctypeid IS NOT NULL AND isactive = 1 ORDER BY machinenumber ASC" Set rsControlPCs = objconn.Execute(strSQL) While Not rsControlPCs.EOF Dim controlPCDisplay, selectedControlPC diff --git a/pclist.asp b/pclist.asp index 07218fe..f3135fe 100644 --- a/pclist.asp +++ b/pclist.asp @@ -133,7 +133,7 @@ Set rsStatus = Nothing "LEFT JOIN communications c ON c.machineid = m.machineid AND c.isprimary = 1 " & _ "LEFT JOIN pctype ON m.pctypeid = pctype.pctypeid " & _ "LEFT JOIN machinestatus ON m.machinestatusid = machinestatus.machinestatusid " & _ - "WHERE m.isactive = 1 AND m.machinetypeid IN (33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43)" + "WHERE m.isactive = 1 AND m.pctypeid IS NOT NULL" ' Apply filters whereClause = "" diff --git a/pcs.asp b/pcs.asp index 63af279..6dcf67d 100644 --- a/pcs.asp +++ b/pcs.asp @@ -133,7 +133,7 @@ Set rsStatus = Nothing "LEFT JOIN communications c ON c.machineid = m.machineid AND c.isprimary = 1 " & _ "LEFT JOIN pctype ON m.pctypeid = pctype.pctypeid " & _ "LEFT JOIN machinestatus ON m.machinestatusid = machinestatus.machinestatusid " & _ - "WHERE m.isactive = 1 AND m.machinetypeid IN (33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43)" + "WHERE m.isactive = 1 AND m.pctypeid IS NOT NULL" ' Apply filters whereClause = "" diff --git a/savedevice.asp b/savedevice.asp index dd75313..922e41d 100644 --- a/savedevice.asp +++ b/savedevice.asp @@ -20,7 +20,7 @@ ' Check if serial number already exists - PHASE 2: Use machines table Dim checkSQL, rsCheck, existingMachineID - checkSQL = "SELECT machineid FROM machines WHERE serialnumber = ? AND machinetypeid IN (33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43)" + checkSQL = "SELECT machineid FROM machines WHERE serialnumber = ? AND pctypeid IS NOT NULL" Set rsCheck = ExecuteParameterizedQuery(objConn, checkSQL, Array(serialnumber)) If Not rsCheck.EOF Then diff --git a/updatedevice.asp b/updatedevice.asp index 96e5377..3153eb6 100644 --- a/updatedevice.asp +++ b/updatedevice.asp @@ -115,7 +115,7 @@ End If ' Add lastupdated timestamp and WHERE clause - updateSQL = updateSQL & "lastupdated = NOW() WHERE machineid = ? AND machinetypeid IN (33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43)" + updateSQL = updateSQL & "lastupdated = NOW() WHERE machineid = ? AND pctypeid IS NOT NULL" paramList(paramIndex) = pcid ' Execute parameterized update diff --git a/updatepc_direct.asp b/updatepc_direct.asp index f973509..ef7fee2 100644 --- a/updatepc_direct.asp +++ b/updatepc_direct.asp @@ -41,7 +41,7 @@ ' Verify the PC exists using parameterized query - PHASE 2: Use machines table Dim checkSQL, rsCheck, cmdCheck - checkSQL = "SELECT COUNT(*) as cnt FROM machines WHERE machineid = ? AND machinetypeid IN (33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43)" + checkSQL = "SELECT COUNT(*) as cnt FROM machines WHERE machineid = ? AND pctypeid IS NOT NULL" Set cmdCheck = Server.CreateObject("ADODB.Command") cmdCheck.ActiveConnection = objConn cmdCheck.CommandText = checkSQL @@ -191,7 +191,7 @@ ' Build UPDATE statement for PC using parameterized query - PHASE 2: Use machines table Dim strSQL, cmdUpdate - strSQL = "UPDATE machines SET modelnumberid = ?, machinenumber = ?, lastupdated = NOW() WHERE machineid = ? AND machinetypeid IN (33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43)" + strSQL = "UPDATE machines SET modelnumberid = ?, machinenumber = ?, lastupdated = NOW() WHERE machineid = ? AND pctypeid IS NOT NULL" Set cmdUpdate = Server.CreateObject("ADODB.Command") cmdUpdate.ActiveConnection = objConn cmdUpdate.CommandText = strSQL