Add USB checkout system and SSO profile page
New Features: - USB Device checkout/check-in system with barcode scanning - displayusb.asp: List all USB devices with status - addusb.asp: Add new USB devices via barcode scan - checkout_usb.asp/savecheckout_usb.asp: Check out USB to SSO - checkin_usb.asp/savecheckin_usb.asp: Check in with wipe confirmation - usb_history.asp: Full checkout history with filters - api_usb.asp: JSON API for AJAX lookups - displayprofile.asp: SSO profile page showing user info and USB history - Date/time format changed to 12-hour (MM/DD/YYYY h:mm AM/PM) - SSO links in USB history now link to profile page via search Database: - New machinetypeid 44 for USB devices - New usb_checkouts table for tracking checkouts Cleanup: - Removed v2 folder (duplicate/old files) - Removed old debug/test files - Removed completed migration documentation 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -6,6 +6,7 @@
|
||||
' UPDATED: 2025-10-27 - Migrated to secure patterns
|
||||
'=============================================================================
|
||||
%><!--#include file="./includes/sql.asp"-->
|
||||
<!--#include file="./includes/response.asp"-->
|
||||
<%
|
||||
' Get all form data
|
||||
Dim appname, appdescription, supportteamid
|
||||
@@ -60,32 +61,29 @@ End If
|
||||
|
||||
' Basic validation
|
||||
If Len(appname) < 1 Or Len(appname) > 50 Then
|
||||
Response.Write("Error: Application name must be 1-50 characters")
|
||||
objConn.Close
|
||||
ShowError "Application name must be 1-50 characters", "addapplication.asp"
|
||||
Response.End
|
||||
End If
|
||||
|
||||
' Validate support team is selected
|
||||
If supportteamid = "" Then
|
||||
Response.Write("<div class='alert alert-danger'>Error: Please select a support team.</div>")
|
||||
Response.Write("<a href='addapplication.asp'>Go back</a>")
|
||||
objConn.Close
|
||||
ShowError "Please select a support team.", "addapplication.asp"
|
||||
Response.End
|
||||
End If
|
||||
|
||||
' Check if we need to create a new support team first
|
||||
If supportteamid = "new" Then
|
||||
If newsupportteamname = "" Then
|
||||
Response.Write("<div class='alert alert-danger'>Error: Support team name is required.</div>")
|
||||
Response.Write("<a href='addapplication.asp'>Go back</a>")
|
||||
objConn.Close
|
||||
ShowError "Support team name is required.", "addapplication.asp"
|
||||
Response.End
|
||||
End If
|
||||
|
||||
If Len(newsupportteamname) > 50 Then
|
||||
Response.Write("<div class='alert alert-danger'>Error: Support team name too long.</div>")
|
||||
Response.Write("<a href='addapplication.asp'>Go back</a>")
|
||||
objConn.Close
|
||||
ShowError "Support team name too long.", "addapplication.asp"
|
||||
Response.End
|
||||
End If
|
||||
|
||||
@@ -101,18 +99,16 @@ If supportteamid = "new" Then
|
||||
Set rsCheck = cmdCheck.Execute
|
||||
If rsCheck.EOF Then
|
||||
rsCheck.Close
|
||||
Response.Write("<div class='alert alert-danger'>Error: Database query failed.</div>")
|
||||
Response.Write("<a href='addapplication.asp'>Go back</a>")
|
||||
objConn.Close
|
||||
ShowError "Database query failed.", "addapplication.asp"
|
||||
Response.End
|
||||
End If
|
||||
If Not IsNull(rsCheck("cnt")) Then
|
||||
If CLng(rsCheck("cnt")) > 0 Then
|
||||
rsCheck.Close
|
||||
Set cmdCheck = Nothing
|
||||
Response.Write("<div class='alert alert-danger'>Error: Support team '" & Server.HTMLEncode(newsupportteamname) & "' already exists.</div>")
|
||||
Response.Write("<a href='addapplication.asp'>Go back</a>")
|
||||
objConn.Close
|
||||
ShowError "Support team '" & Server.HTMLEncode(newsupportteamname) & "' already exists.", "addapplication.asp"
|
||||
Response.End
|
||||
End If
|
||||
End If
|
||||
@@ -126,16 +122,14 @@ If supportteamid = "new" Then
|
||||
newappownersso = Trim(Request.Form("newappownersso"))
|
||||
|
||||
If newappownername = "" Or newappownersso = "" Then
|
||||
Response.Write("<div class='alert alert-danger'>Error: App owner name and SSO are required.</div>")
|
||||
Response.Write("<a href='addapplication.asp'>Go back</a>")
|
||||
objConn.Close
|
||||
ShowError "App owner name and SSO are required.", "addapplication.asp"
|
||||
Response.End
|
||||
End If
|
||||
|
||||
If Len(newappownername) > 50 Or Len(newappownersso) > 50 Then
|
||||
Response.Write("<div class='alert alert-danger'>Error: App owner name or SSO too long.</div>")
|
||||
Response.Write("<a href='addapplication.asp'>Go back</a>")
|
||||
objConn.Close
|
||||
ShowError "App owner name or SSO too long.", "addapplication.asp"
|
||||
Response.End
|
||||
End If
|
||||
|
||||
@@ -151,18 +145,16 @@ If supportteamid = "new" Then
|
||||
Set rsCheck = cmdCheck.Execute
|
||||
If rsCheck.EOF Then
|
||||
rsCheck.Close
|
||||
Response.Write("<div class='alert alert-danger'>Error: Database query failed (app owner check).</div>")
|
||||
Response.Write("<a href='addapplication.asp'>Go back</a>")
|
||||
objConn.Close
|
||||
ShowError "Database query failed (app owner check).", "addapplication.asp"
|
||||
Response.End
|
||||
End If
|
||||
If Not IsNull(rsCheck("cnt")) Then
|
||||
If CLng(rsCheck("cnt")) > 0 Then
|
||||
rsCheck.Close
|
||||
Set cmdCheck = Nothing
|
||||
Response.Write("<div class='alert alert-danger'>Error: App owner with this name or SSO already exists.</div>")
|
||||
Response.Write("<a href='addapplication.asp'>Go back</a>")
|
||||
objConn.Close
|
||||
ShowError "App owner with this name or SSO already exists.", "addapplication.asp"
|
||||
Response.End
|
||||
End If
|
||||
End If
|
||||
@@ -183,10 +175,9 @@ If supportteamid = "new" Then
|
||||
cmdOwner.Execute
|
||||
|
||||
If Err.Number <> 0 Then
|
||||
Response.Write("<div class='alert alert-danger'>Error creating app owner: " & Server.HTMLEncode(Err.Description) & "</div>")
|
||||
Response.Write("<a href='addapplication.asp'>Go back</a>")
|
||||
Set cmdOwner = Nothing
|
||||
objConn.Close
|
||||
ShowError "Error creating app owner: " & Server.HTMLEncode(Err.Description), "addapplication.asp"
|
||||
Response.End
|
||||
End If
|
||||
Set cmdOwner = Nothing
|
||||
@@ -204,9 +195,8 @@ If supportteamid = "new" Then
|
||||
Else
|
||||
' Validate existing app owner ID
|
||||
If Not IsNumeric(newappownerid) Or CLng(newappownerid) < 1 Then
|
||||
Response.Write("<div class='alert alert-danger'>Error: Invalid app owner.</div>")
|
||||
Response.Write("<a href='addapplication.asp'>Go back</a>")
|
||||
objConn.Close
|
||||
ShowError "Invalid app owner.", "addapplication.asp"
|
||||
Response.End
|
||||
End If
|
||||
End If
|
||||
@@ -226,10 +216,9 @@ If supportteamid = "new" Then
|
||||
cmdTeam.Execute
|
||||
|
||||
If Err.Number <> 0 Then
|
||||
Response.Write("<div class='alert alert-danger'>Error creating support team: " & Server.HTMLEncode(Err.Description) & "</div>")
|
||||
Response.Write("<a href='addapplication.asp'>Go back</a>")
|
||||
Set cmdTeam = Nothing
|
||||
objConn.Close
|
||||
ShowError "Error creating support team: " & Server.HTMLEncode(Err.Description), "addapplication.asp"
|
||||
Response.End
|
||||
End If
|
||||
Set cmdTeam = Nothing
|
||||
@@ -247,9 +236,8 @@ If supportteamid = "new" Then
|
||||
Else
|
||||
' Validate existing support team ID
|
||||
If Not IsNumeric(supportteamid) Or CLng(supportteamid) < 1 Then
|
||||
Response.Write("<div class='alert alert-danger'>Error: Invalid support team ID.</div>")
|
||||
Response.Write("<a href='addapplication.asp'>Go back</a>")
|
||||
objConn.Close
|
||||
ShowError "Invalid support team ID.", "addapplication.asp"
|
||||
Response.End
|
||||
End If
|
||||
End If
|
||||
@@ -286,9 +274,9 @@ cmdApp.Parameters.Append cmdApp.CreateParameter("@islicenced", 11, 1, , CBool(is
|
||||
cmdApp.Execute
|
||||
|
||||
If Err.Number <> 0 Then
|
||||
Response.Write("Error: " & Server.HTMLEncode(Err.Description))
|
||||
Set cmdApp = Nothing
|
||||
objConn.Close
|
||||
ShowError Server.HTMLEncode(Err.Description), "addapplication.asp"
|
||||
Response.End
|
||||
End If
|
||||
|
||||
@@ -311,8 +299,8 @@ Set rsNew = Nothing
|
||||
objConn.Close
|
||||
|
||||
If newAppId > 0 Then
|
||||
Response.Redirect("displayapplication.asp?appid=" & newAppId)
|
||||
ShowSuccess "Application added successfully.", "displayapplication.asp?appid=" & newAppId, "application details"
|
||||
Else
|
||||
Response.Write("Error: Could not retrieve new application ID")
|
||||
ShowError "Could not retrieve new application ID.", "addapplication.asp"
|
||||
End If
|
||||
%>
|
||||
|
||||
Reference in New Issue
Block a user