Consolidate PC machinetypeid: all PCs use 33, pctypeid determines type

- Simplified GetMachineTypeIdFromPCType() to always return 33 (PC)
- PC type differentiation now handled entirely by pctypeid
- Updated savedevice.asp: 28 -> 33
- Updated savedevice_direct.asp: 36 -> 33, added pctypeid
- Removed redundant machinetypeid mapping logic (36-43)
- All 317 existing PCs already use machinetypeid=33

Schema simplified:
  machinetypeid=33 (PC) + pctypeid determines specific type
  pctypeid: 1=Standard, 2=Engineer, 3=Shopfloor, 5=CMM, etc.

🤖 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:53:27 -05:00
parent adeff46d80
commit 53fd7e2214
3 changed files with 17 additions and 49 deletions

View File

@@ -3,7 +3,7 @@
' FILE: savedevice_direct.asp
' PURPOSE: Create new PC with minimal required fields (PC-only scanner)
' SECURITY: Parameterized queries, HTML encoding, input validation
' UPDATED: 2025-12-04 - Changed to PC-only (machinetypeid 36 = PC - Standard)
' UPDATED: 2025-12-09 - All PCs use machinetypeid 33, pctypeid determines type
'=============================================================================
%>
<!--#include file="./includes/sql.asp"-->
@@ -55,15 +55,15 @@
Set cmdCheck = Nothing
' Insert new PC with minimal required fields - PHASE 2: Use machines table
' machinetypeid = 36 (PC - Standard)
' machinetypeid = 33 (PC), pctypeid = 1 (Standard)
' machinestatusid = 2 (Inventory)
' modelnumberid = 1 (default model)
' maptop = 1519, mapleft = 1896 (default map location)
' hostname = serialnumber (default)
' isactive = 1
Dim insertSQL, cmdInsert
insertSQL = "INSERT INTO machines (serialnumber, hostname, machinetypeid, machinestatusid, modelnumberid, maptop, mapleft, isactive, lastupdated) " & _
"VALUES (?, ?, 36, 2, 1, 1519, 1896, 1, NOW())"
insertSQL = "INSERT INTO machines (serialnumber, hostname, machinetypeid, pctypeid, machinestatusid, modelnumberid, maptop, mapleft, isactive, lastupdated) " & _
"VALUES (?, ?, 33, 1, 2, 1, 1519, 1896, 1, NOW())"
Set cmdInsert = Server.CreateObject("ADODB.Command")
cmdInsert.ActiveConnection = objConn
cmdInsert.CommandText = insertSQL