'license templates', 'title' => 'That license template is gone', 'text' => 'It may have been deleted.', 'icon' => 'fa-cube', 'filtered' => false, 'actions' => [['label' => 'License Templates', 'href' => 'software_templates.php']]]); require_once "../includes/footer.php"; exit(); } $software_template_id = intval($template['software_template_id']); $name = escapeHtml($template['software_template_name']); // Tab title - used raw, the footer encodes it $page_title = $template['software_template_name']; $archived = !empty($template['software_template_archived_at']); $usage = softwareTemplateUsage([$software_template_id])[$software_template_id] ?? ['count' => 0, 'clients' => 0, 'seats' => 0, 'used' => 0, 'renewing' => 0, 'expired' => 0, 'last' => null]; $type_style = softwareTypeStyle($template['software_template_type']); $csrf = $_SESSION['csrf_token']; // Its licenses by client, with how each is billed when it is sold as a product - in the view picked $product_id = intval($template['software_template_product_id']); $has_product = $template['product_name'] !== null; $all_licenses = softwareTemplateLicenses($software_template_id, $product_id); $views = softwareTemplateLicenseViews($has_product); $view = isset($views[(string) ($_GET['view'] ?? '')]) ? (string) $_GET['view'] : ''; $view_counts = []; foreach ($views as $key => $definition) { $view_counts[$key] = count(array_filter($all_licenses, $definition['test'])); } $licenses = array_filter($all_licenses, $views[$view]['test']); $view_url = function ($key) use ($software_template_id) { return '?' . http_build_query(array_filter(['software_template_id' => $software_template_id, 'view' => $key])) . '#softwareTemplateLicenses'; }; // Who should have one - not counted while it is archived $required = intval($template['software_template_required']); $required_tags = softwareTemplateRequiredTags([$software_template_id])[$software_template_id]; $scope_text = softwareTemplateScopeText($required, $required_tags); $coverage = $required && !$archived ? softwareTemplateCoverage($software_template_id, $required, array_keys($required_tags)) : null; $list_limit = 8; $missing_text = $coverage && $coverage['missing'] ? (count($coverage['missing']) === 1 ? 'the client missing one' : 'the ' . count($coverage['missing']) . ' clients missing one') : ''; $edit_url = "modals/software_template/software_template_edit.php?id=$software_template_id"; $use_url = "modals/software_template/software_template_use.php?id=$software_template_id"; $several_url = "modals/software_template/software_template_use_several.php?id=$software_template_id"; $required_url = "modals/software_template/software_template_required.php?id=$software_template_id"; $true_up_url = "modals/software_template/software_template_true_up.php?id=$software_template_id"; $bill_url = "modals/software_template/software_template_bill.php?id=$software_template_id"; $renew_url = '/agent/modals/software/software_renew.php'; // What can be done to the whole of a view at once $view_ids = function () use ($licenses) { return implode('&', array_map(function ($id) { return 'software_ids[]=' . $id; }, array_keys($licenses))); }; $view_action = [ 'over' => ['label' => 'True up these', 'icon' => 'fa-balance-scale', 'url' => $true_up_url], 'spare' => ['label' => 'True up these', 'icon' => 'fa-balance-scale', 'url' => $true_up_url], 'renewing' => ['label' => 'Renew these', 'icon' => 'fa-redo-alt', 'url' => $renew_url], 'expired' => ['label' => 'Renew these', 'icon' => 'fa-redo-alt', 'url' => $renew_url], 'unbilled' => ['label' => 'Bill these', 'icon' => 'fa-file-invoice-dollar', 'url' => $bill_url], ][$view] ?? null; $term = (string) $template['software_template_term']; $vendor_name = (string) $template['vendor_template_name']; $product_name = (string) $template['product_name']; $facts = array_filter([ 'Type' => $template['software_template_type'] !== '' ? '' . escapeHtml($template['software_template_type']) : '', 'License type' => (string) $template['software_template_license_type'] !== '' ? '' . escapeHtml($template['software_template_license_type']) : '', 'Version' => escapeHtml((string) $template['software_template_version']), 'Seats' => $template['software_template_seats'] !== null ? '' . intval($template['software_template_seats']) : '', 'Renews every' => isset(SOFTWARE_RENEWAL_TERMS[$term]) ? '' . escapeHtml(SOFTWARE_RENEWAL_TERMS[$term]) . ' - from when it was bought' : '', 'Vendor' => $vendor_name !== '' ? '' . vendorTile($vendor_name, 'xs') . escapeHtml($vendor_name) . '' . ($template['vendor_template_archived_at'] ? ' - its vendor template is archived, so licenses from it get no vendor' : '') : '', 'Sold as' => $product_name !== '' ? '' . escapeHtml($product_name) . ' ' . escapeHtml(softwareTemplatePriceText($template)) . '' . ($template['product_archived_at'] ? ' - archived' : '') : '', ]); ?>
| Client | Seats | Renews | Billed | ||
|---|---|---|---|---|---|
|
= escapeHtml($row['client_name']) ?>
= escapeHtml($row['software_name']) ?>
= $billing ? 'Billed on ' . escapeHtml($billing['number']) : 'Not billed' ?>
|
= softwareSeatBar($row['seats'], $row['seats']['state'] === 'over') ?> | = $row['renewal'] ? softwareRenewalPill($row['renewal']) : '-' ?> |
= escapeHtml($billing['number']) ?>
Paused
= $billing['how'] === 'seats' ? 'Counts the seats ' . ($billing['count'] === 'total' ? 'bought' : 'in use') : billingQuantity($billing['quantity']) . ' typed in' ?>
Not its seats
Not billed
|
|