Equipment Management
Relevant source files
The following files were used as context for generating this wiki page:
Introduction
The Equipment Management module serves as the primary inventory system for the IT Management platform. It is designed to track various IT assets, including servers, workstations, switches, and peripherals, across a multi-tenant architecture. The module handles the lifecycle of an asset from acquisition and assignment to maintenance and retirement.
Key features include asset tagging, detailed specification tracking, and photo uploads for physical verification. It integrates deeply with other modules such as IDFs for rack placement and Employees for assignment tracking.
Sources: modules/equipment/AGENT_NOTES.md:4-7, wiki/Home.md:12-14, wiki/Modules.md:38-38
System Architecture and Data Model
Equipment management is built on a standard CRUD (Create, Read, Update, Delete) pattern, but it includes specialized logic for specific equipment types (e.g., switches or firewalls). The architecture enforces strict multi-tenancy where all assets are scoped by a company_id.
Data Relationships
The equipment module relies on several lookup tables to maintain data integrity and provide standardized categorization.
The diagram above illustrates the core foreign key relationships required for an equipment record.
| Component | Description |
|---|---|
| equipment | The main table containing asset records, hostnames, and serial numbers. |
| equipment_types | Categories such as "Server", "Workstation", or "Switch", often including UI emojis for visualization. |
| equipment_statuses | Lifecycle states such as "Active", "Retired", "In Repair", or "Storage". |
| manufacturers | Reference table for hardware vendors. |
| employees | Links to the assigned_to_employee_id field for tracking responsibility. |
Sources: modules/equipment/AGENT_NOTES.md:10-15, modules/equipment_types/AGENT_NOTES.md:4-10, modules/equipment_statuses/AGENT_NOTES.md:4-10
Core Business Rules
To maintain system stability and data accuracy, the following rules are enforced:
- Multi-Tenancy: All queries must filter by
company_idto prevent data leaks between tenants. - Uniqueness: Each item should ideally have a unique serial or asset number within the company scope.
- Relationship Protection: Deletion of equipment is restricted if it is linked to active switch port assignments or open support tickets.
- Synchronization: Equipment records must stay aligned with IDF Synchronization rules. If an asset is moved in a rack, the
idf_idin the equipment table must be updated via transaction.
Sources: modules/equipment/AGENT_NOTES.md:18-21, modules/equipment/AGENT_NOTES.md:33-35, wiki/IDF-Synchronization.md:9-11
Implementation Details
Standard Operations
The module follows a flat file structure for its operations.
index.php: Provides the list view with search, sort, and filtering capabilities.delete_functions.php: Contains logic for handling record removal and dependency checks.is_access_point/index.php&is_firewall/index.php: These act as "façade" modules that wrap the main equipment logic but apply pre-defined filters for specific types.
Sources: modules/equipment/AGENT_NOTES.md:29-31, modules/is_access_point/AGENT_NOTES.md:4-15, modules/is_firewall/AGENT_NOTES.md:4-15
API Integration
The system exposes JSON endpoints for bulk operations. The import_excel_rows action allows for the mass ingestion of asset data.
Flow of bulk data import via the JSON API.
Sources: scripts/api.php:123-134, modules/equipment/AGENT_NOTES.md:26-27
Safe Query Patterns
As a security requirement, all database interactions must use prepared statements to prevent SQL injection.
// Example of a safe SELECT for equipment
$stmt = $conn->prepare("SELECT * FROM equipment WHERE company_id = ? AND asset_number = ?");
$stmt->bind_param("is", $companyId, $assetNumber);
$stmt->execute();
Sources: modules/equipment/AGENT_NOTES.md:41-45
Conclusion
Equipment Management is the foundational module of the IT Management system. By enforcing strict multi-tenant scoping and maintaining synchronized relationships with IDFs and personnel, it provides a reliable single source of truth for all IT hardware assets. Its architecture allows for specialized views (Firewalls, Access Points) while maintaining a unified data structure.