Replace machinetypeid 33-43 checks with pctypeid throughout codebase

- PCs now identified by pctypeid IS NOT NULL (not machinetypeid >= 33)
- Equipment identified by pctypeid IS NULL (not machinetypeid < 33)
- Updated 8 files: search.asp, savemachineedit.asp, displaymachine.asp,
  displaypc.asp, displaypcs.asp, machine_map.asp, displaymachines.asp, api.asp
- Simplified queries and removed redundant machinetypeid checks
- Updated all related comments to reflect new pattern

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

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
cproudlock
2025-12-09 07:24:20 -05:00
parent a52dd2e932
commit 81f905f0b0
8 changed files with 26 additions and 39 deletions

View File

@@ -28,7 +28,7 @@ Response.ContentType = "application/json"
' Purpose: Receive PC asset data from PowerShell scripts and store in Phase 2 schema
' Created: 2025-11-13
' Modified: 2025-11-21 - Use sql.asp include for database connection
' Schema: Phase 2 (machines table, machinetypeid 33-43 for PCs)
' Schema: Phase 2 (machines table, pctypeid IS NOT NULL for PCs)
' ============================================================================
' Error handling wrapper
@@ -847,7 +847,7 @@ Function InsertOrUpdatePC(conn, hostname, serialnumber, manufacturer, model, pcT
LogToFile "Vendor ID: " & vendorId & ", Model ID: " & modelId & ", Machine Type ID: " & machineTypeId
' Check if PC already exists (Phase 2: identify PCs by machinetypeid 33,34,35)
' Check if PC already exists (Phase 2: identify PCs by pctypeid IS NOT NULL)
Dim strSQL, rsResult, safeHostname
safeHostname = Replace(hostname, "'", "''")
strSQL = "SELECT machineid FROM machines WHERE hostname = '" & safeHostname & "' AND pctypeid IS NOT NULL"
@@ -1337,7 +1337,7 @@ Function CreatePCMachineRelationship(pcMachineid, machineNumber)
Exit Function
End If
' Find equipment by machine number (Phase 2: PCs are machinetypeid 33-43, Equipment is 1-32)
' Find equipment by machine number (Phase 2: PCs have pctypeid IS NOT NULL, Equipment has pctypeid IS NULL)
Dim strSQL, rsResult, safeMachineNumber
safeMachineNumber = Replace(machineNumber, "'", "''")
strSQL = "SELECT machineid FROM machines WHERE machinenumber = '" & safeMachineNumber & "' AND pctypeid IS NULL"