From a52dd2e9320d39ad5b33576e62b4d8b6b9f676c4 Mon Sep 17 00:00:00 2001 From: cproudlock Date: Mon, 8 Dec 2025 16:25:16 -0500 Subject: [PATCH] Fix SQL syntax error and add CMM equipment filtering MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 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 --- computers.asp | 2 +- displaypcs.asp | 2 +- editdevice.asp | 13 ++++++++++--- listpcs.asp | 2 +- pclist.asp | 2 +- pcs.asp | 2 +- 6 files changed, 15 insertions(+), 8 deletions(-) diff --git a/computers.asp b/computers.asp index a7c7a58..708ca31 100644 --- a/computers.asp +++ b/computers.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%') " 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) while not rs.eof diff --git a/displaypcs.asp b/displaypcs.asp index d16ef73..2f7a862 100644 --- a/displaypcs.asp +++ b/displaypcs.asp @@ -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) " 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) while not rs.eof diff --git a/editdevice.asp b/editdevice.asp index ba0ce9c..6125ba4 100644 --- a/editdevice.asp +++ b/editdevice.asp @@ -54,7 +54,7 @@ End If ' 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") & "" hostname = "" : If NOT IsNull(rsMachine("hostname")) Then hostname = rsMachine("hostname") & "" machinenumber = "" : If NOT IsNull(rsMachine("machinenumber")) Then machinenumber = rsMachine("machinenumber") & "" @@ -64,6 +64,7 @@ machinenotes = "" : If NOT IsNull(rsMachine("machinenotes")) Then machinenotes = rsMachine("machinenotes") & "" mapleft = "" : If NOT IsNull(rsMachine("mapleft")) Then mapleft = rsMachine("mapleft") maptop = "" : If NOT IsNull(rsMachine("maptop")) Then maptop = rsMachine("maptop") + currentPctypeid = "" : If NOT IsNull(rsMachine("pctypeid")) Then currentPctypeid = rsMachine("pctypeid") rsMachine.Close Set rsMachine = Nothing @@ -566,8 +567,14 @@