Update pages to use pctypeid instead of machinetypeid IN (33-43)

- 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 <noreply@anthropic.com>
This commit is contained in:
cproudlock
2025-12-08 15:46:48 -05:00
parent e2e7cb1466
commit 659e8bad4b
18 changed files with 26 additions and 26 deletions

10
api.asp
View File

@@ -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)