Fix multi-printer selection bug in printer installer map

Removed VBScript Dim statements from inside while loop which caused
re-declaration errors on subsequent iterations. Now uses standardized
printer names directly from database instead of generating them.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
cproudlock
2025-12-08 13:06:17 -05:00
parent 1e97522831
commit 97683e9b1a

View File

@@ -241,57 +241,8 @@ var selectedPrinters = {};
image = "Versalink-C7125.png" image = "Versalink-C7125.png"
end if end if
' Generate standardized printer name using same logic as api_printers.asp ' Use standardized name from database (no need to generate - names are now standardized)
Dim cleanMachine, cleanModel, shortDescription, standardName printerwindowsname = rs("printerwindowsname") & ""
cleanMachine = Replace(machineName, " ", "")
cleanMachine = Replace(cleanMachine, "Machine", "")
cleanModel = Replace(modelnumber, " ", "")
' Extract short description from model number
If InStr(cleanModel, "ColorLaserJet") > 0 Then
shortDescription = "ColorLaserJet"
ElseIf InStr(cleanModel, "LaserJetPro") > 0 Then
shortDescription = "LaserJetPro"
ElseIf InStr(cleanModel, "LaserJet") > 0 Then
shortDescription = "LaserJet"
ElseIf InStr(cleanModel, "Altalink") > 0 Then
shortDescription = "Altalink"
ElseIf InStr(cleanModel, "Versalink") > 0 Then
shortDescription = "Versalink"
ElseIf InStr(cleanModel, "DesignJet") > 0 Then
shortDescription = "DesignJet"
Else
' Extract model prefix before numbers
Dim i, char
shortDescription = ""
For i = 1 To Len(cleanModel)
char = Mid(cleanModel, i, 1)
If char >= "0" And char <= "9" Then
Exit For
End If
shortDescription = shortDescription & char
Next
If shortDescription = "" Then
shortDescription = cleanModel
End If
End If
' Build standard name: CSFName-Location-VendorModel (no dash between vendor and model)
If printercsfname <> "" And printercsfname <> "NONE" And printercsfname <> "gage lab " Then
If cleanMachine <> "" Then
standardName = printercsfname & "-" & cleanMachine & "-" & vendor & shortDescription
Else
standardName = printercsfname & "-" & vendor & shortDescription
End If
Else
If cleanMachine <> "" Then
standardName = cleanMachine & "-" & vendor & shortDescription
Else
standardName = "Printer" & printerid & "-" & vendor & shortDescription
End If
End If
printerwindowsname = standardName
%> %>
(function() { (function() {
var printerId = '<%Response.Write(printerid)%>'; var printerId = '<%Response.Write(printerid)%>';