License templates stage 3: a template can be required of every client or of clients with certain client tags (database 3.3.0, tags kept when tags are merged); the template page shows how many of those clients have it and lists the missing ones with Make and Make for the clients missing one; the list gains a Required tab and a coverage chip; a client's Licenses page shows the licenses it should have but doesn't, opening New License from the template, and the client overview counts them under Licenses missing; the template page lists its licenses by client with seats, renewal and billing state, with views for over seats, spare seats, renewing soon, expired and not billed, an action for each view and bulk Renew, True up seats and Bill seats; true-up sets seats bought to the seats in use or a typed number; Bill seats adds a line for the template's product to each client's recurring invoice that follows the license's seats bought or in use, using seats in use for licenses with no seat limit; the Renew window now posts to the agent handler so it also works from Admin

This commit is contained in:
johnnyq
2026-10-18 21:10:29 -04:00
parent 0c12459eaf
commit b76bdd4b82
15 changed files with 1112 additions and 51 deletions

View File

@@ -6,7 +6,9 @@
* coming up, what has lapsed) and seats (bought against in use - over means a
* true-up, none in use means paying for nothing). Tabs along the top pull
* those out; each row shows its seats as a bar and its renewal in colour.
* Names open the license page.
* Names open the license page. A client's own list says which licenses it
* should have and hasn't (license templates required of every client, or of
* the clients with its tags), each a button to make it from the template.
*/
// Default Column Sortby Filter
@@ -44,6 +46,8 @@ if (isset($_GET['client_id'])) {
enforceUserPermission('module_support');
$can_edit = lookupUserPermission('module_support') >= 2;
// The license templates this client should have a license from, and hasn't
$missing_templates = $client_url && !$archived ? softwareTemplatesMissingFor($client_id) : [];
// Deleting for good also needs Admin > Settings to allow destructive deletes
$can_delete = lookupUserPermission('module_support') >= 3 && !empty($config_destructive_deletes_enable);
@@ -209,6 +213,22 @@ while ($license_type_row = mysqli_fetch_row($sql_license_types)) {
</div>
</div>
<?php if ($missing_templates) { ?>
<!-- The license templates this client should have a license from, and hasn't -->
<div class="card-header py-2 bg-warning-subtle d-flex flex-wrap align-items-center gap-2 itflow-licenses-missing">
<span class="small text-warning-emphasis fw-semibold"><i class="fas fa-fw fa-clipboard-check me-1"></i><?= count($missing_templates) === 1 ? 'A license it should have' : 'Licenses it should have' ?>:</span>
<?php foreach ($missing_templates as $missing_id => $missing_name) { ?>
<?php if ($can_edit) { ?>
<button type="button" class="btn btn-sm btn-light border py-0 ajax-modal" data-modal-size="lg" data-modal-url="modals/software/software_add.php?client_id=<?= $client_id ?>&template_id=<?= $missing_id ?>" title="Start it from the template" data-missing-template-id="<?= $missing_id ?>">
<i class="fas fa-plus me-1 text-secondary"></i><?= escapeHtml($missing_name) ?>
</button>
<?php } else { ?>
<span class="badge rounded-pill text-bg-light border fw-normal" data-missing-template-id="<?= $missing_id ?>"><?= escapeHtml($missing_name) ?></span>
<?php } ?>
<?php } ?>
</div>
<?php } ?>
<?php if ($tab_counts['']) { ?>
<!-- What needs a look -->
<div class="card-header py-2 itflow-asset-tabs">