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:
@@ -7,15 +7,17 @@
|
||||
'=============================================================================
|
||||
%>
|
||||
<!--#include file="./includes/sql.asp"-->
|
||||
<!--#include file="./includes/response.asp"-->
|
||||
<%
|
||||
' Get form inputs
|
||||
Dim notification, ticketnumber, starttime, endtime, isactive, isshopfloor, notificationtypeid, businessunitid
|
||||
Dim notification, ticketnumber, starttime, endtime, isactive, isshopfloor, notificationtypeid, businessunitid, appid
|
||||
notification = Trim(Request.Form("notification"))
|
||||
ticketnumber = Trim(Request.Form("ticketnumber"))
|
||||
starttime = Trim(Request.Form("starttime"))
|
||||
endtime = Trim(Request.Form("endtime"))
|
||||
notificationtypeid = Trim(Request.Form("notificationtypeid"))
|
||||
businessunitid = Trim(Request.Form("businessunitid"))
|
||||
appid = Trim(Request.Form("appid"))
|
||||
|
||||
' Checkboxes - ensure they are always integers 0 or 1
|
||||
If Request.Form("isactive") = "1" Then
|
||||
@@ -37,14 +39,14 @@ End If
|
||||
|
||||
' Validate required fields (endtime is now optional)
|
||||
If Len(notification) = 0 Or Len(starttime) = 0 Then
|
||||
Response.Write("Required fields missing")
|
||||
objConn.Close
|
||||
ShowError "Required fields missing.", "addnotification.asp"
|
||||
Response.End
|
||||
End If
|
||||
|
||||
If Len(notification) > 500 Or Len(ticketnumber) > 50 Then
|
||||
Response.Write("Field length exceeded")
|
||||
objConn.Close
|
||||
ShowError "Field length exceeded.", "addnotification.asp"
|
||||
Response.End
|
||||
End If
|
||||
|
||||
@@ -69,10 +71,18 @@ Else
|
||||
businessunitValue = CLng(businessunitid)
|
||||
End If
|
||||
|
||||
' Handle optional appid - NULL means not linked to an application
|
||||
Dim appidValue
|
||||
If appid = "" Or Not IsNumeric(appid) Then
|
||||
appidValue = Null
|
||||
Else
|
||||
appidValue = CLng(appid)
|
||||
End If
|
||||
|
||||
' INSERT using parameterized query
|
||||
Dim strSQL, cmdInsert
|
||||
strSQL = "INSERT INTO notifications (notificationtypeid, businessunitid, notification, ticketnumber, starttime, endtime, isactive, isshopfloor) " & _
|
||||
"VALUES (?, ?, ?, ?, ?, ?, ?, ?)"
|
||||
strSQL = "INSERT INTO notifications (notificationtypeid, businessunitid, appid, notification, ticketnumber, starttime, endtime, isactive, isshopfloor) " & _
|
||||
"VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)"
|
||||
Set cmdInsert = Server.CreateObject("ADODB.Command")
|
||||
cmdInsert.ActiveConnection = objConn
|
||||
cmdInsert.CommandText = strSQL
|
||||
@@ -83,6 +93,11 @@ If IsNull(businessunitValue) Then
|
||||
Else
|
||||
cmdInsert.Parameters.Append cmdInsert.CreateParameter("@businessunitid", 3, 1, , businessunitValue)
|
||||
End If
|
||||
If IsNull(appidValue) Then
|
||||
cmdInsert.Parameters.Append cmdInsert.CreateParameter("@appid", 2, 1, , Null)
|
||||
Else
|
||||
cmdInsert.Parameters.Append cmdInsert.CreateParameter("@appid", 2, 1, , appidValue)
|
||||
End If
|
||||
cmdInsert.Parameters.Append cmdInsert.CreateParameter("@notification", 200, 1, 500, notification)
|
||||
cmdInsert.Parameters.Append cmdInsert.CreateParameter("@ticketnumber", 200, 1, 50, ticketnumber)
|
||||
cmdInsert.Parameters.Append cmdInsert.CreateParameter("@starttime", 135, 1, , starttime)
|
||||
@@ -100,10 +115,12 @@ cmdInsert.Execute
|
||||
If Err.Number = 0 Then
|
||||
Set cmdInsert = Nothing
|
||||
objConn.Close
|
||||
Response.Redirect("displaynotifications.asp")
|
||||
ShowSuccess "Notification created successfully.", "displaynotifications.asp", "notifications"
|
||||
Else
|
||||
Response.Write("Error: " & Server.HTMLEncode(Err.Description))
|
||||
Dim insertErr
|
||||
insertErr = Err.Description
|
||||
Set cmdInsert = Nothing
|
||||
objConn.Close
|
||||
ShowError "Error: " & Server.HTMLEncode(insertErr), "addnotification.asp"
|
||||
End If
|
||||
%>
|
||||
|
||||
Reference in New Issue
Block a user