api.asp: archive stale PC->equipment relationships on new PC self-registration

When a new PC POSTs updateCompleteAsset for a machine number, the previous
PC's "Controls" relationship to that equipment is now soft-archived
(isactive=0) before the new relationship is created. Prevents duplicate
active relationships when PCs are replaced floor-wide. Display pages
already filter on isactive=1 so archived rows just disappear from inventory
views (history preserved).

displaymachine.asp: added Controller field populated via the controllertypes
join.

displaypc.asp: fixed top-bar search bug - searching a machine number was
returning the PC row instead of the machine. Three lookup queries now scope
to pctypeid IS NOT NULL.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-27 17:10:33 -04:00
parent 0f9aebf9c6
commit c1f4412a52
3 changed files with 31 additions and 5 deletions

View File

@@ -89,12 +89,14 @@
"businessunits.businessunit, " & _
"functionalaccounts.functionalaccount, functionalaccounts.functionalaccountid, " & _
"vendors.vendor, vendors.vendorid, " & _
"controllertypes.controllertype, " & _
"printers.ipaddress AS printerip, " & _
"printers.printercsfname, printers.printerwindowsname, " & _
"machinestatus.machinestatus " & _
"FROM machines " & _
"LEFT JOIN models ON machines.modelnumberid = models.modelnumberid " & _
"LEFT JOIN machinetypes ON models.machinetypeid = machinetypes.machinetypeid " & _
"LEFT JOIN controllertypes ON machines.controllertypeid = controllertypes.controllertypeid " & _
"LEFT JOIN businessunits ON machines.businessunitid = businessunits.businessunitid " & _
"LEFT JOIN functionalaccounts ON machinetypes.functionalaccountid = functionalaccounts.functionalaccountid " & _
"LEFT JOIN vendors ON models.vendorid = vendors.vendorid " & _
@@ -191,6 +193,7 @@
<p class="mb-2"><strong>Model:</strong></p>
<p class="mb-2"><strong>Function:</strong></p>
<p class="mb-2"><strong>BU:</strong></p>
<p class="mb-2"><strong>Controller:</strong></p>
<p class="mb-2"><strong>IP Address:</strong></p>
<p class="mb-2"><strong>MAC Address:</strong></p>
<p class="mb-2"><strong>FQDN:</strong></p>
@@ -202,7 +205,7 @@
</div>
<div class="col-md-5">
<%
Dim machineNumVal, vendorValM, modelValM, machineTypeVal, buVal, statusValM
Dim machineNumVal, vendorValM, modelValM, machineTypeVal, buVal, statusValM, controllerVal
' Get values and default to N/A if empty
machineNumVal = rs("machinenumber") & ""
@@ -222,6 +225,9 @@ If machineTypeVal = "" Then machineTypeVal = "N/A"
buVal = rs("businessunit") & ""
If buVal = "" Then buVal = "N/A"
controllerVal = rs("controllertype") & ""
If controllerVal = "" Then controllerVal = "N/A"
%>
<p class="mb-2">
<%
@@ -241,6 +247,7 @@ End If
<p class="mb-2"><%=Server.HTMLEncode(modelValM)%></p>
<p class="mb-2"><%=Server.HTMLEncode(machineTypeVal)%></p>
<p class="mb-2"><%=Server.HTMLEncode(buVal)%></p>
<p class="mb-2"><%=Server.HTMLEncode(controllerVal)%></p>
<%
' Get primary communication (IP and MAC) from communications table
Dim rsPrimaryCom, strPrimaryComSQL, primaryIP, primaryMAC