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>
57 lines
2.4 KiB
SQL
57 lines
2.4 KiB
SQL
-- USB Device Checkout System Schema
|
|
-- Created: 2025-12-07
|
|
--
|
|
-- This script adds:
|
|
-- 1. New machine type for USB devices (machinetypeid = 44)
|
|
-- 2. New usb_checkouts table for tracking checkout/check-in records
|
|
|
|
-- ============================================
|
|
-- 1. Add USB Device machine type
|
|
-- ============================================
|
|
INSERT INTO machinetypes (machinetypeid, machinetype, isactive)
|
|
VALUES (44, 'USB Device', 1)
|
|
ON DUPLICATE KEY UPDATE machinetype = 'USB Device', isactive = 1;
|
|
|
|
-- ============================================
|
|
-- 2. Create usb_checkouts table
|
|
-- ============================================
|
|
CREATE TABLE IF NOT EXISTS usb_checkouts (
|
|
checkoutid INT(11) NOT NULL AUTO_INCREMENT,
|
|
machineid INT(11) NOT NULL, -- FK to machines (USB device)
|
|
sso VARCHAR(20) NOT NULL, -- Who checked it out (9-digit SSO)
|
|
checkout_reason TEXT, -- Why they need it
|
|
checkout_time DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
|
checkin_time DATETIME DEFAULT NULL, -- NULL = still checked out
|
|
was_wiped TINYINT(1) DEFAULT NULL, -- 1=yes, 0=no, NULL=not checked in yet
|
|
checkin_notes TEXT, -- Notes on check-in
|
|
PRIMARY KEY (checkoutid),
|
|
KEY idx_usb_machineid (machineid),
|
|
KEY idx_usb_sso (sso),
|
|
KEY idx_usb_checkout_time (checkout_time),
|
|
KEY idx_usb_checkin_time (checkin_time),
|
|
CONSTRAINT fk_usb_checkouts_machine FOREIGN KEY (machineid)
|
|
REFERENCES machines(machineid) ON DELETE CASCADE
|
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
|
|
|
-- ============================================
|
|
-- 3. Sample USB devices for testing (optional)
|
|
-- ============================================
|
|
-- Uncomment to add test data:
|
|
-- INSERT INTO machines (machinenumber, serialnumber, alias, machinetypeid, businessunitid, isactive)
|
|
-- VALUES
|
|
-- ('USB-001', 'SN-USB-001', 'Blue 32GB', 44, 1, 1),
|
|
-- ('USB-002', 'SN-USB-002', 'Red 64GB', 44, 1, 1),
|
|
-- ('USB-003', 'SN-USB-003', 'White 16GB', 44, 1, 1);
|
|
|
|
-- ============================================
|
|
-- Verification queries
|
|
-- ============================================
|
|
-- Check machine type was added:
|
|
-- SELECT * FROM machinetypes WHERE machinetypeid = 44;
|
|
|
|
-- Check table was created:
|
|
-- DESCRIBE usb_checkouts;
|
|
|
|
-- List USB devices:
|
|
-- SELECT * FROM machines WHERE machinetypeid = 44;
|