From a33f98ffa5b2882d918c2432a41d967acea103c2 Mon Sep 17 00:00:00 2001 From: johnnyq Date: Wed, 14 Oct 2026 21:31:30 -0400 Subject: [PATCH] Licenses: rebuilt the license list with Renewing soon, Expired, Over seats and No seats assigned tabs, a seat bar (used against bought, red when over) and colour-coded renewal on each row, license type and renewal filters, optional key, purchase and order reference columns, search by vendor, order reference and individual keys, and bulk Renew, Archive, Restore and Delete; new license page (license.php) with renewal and over-seats status in the header, License and Vendor cards (key, order ref, purchase date, vendor account number, phone, email, website, hours, SLA, all copyable), notes that save on blur, and tabs for Seats (each device and user with the key they were given), Keys, Credentials, Documents, Files and History from the audit log; new license quick look used everywhere a license is shown; New and Edit share one tabbed form (Details, License, Seats, Notes) with device and user pickers, a live seat counter, renewal shortcuts and a template picker that replaces the separate Create from Template modal; Renew modal for one license or a bulk selection that moves the renewal date by a term or to a set date, previews the new date for each license and records a new order reference; Manage Seats modal; individual keys pasted one per line and handed out to devices and users, which gives them a seat, with the key returned to the pool when they come off the license; Renewal Ticket opens New Ticket with the subject and details filled in; New Document and Upload from a license link the result to it; devices, users, credentials and files now link to licenses through the shared link modal, which shows the seats left on each license and offers every license type, not just Device; the asset and contact pages and quick looks list licenses with their seats, renewal and the key to install, and get New License; the client overview gets a Licenses over seats card under Needs attention, starred licenses under Favorites and renewals that open the license page; global search finds licenses by name, vendor, order reference or key; the vendor quick look lists that vendor's licenses; the dashboard card opens the Renewing tab; the export gains seats used, individual keys, vendor, order reference and client columns; admin license templates share the license type list and show type icons. Uses the existing software_keys, key assignment, software_credentials and software_files tables. Fixes editing a Subscription or Open Source license clearing its license type, archiving a license removing all of its seats (seats are now kept, matching the API), license forms and seat handlers accepting another client's assets, contacts or vendor, a 500 on duplicate seat links and on forms missing fields, and an extra query per row in the export; license deletes now respect the destructive deletes setting. No DB change --- .../software_template_add.php | 13 +- .../software_template_edit.php | 16 +- admin/software_templates.php | 14 +- agent/ajax.php | 25 + agent/asset.php | 84 +-- agent/client_overview.php | 15 +- agent/contact.php | 77 +- agent/license.php | 692 ++++++++++++++++++ agent/modals/asset/asset.php | 25 +- agent/modals/asset/asset_link_software.php | 77 +- agent/modals/contact/contact.php | 25 +- .../modals/contact/contact_link_software.php | 74 +- agent/modals/document/document_add.php | 9 +- agent/modals/file/file_upload.php | 9 +- agent/modals/link/link.php | 12 +- agent/modals/software/software.php | 318 ++++++++ agent/modals/software/software_add.php | 307 +------- .../software/software_add_from_template.php | 77 +- agent/modals/software/software_edit.php | 310 +------- agent/modals/software/software_export.php | 35 +- agent/modals/software/software_form.php | 417 +++++++++++ agent/modals/software/software_key_add.php | 44 ++ agent/modals/software/software_key_edit.php | 110 +++ agent/modals/software/software_renew.php | 145 ++++ agent/modals/software/software_seats.php | 124 ++++ agent/modals/ticket/ticket_add.php | 10 +- agent/modals/vendor/vendor.php | 31 +- agent/post/asset.php | 60 +- agent/post/contact.php | 60 +- agent/post/document.php | 11 +- agent/post/file.php | 7 +- agent/post/link.php | 18 +- agent/post/software.php | 567 +++++++++----- agent/software.php | 620 ++++++++++------ css/itflow_custom.css | 69 ++ functions.php | 1 + functions/client_overview.php | 26 +- functions/dashboard.php | 2 +- functions/export.php | 7 +- functions/links.php | 60 +- functions/search.php | 26 + functions/software.php | 609 +++++++++++++++ 42 files changed, 3711 insertions(+), 1527 deletions(-) create mode 100644 agent/license.php create mode 100644 agent/modals/software/software.php create mode 100644 agent/modals/software/software_form.php create mode 100644 agent/modals/software/software_key_add.php create mode 100644 agent/modals/software/software_key_edit.php create mode 100644 agent/modals/software/software_renew.php create mode 100644 agent/modals/software/software_seats.php create mode 100644 functions/software.php diff --git a/admin/modals/software_template/software_template_add.php b/admin/modals/software_template/software_template_add.php index 9b9492713..485a3f7eb 100644 --- a/admin/modals/software_template/software_template_add.php +++ b/admin/modals/software_template/software_template_add.php @@ -2,15 +2,8 @@ require_once '../../includes/modal_header.php'; -$license_types_array = array ( - 'Device', - 'User', - 'Site', - 'Concurrent', - 'Trial', - 'Perpetual', - 'Usage-based' -); +// The license types the license form offers (functions/software.php) +$license_types_array = array_keys(SOFTWARE_LICENSE_TYPES); ob_start(); @@ -78,7 +71,7 @@ ob_start(); diff --git a/admin/modals/software_template/software_template_edit.php b/admin/modals/software_template/software_template_edit.php index 78cf09e95..030687f76 100644 --- a/admin/modals/software_template/software_template_edit.php +++ b/admin/modals/software_template/software_template_edit.php @@ -14,15 +14,11 @@ $software_type = escapeHtml($row['software_template_type']); $software_license_type = escapeHtml($row['software_template_license_type']); $software_notes = escapeHtml($row['software_template_notes']); -$license_types_array = array ( - 'Device', - 'User', - 'Site', - 'Concurrent', - 'Trial', - 'Perpetual', - 'Usage-based' -); +// The license types the license form offers (functions/software.php), keeping one this template already has +$license_types_array = array_keys(SOFTWARE_LICENSE_TYPES); +if ($row['software_template_license_type'] && !in_array($row['software_template_license_type'], $license_types_array, true)) { + $license_types_array[] = $row['software_template_license_type']; +} ob_start(); @@ -93,7 +89,7 @@ ob_start(); diff --git a/admin/software_templates.php b/admin/software_templates.php index e7adf51a0..ffcc0a52f 100644 --- a/admin/software_templates.php +++ b/admin/software_templates.php @@ -44,7 +44,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
- +
"> - +
@@ -80,18 +80,18 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()")); ?>
- - -