Fix SQL syntax error and add CMM equipment filtering
- Fix missing space before GROUP BY in PC list pages (displaypcs, computers, listpcs, pclist, pcs) - Add pctypeid-based equipment filtering in editdevice.asp (CMM PCs only see CMM equipment) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -156,7 +156,7 @@ Set rsStatus = Nothing
|
|||||||
whereClause = whereClause & "AND (models.modelnumber LIKE '%OptiPlex%' OR models.modelnumber LIKE '%Tower%' OR models.modelnumber LIKE '%Micro%') "
|
whereClause = whereClause & "AND (models.modelnumber LIKE '%OptiPlex%' OR models.modelnumber LIKE '%Tower%' OR models.modelnumber LIKE '%Micro%') "
|
||||||
End If
|
End If
|
||||||
|
|
||||||
strSQL = strSQL & whereClause & "GROUP BY m.machineid ORDER BY m.machinenumber ASC, m.hostname ASC"
|
strSQL = strSQL & whereClause & " GROUP BY m.machineid ORDER BY m.machinenumber ASC, m.hostname ASC"
|
||||||
|
|
||||||
set rs = objconn.Execute(strSQL)
|
set rs = objconn.Execute(strSQL)
|
||||||
while not rs.eof
|
while not rs.eof
|
||||||
|
|||||||
@@ -166,7 +166,7 @@ Set rsStatus = Nothing
|
|||||||
"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) "
|
"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
|
End If
|
||||||
|
|
||||||
strSQL = strSQL & whereClause & "GROUP BY m.machineid ORDER BY m.machinenumber ASC, m.hostname ASC"
|
strSQL = strSQL & whereClause & " GROUP BY m.machineid ORDER BY m.machinenumber ASC, m.hostname ASC"
|
||||||
|
|
||||||
set rs = objconn.Execute(strSQL)
|
set rs = objconn.Execute(strSQL)
|
||||||
while not rs.eof
|
while not rs.eof
|
||||||
|
|||||||
@@ -54,7 +54,7 @@
|
|||||||
End If
|
End If
|
||||||
|
|
||||||
' Store machine data
|
' Store machine data
|
||||||
Dim serialnumber, hostname, machinenumber, modelid, businessunitid, alias, machinenotes, mapleft, maptop
|
Dim serialnumber, hostname, machinenumber, modelid, businessunitid, alias, machinenotes, mapleft, maptop, currentPctypeid
|
||||||
serialnumber = "" : If NOT IsNull(rsMachine("serialnumber")) Then serialnumber = rsMachine("serialnumber") & ""
|
serialnumber = "" : If NOT IsNull(rsMachine("serialnumber")) Then serialnumber = rsMachine("serialnumber") & ""
|
||||||
hostname = "" : If NOT IsNull(rsMachine("hostname")) Then hostname = rsMachine("hostname") & ""
|
hostname = "" : If NOT IsNull(rsMachine("hostname")) Then hostname = rsMachine("hostname") & ""
|
||||||
machinenumber = "" : If NOT IsNull(rsMachine("machinenumber")) Then machinenumber = rsMachine("machinenumber") & ""
|
machinenumber = "" : If NOT IsNull(rsMachine("machinenumber")) Then machinenumber = rsMachine("machinenumber") & ""
|
||||||
@@ -64,6 +64,7 @@
|
|||||||
machinenotes = "" : If NOT IsNull(rsMachine("machinenotes")) Then machinenotes = rsMachine("machinenotes") & ""
|
machinenotes = "" : If NOT IsNull(rsMachine("machinenotes")) Then machinenotes = rsMachine("machinenotes") & ""
|
||||||
mapleft = "" : If NOT IsNull(rsMachine("mapleft")) Then mapleft = rsMachine("mapleft")
|
mapleft = "" : If NOT IsNull(rsMachine("mapleft")) Then mapleft = rsMachine("mapleft")
|
||||||
maptop = "" : If NOT IsNull(rsMachine("maptop")) Then maptop = rsMachine("maptop")
|
maptop = "" : If NOT IsNull(rsMachine("maptop")) Then maptop = rsMachine("maptop")
|
||||||
|
currentPctypeid = "" : If NOT IsNull(rsMachine("pctypeid")) Then currentPctypeid = rsMachine("pctypeid")
|
||||||
|
|
||||||
rsMachine.Close
|
rsMachine.Close
|
||||||
Set rsMachine = Nothing
|
Set rsMachine = Nothing
|
||||||
@@ -566,8 +567,14 @@
|
|||||||
<select class="form-control" id="controllingpc" name="controllingpc">
|
<select class="form-control" id="controllingpc" name="controllingpc">
|
||||||
<option value="">-- None --</option>
|
<option value="">-- None --</option>
|
||||||
<%
|
<%
|
||||||
Dim rsControlPCs
|
Dim rsControlPCs, equipmentFilter
|
||||||
strSQL = "SELECT machineid, machinenumber, alias FROM machines WHERE pctypeid IS NULL AND isactive = 1 ORDER BY machinenumber ASC"
|
' Filter equipment dropdown based on PC type
|
||||||
|
' CMM PCs (pctypeid 5) should only see CMM equipment (machinetypeid 3)
|
||||||
|
equipmentFilter = ""
|
||||||
|
If currentPctypeid = 5 Then
|
||||||
|
equipmentFilter = " AND machinetypeid = 3"
|
||||||
|
End If
|
||||||
|
strSQL = "SELECT machineid, machinenumber, alias FROM machines WHERE pctypeid IS NULL AND isactive = 1" & equipmentFilter & " ORDER BY machinenumber ASC"
|
||||||
Set rsControlPCs = objconn.Execute(strSQL)
|
Set rsControlPCs = objconn.Execute(strSQL)
|
||||||
While Not rsControlPCs.EOF
|
While Not rsControlPCs.EOF
|
||||||
Dim controlPCDisplay, selectedControlPC
|
Dim controlPCDisplay, selectedControlPC
|
||||||
|
|||||||
@@ -156,7 +156,7 @@ Set rsStatus = Nothing
|
|||||||
whereClause = whereClause & "AND (models.modelnumber LIKE '%OptiPlex%' OR models.modelnumber LIKE '%Tower%' OR models.modelnumber LIKE '%Micro%') "
|
whereClause = whereClause & "AND (models.modelnumber LIKE '%OptiPlex%' OR models.modelnumber LIKE '%Tower%' OR models.modelnumber LIKE '%Micro%') "
|
||||||
End If
|
End If
|
||||||
|
|
||||||
strSQL = strSQL & whereClause & "GROUP BY m.machineid ORDER BY m.machinenumber ASC, m.hostname ASC"
|
strSQL = strSQL & whereClause & " GROUP BY m.machineid ORDER BY m.machinenumber ASC, m.hostname ASC"
|
||||||
|
|
||||||
set rs = objconn.Execute(strSQL)
|
set rs = objconn.Execute(strSQL)
|
||||||
while not rs.eof
|
while not rs.eof
|
||||||
|
|||||||
@@ -156,7 +156,7 @@ Set rsStatus = Nothing
|
|||||||
whereClause = whereClause & "AND (models.modelnumber LIKE '%OptiPlex%' OR models.modelnumber LIKE '%Tower%' OR models.modelnumber LIKE '%Micro%') "
|
whereClause = whereClause & "AND (models.modelnumber LIKE '%OptiPlex%' OR models.modelnumber LIKE '%Tower%' OR models.modelnumber LIKE '%Micro%') "
|
||||||
End If
|
End If
|
||||||
|
|
||||||
strSQL = strSQL & whereClause & "GROUP BY m.machineid ORDER BY m.machinenumber ASC, m.hostname ASC"
|
strSQL = strSQL & whereClause & " GROUP BY m.machineid ORDER BY m.machinenumber ASC, m.hostname ASC"
|
||||||
|
|
||||||
set rs = objconn.Execute(strSQL)
|
set rs = objconn.Execute(strSQL)
|
||||||
while not rs.eof
|
while not rs.eof
|
||||||
|
|||||||
2
pcs.asp
2
pcs.asp
@@ -156,7 +156,7 @@ Set rsStatus = Nothing
|
|||||||
whereClause = whereClause & "AND (models.modelnumber LIKE '%OptiPlex%' OR models.modelnumber LIKE '%Tower%' OR models.modelnumber LIKE '%Micro%') "
|
whereClause = whereClause & "AND (models.modelnumber LIKE '%OptiPlex%' OR models.modelnumber LIKE '%Tower%' OR models.modelnumber LIKE '%Micro%') "
|
||||||
End If
|
End If
|
||||||
|
|
||||||
strSQL = strSQL & whereClause & "GROUP BY m.machineid ORDER BY m.machinenumber ASC, m.hostname ASC"
|
strSQL = strSQL & whereClause & " GROUP BY m.machineid ORDER BY m.machinenumber ASC, m.hostname ASC"
|
||||||
|
|
||||||
set rs = objconn.Execute(strSQL)
|
set rs = objconn.Execute(strSQL)
|
||||||
while not rs.eof
|
while not rs.eof
|
||||||
|
|||||||
Reference in New Issue
Block a user