Remove category grouping from machine type dropdowns

Simplified machine type dropdowns to flat list without category
grouping. This removes dependency on the 'category' column in
machinetypes table which may not exist on all environments.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
cproudlock
2026-01-22 16:24:07 -05:00
parent 12a35ed7e0
commit 1b7946900c
7 changed files with 12 additions and 99 deletions

View File

@@ -167,20 +167,13 @@
<select class="form-control" id="newmodelmachinetypeid" name="newmodelmachinetypeid">
<option value="">-- Select Machine Type --</option>
<%
Dim rsMachineTypes, lastCat
strSQL = "SELECT machinetypeid, machinetype, category FROM machinetypes WHERE isactive = 1 ORDER BY category, machinetype ASC"
Dim rsMachineTypes
strSQL = "SELECT machinetypeid, machinetype FROM machinetypes WHERE isactive = 1 ORDER BY machinetype ASC"
Set rsMachineTypes = objconn.Execute(strSQL)
lastCat = ""
While Not rsMachineTypes.EOF
If rsMachineTypes("category") <> lastCat Then
If lastCat <> "" Then Response.Write("</optgroup>")
Response.Write("<optgroup label='" & Server.HTMLEncode(rsMachineTypes("category")) & "'>")
lastCat = rsMachineTypes("category")
End If
Response.Write("<option value='" & rsMachineTypes("machinetypeid") & "'>" & Server.HTMLEncode(rsMachineTypes("machinetype")) & "</option>")
rsMachineTypes.MoveNext
Wend
If lastCat <> "" Then Response.Write("</optgroup>")
rsMachineTypes.Close
Set rsMachineTypes = Nothing
%>

View File

@@ -240,20 +240,13 @@
<select class="form-control" id="newmodelmachinetypeid" name="newmodelmachinetypeid">
<option value="">-- Select Machine Type --</option>
<%
Dim rsMachineTypes, lastCat
strSQL3 = "SELECT machinetypeid, machinetype, category FROM machinetypes WHERE isactive = 1 ORDER BY category, machinetype ASC"
Dim rsMachineTypes
strSQL3 = "SELECT machinetypeid, machinetype FROM machinetypes WHERE isactive = 1 ORDER BY machinetype ASC"
Set rsMachineTypes = objConn.Execute(strSQL3)
lastCat = ""
While Not rsMachineTypes.EOF
If rsMachineTypes("category") <> lastCat Then
If lastCat <> "" Then Response.Write("</optgroup>")
Response.Write("<optgroup label='" & Server.HTMLEncode(rsMachineTypes("category")) & "'>")
lastCat = rsMachineTypes("category")
End If
Response.Write("<option value='" & rsMachineTypes("machinetypeid") & "'>" & Server.HTMLEncode(rsMachineTypes("machinetype")) & "</option>")
rsMachineTypes.MoveNext
Wend
If lastCat <> "" Then Response.Write("</optgroup>")
rsMachineTypes.Close
Set rsMachineTypes = Nothing
%>
@@ -275,13 +268,6 @@
<input type="text" class="form-control" id="newmachinetypename" name="newmachinetypename"
maxlength="50" placeholder="e.g., Firewall, Router, UPS">
</div>
<div class="form-group">
<label for="newmachinetypecategory">Category</label>
<select class="form-control" id="newmachinetypecategory" name="newmachinetypecategory">
<option value="Equipment">Equipment</option>
<option value="Network" selected>Network Device</option>
</select>
</div>
<button type="button" class="btn btn-sm btn-secondary" id="cancelNewMachineType">
<i class="zmdi zmdi-close"></i> Cancel
</button>

View File

@@ -331,20 +331,13 @@
<select class="form-control" id="newmodelmachinetypeid" name="newmodelmachinetypeid">
<option value="">-- Select Machine Type --</option>
<%
Dim rsMachineTypes, lastCat
strSQL2 = "SELECT machinetypeid, machinetype, category FROM machinetypes WHERE isactive = 1 ORDER BY category, machinetype ASC"
Dim rsMachineTypes
strSQL2 = "SELECT machinetypeid, machinetype FROM machinetypes WHERE isactive = 1 ORDER BY machinetype ASC"
Set rsMachineTypes = objConn.Execute(strSQL2)
lastCat = ""
While Not rsMachineTypes.EOF
If rsMachineTypes("category") <> lastCat Then
If lastCat <> "" Then Response.Write("</optgroup>")
Response.Write("<optgroup label='" & Server.HTMLEncode(rsMachineTypes("category")) & "'>")
lastCat = rsMachineTypes("category")
End If
Response.Write("<option value='" & rsMachineTypes("machinetypeid") & "'>" & Server.HTMLEncode(rsMachineTypes("machinetype")) & "</option>")
rsMachineTypes.MoveNext
Wend
If lastCat <> "" Then Response.Write("</optgroup>")
rsMachineTypes.Close
Set rsMachineTypes = Nothing
%>
@@ -366,13 +359,6 @@
<input type="text" class="form-control" id="newmachinetypename" name="newmachinetypename"
maxlength="50" placeholder="e.g., Firewall, Router, UPS">
</div>
<div class="form-group">
<label for="newmachinetypecategory">Category</label>
<select class="form-control" id="newmachinetypecategory" name="newmachinetypecategory">
<option value="Equipment">Equipment</option>
<option value="Network" selected>Network Device</option>
</select>
</div>
<button type="button" class="btn btn-sm btn-secondary" id="cancelNewMachineType">
<i class="zmdi zmdi-close"></i> Cancel
</button>

View File

@@ -237,20 +237,12 @@
<option value="">-- Select Machine Type --</option>
<%
Dim rsMachineTypes
strSQL2 = "SELECT machinetypeid, machinetype, category FROM machinetypes WHERE isactive = 1 ORDER BY category, machinetype ASC"
strSQL2 = "SELECT machinetypeid, machinetype FROM machinetypes WHERE isactive = 1 ORDER BY machinetype ASC"
Set rsMachineTypes = objConn.Execute(strSQL2)
Dim lastCat
lastCat = ""
While Not rsMachineTypes.EOF
If rsMachineTypes("category") <> lastCat Then
If lastCat <> "" Then Response.Write("</optgroup>")
Response.Write("<optgroup label='" & Server.HTMLEncode(rsMachineTypes("category")) & "'>")
lastCat = rsMachineTypes("category")
End If
Response.Write("<option value='" & rsMachineTypes("machinetypeid") & "'>" & Server.HTMLEncode(rsMachineTypes("machinetype")) & "</option>")
rsMachineTypes.MoveNext
Wend
If lastCat <> "" Then Response.Write("</optgroup>")
rsMachineTypes.Close
Set rsMachineTypes = Nothing
%>
@@ -274,14 +266,6 @@
maxlength="50" placeholder="e.g., Firewall, Router, UPS">
</div>
<div class="form-group">
<label for="newmachinetypecategory">Category</label>
<select class="form-control" id="newmachinetypecategory" name="newmachinetypecategory">
<option value="Equipment">Equipment</option>
<option value="Network" selected>Network Device</option>
</select>
</div>
<button type="button" class="btn btn-sm btn-secondary" id="cancelNewMachineType">
<i class="zmdi zmdi-close"></i> Cancel
</button>

View File

@@ -237,20 +237,13 @@
<select class="form-control" id="newmodelmachinetypeid" name="newmodelmachinetypeid">
<option value="">-- Select Machine Type --</option>
<%
Dim rsMachineTypes, lastCat
strSQL3 = "SELECT machinetypeid, machinetype, category FROM machinetypes WHERE isactive = 1 ORDER BY category, machinetype ASC"
Dim rsMachineTypes
strSQL3 = "SELECT machinetypeid, machinetype FROM machinetypes WHERE isactive = 1 ORDER BY machinetype ASC"
Set rsMachineTypes = objConn.Execute(strSQL3)
lastCat = ""
While Not rsMachineTypes.EOF
If rsMachineTypes("category") <> lastCat Then
If lastCat <> "" Then Response.Write("</optgroup>")
Response.Write("<optgroup label='" & Server.HTMLEncode(rsMachineTypes("category")) & "'>")
lastCat = rsMachineTypes("category")
End If
Response.Write("<option value='" & rsMachineTypes("machinetypeid") & "'>" & Server.HTMLEncode(rsMachineTypes("machinetype")) & "</option>")
rsMachineTypes.MoveNext
Wend
If lastCat <> "" Then Response.Write("</optgroup>")
rsMachineTypes.Close
Set rsMachineTypes = Nothing
%>
@@ -272,13 +265,6 @@
<input type="text" class="form-control" id="newmachinetypename" name="newmachinetypename"
maxlength="50" placeholder="e.g., Firewall, Router, UPS">
</div>
<div class="form-group">
<label for="newmachinetypecategory">Category</label>
<select class="form-control" id="newmachinetypecategory" name="newmachinetypecategory">
<option value="Equipment">Equipment</option>
<option value="Network" selected>Network Device</option>
</select>
</div>
<button type="button" class="btn btn-sm btn-secondary" id="cancelNewMachineType">
<i class="zmdi zmdi-close"></i> Cancel
</button>

View File

@@ -237,20 +237,12 @@
<option value="">-- Select Machine Type --</option>
<%
Dim rsMachineTypes
strSQL2 = "SELECT machinetypeid, machinetype, category FROM machinetypes WHERE isactive = 1 ORDER BY category, machinetype ASC"
strSQL2 = "SELECT machinetypeid, machinetype FROM machinetypes WHERE isactive = 1 ORDER BY machinetype ASC"
Set rsMachineTypes = objConn.Execute(strSQL2)
Dim lastCat
lastCat = ""
While Not rsMachineTypes.EOF
If rsMachineTypes("category") <> lastCat Then
If lastCat <> "" Then Response.Write("</optgroup>")
Response.Write("<optgroup label='" & Server.HTMLEncode(rsMachineTypes("category")) & "'>")
lastCat = rsMachineTypes("category")
End If
Response.Write("<option value='" & rsMachineTypes("machinetypeid") & "'>" & Server.HTMLEncode(rsMachineTypes("machinetype")) & "</option>")
rsMachineTypes.MoveNext
Wend
If lastCat <> "" Then Response.Write("</optgroup>")
rsMachineTypes.Close
Set rsMachineTypes = Nothing
%>
@@ -274,14 +266,6 @@
maxlength="50" placeholder="e.g., Firewall, Router, UPS">
</div>
<div class="form-group">
<label for="newmachinetypecategory">Category</label>
<select class="form-control" id="newmachinetypecategory" name="newmachinetypecategory">
<option value="Equipment">Equipment</option>
<option value="Network" selected>Network Device</option>
</select>
</div>
<button type="button" class="btn btn-sm btn-secondary" id="cancelNewMachineType">
<i class="zmdi zmdi-close"></i> Cancel
</button>

View File

@@ -199,9 +199,8 @@ If modelid = "new" Then
' Handle new machine type creation (nested)
If newmodelmachinetypeid = "new" Then
Dim newmachinetypename, newmachinetypecategory
Dim newmachinetypename
newmachinetypename = Trim(Request.Form("newmachinetypename"))
newmachinetypecategory = Trim(Request.Form("newmachinetypecategory"))
If newmachinetypename = "" Then
objConn.Close
@@ -209,19 +208,14 @@ If modelid = "new" Then
Response.End
End If
If newmachinetypecategory = "" Then
newmachinetypecategory = "Equipment"
End If
' Insert new machine type using parameterized query
Dim sqlNewMT, cmdNewMT
sqlNewMT = "INSERT INTO machinetypes (machinetype, category, isactive) VALUES (?, ?, 1)"
sqlNewMT = "INSERT INTO machinetypes (machinetype, isactive) VALUES (?, 1)"
Set cmdNewMT = Server.CreateObject("ADODB.Command")
cmdNewMT.ActiveConnection = objConn
cmdNewMT.CommandText = sqlNewMT
cmdNewMT.CommandType = 1
cmdNewMT.Parameters.Append cmdNewMT.CreateParameter("@machinetype", 200, 1, 50, newmachinetypename)
cmdNewMT.Parameters.Append cmdNewMT.CreateParameter("@category", 200, 1, 50, newmachinetypecategory)
On Error Resume Next
cmdNewMT.Execute