mirror of
https://github.com/itflow-org/itflow
synced 2026-12-05 10:39:00 +00:00
Switched-off modules leave ITFlow completely: one map of each module's pages, windows, portal and guest pages (modulePaths) turned away by moduleRequestGuard with a refusal in the right shape, the API refusing resources and tag and category kinds of a module that is off, and every other page leaving out its tabs, New items, links, dashboard tiles, search groups, calendar layers, kinds, email previews, From addresses, settings sections and cron jobs; the nightly run skips the work of a module that is off, shared links don't open with IT documentation off, hidden settings keep their values, start pages fall back to the dashboard; 26.12.6 changelog and CONTRIBUTING rule
This commit is contained in:
24
CHANGELOG.md
24
CHANGELOG.md
@@ -2,6 +2,30 @@
|
||||
|
||||
This file documents all notable changes made to ITFlow.
|
||||
|
||||
## [26.12.6]
|
||||
|
||||
### Upgrading to 26.12.6
|
||||
|
||||
Update from Maintenance > Update as usual. There is no database change.
|
||||
|
||||
- If you have switched a module off in Admin > Settings > Modules - IT documentation, ticketing, invoicing and accounting or any of the others - check that you meant it before updating. Its pages, bookmarks to them and links in old emails stop opening, and the nightly run stops doing its work: with ticketing off, no recurring tickets are raised and resolved tickets aren't closed; with invoicing and accounting off, no recurring invoices or expenses are made, no autopay is charged and no payment reminders go out; with IT documentation off, no domain, certificate, warranty or service review notifications, and shared links - logins, files, documents and IT documentation exports sent to clients - don't open. Switch it back on and the next run picks up what is due, and shared links that haven't run out open again.
|
||||
- API keys get a 403 saying which module is off for anything of a module that is switched off - tickets with ticketing off, assets and credentials with IT documentation off, invoices with invoicing off.
|
||||
|
||||
### New Features & Updates
|
||||
|
||||
- Switching a module off in Admin > Settings > Modules now takes it out of ITFlow completely, not just out of the side menu. Every other page leaves out its tabs, buttons, New items and links: with ticketing off, a contact, location, asset, vendor, service or license has no Tickets tab or New Ticket, the client menu has no New Ticket or New Project, and the calendar has no scheduled tickets, projects or recurring tickets; with IT documentation off, a contact, location, vendor or ticket has no assets, credentials, licenses, documents, files or services, the dashboard has no expiring domains, certificates or warranties, Network Platforms leaves the admin menu, and global search doesn't look through them; with invoicing and accounting off, one of your vendors has no expenses or products, and the calendar has no invoices due. Tags, Categories, email previews, From addresses, tax switches, the default calendar, start pages and the cron jobs follow suit, and settings saved while a module is off keep what that module had.
|
||||
- A page or window of a module that is switched off says so and goes back where you came from - or to the dashboard, or for an admin page to Modules - instead of opening as if nothing were off. Whatever leads there: a bookmark, a link in an old email or notification, an address typed in. The settings overview's faded tiles take you to Modules, to switch it on.
|
||||
- The client portal leaves out what is switched off too. With ticketing off, a contact sees no Tickets, New Ticket, open tickets, approvals or request forms, and portal search doesn't look through tickets; with IT documentation off, their home lists no devices. A link someone was sent - to a ticket, invoice, quote or contract, or a shared login or file - for a module that is now off says it isn't available, without mentioning settings.
|
||||
- Maintenance > Cron shows the jobs of a module that is off as **Not in use**, saying which module: the Ticket Email Parser, Ticket SLA Monitor, Ticket Pictures and AI Triage with ticketing off, the Domain and Certificate Refreshers with IT documentation off, and Payment Provider Fees with invoicing off.
|
||||
- Audit logs and notifications still name a ticket, invoice or asset of a module that is off, without linking it. The quick looks - a contact, location, vendor or ticket at a glance - leave out what is off too, and a quote's files from the client can still be downloaded with IT documentation off.
|
||||
|
||||
### Developer Updates
|
||||
|
||||
- `functions/settings.php`: `modulePaths()` lists each module's pages, windows (`agent/modals/`, `admin/modals/`, a trailing `/` for a whole folder), portal pages and guest pages; `moduleForPath()` gives the modules a path belongs to, a report's from its `'feature'`s in `reportCatalog()`; `modulePathOff()`; `moduleRequestGuard()` turns a request away with `moduleRefuse()` - a window's JSON `content` "Switched off", a portal page's flash and `/client/index.php`, a guest page's plain 404, and an agent page's flash with the `HTTP_REFERER` when that is on this host and not off too, else `/agent/dashboard.php` or `/admin/settings_module.php`. It runs from `includes/check_login.php`, `client/includes/check_login.php`, `guest/includes/inc_all_guest.php` and `guest/guest_ticket_attachment.php`; `guest/share_ajax.php` answers `state: gone` with IT documentation off. `agent/file.php` isn't mapped - a quote's files from the client download through it. `moduleOffText()` now names `itdoc`, `ticketing`, `accounting` and `portal`. `moduleLink($module, $href, $inner_html, $attrs)` gives an `<a>` or, with the module off, a `<span>`; `ticketLink()` and `reportAssetCell()` use it. `settingsStartPages()` leaves out pages that are off, and `includes/load_global_settings.php` and `login.php` open the dashboard instead of a start page that is off (`moduleSwitchesLoad()` reads the switches where the settings aren't loaded). CONTRIBUTING.md has the rule.
|
||||
- `api/v1/enforce_api_rbac.php` maps each resource to its module in `$resource_feature` and `apiDeny(moduleOffText())`s one that is off, reading the switches from `settings` itself. `categoryKindModule()`, `categoryKindsOn()` (`functions/categories.php`), `tagKindModule()` and `tagKindsOn()` (`functions/tags.php`) give the kinds of the modules on - Admin > Categories and Tags, their windows, global search and the API use them, and the API refuses a kind that is off. `calendarSources()` takes a `'part'` per source. `dashboardAccess()` adds `itdoc`. `globalSearchGroups()` gives the documentation groups `'enabled' => $itdoc`. `auditLogRecords()` leaves `url` empty for a record whose page is off and `auditLogRecordLink()` gives a `<span>`; `notificationActionUrl()` returns null for one.
|
||||
- Cron: `cronJobModuleOff()` (`includes/cron_jobs.php`) and `not_in_use` checks on `ticket_email_parser`, `ticket_sla`, `ai_triage`, `ticket_pictures`, `domain_refresher`, `certificate_refresher` and `payment_provider_fees`; `cronJobSettings()` reads the whole settings row. `cron/nightly_tasks.php` skips contracts, recurring invoices, expenses and payments, reminders, quote and draft notices and card checks with accounting off, recurring tickets, auto-close and the pending-tickets notice with ticketing off, and the domain, certificate, warranty, asset date and service review notices with IT documentation off.
|
||||
- Pages: `agent/contact.php`, `location.php`, `asset.php`, `vendor.php`, `service.php`, `ticket.php`, `license.php`, `services.php`, `assets.php`, `calls.php`, `texts.php`, `invoice.php`, `invoices.php`, `quote.php`, `contract.php`, `trips.php`, `unbilled_time.php`, `client_overview.php`, `includes/client_actions_menu.php`, `reports/client_review.php`, `admin/includes/side_nav.php`, `rmm_clients.php`, `payment_methods.php`, `agent_banners.php`, `settings.php`, `settings_mail.php`, `settings_notification.php`, `settings_invoice.php`, `settings_default.php`, `tax_rates.php`, the contract and contract template windows (SLAs kept as hidden fields), the contact, location, vendor and ticket quick looks (`agent/modals/*/`), the offboarding window's open tickets note, `client/index.php`, `search.php`, `functions.php` (`portalNav()`) and `includes/header.php`. A switch or field hidden for a module that is off is kept as saved: `admin/post/settings_notification.php` only writes `config_enable_alert_domain_expire` with IT documentation on, and `tax_rates.php` posts `tax_time` and `tax_trips` hidden.
|
||||
|
||||
## [26.12.5]
|
||||
|
||||
### Upgrading to 26.12.5
|
||||
|
||||
@@ -184,6 +184,8 @@ Two portals are gated differently, which is why their handlers look like they ar
|
||||
- **Client portal.** `client/post.php` is a single file of action blocks rather than a dispatcher, and gates on the contact's own capabilities with `enforceContactCan('accounting'|'contacts'|'itdoc')`.
|
||||
|
||||
Everywhere else — anything under `agent/post/` — the call belongs in the block.
|
||||
|
||||
**Switched-off modules.** The parts of ITFlow an admin can switch off in Admin > Settings > Modules (`moduleOn()` in `functions/settings.php`) are a separate gate from roles. A new page, window, portal page or guest page of one goes in `modulePaths()` - a folder with a trailing `/` covers every window in it - and `moduleRequestGuard()` turns it away while the module is off; a new report says its module in `'feature'`, and a new API resource goes in `$resource_feature` in `api/v1/enforce_api_rbac.php`. Anything on another page that leads into a module - a tab, a New item, a button, a link - checks `moduleOn()` itself; `moduleLink()` names a record without linking it. A setting or field left off a form while its module is off must keep its saved value when the form is saved.
|
||||
|
||||
### 4. Client scoping is enforced, not assumed.
|
||||
|
||||
|
||||
@@ -90,7 +90,7 @@ $csrf = $_SESSION['csrf_token'];
|
||||
<?php if (!$ready) { ?>
|
||||
<div class="alert alert-warning py-2 small"><i class="fas fa-exclamation-triangle me-2"></i>Banners come with the 3.7.2 database update - run it in <a href="update.php">Update</a>.</div>
|
||||
<?php } ?>
|
||||
<p class="text-secondary small mb-3">Along the top of agents' pages - for every client on every page, or for one client on its pages and its tickets, invoices, quotes and projects. Agents who can edit a client add its banners from its <strong>⋮</strong> menu. Clients don't see them; for a note on the client portal, use <a href="settings_client_portal.php">announcements</a>.</p>
|
||||
<p class="text-secondary small mb-3">Along the top of agents' pages - for every client on every page, or for one client on its pages and its tickets, invoices, quotes and projects. Agents who can edit a client add its banners from its <strong>⋮</strong> menu. Clients don't see them<?= moduleOn('portal') ? '; for a note on the client portal, use <a href="settings_client_portal.php">announcements</a>' : '' ?>.</p>
|
||||
<form autocomplete="off">
|
||||
<?php if ($show !== '') { ?><input type="hidden" name="show" value="<?= escapeHtml($show) ?>"><?php } ?>
|
||||
<div class="row g-2 align-items-center">
|
||||
|
||||
@@ -19,8 +19,12 @@ $order = "ASC";
|
||||
|
||||
require_once "includes/inc_all_admin.php";
|
||||
|
||||
$kinds = categoryKinds();
|
||||
$kind = isset($kinds[$_GET['category'] ?? '']) ? (string) $_GET['category'] : 'Expense';
|
||||
// The kinds of the parts of ITFlow switched on (Admin > Settings > Modules) - the first when none is asked for
|
||||
$kinds = categoryKindsOn();
|
||||
$kind = isset($kinds[$_GET['category'] ?? '']) ? (string) $_GET['category'] : (string) array_key_first($kinds);
|
||||
// The sort and page links keep the kind shown, not one asked for that isn't there (includes/filter_header.php built the sort ones)
|
||||
$_GET['category'] = $kind;
|
||||
$url_query_strings_sort = http_build_query(['category' => $kind] + array_diff_key($_GET, ['sort' => 1, 'order' => 1]));
|
||||
$config = categoryKind($kind);
|
||||
// ?archived=1 is how older links asked for the archived ones
|
||||
$show_archived = ($_GET['show'] ?? '') === 'archived' || !empty($_GET['archived']);
|
||||
|
||||
@@ -157,6 +157,7 @@
|
||||
<p>RMM Providers</p>
|
||||
</a>
|
||||
</li>
|
||||
<?php if ($config_module_enable_itdoc) { // What a platform brings in are assets ?>
|
||||
<li class="nav-item">
|
||||
<a href="/admin/network_platforms.php"
|
||||
class="nav-link <?= ($nav_rmm_page === 'network_platforms.php' || ($nav_rmm_page === 'rmm_clients.php' && $nav_rmm_family === 'network') ? 'active' : '') ?>">
|
||||
@@ -164,6 +165,7 @@
|
||||
<p>Network Platforms</p>
|
||||
</a>
|
||||
</li>
|
||||
<?php } ?>
|
||||
<li class="nav-item">
|
||||
<a href="/admin/phone_systems.php"
|
||||
class="nav-link <?= (in_array(basename($_SERVER['PHP_SELF']), ['phone_systems.php', 'phone_domains.php']) ? 'active' : '') ?>">
|
||||
|
||||
@@ -49,7 +49,7 @@ $c_max = $c_config['max'] ?? 200;
|
||||
<span class="input-group-text"><i class="fas fa-fw fa-layer-group"></i></span>
|
||||
<select class="form-select select2" name="type" required>
|
||||
<option value="">- Select a type -</option>
|
||||
<?php foreach (categoryKinds() as $kind_key => $kind_config) { ?>
|
||||
<?php foreach (categoryKindsOn() as $kind_key => $kind_config) { ?>
|
||||
<option value="<?= escapeHtml($kind_key) ?>"><?= escapeHtml(ucfirst($kind_config['many'])) ?></option>
|
||||
<?php } ?>
|
||||
</select>
|
||||
|
||||
@@ -146,6 +146,12 @@ $tab = 'templateTab' . bin2hex(random_bytes(3));
|
||||
</div>
|
||||
</div>
|
||||
<small class="text-secondary d-block mb-3">While the contract is in force, time bills at these rates - the after-hours one for tickets opened outside business hours - and new invoices are due on these terms. Leave one empty and the default in Admin > Settings > Defaults applies - a rate of 0 bills that time at nothing.</small>
|
||||
<?php if (!moduleOn('ticketing')) {
|
||||
// SLAs are ticketing's - kept as they are while it is switched off (Admin > Settings > Modules)
|
||||
foreach (CONTRACT_SLA_PRIORITIES as $priority => $part) { ?>
|
||||
<input type="hidden" name="sla_<?= $part ?>" value="<?= intval($t_value("sla_{$part}_id", 0)) ?>">
|
||||
<?php }
|
||||
} else { ?>
|
||||
<label class="form-label">SLA by ticket priority</label>
|
||||
<?php foreach (CONTRACT_SLA_PRIORITIES as $priority => $part) { ?>
|
||||
<div class="input-group mb-2">
|
||||
@@ -159,6 +165,7 @@ $tab = 'templateTab' . bin2hex(random_bytes(3));
|
||||
</div>
|
||||
<?php } ?>
|
||||
<div class="form-text">From Admin > SLAs. While the contract is in force, the client's new tickets get them, and the default for a priority left on the default.</div>
|
||||
<?php } ?>
|
||||
</div>
|
||||
|
||||
<div class="tab-pane fade" id="<?= $tab ?>Terms" role="tabpanel">
|
||||
|
||||
@@ -49,7 +49,7 @@ if (!in_array($t_icon, $t_icons, true)) {
|
||||
<div class="input-group">
|
||||
<span class="input-group-text"><i class="fas fa-fw fa-layer-group"></i></span>
|
||||
<select class="form-select select2" name="type"<?= $t_kind_locked ? ' disabled' : '' ?> required>
|
||||
<?php foreach (tagKinds() as $kind_type => $kind_entity) {
|
||||
<?php foreach (tagKindsOn() + (isset(tagKinds()[intval($type)]) ? [intval($type) => tagKinds()[intval($type)]] : []) as $kind_type => $kind_entity) {
|
||||
$kind_config = tagEntity($kind_entity); ?>
|
||||
<option value="<?= $kind_type ?>"<?= $kind_type === intval($type) ? ' selected' : '' ?>><?= $kind_config['title'] ?>s</option>
|
||||
<?php } ?>
|
||||
|
||||
@@ -186,7 +186,7 @@ $csrf = $_SESSION['csrf_token'];
|
||||
<a class="dropdown-item ajax-modal" href="#" data-modal-url="<?= $edit_url ?>">
|
||||
<i class="fas fa-fw fa-edit text-secondary me-2"></i>Edit
|
||||
</a>
|
||||
<?php if ($used['total']) { ?>
|
||||
<?php if ($used['total'] && moduleOn('bookkeeping')) { ?>
|
||||
<a class="dropdown-item" href="<?= escapeHtml($records_url) ?>">
|
||||
<i class="fas fa-fw fa-exchange-alt text-secondary me-2"></i>See Its Transactions
|
||||
</a>
|
||||
|
||||
@@ -21,7 +21,10 @@ if (isset($_POST['edit_notification_settings'])) {
|
||||
$weekly_columns = weeklySummaryReady() ? ['config_weekly_summary', 'config_weekly_summary_day', 'config_weekly_summary_to'] : [];
|
||||
$before = settingsCurrent(array_merge(['config_enable_alert_domain_expire', 'config_ticket_client_general_notifications', 'config_recurring_auto_send_invoice'], $team_columns, $sms_columns, $weekly_columns));
|
||||
|
||||
$after = ['config_enable_alert_domain_expire' => empty($_POST['config_enable_alert_domain_expire']) ? 0 : 1];
|
||||
$after = [];
|
||||
if ($config_module_enable_itdoc) {
|
||||
$after['config_enable_alert_domain_expire'] = empty($_POST['config_enable_alert_domain_expire']) ? 0 : 1;
|
||||
}
|
||||
if ($config_module_enable_ticketing) {
|
||||
$after['config_ticket_client_general_notifications'] = empty($_POST['config_ticket_client_general_notifications']) ? 0 : 1;
|
||||
}
|
||||
|
||||
@@ -208,7 +208,7 @@ $devices_in = intval(mysqli_fetch_row(mysqli_query($mysqli, "SELECT COUNT(*) FRO
|
||||
<td class="d-none d-md-table-cell text-nowrap">
|
||||
<div><?= number_format(intval($row['rmm_client_devices'])) ?> in <?= escapeHtml($short) ?></div>
|
||||
<?php if ($linked) { ?>
|
||||
<div class="small"><a href="../agent/assets.php?client_id=<?= $client_id ?>&rmm=any"><?= number_format(intval($row['assets_in'])) ?> asset<?= intval($row['assets_in']) === 1 ? '' : 's' ?></a>
|
||||
<div class="small"><?= moduleLink('itdoc', "../agent/assets.php?client_id=$client_id&rmm=any", number_format(intval($row['assets_in'])) . ' asset' . (intval($row['assets_in']) === 1 ? '' : 's')) ?>
|
||||
<?php if ($overdue) { ?><span class="text-danger-emphasis ms-1" title="Not heard from for longer than <?= escapeHtml($short) ?>'s overdue time"><?= $overdue ?> overdue</span><?php } ?>
|
||||
<?php if ($deleted) { ?><span class="text-body-secondary ms-1" title="Their assets were deleted in ITFlow, so they aren't brought in again"><?= $deleted ?> deleted</span><?php } ?>
|
||||
</div>
|
||||
|
||||
@@ -140,7 +140,7 @@ $groups = settingsGroups();
|
||||
continue;
|
||||
}
|
||||
$available = settingsPageAvailable($page); ?>
|
||||
<a href="<?= escapeHtml($page['url']) ?>" class="itflow-settings-tile<?= $available ? '' : ' is-off' ?>" data-settings-tile="<?= $page_key ?>">
|
||||
<a href="<?= escapeHtml($available ? $page['url'] : 'settings_module.php') ?>" class="itflow-settings-tile<?= $available ? '' : ' is-off' ?>" data-settings-tile="<?= $page_key ?>"<?= $available ? '' : ' title="Switch it on in Modules"' ?>>
|
||||
<span class="itflow-settings-tile-icon"><i class="fas fa-fw <?= escapeHtml($page['icon']) ?>"></i></span>
|
||||
<span class="min-w-0">
|
||||
<span class="itflow-settings-tile-title"><?= escapeHtml($page['title']) ?></span>
|
||||
|
||||
@@ -60,7 +60,9 @@ echo settingsPageStart('default');
|
||||
<?= settingsSectionStart('opening', 'Opening ITFlow', 'Where everyone lands on signing in or clicking the logo, and the calendar a new event goes on.') ?>
|
||||
<?= settingsSelect('config_start_page', $config_start_page, $start_pages, ['icon' => 'fa-home', 'search' => true, 'required' => true, 'data' => ['tags' => 'true'],
|
||||
'help' => 'Or type another page, as it is after /agent/ in its address - tickets.php?status=Open.']) ?>
|
||||
<?= settingsSelect('config_default_calendar', intval($config_default_calendar), $calendars, ['icon' => 'fa-calendar']) ?>
|
||||
<?php if (moduleOn('calendar')) { ?>
|
||||
<?= settingsSelect('config_default_calendar', intval($config_default_calendar), $calendars, ['icon' => 'fa-calendar']) ?>
|
||||
<?php } ?>
|
||||
<?= settingsSectionEnd() ?>
|
||||
|
||||
<?= settingsSectionStart('clients', 'Rates and terms', 'What a client is billed on when no contract in force sets it - a client has no rates or terms of its own; its contract\'s apply. The SLAs are in Admin > SLAs.') ?>
|
||||
|
||||
@@ -165,6 +165,7 @@ echo settingsPageStart('invoice');
|
||||
</script>
|
||||
<?= settingsSectionEnd() ?>
|
||||
|
||||
<?php if ($config_module_enable_ticketing) { ?>
|
||||
<?= settingsSectionStart('time', 'Billing time', 'How the time logged on a billable ticket becomes hours on an invoice - in Unbilled Time, a ticket\'s Invoice window and Add Tickets. Each ticket\'s time is rounded once, as a whole, and billed at the client\'s hourly rate, or the one in <a href="settings_default.php#setting=config_default_hourly_rate">Defaults</a> when the client has none.', 'billing-time') ?>
|
||||
<div class="row g-3">
|
||||
<div class="col-md-6"><?= settingsSelect('config_time_increment', $time_rules['increment'], billingTimeIncrements(), ['icon' => 'fa-stopwatch', 'label' => 'Round to']) ?></div>
|
||||
@@ -176,6 +177,7 @@ echo settingsPageStart('invoice');
|
||||
'placeholder' => 'Support [Hourly]', 'help' => 'The ticket number, subject and date go in its description.']) ?></div>
|
||||
</div>
|
||||
<?= settingsSectionEnd() ?>
|
||||
<?php } ?>
|
||||
|
||||
<?= settingsSectionStart('expenses', 'Billable expenses', 'An expense for a client can be billed on to them - it waits in Unbilled Time and goes on their invoice at what it cost, less any refund, plus a markup. A recurring expense can be billed on each time it records one.', 'billable-expenses') ?>
|
||||
<div class="row g-3">
|
||||
@@ -184,6 +186,7 @@ echo settingsPageStart('invoice');
|
||||
</div>
|
||||
<?= settingsSectionEnd() ?>
|
||||
|
||||
<?php if (moduleOn('trips')) { ?>
|
||||
<?= settingsSectionStart('mileage', 'Trips and mileage', 'An agent driving their own vehicle is paid back for the distance: Pay Mileage on the Trips page makes their trips a mileage expense they paid personally, to pay back with Reimburse. A trip for a client can be billed to them from Unbilled Time, beside their tickets and expenses.', 'mileage') ?>
|
||||
<div class="row g-3">
|
||||
<div class="col-md-6"><?= settingsSelect('config_mileage_unit', $trip_rules['unit'], ['mi' => 'Miles', 'km' => 'Kilometers'], ['icon' => 'fa-ruler',
|
||||
@@ -209,6 +212,7 @@ echo settingsPageStart('invoice');
|
||||
</div>
|
||||
<div class="itflow-settings-note mt-3" data-trip-rule><?= tripBillingOn() ? 'A trip bills ' . escapeHtml(tripBillRuleText()) . '.' : 'With no charge and no rate, trips aren\'t billed.' ?> The price can be changed in Unbilled Time before it goes on.</div>
|
||||
<?= settingsSectionEnd() ?>
|
||||
<?php } ?>
|
||||
|
||||
<?= settingsSaveBar('edit_invoice_settings') ?>
|
||||
</div>
|
||||
|
||||
@@ -355,9 +355,9 @@ if (!$config_module_enable_ticketing) {
|
||||
</div>
|
||||
|
||||
<?= $from_box('mail', 'System emails', 'Share links, password resets, alerts - anything without its own address below.', $config_mail_from_email, $config_mail_from_name, 'noreply@example.com', (string) ($session_company_name ?? 'Your company')) ?>
|
||||
<?= $from_box('invoice', 'Invoices', 'Invoices, receipts, statements and payment reminders.', $config_invoice_from_email, $config_invoice_from_name, 'billing@example.com', 'Billing') ?>
|
||||
<?= $from_box('quote', 'Quotes', 'Quotes sent to clients. Empty - they come from the invoices address.', $config_quote_from_email, $config_quote_from_name, 'sales@example.com', 'Sales') ?>
|
||||
<?= $from_box('ticket', 'Tickets', 'Ticket emails to clients. Make it the mailbox Receiving reads, so their replies go on the ticket. An agent\'s reply goes out with their name in front of this one - <em>' . escapeHtml(ticketEmailFromName(stripslashes((string) ($session_name ?? 'Tess Tech')), (string) $config_ticket_from_name !== '' ? (string) $config_ticket_from_name : 'Support')) . '</em> - from the same address.', $config_ticket_from_email, $config_ticket_from_name, 'support@example.com', 'Support') ?>
|
||||
<?= !$config_module_enable_accounting ? '' : $from_box('invoice', 'Invoices', 'Invoices, receipts, statements and payment reminders.', $config_invoice_from_email, $config_invoice_from_name, 'billing@example.com', 'Billing') ?>
|
||||
<?= !$config_module_enable_accounting ? '' : $from_box('quote', 'Quotes', 'Quotes sent to clients. Empty - they come from the invoices address.', $config_quote_from_email, $config_quote_from_name, 'sales@example.com', 'Sales') ?>
|
||||
<?= !$config_module_enable_ticketing ? '' : $from_box('ticket', 'Tickets', 'Ticket emails to clients. Make it the mailbox Receiving reads, so their replies go on the ticket. An agent\'s reply goes out with their name in front of this one - <em>' . escapeHtml(ticketEmailFromName(stripslashes((string) ($session_name ?? 'Tess Tech')), (string) $config_ticket_from_name !== '' ? (string) $config_ticket_from_name : 'Support')) . '</em> - from the same address.', $config_ticket_from_email, $config_ticket_from_name, 'support@example.com', 'Support') ?>
|
||||
|
||||
<?= settingsSaveBar('edit_mail_from_settings') ?>
|
||||
</form>
|
||||
@@ -435,7 +435,12 @@ if (!$config_module_enable_ticketing) {
|
||||
<!-- ============================ PREVIEWS ============================ -->
|
||||
<?php
|
||||
// Every email ITFlow sends, made on sample records that are thrown away again (functions/email_preview.php)
|
||||
$preview_catalog = emailPreviewCatalog();
|
||||
// Only the emails of the parts of ITFlow switched on (Admin > Settings > Modules)
|
||||
$preview_catalog = array_filter(emailPreviewCatalog(), function ($entry) {
|
||||
$module = ['Tickets - to clients' => 'ticketing', 'Tickets - to your team' => 'ticketing', 'Billing' => 'accounting', 'Contracts' => 'accounting',
|
||||
'Calendar' => 'calendar', 'Client portal' => 'portal', 'Shared links' => 'itdoc'][$entry['group']] ?? null;
|
||||
return $module === null || moduleOn($module);
|
||||
});
|
||||
$preview_groups = [];
|
||||
foreach ($preview_catalog as $preview_key => $preview_entry) {
|
||||
$preview_groups[$preview_entry['group']][$preview_key] = $preview_entry;
|
||||
|
||||
@@ -22,9 +22,11 @@ echo settingsPageStart('notification');
|
||||
<div class="card itflow-settings-card">
|
||||
<div class="card-body">
|
||||
|
||||
<?php if ($config_module_enable_itdoc) { ?>
|
||||
<?= settingsSectionStart('alerts', 'Alerts for your team', 'In the bell at the top of the page, for everyone who can see the client - raised by the nightly job.') ?>
|
||||
<?= settingsSwitch('config_enable_alert_domain_expire', $config_enable_alert_domain_expire, ['help' => '45, 7 and 1 days before a domain expires - saying when one is set to auto-renew, to check it goes through.']) ?>
|
||||
<?= settingsSectionEnd() ?>
|
||||
<?php } ?>
|
||||
|
||||
<?php if ($config_module_enable_ticketing && version_compare(CURRENT_DATABASE_VERSION, '3.9.1', '>=')) { ?>
|
||||
<?= settingsSectionStart('team', 'Emails and notices to your team', 'What ITFlow tells your agents about their tickets by itself. The new-ticket address is set in <a href="settings_ticket.php">Tickets</a>.') ?>
|
||||
|
||||
@@ -17,12 +17,16 @@ $order = "ASC";
|
||||
|
||||
require_once "includes/inc_all_admin.php";
|
||||
|
||||
// The kinds of the parts of ITFlow switched on (Admin > Settings > Modules)
|
||||
$kinds = [];
|
||||
foreach (tagKinds() as $kind_type => $kind_entity) {
|
||||
foreach (tagKindsOn() as $kind_type => $kind_entity) {
|
||||
$kinds[$kind_type] = tagEntity($kind_entity);
|
||||
}
|
||||
$type = intval($_GET['type'] ?? 1);
|
||||
$type = isset($kinds[$type]) ? $type : 1;
|
||||
// The sort and page links keep the kind shown, not one asked for that isn't there (includes/filter_header.php built the sort ones)
|
||||
$_GET['type'] = $type;
|
||||
$url_query_strings_sort = http_build_query(['type' => $type] + array_diff_key($_GET, ['sort' => 1, 'order' => 1]));
|
||||
$kind = $kinds[$type];
|
||||
// ?archived=1 is how older links asked for the archived ones
|
||||
$show_archived = ($_GET['show'] ?? '') === 'archived' || !empty($_GET['archived']);
|
||||
|
||||
@@ -212,14 +212,23 @@ $used_text = function (array $u) {
|
||||
</div>
|
||||
|
||||
<label class="form-label">Also tax</label>
|
||||
<?php // Ticket time and trips switched off (Admin > Settings > Modules) keep what they are
|
||||
if (moduleOn('ticketing')) { ?>
|
||||
<div class="form-check form-switch">
|
||||
<input type="checkbox" class="form-check-input" name="tax_time" value="1" id="taxTime"<?= $tax_settings['time'] ? ' checked' : '' ?>>
|
||||
<label class="form-check-label" for="taxTime">Billed time</label>
|
||||
</div>
|
||||
<?php } elseif ($tax_settings['time']) { ?>
|
||||
<input type="hidden" name="tax_time" value="1">
|
||||
<?php } ?>
|
||||
<?php if (moduleOn('trips')) { ?>
|
||||
<div class="form-check form-switch">
|
||||
<input type="checkbox" class="form-check-input" name="tax_trips" value="1" id="taxTrips"<?= $tax_settings['trip'] ? ' checked' : '' ?>>
|
||||
<label class="form-check-label" for="taxTrips">Trips</label>
|
||||
</div>
|
||||
<?php } elseif ($tax_settings['trip']) { ?>
|
||||
<input type="hidden" name="tax_trips" value="1">
|
||||
<?php } ?>
|
||||
<div class="form-check form-switch">
|
||||
<input type="checkbox" class="form-check-input" name="tax_expenses" value="1" id="taxExpenses"<?= $tax_settings['expense'] ? ' checked' : '' ?>>
|
||||
<label class="form-check-label" for="taxExpenses">Expenses billed to clients</label>
|
||||
|
||||
@@ -251,6 +251,11 @@ if (mysqli_num_rows($sql) == 0) {
|
||||
if (!$can_credentials) {
|
||||
unset($asset_tabs['credentials']);
|
||||
}
|
||||
// Ticketing switched off (Admin > Settings > Modules) - its tabs and New items go
|
||||
$asset_ticketing = moduleOn('ticketing');
|
||||
if (!$asset_ticketing) {
|
||||
unset($asset_tabs['tickets'], $asset_tabs['recurring']);
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
@@ -339,12 +344,14 @@ if (mysqli_num_rows($sql) == 0) {
|
||||
<div class="dropdown">
|
||||
<button type="button" class="btn btn-primary dropdown-toggle" data-bs-toggle="dropdown"><i class="fas fa-plus me-2"></i>New</button>
|
||||
<div class="dropdown-menu dropdown-menu-end">
|
||||
<?php if ($asset_ticketing) { ?>
|
||||
<a class="dropdown-item ajax-modal" href="#" data-modal-url="modals/ticket/ticket_add.php?<?= $client_url ?>&asset_id=<?= $asset_id ?>" data-modal-size="lg">
|
||||
<i class="fas fa-fw fa-life-ring text-secondary me-2"></i>Ticket
|
||||
</a>
|
||||
<a class="dropdown-item ajax-modal" href="#" data-modal-url="modals/recurring_ticket/recurring_ticket_add.php?<?= $client_url ?>&asset_id=<?= $asset_id ?>" data-modal-size="lg">
|
||||
<i class="fas fa-fw fa-redo-alt text-secondary me-2"></i>Recurring Ticket
|
||||
</a>
|
||||
<?php } ?>
|
||||
<?php if ($can_credentials_edit) { ?>
|
||||
<a class="dropdown-item ajax-modal" href="#" data-modal-size="lg" data-modal-url="modals/credential/credential_add.php?<?= $client_url ?>asset_id=<?= $asset_id ?>">
|
||||
<i class="fas fa-fw fa-key text-secondary me-2"></i>Credential
|
||||
@@ -493,7 +500,7 @@ if (mysqli_num_rows($sql) == 0) {
|
||||
<ul class="list-unstyled small mt-3 mb-0" data-rmm-alerts="<?= count($rmm_alerts) ?>">
|
||||
<?php foreach ($rmm_alerts as $rmm_alert) { ?>
|
||||
<li class="text-<?= ['error' => 'danger', 'warning' => 'warning'][$rmm_alert['rmm_alert_severity']] ?? 'secondary' ?>-emphasis">
|
||||
<i class="fas fa-fw fa-bell me-1"></i><a class="fw-semibold" href="<?= escapeHtml(ticketUrl($rmm_alert['ticket_id'], $rmm_alert['ticket_client_id'])) ?>"><?= escapeHtml($rmm_alert['ticket_prefix'] . $rmm_alert['ticket_number']) ?></a>
|
||||
<i class="fas fa-fw fa-bell me-1"></i><?php if ($asset_ticketing) { ?><a class="fw-semibold" href="<?= escapeHtml(ticketUrl($rmm_alert['ticket_id'], $rmm_alert['ticket_client_id'])) ?>"><?= escapeHtml($rmm_alert['ticket_prefix'] . $rmm_alert['ticket_number']) ?></a><?php } else { ?><span class="fw-semibold"><?= escapeHtml($rmm_alert['ticket_prefix'] . $rmm_alert['ticket_number']) ?></span><?php } ?>
|
||||
<?= escapeHtml(mb_strimwidth((string) $rmm_alert['rmm_alert_message'], 0, 120, '...')) ?>
|
||||
</li>
|
||||
<?php } ?>
|
||||
@@ -1079,6 +1086,7 @@ if (mysqli_num_rows($sql) == 0) {
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
||||
<?php if (isset($asset_tabs['tickets'])) { ?>
|
||||
<!-- Tickets -->
|
||||
<div class="tab-pane fade" id="asset-pane-tickets" role="tabpanel">
|
||||
<div class="itflow-asset-pane-bar">
|
||||
@@ -1095,7 +1103,9 @@ if (mysqli_num_rows($sql) == 0) {
|
||||
<div class="itflow-asset-empty">No tickets have mentioned this asset.</div>
|
||||
<?php } ?>
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
||||
<?php if (isset($asset_tabs['recurring'])) { ?>
|
||||
<!-- Recurring tickets -->
|
||||
<div class="tab-pane fade" id="asset-pane-recurring" role="tabpanel">
|
||||
<div class="itflow-asset-pane-bar">
|
||||
@@ -1170,6 +1180,7 @@ if (mysqli_num_rows($sql) == 0) {
|
||||
<div class="itflow-asset-empty">Nothing scheduled for this asset.</div>
|
||||
<?php } ?>
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
||||
<!-- Licenses -->
|
||||
<div class="tab-pane fade" id="asset-pane-licenses" role="tabpanel">
|
||||
|
||||
@@ -441,12 +441,14 @@ $search_noun = $type_filter ? $asset_type_tabs[$type_filter]['label'] : 'assets'
|
||||
<i class="fas fa-fw fa-tags me-2"></i>Tags
|
||||
</a>
|
||||
<div class="dropdown-divider"></div>
|
||||
<?php if (moduleOn('ticketing')) { ?>
|
||||
<a class="dropdown-item ajax-modal" href="#"
|
||||
data-modal-url="modals/asset/asset_bulk_add_ticket.php"
|
||||
data-modal-size="lg"
|
||||
data-bulk="true">
|
||||
<i class="fas fa-fw fa-life-ring me-2"></i>Create Tickets
|
||||
</a>
|
||||
<?php } ?>
|
||||
<a class="dropdown-item ajax-modal" href="#"
|
||||
data-modal-url="modals/asset/asset_bulk_transfer_client.php?<?= $client_url ?>"
|
||||
data-bulk="true">
|
||||
|
||||
@@ -172,7 +172,9 @@ $view_empty = [
|
||||
<div class="col-lg-9 col-md-6 small" data-audit-entity="<?= $entity_filter ?>">
|
||||
<input type="hidden" name="entity" value="<?= $entity_filter ?>">
|
||||
<span class="text-body-secondary"><i class="fas fa-fw fa-filter me-1"></i>Just one record:</span>
|
||||
<?php if ($entity_record) { ?>
|
||||
<?php if ($entity_record && $entity_record['url'] === '') { ?>
|
||||
<span><?= escapeHtml($type_filter . ' ' . $entity_record['name']) ?></span>
|
||||
<?php } elseif ($entity_record) { ?>
|
||||
<a href="<?= escapeHtml($entity_record['url']) ?>"><?= escapeHtml($type_filter . ' ' . $entity_record['name']) ?></a>
|
||||
<?php } else { ?>
|
||||
<span class="text-body-secondary"><?= escapeHtml($type_filter !== '' ? $type_filter : 'record') ?> #<?= $entity_filter ?></span>
|
||||
|
||||
@@ -154,7 +154,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
||||
<th class="d-none d-xl-table-cell"><?= sortLink('phone_call_extension', 'Taken by') ?></th>
|
||||
<th><?= sortLink('phone_call_started_at', 'When') ?></th>
|
||||
<th class="d-none d-sm-table-cell text-end"><?= sortLink('phone_call_talk_seconds', 'Talked') ?></th>
|
||||
<th class="d-none d-lg-table-cell">Ticket</th>
|
||||
<?php if (moduleOn('ticketing')) { ?><th class="d-none d-lg-table-cell">Ticket</th><?php } ?>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
@@ -211,6 +211,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
||||
<div class="text-body-secondary"><?= escapeHtml(date('M j, g:i a', strtotime($row['phone_call_started_at']))) ?></div>
|
||||
</td>
|
||||
<td class="d-none d-sm-table-cell small text-end text-nowrap"><?= $answered ? escapeHtml(phoneSecondsText($row['phone_call_talk_seconds'])) : '<span class="text-body-secondary">-</span>' ?></td>
|
||||
<?php if (moduleOn('ticketing')) { ?>
|
||||
<td class="d-none d-lg-table-cell small text-nowrap">
|
||||
<?php if ($ticket_id && $row['ticket_number'] !== null) { ?>
|
||||
<a href="ticket.php?client_id=<?= $call_client_id ?>&ticket_id=<?= $ticket_id ?>" title="<?= escapeHtml((string) $row['ticket_subject']) ?>"><?= escapeHtml($row['ticket_prefix'] . $row['ticket_number']) ?></a>
|
||||
@@ -218,12 +219,13 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()"));
|
||||
<span class="text-body-secondary">-</span>
|
||||
<?php } ?>
|
||||
</td>
|
||||
<?php } ?>
|
||||
<td class="text-end pe-3">
|
||||
<?php if (($can_edit && $row['phone_call_direction'] !== 'local') || $call_web !== '') { ?>
|
||||
<?php if (($can_edit && $row['phone_call_direction'] !== 'local' && moduleOn('ticketing')) || $call_web !== '') { ?>
|
||||
<div class="dropdown dropstart">
|
||||
<button class="btn btn-sm btn-light" title="More actions" type="button" data-bs-toggle="dropdown"><i class="fas fa-fw fa-ellipsis-v"></i></button>
|
||||
<div class="dropdown-menu">
|
||||
<?php if ($can_edit && $row['phone_call_direction'] !== 'local') { ?>
|
||||
<?php if ($can_edit && $row['phone_call_direction'] !== 'local' && moduleOn('ticketing')) { ?>
|
||||
<a class="dropdown-item ajax-modal" href="#" data-modal-url="modals/phone/phone_call_ticket.php?id=<?= $phone_call_id ?>"><i class="fas fa-fw fa-life-ring text-secondary me-2"></i>Add to Ticket</a>
|
||||
<?php } ?>
|
||||
<?php if ($call_web !== '') { ?>
|
||||
|
||||
@@ -31,7 +31,7 @@ $favorites = clientOverviewFavorites($client_id, $access);
|
||||
$upcoming = clientOverviewUpcoming($client_id, $access);
|
||||
$asset_summary = $access['docs'] ? clientOverviewAssets($client_id) : null;
|
||||
$rmm_summary = $access['docs'] ? rmmClientSummary($client_id) : null;
|
||||
$shared_items = clientOverviewSharedItems($client_id);
|
||||
$shared_items = $access['docs'] ? clientOverviewSharedItems($client_id) : [];
|
||||
$activity = clientOverviewActivity($client_id);
|
||||
$money = $access['financial'] ? clientOverviewMoney($client_id, $balance, $recurring_monthly) : null;
|
||||
$open_invoices = $access['sales'] ? clientOverviewOpenInvoices($client_id) : null;
|
||||
|
||||
@@ -206,6 +206,15 @@ if (!$can_support) {
|
||||
unset($contact_tabs['assets'], $contact_tabs['tickets'], $contact_tabs['recurring'], $contact_tabs['licenses'],
|
||||
$contact_tabs['documents'], $contact_tabs['files'], $contact_tabs['services']);
|
||||
}
|
||||
// The parts of ITFlow switched off (Admin > Settings > Modules) - their tabs and New items go
|
||||
$contact_itdoc = moduleOn('itdoc');
|
||||
$contact_ticketing = moduleOn('ticketing');
|
||||
if (!$contact_itdoc) {
|
||||
unset($contact_tabs['assets'], $contact_tabs['credentials'], $contact_tabs['licenses'], $contact_tabs['documents'], $contact_tabs['files'], $contact_tabs['services']);
|
||||
}
|
||||
if (!$contact_ticketing) {
|
||||
unset($contact_tabs['tickets'], $contact_tabs['recurring']);
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
@@ -264,27 +273,31 @@ if (!$can_support) {
|
||||
<button type="button" class="btn btn-primary dropdown-toggle" data-bs-toggle="dropdown"><i class="fas fa-plus me-2"></i>New</button>
|
||||
<div class="dropdown-menu dropdown-menu-end">
|
||||
<?php if ($can_support_edit) { ?>
|
||||
<?php if ($contact_ticketing) { ?>
|
||||
<a class="dropdown-item ajax-modal" href="#" data-modal-url="modals/ticket/ticket_add.php?<?= $client_url ?>&contact_id=<?= $contact_id ?>" data-modal-size="lg">
|
||||
<i class="fas fa-fw fa-life-ring text-secondary me-2"></i>Ticket
|
||||
</a>
|
||||
<a class="dropdown-item ajax-modal" href="#" data-modal-url="modals/recurring_ticket/recurring_ticket_add.php?<?= $client_url ?>&contact_id=<?= $contact_id ?>" data-modal-size="lg">
|
||||
<i class="fas fa-fw fa-redo-alt text-secondary me-2"></i>Recurring Ticket
|
||||
</a>
|
||||
<?php } ?>
|
||||
<?php if (moduleOn('calendar')) { ?>
|
||||
<a class="dropdown-item ajax-modal" href="#" data-modal-url="modals/calendar/calendar_event_add.php?<?= $client_url ?>&contact_id=<?= $contact_id ?>&lock_client=1" data-modal-size="lg">
|
||||
<i class="far fa-fw fa-calendar-plus text-secondary me-2"></i>Meeting
|
||||
</a>
|
||||
<?php } ?>
|
||||
<?php if ($contact_itdoc) { ?>
|
||||
<a class="dropdown-item ajax-modal" href="#" data-modal-size="lg" data-modal-url="modals/asset/asset_add.php?<?= $client_url ?>&contact_id=<?= $contact_id ?>">
|
||||
<i class="fas fa-fw fa-desktop text-secondary me-2"></i>Asset
|
||||
</a>
|
||||
<?php } ?>
|
||||
<?php } ?>
|
||||
<?php if ($can_credentials_edit) { ?>
|
||||
<?php if ($can_credentials_edit && $contact_itdoc) { ?>
|
||||
<a class="dropdown-item ajax-modal" href="#" data-modal-size="lg" data-modal-url="modals/credential/credential_add.php?<?= $client_url ?>&contact_id=<?= $contact_id ?>">
|
||||
<i class="fas fa-fw fa-key text-secondary me-2"></i>Credential
|
||||
</a>
|
||||
<?php } ?>
|
||||
<?php if ($can_support_edit) { ?>
|
||||
<?php if ($can_support_edit && $contact_itdoc) { ?>
|
||||
<a class="dropdown-item ajax-modal" href="#" data-modal-url="modals/document/document_add.php?<?= $client_url ?>&contact_id=<?= $contact_id ?>" data-modal-size="xl">
|
||||
<i class="fas fa-fw fa-file-alt text-secondary me-2"></i>Document
|
||||
</a>
|
||||
@@ -300,6 +313,7 @@ if (!$can_support) {
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
<?php if ($contact_itdoc) { ?>
|
||||
<div class="dropdown">
|
||||
<button type="button" class="btn btn-outline-secondary dropdown-toggle" data-bs-toggle="dropdown"><i class="fas fa-link me-2"></i>Link</button>
|
||||
<div class="dropdown-menu dropdown-menu-end">
|
||||
@@ -317,6 +331,7 @@ if (!$can_support) {
|
||||
<?= linkPickerButton('contact', $contact_id, 'file', 'File', 'dropdown-item', 'fas fa-fw fa-paperclip text-secondary me-2') ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php } ?>
|
||||
<button type="button" class="btn btn-outline-secondary ajax-modal" data-modal-size="lg" data-modal-url="modals/contact/contact_edit.php?id=<?= $contact_id ?>">
|
||||
<i class="fas fa-user-edit me-2"></i>Edit
|
||||
</button>
|
||||
@@ -527,6 +542,7 @@ if (!$can_support) {
|
||||
<div class="tab-content">
|
||||
|
||||
<?php if ($can_support) { ?>
|
||||
<?php if (isset($contact_tabs['assets'])) { ?>
|
||||
<!-- Assets -->
|
||||
<div class="tab-pane fade" id="contact-pane-assets" role="tabpanel">
|
||||
<div class="itflow-asset-pane-bar">
|
||||
@@ -604,8 +620,10 @@ if (!$can_support) {
|
||||
<?php } ?>
|
||||
</div>
|
||||
<?php } ?>
|
||||
<?php } ?>
|
||||
|
||||
<?php if ($can_credentials) { ?>
|
||||
<?php if (isset($contact_tabs['credentials'])) { ?>
|
||||
<!-- Credentials -->
|
||||
<div class="tab-pane fade" id="contact-pane-credentials" role="tabpanel">
|
||||
<div class="itflow-asset-pane-bar">
|
||||
@@ -630,8 +648,10 @@ if (!$can_support) {
|
||||
<?php } ?>
|
||||
</div>
|
||||
<?php } ?>
|
||||
<?php } ?>
|
||||
|
||||
<?php if ($can_support) { ?>
|
||||
<?php if (isset($contact_tabs['tickets'])) { ?>
|
||||
<!-- Tickets -->
|
||||
<div class="tab-pane fade" id="contact-pane-tickets" role="tabpanel">
|
||||
<div class="itflow-asset-pane-bar">
|
||||
@@ -648,6 +668,7 @@ if (!$can_support) {
|
||||
<div class="itflow-asset-empty">No tickets yet.</div>
|
||||
<?php } ?>
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
||||
<?php if ($contact_calls !== null) { ?>
|
||||
<!-- Calls from the phone systems -->
|
||||
@@ -666,6 +687,7 @@ if (!$can_support) {
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
||||
<?php if (isset($contact_tabs['recurring'])) { ?>
|
||||
<!-- Recurring tickets -->
|
||||
<div class="tab-pane fade" id="contact-pane-recurring" role="tabpanel">
|
||||
<div class="itflow-asset-pane-bar">
|
||||
@@ -728,8 +750,10 @@ if (!$can_support) {
|
||||
<?php } ?>
|
||||
</div>
|
||||
<?php } ?>
|
||||
<?php } ?>
|
||||
|
||||
<?php if ($can_support) { ?>
|
||||
<?php if (isset($contact_tabs['licenses'])) { ?>
|
||||
<!-- Licenses -->
|
||||
<div class="tab-pane fade" id="contact-pane-licenses" role="tabpanel">
|
||||
<div class="itflow-asset-pane-bar">
|
||||
@@ -750,8 +774,10 @@ if (!$can_support) {
|
||||
<?php } ?>
|
||||
</div>
|
||||
<?php } ?>
|
||||
<?php } ?>
|
||||
|
||||
<?php if ($can_support) { ?>
|
||||
<?php if (isset($contact_tabs['documents'])) { ?>
|
||||
<!-- Documents -->
|
||||
<div class="tab-pane fade" id="contact-pane-documents" role="tabpanel">
|
||||
<div class="itflow-asset-pane-bar">
|
||||
@@ -790,7 +816,9 @@ if (!$can_support) {
|
||||
<div class="itflow-asset-empty">No documents.</div>
|
||||
<?php } ?>
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
||||
<?php if (isset($contact_tabs['files'])) { ?>
|
||||
<!-- Files -->
|
||||
<div class="tab-pane fade" id="contact-pane-files" role="tabpanel">
|
||||
<div class="itflow-asset-pane-bar">
|
||||
@@ -827,7 +855,9 @@ if (!$can_support) {
|
||||
<div class="itflow-asset-empty">No files.</div>
|
||||
<?php } ?>
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
||||
<?php if (isset($contact_tabs['services'])) { ?>
|
||||
<!-- Services -->
|
||||
<div class="tab-pane fade" id="contact-pane-services" role="tabpanel">
|
||||
<div class="itflow-asset-pane-bar">
|
||||
@@ -845,6 +875,7 @@ if (!$can_support) {
|
||||
<?php } ?>
|
||||
</div>
|
||||
<?php } ?>
|
||||
<?php } ?>
|
||||
|
||||
<!-- History, from the audit log -->
|
||||
<div class="tab-pane fade" id="contact-pane-history" role="tabpanel">
|
||||
|
||||
@@ -404,6 +404,7 @@ if (!$contract || ($client_url && intval($contract['contract_client_id']) !== in
|
||||
?></div>
|
||||
</div>
|
||||
</div>
|
||||
<?php if (moduleOn('ticketing')) { // SLAs are ticketing's ?>
|
||||
<div class="small text-body-secondary text-uppercase fw-semibold mt-3 mb-1">SLA by priority</div>
|
||||
<div class="table-responsive">
|
||||
<table class="table table-sm table-borderless mb-0" data-contract-slas>
|
||||
@@ -430,6 +431,7 @@ if (!$contract || ($client_url && intval($contract['contract_client_id']) !== in
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<?php } ?>
|
||||
</div>
|
||||
<div class="card-footer small text-body-secondary" data-contract-in-force>
|
||||
<i class="fas fa-fw <?= $in_force ? 'fa-check-circle text-success' : 'fa-info-circle' ?> me-1"></i>
|
||||
@@ -556,7 +558,7 @@ if (!$contract || ($client_url && intval($contract['contract_client_id']) !== in
|
||||
$reference = $use['ticket_prefix'] . $use['ticket_number']; ?>
|
||||
<li class="list-group-item px-0 d-flex align-items-center gap-2">
|
||||
<div class="flex-grow-1 min-w-0">
|
||||
<a class="d-block text-truncate" href="ticket.php?client_id=<?= $client_id ?>&ticket_id=<?= intval($use['ticket_id']) ?>"><span class="font-monospace small me-1"><?= escapeHtml($reference) ?></span><?= escapeHtml($use['ticket_subject']) ?></a>
|
||||
<?= moduleLink('ticketing', "ticket.php?client_id=$client_id&ticket_id=" . intval($use['ticket_id']), '<span class="font-monospace small me-1">' . escapeHtml($reference) . '</span>' . escapeHtml($use['ticket_subject']), 'class="d-block text-truncate"') ?>
|
||||
<div class="small text-body-secondary">
|
||||
Drawn <?= escapeHtml(date('M j, Y', strtotime($use['drawn_at']))) ?>
|
||||
<?= intval($use['covered']) ? '' : ' · <span class="text-warning-emphasis">part - the rest is billed</span>' ?>
|
||||
|
||||
@@ -24,7 +24,7 @@ if (!isset($period_options[$period_key])) {
|
||||
}
|
||||
$period = dashboardPeriod($period_key);
|
||||
|
||||
$attention = ($access['tickets'] || $access['sales'] || $access['support']) ? dashboardAttention($access) : null;
|
||||
$attention = ($access['tickets'] || $access['sales'] || $access['itdoc']) ? dashboardAttention($access) : null;
|
||||
$my_tickets = $access['tickets'] ? dashboardMyTickets(8) : null;
|
||||
$money_cards = $show_money ? dashboardMoneyCards($access, $period) : [];
|
||||
$schedule = $access['tickets'] ? dashboardSchedule() : null;
|
||||
|
||||
@@ -7,15 +7,15 @@
|
||||
*/
|
||||
?>
|
||||
<div class="dropdown-menu">
|
||||
<?php if (lookupUserPermission("module_support") >= 2) { ?>
|
||||
<?php if (lookupUserPermission("module_support") >= 2 && moduleOn('ticketing')) { ?>
|
||||
<a class="dropdown-item ajax-modal" href="#" data-modal-url="modals/ticket/ticket_add.php?client_id=<?= $client_id ?>" data-modal-size="lg">
|
||||
<i class="fas fa-fw fa-life-ring me-2"></i>New Ticket
|
||||
</a>
|
||||
<a class="dropdown-item ajax-modal" href="#" data-modal-url="modals/project/project_add.php?client_id=<?= $client_id ?>" data-modal-size="lg">
|
||||
<i class="fas fa-fw fa-project-diagram me-2"></i>New Project
|
||||
</a>
|
||||
<div class="dropdown-divider"></div>
|
||||
<?php } ?>
|
||||
<div class="dropdown-divider"></div>
|
||||
<a class="dropdown-item ajax-modal" href="#"
|
||||
data-modal-url="modals/client/client_edit.php?id=<?= $client_id ?>">
|
||||
<i class="fas fa-fw fa-edit me-2"></i>Edit Client
|
||||
@@ -39,7 +39,7 @@
|
||||
</a>
|
||||
<?php } ?>
|
||||
<?php } ?>
|
||||
<?php if (lookupUserPermission("module_sales") >= 2) { ?>
|
||||
<?php if (lookupUserPermission("module_sales") >= 2 && moduleOn('accounting')) { ?>
|
||||
<?php if ($show_add_credit) { ?>
|
||||
<div class="dropdown-divider"></div>
|
||||
<a class="dropdown-item" href="#" data-bs-toggle="modal" data-bs-target="#addCreditModal">
|
||||
|
||||
@@ -78,7 +78,7 @@ $guest_url = billingGuestUrl('invoice', $invoice);
|
||||
// Done long enough ago, its link no longer opens it - emailing it again does (functions/guest_link.php)
|
||||
$guest_expired = guestLinkExpired('invoice', $invoice['invoice_id']);
|
||||
// Hardware sold on it, and how much of it is on the client's assets (functions/products.php)
|
||||
$can_see_assets = lookupUserPermission('module_support') >= 1;
|
||||
$can_see_assets = lookupUserPermission('module_support') >= 1 && moduleOn('itdoc');
|
||||
$hardware = $can_see_assets ? productInvoiceHardware($invoice_id) : [];
|
||||
$hardware_units = array_sum(array_column($hardware, 'units'));
|
||||
$hardware_to_add = $status === 'Cancelled' ? 0 : array_sum(array_column($hardware, 'to_add'));
|
||||
@@ -467,7 +467,7 @@ echo agentBannersHtml($client_id);
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
||||
<?php if ($tickets || $unbilled_tickets) { ?>
|
||||
<?php if (($tickets || $unbilled_tickets) && moduleOn('ticketing')) { ?>
|
||||
<div class="card mb-3">
|
||||
<div class="card-header d-flex align-items-center">
|
||||
<h3 class="card-title mb-0 me-auto"><i class="fas fa-fw fa-life-ring text-secondary me-2"></i>Tickets <span class="badge rounded-pill bg-secondary-subtle text-secondary-emphasis fw-normal ms-1"><?= count($tickets) ?></span></h3>
|
||||
|
||||
@@ -54,7 +54,7 @@ $recurring_query = $recurring_filter ? "AND invoice_recurring_invoice_id = $recu
|
||||
$recurring_filter_row = $recurring_filter ? billingRow('recurring', $recurring_filter) : null;
|
||||
|
||||
// Hardware sold on them that isn't on the client's assets yet (functions/products.php)
|
||||
$hardware_filter = !empty($_GET['hardware']);
|
||||
$hardware_filter = !empty($_GET['hardware']) && moduleOn('itdoc');
|
||||
$hardware_query = $hardware_filter ? "AND " . productHardwareInvoiceSql() . " AND invoices.invoice_id IN (SELECT invoice_items.item_invoice_id FROM invoice_items
|
||||
JOIN products ON products.product_id = invoice_items.item_product_id " . productHardwareMadeJoinSql() . " WHERE " . productHardwareShortSql() . ")" : '';
|
||||
|
||||
|
||||
@@ -151,9 +151,11 @@ if (!$license || ($client_url && intval($license['software_client_id']) !== intv
|
||||
<div class="dropdown">
|
||||
<button type="button" class="btn btn-primary dropdown-toggle" data-bs-toggle="dropdown"><i class="fas fa-plus me-2"></i>New</button>
|
||||
<div class="dropdown-menu dropdown-menu-end">
|
||||
<?php if (moduleOn('ticketing')) { ?>
|
||||
<a class="dropdown-item ajax-modal" href="#" data-modal-size="lg" data-modal-url="<?= escapeHtml($renewal_ticket_url) ?>">
|
||||
<i class="fas fa-fw fa-life-ring text-secondary me-2"></i>Renewal Ticket
|
||||
</a>
|
||||
<?php } ?>
|
||||
<a class="dropdown-item ajax-modal" href="#" data-modal-url="modals/software/software_key_add.php?software_id=<?= $software_id ?>">
|
||||
<i class="fas fa-fw fa-key text-secondary me-2"></i>Keys
|
||||
</a>
|
||||
|
||||
@@ -130,6 +130,15 @@ if (!$location || ($client_url && intval($location['location_client_id']) !== in
|
||||
if (!$can_support) {
|
||||
unset($location_tabs['assets'], $location_tabs['networks'], $location_tabs['racks'], $location_tabs['tickets'], $location_tabs['documents'], $location_tabs['files']);
|
||||
}
|
||||
// The parts of ITFlow switched off (Admin > Settings > Modules) - their tabs and New items go
|
||||
$location_itdoc = moduleOn('itdoc');
|
||||
$location_ticketing = moduleOn('ticketing');
|
||||
if (!$location_itdoc) {
|
||||
unset($location_tabs['assets'], $location_tabs['networks'], $location_tabs['racks'], $location_tabs['documents'], $location_tabs['files']);
|
||||
}
|
||||
if (!$location_ticketing) {
|
||||
unset($location_tabs['tickets']);
|
||||
}
|
||||
|
||||
$move_url = "modals/location/location_assign.php?id=$location_id&kind=";
|
||||
$unset_url = function ($kind, $id) use ($location_id) {
|
||||
@@ -186,7 +195,7 @@ if (!$location || ($client_url && intval($location['location_client_id']) !== in
|
||||
<div class="dropdown">
|
||||
<button type="button" class="btn btn-primary dropdown-toggle" data-bs-toggle="dropdown"><i class="fas fa-plus me-2"></i>New</button>
|
||||
<div class="dropdown-menu dropdown-menu-end">
|
||||
<?php if ($can_support_edit) { ?>
|
||||
<?php if ($can_support_edit && $location_ticketing) { ?>
|
||||
<a class="dropdown-item ajax-modal" href="#" data-modal-size="lg" data-modal-url="modals/ticket/ticket_add.php?client_id=<?= $client_id ?>&location_id=<?= $location_id ?>">
|
||||
<i class="fas fa-fw fa-life-ring text-secondary me-2"></i>Ticket Here
|
||||
</a>
|
||||
@@ -201,7 +210,7 @@ if (!$location || ($client_url && intval($location['location_client_id']) !== in
|
||||
<i class="fas fa-fw fa-user text-secondary me-2"></i>Contact
|
||||
</a>
|
||||
<?php } ?>
|
||||
<?php if ($can_support_edit) { ?>
|
||||
<?php if ($can_support_edit && $location_itdoc) { ?>
|
||||
<a class="dropdown-item ajax-modal" href="#" data-modal-size="lg" data-modal-url="modals/asset/asset_add.php?client_id=<?= $client_id ?>&location_id=<?= $location_id ?>">
|
||||
<i class="fas fa-fw fa-desktop text-secondary me-2"></i>Asset
|
||||
</a>
|
||||
@@ -233,12 +242,12 @@ if (!$location || ($client_url && intval($location['location_client_id']) !== in
|
||||
<button type="button" class="btn btn-outline-secondary dropdown-toggle" data-bs-toggle="dropdown"><i class="fas fa-dolly me-2"></i>Move Here</button>
|
||||
<div class="dropdown-menu dropdown-menu-end">
|
||||
<?php foreach (LOCATION_KINDS as $kind => $k) {
|
||||
if (lookupUserPermission($k['module']) < 2) {
|
||||
if (lookupUserPermission($k['module']) < 2 || ($kind !== 'contact' && !$location_itdoc)) {
|
||||
continue;
|
||||
} ?>
|
||||
<a class="dropdown-item ajax-modal" href="#" data-modal-url="<?= $move_url . $kind ?>"><i class="fas fa-fw <?= $k['icon'] ?> text-secondary me-2"></i><?= $k['plural'] ?></a>
|
||||
<?php } ?>
|
||||
<?php if ($can_support_edit) { ?>
|
||||
<?php if ($can_support_edit && $location_itdoc) { ?>
|
||||
<div class="dropdown-divider"></div>
|
||||
<?= linkPickerButton('location', $location_id, '', 'Link a document or file', 'dropdown-item', 'fas fa-fw fa-link text-secondary me-2') ?>
|
||||
<?php } ?>
|
||||
@@ -431,6 +440,7 @@ if (!$location || ($client_url && intval($location['location_client_id']) !== in
|
||||
</div>
|
||||
|
||||
<?php if ($can_support) { ?>
|
||||
<?php if (isset($location_tabs['assets'])) { ?>
|
||||
<!-- Assets on site -->
|
||||
<div class="tab-pane fade" id="location-pane-assets" role="tabpanel">
|
||||
<div class="itflow-asset-pane-bar">
|
||||
@@ -477,7 +487,9 @@ if (!$location || ($client_url && intval($location['location_client_id']) !== in
|
||||
<div class="itflow-asset-empty">No assets here.</div>
|
||||
<?php } ?>
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
||||
<?php if (isset($location_tabs['networks'])) { ?>
|
||||
<!-- Networks -->
|
||||
<div class="tab-pane fade" id="location-pane-networks" role="tabpanel">
|
||||
<div class="itflow-asset-pane-bar">
|
||||
@@ -525,7 +537,9 @@ if (!$location || ($client_url && intval($location['location_client_id']) !== in
|
||||
<div class="itflow-asset-empty">No networks here.</div>
|
||||
<?php } ?>
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
||||
<?php if (isset($location_tabs['racks'])) { ?>
|
||||
<!-- Racks -->
|
||||
<div class="tab-pane fade" id="location-pane-racks" role="tabpanel">
|
||||
<div class="itflow-asset-pane-bar">
|
||||
@@ -557,7 +571,9 @@ if (!$location || ($client_url && intval($location['location_client_id']) !== in
|
||||
<div class="itflow-asset-empty">No racks here.</div>
|
||||
<?php } ?>
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
||||
<?php if (isset($location_tabs['tickets'])) { ?>
|
||||
<!-- Tickets for this site -->
|
||||
<div class="tab-pane fade" id="location-pane-tickets" role="tabpanel">
|
||||
<div class="itflow-asset-pane-bar">
|
||||
@@ -575,10 +591,14 @@ if (!$location || ($client_url && intval($location['location_client_id']) !== in
|
||||
<div class="itflow-asset-empty">No tickets for this site.</div>
|
||||
<?php } ?>
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
||||
<!-- Documents and files -->
|
||||
<?php foreach (['documents' => ['document', $documents, 'Floor plans, site runbooks, cabling and access guides.', 'No documents linked.'],
|
||||
'files' => ['file', $files, 'Photos of the cupboard and the patch panel, plans, leases.', 'No files linked.']] as $pane => [$to, $linked, $hint, $empty]) { ?>
|
||||
'files' => ['file', $files, 'Photos of the cupboard and the patch panel, plans, leases.', 'No files linked.']] as $pane => [$to, $linked, $hint, $empty]) {
|
||||
if (!isset($location_tabs[$pane])) {
|
||||
continue;
|
||||
} ?>
|
||||
<div class="tab-pane fade" id="location-pane-<?= $pane ?>" role="tabpanel">
|
||||
<div class="itflow-asset-pane-bar">
|
||||
<span class="text-body-secondary small"><?= $hint ?></span>
|
||||
|
||||
@@ -77,7 +77,7 @@ ob_start();
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<?php if ($counts['open_tickets']) { ?>
|
||||
<?php if ($counts['open_tickets'] && moduleOn('ticketing')) { ?>
|
||||
<div class="small text-body-secondary"><i class="fas fa-exclamation-triangle text-warning me-1"></i><?= $plural($counts['open_tickets'], 'ticket is', 'tickets are') ?> still open - <a href="tickets.php?client_id=<?= $client_id ?>">resolve or close them</a> as you finish the work.</div>
|
||||
<?php } ?>
|
||||
|
||||
|
||||
@@ -115,6 +115,14 @@ while ($row = mysqli_fetch_assoc($sql_note_type_icons)) {
|
||||
$note_type_icons[$row['category_name']] = escapeHtml($row['category_icon']);
|
||||
}
|
||||
|
||||
// The parts of ITFlow switched off (Admin > Settings > Modules) - none of their tabs
|
||||
if (!moduleOn('itdoc')) {
|
||||
$asset_count = $credential_count = $software_count = $document_count = $file_count = 0;
|
||||
}
|
||||
if (!moduleOn('ticketing')) {
|
||||
$ticket_count = $ticket_open_count = $recurring_ticket_count = 0;
|
||||
}
|
||||
|
||||
// Only the tabs with something in them - same order as the contact page
|
||||
$quick_tabs = array_filter([
|
||||
'assets' => ['label' => 'Assets', 'count' => $asset_count],
|
||||
|
||||
@@ -310,6 +310,12 @@ $tab = 'contractTab' . bin2hex(random_bytes(3));
|
||||
</div>
|
||||
<small class="text-secondary d-block mb-3">While the contract is in force, time bills at these rates - the after-hours one for tickets opened outside business hours - and new invoices are due on these terms. Leave one empty and the default in Admin > Settings > Defaults applies - a rate of 0 bills that time at nothing.</small>
|
||||
|
||||
<?php if (!moduleOn('ticketing')) {
|
||||
// SLAs are ticketing's - kept as they are while it is switched off (Admin > Settings > Modules)
|
||||
foreach (CONTRACT_SLA_PRIORITIES as $priority => $part) { ?>
|
||||
<input type="hidden" name="sla_<?= $part ?>" value="<?= intval($c_value("sla_{$part}_id", 0)) ?>" data-contract-field="sla_<?= $part ?>">
|
||||
<?php }
|
||||
} else { ?>
|
||||
<label class="form-label">SLA by ticket priority</label>
|
||||
<?php foreach (CONTRACT_SLA_PRIORITIES as $priority => $part) { ?>
|
||||
<div class="input-group mb-2">
|
||||
@@ -323,6 +329,7 @@ $tab = 'contractTab' . bin2hex(random_bytes(3));
|
||||
</div>
|
||||
<?php } ?>
|
||||
<div class="form-text">From Admin > SLAs. While the contract is in force, the client's new tickets get them, and the default for a priority left on the default.</div>
|
||||
<?php } ?>
|
||||
</div>
|
||||
|
||||
<div class="tab-pane fade" id="<?= $tab ?>Terms" role="tabpanel">
|
||||
|
||||
@@ -53,6 +53,13 @@ if ($can_support) {
|
||||
}
|
||||
$open_tickets = ticketRows("tickets.ticket_location_id = $location_id AND " . TICKET_OPEN_SQL);
|
||||
}
|
||||
// The parts of ITFlow switched off (Admin > Settings > Modules) - none of their tabs
|
||||
if (!moduleOn('itdoc')) {
|
||||
$assets = $networks = [];
|
||||
}
|
||||
if (!moduleOn('ticketing')) {
|
||||
$open_tickets = [];
|
||||
}
|
||||
|
||||
$quick_tabs = array_filter([
|
||||
'people' => ['label' => 'People', 'count' => count($people)],
|
||||
|
||||
@@ -163,7 +163,7 @@ ob_start();
|
||||
<dt>Assigned</dt>
|
||||
<dd><?= formatAssignee($ticket['ticket_assigned_to'], $ticket['user_name'], $ticket['user_avatar'], $is_open) ?></dd>
|
||||
|
||||
<?php if (intval($ticket['ticket_asset_id']) && $ticket['asset_name'] !== null) { ?>
|
||||
<?php if (intval($ticket['ticket_asset_id']) && $ticket['asset_name'] !== null && moduleOn('itdoc')) { ?>
|
||||
<dt>Asset</dt>
|
||||
<dd><a class="ajax-modal" href="#" data-modal-size="lg" data-modal-url="modals/asset/asset.php?id=<?= intval($ticket['ticket_asset_id']) ?>"><i class="fas fa-desktop text-body-secondary me-1"></i><?= escapeHtml($ticket['asset_name']) ?></a></dd>
|
||||
<?php } ?>
|
||||
|
||||
13
agent/modals/vendor/vendor.php
vendored
13
agent/modals/vendor/vendor.php
vendored
@@ -64,7 +64,14 @@ if ($can_support) {
|
||||
if ($can_credentials && $client_id) {
|
||||
$logins = linkedRecords('vendor', $vendor_id, 'credential');
|
||||
}
|
||||
$spend = !$client_id && $can_financial ? vendorSpend($vendor_id) : null;
|
||||
$spend = !$client_id && $can_financial && moduleOn('accounting') ? vendorSpend($vendor_id) : null;
|
||||
// The parts of ITFlow switched off (Admin > Settings > Modules) - none of their tabs
|
||||
if (!moduleOn('itdoc')) {
|
||||
$licenses = $assets = $logins = [];
|
||||
}
|
||||
if (!moduleOn('ticketing')) {
|
||||
$cases = [];
|
||||
}
|
||||
|
||||
$quick_tabs = array_filter([
|
||||
'cases' => ['label' => 'Open cases', 'count' => count($cases)],
|
||||
@@ -170,7 +177,7 @@ ob_start();
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php if ($vendor_dial || $vendor_email || $vendor_website_url || ($client_id && $can_support_edit && !$vendor_archived)) { ?>
|
||||
<?php if ($vendor_dial || $vendor_email || $vendor_website_url || ($client_id && $can_support_edit && !$vendor_archived && moduleOn('ticketing'))) { ?>
|
||||
<div class="d-flex flex-wrap gap-2 mt-3">
|
||||
<?php if ($vendor_dial) { ?>
|
||||
<a class="btn btn-sm btn-outline-primary" href="tel:<?= escapeHtml($vendor_dial) ?><?= $vendor['vendor_extension'] ? ',' . escapeHtml($vendor['vendor_extension']) : '' ?>"><i class="fas fa-phone me-1"></i>Call Support</a>
|
||||
@@ -181,7 +188,7 @@ ob_start();
|
||||
<?php if ($vendor_website_url) { ?>
|
||||
<a class="btn btn-sm btn-outline-primary" href="<?= escapeHtml($vendor_website_url) ?>" target="_blank" rel="noopener"><i class="fas fa-external-link-alt me-1"></i>Support Site</a>
|
||||
<?php } ?>
|
||||
<?php if ($client_id && $can_support_edit && !$vendor_archived) { ?>
|
||||
<?php if ($client_id && $can_support_edit && !$vendor_archived && moduleOn('ticketing')) { ?>
|
||||
<a class="btn btn-sm btn-outline-secondary ajax-modal" href="#" data-modal-size="lg" data-modal-url="modals/ticket/ticket_add.php?client_id=<?= $client_id ?>&vendor_id=<?= $vendor_id ?>"><i class="fas fa-life-ring me-1"></i>New Case</a>
|
||||
<?php } ?>
|
||||
</div>
|
||||
|
||||
@@ -114,7 +114,7 @@ echo agentBannersHtml($client_id);
|
||||
<?php if (trim((string) $quote['quote_scope']) !== '') { ?><span><i class="fas fa-fw fa-comment me-1"></i><?= escapeHtml($quote['quote_scope']) ?></span><?php } ?>
|
||||
<?php if ($quote['category_name']) { ?><span><i class="fas fa-fw fa-tag me-1"></i><?= escapeHtml($quote['category_name']) ?></span><?php } ?>
|
||||
<?php if ($ticket) { ?>
|
||||
<span><i class="fas fa-fw fa-life-ring me-1"></i>For <a class="text-reset" href="ticket.php?ticket_id=<?= intval($ticket['ticket_id']) ?>"><?= escapeHtml($ticket['ticket_prefix'] . $ticket['ticket_number']) ?></a></span>
|
||||
<span><i class="fas fa-fw fa-life-ring me-1"></i>For <?= moduleLink('ticketing', 'ticket.php?ticket_id=' . intval($ticket['ticket_id']), escapeHtml($ticket['ticket_prefix'] . $ticket['ticket_number']), 'class="text-reset"') ?></span>
|
||||
<?php } ?>
|
||||
<span title="<?= formatDateTime($quote['quote_created_at']) ?>"><i class="far fa-fw fa-clock me-1"></i>Created <?= escapeHtml(timeAgo($quote['quote_created_at'])) ?></span>
|
||||
</div>
|
||||
@@ -318,7 +318,11 @@ echo agentBannersHtml($client_id);
|
||||
<div class="list-group-item d-flex align-items-center gap-2">
|
||||
<?= fileTypeTile($file['file_ext'], 'sm') ?>
|
||||
<div class="flex-grow-1 min-w-0">
|
||||
<a class="ajax-modal text-break" href="#" data-modal-size="lg" data-modal-url="modals/file/file.php?id=<?= $file_id ?>"><?= escapeHtml($file['file_name']) ?></a>
|
||||
<?php if (moduleOn('itdoc')) { ?>
|
||||
<a class="ajax-modal text-break" href="#" data-modal-size="lg" data-modal-url="modals/file/file.php?id=<?= $file_id ?>"><?= escapeHtml($file['file_name']) ?></a>
|
||||
<?php } else { // The quick look is IT documentation's; the download stays ?>
|
||||
<span class="text-break"><?= escapeHtml($file['file_name']) ?></span>
|
||||
<?php } ?>
|
||||
<div class="small text-body-secondary"><?= formatBytes(intval($file['file_size'])) ?> · <span title="<?= formatDateTime($file['file_created_at']) ?>"><?= escapeHtml(timeAgo($file['file_created_at'])) ?></span></div>
|
||||
</div>
|
||||
<a class="btn btn-sm btn-link text-body-secondary" href="file.php?file_id=<?= $file_id ?>" title="Download"><i class="fas fa-fw fa-download"></i></a>
|
||||
|
||||
@@ -240,7 +240,7 @@ if ($client) {
|
||||
$advice[] = ['info', 'fa-tags', '<strong>' . escapeHtml($top['label']) . ' was ' . reportPercent(reportShare($top['value'], $t['opened'], 0)) . ' of tickets</strong> (' . reportCount($top['value']) . ').
|
||||
Fixing the cause, or some training, could cut that down.', ''];
|
||||
}
|
||||
if ($t && $t['assets'] && intval($t['assets'][0]['n']) >= 3) {
|
||||
if ($t && $itdoc && $t['assets'] && intval($t['assets'][0]['n']) >= 3) {
|
||||
$asset = $t['assets'][0];
|
||||
$advice[] = ['info', 'fa-redo', '<strong>' . escapeHtml($asset['asset_name']) . ' was on ' . reportCount(intval($asset['n'])) . ' tickets.</strong> Worth repairing properly or replacing.',
|
||||
'/agent/asset.php?client_id=' . $client_id . '&asset_id=' . intval($asset['asset_id'])];
|
||||
@@ -573,8 +573,8 @@ $header = [
|
||||
<?php } ?>
|
||||
|
||||
<p class="small text-body-secondary">
|
||||
Times run on the clock from when a ticket was raised; "typical" is the middle ticket, so a few long ones do not skew it. The SLA counts business hours.
|
||||
Hardware age runs from the purchase date, else the install date.
|
||||
<?php if ($ticketing) { ?>Times run on the clock from when a ticket was raised; "typical" is the middle ticket, so a few long ones do not skew it. The SLA counts business hours.<?php } ?>
|
||||
<?php if ($itdoc) { ?>Hardware age runs from the purchase date, else the install date.<?php } ?>
|
||||
</p>
|
||||
|
||||
<?php } ?>
|
||||
|
||||
@@ -132,6 +132,10 @@ if (!$service || ($client_url && intval($service['service_client_id']) !== intva
|
||||
if (!$can_credentials) {
|
||||
unset($service_tabs['logins']);
|
||||
}
|
||||
// Ticketing switched off (Admin > Settings > Modules) - no tickets about it
|
||||
if (!moduleOn('ticketing')) {
|
||||
unset($service_tabs['tickets']);
|
||||
}
|
||||
$unlink_url = function ($to, $other_id) use ($service_id) {
|
||||
return "post.php?unlink_item&from=service&id=$service_id&to=$to&other=" . intval($other_id) . "&csrf_token=" . $_SESSION['csrf_token'];
|
||||
};
|
||||
@@ -184,9 +188,11 @@ if (!$service || ($client_url && intval($service['service_client_id']) !== intva
|
||||
|
||||
<div class="d-flex flex-wrap gap-2 d-print-none">
|
||||
<?php if ($can_edit) { ?>
|
||||
<?php if (isset($service_tabs['tickets'])) { ?>
|
||||
<button type="button" class="btn btn-outline-danger ajax-modal" data-modal-size="lg" data-modal-url="<?= escapeHtml($report_url) ?>">
|
||||
<i class="fas fa-life-ring me-2"></i>Report a Problem
|
||||
</button>
|
||||
<?php } ?>
|
||||
<div class="dropdown">
|
||||
<button type="button" class="btn btn-outline-secondary dropdown-toggle" data-bs-toggle="dropdown"><i class="fas fa-link me-2"></i>Link</button>
|
||||
<div class="dropdown-menu dropdown-menu-end">
|
||||
@@ -592,6 +598,7 @@ if (!$service || ($client_url && intval($service['service_client_id']) !== intva
|
||||
<?php } ?>
|
||||
</div>
|
||||
|
||||
<?php if (isset($service_tabs['tickets'])) { ?>
|
||||
<!-- Tickets about it, or about what it runs on -->
|
||||
<div class="tab-pane fade" id="service-pane-tickets" role="tabpanel">
|
||||
<div class="itflow-asset-pane-bar">
|
||||
@@ -623,6 +630,7 @@ if (!$service || ($client_url && intval($service['service_client_id']) !== intva
|
||||
<div class="itflow-asset-empty">No tickets about it or what it runs on.</div>
|
||||
<?php } ?>
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
||||
<!-- History, from the audit log -->
|
||||
<div class="tab-pane fade" id="service-pane-history" role="tabpanel">
|
||||
|
||||
@@ -387,9 +387,11 @@ $link_icons = ['asset' => ['fa-desktop', 'asset', 'assets'], 'credential' => ['f
|
||||
<i class="fas fa-fw fa-external-link-alt text-secondary me-2"></i>Open in a New Tab
|
||||
</a>
|
||||
<?php if ($can_edit && !$is_archived) { ?>
|
||||
<?php if (moduleOn('ticketing')) { ?>
|
||||
<a class="dropdown-item ajax-modal" href="#" data-modal-size="lg" data-modal-url="<?= escapeHtml('modals/ticket/ticket_add.php?' . http_build_query(['client_id' => $row_client_id, 'service_id' => $service_id])) ?>">
|
||||
<i class="fas fa-fw fa-life-ring text-secondary me-2"></i>Report a Problem
|
||||
</a>
|
||||
<?php } ?>
|
||||
<a class="dropdown-item ajax-modal" href="#" data-modal-size="lg" data-modal-url="modals/service/service_edit.php?id=<?= $service_id ?>">
|
||||
<i class="fas fa-fw fa-edit text-secondary me-2"></i>Edit
|
||||
</a>
|
||||
|
||||
@@ -245,7 +245,7 @@ $provider = smsProvider();
|
||||
<div class="text-body-secondary"><?= escapeHtml(date('M j, g:i A', strtotime($row['sms_message_created_at']))) ?></div>
|
||||
</td>
|
||||
<td class="text-end pe-3 text-nowrap">
|
||||
<?php if ($show === 'unmatched' && $can_work) { ?>
|
||||
<?php if ($show === 'unmatched' && $can_work && moduleOn('ticketing')) { ?>
|
||||
<button type="button" class="btn btn-sm btn-primary ajax-modal" data-modal-url="modals/sms/sms_ticket_open.php?id=<?= $message_id ?>"><i class="fas fa-fw fa-life-ring me-1"></i><span class="d-none d-sm-inline">Open Ticket</span></button>
|
||||
<?php } ?>
|
||||
<?php if (($show !== 'codes' && $can_work) || ($codes && $can_codes)) { ?>
|
||||
|
||||
@@ -1883,9 +1883,12 @@ if (isset($_GET['ticket_id'])) {
|
||||
-->
|
||||
<?php
|
||||
$can_link = $can_edit_ticket && !$ticket_is_closed;
|
||||
// Its assets and services are IT documentation - not shown while that is switched off (Admin > Settings > Modules)
|
||||
$ticket_itdoc = moduleOn('itdoc');
|
||||
$ticket_asset_shown = $ticket_itdoc ? $asset_id : 0;
|
||||
// The services it is about - raised for them, or through its assets
|
||||
$ticket_services = $client_id ? ticketServices($ticket_id) : [];
|
||||
$has_links = $asset_id || $vendor_id || $project_id || $cc_count || $ticket_services;
|
||||
$ticket_services = $client_id && $ticket_itdoc ? ticketServices($ticket_id) : [];
|
||||
$has_links = $ticket_asset_shown || $vendor_id || $project_id || $cc_count || $ticket_services;
|
||||
if ($has_links || $can_link) { ?>
|
||||
<div class="card mb-3">
|
||||
<div class="card-header px-3 py-2">
|
||||
@@ -1898,16 +1901,18 @@ if (isset($_GET['ticket_id'])) {
|
||||
</button>
|
||||
<div class="dropdown-menu">
|
||||
<?php if ($client_id) { ?>
|
||||
<?php if ($ticket_itdoc) { ?>
|
||||
<a class="dropdown-item ajax-modal" href="#" data-modal-url="modals/ticket/ticket_edit_asset.php?id=<?= $ticket_id ?>">
|
||||
<i class="fas fa-fw fa-desktop me-2"></i><?= $asset_id ? 'Change assets' : 'Add asset' ?>
|
||||
</a>
|
||||
<?php } ?>
|
||||
<a class="dropdown-item ajax-modal" href="#" data-modal-url="modals/ticket/ticket_edit_vendor.php?ticket_id=<?= $ticket_id ?>">
|
||||
<i class="fas fa-fw fa-building me-2"></i><?= $vendor_id ? 'Change vendor' : 'Add vendor' ?>
|
||||
</a>
|
||||
<a class="dropdown-item ajax-modal" href="#" data-modal-url="modals/ticket/ticket_edit_project.php?id=<?= $ticket_id ?>">
|
||||
<i class="fas fa-fw fa-project-diagram me-2"></i><?= $project_id ? 'Change project' : 'Add to a project' ?>
|
||||
</a>
|
||||
<?= linkPickerButton('ticket', $ticket_id, 'service', 'Link a service', 'dropdown-item', 'fas fa-fw fa-stream me-2') ?>
|
||||
<?php if ($ticket_itdoc) { ?><?= linkPickerButton('ticket', $ticket_id, 'service', 'Link a service', 'dropdown-item', 'fas fa-fw fa-stream me-2') ?><?php } ?>
|
||||
<div class="dropdown-divider"></div>
|
||||
<?php } ?>
|
||||
<a class="dropdown-item ajax-modal" href="#" data-modal-url="modals/ticket/ticket_add_cc.php?ticket_id=<?= $ticket_id ?>">
|
||||
@@ -1924,10 +1929,10 @@ if (isset($_GET['ticket_id'])) {
|
||||
<div class="card-body p-3">
|
||||
|
||||
<?php if (!$has_links) { ?>
|
||||
<div class="text-body-secondary small">Nothing linked yet. Use <i class="fas fa-fw fa-plus"></i> to add an asset, vendor, project, service or CC.</div>
|
||||
<div class="text-body-secondary small">Nothing linked yet. Use <i class="fas fa-fw fa-plus"></i> to add <?= $ticket_itdoc ? 'an asset, vendor, project, service or CC' : 'a vendor, project or CC' ?>.</div>
|
||||
<?php } ?>
|
||||
|
||||
<?php if ($asset_id) { ?>
|
||||
<?php if ($ticket_asset_shown) { ?>
|
||||
<div class="ticket-link-heading">Assets</div>
|
||||
<div class="mt-1 text-truncate">
|
||||
<a class="ajax-modal" href="#" data-modal-size="lg" data-modal-url="modals/asset/asset.php?<?= $client_url ?>&id=<?= $asset_id ?>" title="<?= $asset_name ?>">
|
||||
@@ -1960,7 +1965,7 @@ if (isset($_GET['ticket_id'])) {
|
||||
$vendor_website_url = vendorWebsiteUrl($ticket['vendor_website']);
|
||||
$vendor_when = escapeHtml(implode(' · ', array_filter([$ticket['vendor_hours'], $ticket['vendor_sla']])));
|
||||
?>
|
||||
<div class="ticket-link-heading <?= $asset_id ? 'mt-3 pt-2 border-top' : '' ?>">Vendor</div>
|
||||
<div class="ticket-link-heading <?= $ticket_asset_shown ? 'mt-3 pt-2 border-top' : '' ?>">Vendor</div>
|
||||
<div class="mt-1 d-flex min-w-0">
|
||||
<?= vendorLink($vendor_id, $ticket['vendor_name'], ['archived' => !empty($ticket['vendor_archived_at'])]) ?>
|
||||
</div>
|
||||
@@ -1994,7 +1999,7 @@ if (isset($_GET['ticket_id'])) {
|
||||
<?php } ?>
|
||||
|
||||
<?php if ($project_id) { ?>
|
||||
<div class="ticket-link-heading <?= ($asset_id || $vendor_id) ? 'mt-3 pt-2 border-top' : '' ?>">Project</div>
|
||||
<div class="ticket-link-heading <?= ($ticket_asset_shown || $vendor_id) ? 'mt-3 pt-2 border-top' : '' ?>">Project</div>
|
||||
<div class="mt-1 d-flex align-items-center gap-1 min-w-0">
|
||||
<a class="text-truncate" href="<?= $project_url ?>" title="<?= $project_name ?>"><i class="fas fa-fw fa-project-diagram text-secondary me-2"></i><?= $project_name ?></a>
|
||||
<a class="ajax-modal ms-auto text-body-secondary" href="#" data-modal-size="lg" data-modal-url="modals/project/project.php?id=<?= $project_id ?>" title="Quick look"><i class="fas fa-fw fa-eye"></i></a>
|
||||
@@ -2008,7 +2013,7 @@ if (isset($_GET['ticket_id'])) {
|
||||
<?php } ?>
|
||||
|
||||
<?php if ($ticket_services) { ?>
|
||||
<div class="ticket-link-heading <?= ($asset_id || $vendor_id || $project_id) ? 'mt-3 pt-2 border-top' : '' ?>">Services</div>
|
||||
<div class="ticket-link-heading <?= ($ticket_asset_shown || $vendor_id || $project_id) ? 'mt-3 pt-2 border-top' : '' ?>">Services</div>
|
||||
<?php foreach ($ticket_services as $ticket_service) {
|
||||
$ticket_service_id = intval($ticket_service['service_id']); ?>
|
||||
<div class="mt-1 d-flex align-items-center gap-1 min-w-0">
|
||||
@@ -2026,7 +2031,7 @@ if (isset($_GET['ticket_id'])) {
|
||||
<?php } ?>
|
||||
|
||||
<?php if ($cc_count) { ?>
|
||||
<div class="ticket-link-heading <?= ($asset_id || $vendor_id || $project_id || $ticket_services) ? 'mt-3 pt-2 border-top' : '' ?>">
|
||||
<div class="ticket-link-heading <?= ($ticket_asset_shown || $vendor_id || $project_id || $ticket_services) ? 'mt-3 pt-2 border-top' : '' ?>">
|
||||
CC <span class="text-body-secondary text-lowercase fw-normal">· copied in on its emails</span>
|
||||
</div>
|
||||
<?php while ($cc_row = mysqli_fetch_assoc($sql_ticket_ccs)) {
|
||||
|
||||
@@ -348,7 +348,7 @@ $add_url = 'modals/trip/trip_add.php' . ($client_page ? "?client_id=$client_id"
|
||||
</div>
|
||||
<div class="small text-body-secondary text-truncate" title="<?= escapeHtml($row['trip_purpose']) ?>">
|
||||
<?php if (intval($row['trip_ticket_id']) && $row['ticket_number'] !== null) { ?>
|
||||
<a class="font-monospace" href="<?= escapeHtml(ticketUrl($row['trip_ticket_id'], $row['trip_client_id'])) ?>" title="<?= escapeHtml($row['ticket_subject']) ?>"><?= escapeHtml(ticketReference($row)) ?></a> ·
|
||||
<?= moduleLink('ticketing', escapeHtml(ticketUrl($row['trip_ticket_id'], $row['trip_client_id'])), escapeHtml(ticketReference($row)), 'class="font-monospace" title="' . escapeHtml($row['ticket_subject']) . '"') ?> ·
|
||||
<?php } ?>
|
||||
<?= escapeHtml($row['trip_purpose']) ?>
|
||||
</div>
|
||||
|
||||
@@ -115,13 +115,14 @@ $hours_text = function ($hours) {
|
||||
<div class="itflow-billing-stat-value <?= $total['value'] + $total['extra_value'] > 0 ? 'text-info-emphasis' : '' ?>"><?= $money($total['value'] + $total['extra_value']) ?></div>
|
||||
<div class="itflow-billing-stat-note">
|
||||
<?php if ($total['extras']) { ?>
|
||||
<?= $money($total['value']) ?> of time<?= $total['expenses'] ? ' · ' . $money($total['expense_value']) . ' of expenses' : '' ?><?= $total['trips'] ? ' · ' . $money($total['trip_value']) . ' of travel' : '' ?>
|
||||
<?= implode(' · ', array_filter([$with_time ? $money($total['value']) . ' of time' : '', $total['expenses'] ? $money($total['expense_value']) . ' of expenses' : '', $total['trips'] ? $money($total['trip_value']) . ' of travel' : ''])) ?>
|
||||
<?php } else { ?>
|
||||
<?= $client_view ? (!$one_rate ? "At each ticket's rate" : 'At ' . ($this_client && ($this_client['rate'] > 0 || !$this_client['default_rate']) ? $money($this_client['rate']) . ' an hour' . (in_array($this_client['rate_source'] ?? '', ['contract', 'after_hours'], true) ? ', ' . escapeHtml($this_client['rate_note']) : '') : 'no rate set')) : 'At each client\'s hourly rate' ?>
|
||||
<?php } ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php if ($with_time) { // Ticketing switched off (Admin > Settings > Modules) - no time to bill ?>
|
||||
<div class="col-sm-6 col-xl-3">
|
||||
<div class="itflow-billing-stat">
|
||||
<div class="itflow-billing-stat-label"><i class="fas fa-stopwatch me-1"></i>Hours</div>
|
||||
@@ -129,21 +130,28 @@ $hours_text = function ($hours) {
|
||||
<div class="itflow-billing-stat-note"><?= billingDuration($total['seconds']) ?> logged, rounded <?= escapeHtml(billingTimeRulesText($rules)) ?><?= $total['prepaid'] > 0 ? ' · less ' . escapeHtml(contractHoursText($total['prepaid'])) . ' prepaid' : '' ?></div>
|
||||
</div>
|
||||
</div>
|
||||
<?php } ?>
|
||||
<div class="col-sm-6 col-xl-3">
|
||||
<div class="itflow-billing-stat">
|
||||
<?php if (!$with_time) { ?>
|
||||
<div class="itflow-billing-stat-label"><i class="fas fa-receipt me-1"></i><?= $total['expenses'] && $total['trips'] ? 'Expenses & trips' : ($total['trips'] ? 'Trips' : 'Expenses') ?></div>
|
||||
<div class="itflow-billing-stat-value"><?= $total['extras'] ?></div>
|
||||
<div class="itflow-billing-stat-note"><?= count($clients) . ' client' . (count($clients) === 1 ? '' : 's') ?></div>
|
||||
<?php } else { ?>
|
||||
<div class="itflow-billing-stat-label"><i class="fas fa-life-ring me-1"></i>Tickets<?= $total['extras'] ? ' & ' . ($total['expenses'] && $total['trips'] ? 'more' : ($total['expenses'] ? 'expenses' : 'trips')) : '' ?></div>
|
||||
<div class="itflow-billing-stat-value"><?= $total['tickets'] ?><?= $total['extras'] ? ' <span class="text-body-secondary fw-normal">+</span> ' . $total['extras'] : '' ?></div>
|
||||
<div class="itflow-billing-stat-note">
|
||||
<?= $client_view ? ($total['extras'] ? $total['tickets'] . ' ticket' . ($total['tickets'] === 1 ? '' : 's') . ', ' . $extras_text($total['expenses'], $total['trips']) : 'Resolved or closed, not invoiced') : count($clients) . ' client' . (count($clients) === 1 ? '' : 's') ?>
|
||||
<?= $total['no_time'] ? ' · <span class="text-warning-emphasis">' . $total['no_time'] . ' with no time logged</span>' : '' ?>
|
||||
</div>
|
||||
<?php } ?>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-6 col-xl-3">
|
||||
<div class="itflow-billing-stat">
|
||||
<div class="itflow-billing-stat-label"><i class="fas fa-hourglass-half me-1"></i>Waiting longest</div>
|
||||
<div class="itflow-billing-stat-value <?= $total['oldest'] > 30 ? 'text-danger-emphasis' : '' ?>"><?= $total['tickets'] || $total['extras'] ? $total['oldest'] . ' day' . ($total['oldest'] === 1 ? '' : 's') : '-' ?></div>
|
||||
<div class="itflow-billing-stat-note"><?= $total['extras'] ? 'Since the ticket was done' . ($total['expenses'] ? ', the expense paid' : '') . ($total['trips'] ? ', the trip driven' : '') : 'Since the ticket was done' ?></div>
|
||||
<div class="itflow-billing-stat-note"><?= $with_time ? ($total['extras'] ? 'Since the ticket was done' . ($total['expenses'] ? ', the expense paid' : '') . ($total['trips'] ? ', the trip driven' : '') : 'Since the ticket was done') : 'Since ' . implode(', or ', array_filter([$total['expenses'] || !$total['trips'] ? 'the expense was paid' : '', $total['trips'] ? 'the trip was driven' : ''])) ?></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -215,11 +215,24 @@ if (!$vendor || (isset($_GET['client_id']) && $vendor_client_id !== intval($clie
|
||||
unset($vendor_tabs['logins']);
|
||||
}
|
||||
}
|
||||
// The parts of ITFlow switched off (Admin > Settings > Modules) - their tabs and New items go
|
||||
$vendor_itdoc = moduleOn('itdoc');
|
||||
$vendor_ticketing = moduleOn('ticketing');
|
||||
$vendor_accounting = moduleOn('accounting');
|
||||
if (!$vendor_itdoc) {
|
||||
unset($vendor_tabs['licenses'], $vendor_tabs['assets'], $vendor_tabs['domains'], $vendor_tabs['services'], $vendor_tabs['logins'], $vendor_tabs['documents'], $vendor_tabs['files']);
|
||||
}
|
||||
if (!$vendor_ticketing) {
|
||||
unset($vendor_tabs['cases']);
|
||||
}
|
||||
if (!$vendor_accounting) {
|
||||
unset($vendor_tabs['expenses'], $vendor_tabs['recurring'], $vendor_tabs['products']);
|
||||
}
|
||||
$unlink_url = function ($to, $other_id) use ($vendor_id) {
|
||||
return "post.php?unlink_item&from=vendor&id=$vendor_id&to=$to&other=" . intval($other_id) . "&csrf_token=" . $_SESSION['csrf_token'];
|
||||
};
|
||||
$new_case_url = "modals/ticket/ticket_add.php?client_id=$client_id&vendor_id=$vendor_id";
|
||||
$can_new = !$vendor_archived_at && (($is_ours && $can_financial_edit) || (!$is_ours && ($can_support_edit || $can_credentials_edit)));
|
||||
$can_new = !$vendor_archived_at && (($is_ours && $can_financial_edit && $vendor_accounting) || (!$is_ours && ($vendor_itdoc || $vendor_ticketing) && ($can_support_edit || ($can_credentials_edit && $vendor_itdoc))));
|
||||
|
||||
?>
|
||||
|
||||
@@ -292,10 +305,12 @@ if (!$vendor || (isset($_GET['client_id']) && $vendor_client_id !== intval($clie
|
||||
<i class="fas fa-fw fa-redo-alt text-secondary me-2"></i>Recurring Expense
|
||||
</a>
|
||||
<?php } else { ?>
|
||||
<?php if ($can_support_edit) { ?>
|
||||
<?php if ($can_support_edit && $vendor_ticketing) { ?>
|
||||
<a class="dropdown-item ajax-modal" href="#" data-modal-size="lg" data-modal-url="<?= $new_case_url ?>">
|
||||
<i class="fas fa-fw fa-life-ring text-secondary me-2"></i>Case with Them
|
||||
</a>
|
||||
<?php } ?>
|
||||
<?php if ($can_support_edit && $vendor_itdoc) { ?>
|
||||
<a class="dropdown-item ajax-modal" href="#" data-modal-size="lg" data-modal-url="modals/software/software_add.php?client_id=<?= $client_id ?>&vendor_id=<?= $vendor_id ?>">
|
||||
<i class="fas fa-fw fa-cube text-secondary me-2"></i>License from Them
|
||||
</a>
|
||||
@@ -303,12 +318,12 @@ if (!$vendor || (isset($_GET['client_id']) && $vendor_client_id !== intval($clie
|
||||
<i class="fas fa-fw fa-desktop text-secondary me-2"></i>Asset Bought from Them
|
||||
</a>
|
||||
<?php } ?>
|
||||
<?php if ($can_credentials_edit) { ?>
|
||||
<?php if ($can_credentials_edit && $vendor_itdoc) { ?>
|
||||
<a class="dropdown-item ajax-modal" href="#" data-modal-size="lg" data-modal-url="modals/credential/credential_add.php?client_id=<?= $client_id ?>&vendor_id=<?= $vendor_id ?>">
|
||||
<i class="fas fa-fw fa-key text-secondary me-2"></i>Portal Login
|
||||
</a>
|
||||
<?php } ?>
|
||||
<?php if ($can_support_edit) { ?>
|
||||
<?php if ($can_support_edit && $vendor_itdoc) { ?>
|
||||
<div class="dropdown-divider"></div>
|
||||
<a class="dropdown-item ajax-modal" href="#" data-modal-size="xl" data-modal-url="modals/document/document_add.php?client_id=<?= $client_id ?>&vendor_id=<?= $vendor_id ?>">
|
||||
<i class="fas fa-fw fa-file-alt text-secondary me-2"></i>Document
|
||||
|
||||
@@ -23,7 +23,7 @@ function categoryApiCanRead($kind) {
|
||||
|
||||
/* The kinds the key's user can read - category_type values, in Admin > Categories' order. */
|
||||
function categoryApiReadableKinds() {
|
||||
return array_values(array_filter(array_keys(categoryKinds()), 'categoryApiCanRead'));
|
||||
return array_values(array_filter(array_keys(categoryKindsOn()), 'categoryApiCanRead'));
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -35,6 +35,10 @@ function categoryApiKind($value) {
|
||||
$key = str_replace([' ', '-'], '_', strtolower(trim((string) $value)));
|
||||
foreach (categoryKinds() as $kind => $config) {
|
||||
if ($key === strtolower($kind) || $key === str_replace(' ', '_', strtolower($config['label']))) {
|
||||
// A kind of a part of ITFlow switched off (Admin > Settings > Modules)
|
||||
if (categoryKindModule($kind) !== null && !moduleOn(categoryKindModule($kind))) {
|
||||
apiDeny(moduleOffText(categoryKindModule($kind)));
|
||||
}
|
||||
if (!categoryApiCanRead($kind)) {
|
||||
apiDeny("The user linked to this API key does not have permission for " . $config['many'] . ".");
|
||||
}
|
||||
|
||||
@@ -257,6 +257,26 @@ $resource_operation_level = [
|
||||
'ticket_ccs' => ['delete.php' => 2],
|
||||
];
|
||||
|
||||
// The part of ITFlow a resource belongs to - switched off in Admin > Settings > Modules, its calls are refused
|
||||
// as its pages are. Trips, calendar events and Knowledge Base articles check their own (moduleOn()) in their files.
|
||||
$resource_feature = [
|
||||
'assets' => 'itdoc', 'asset_interfaces' => 'itdoc', 'asset_notes' => 'itdoc', 'certificates' => 'itdoc', 'credentials' => 'itdoc',
|
||||
'documents' => 'itdoc', 'domains' => 'itdoc', 'files' => 'itdoc', 'folders' => 'itdoc', 'networks' => 'itdoc', 'network_ips' => 'itdoc',
|
||||
'racks' => 'itdoc', 'rack_units' => 'itdoc', 'services' => 'itdoc', 'software' => 'itdoc', 'software_keys' => 'itdoc',
|
||||
'tickets' => 'ticketing', 'ticket_replies' => 'ticketing', 'ticket_ccs' => 'ticketing', 'projects' => 'ticketing', 'tasks' => 'ticketing',
|
||||
'task_approvals' => 'ticketing', 'recurring_tickets' => 'ticketing',
|
||||
'invoices' => 'accounting', 'invoice_items' => 'accounting', 'recurring_invoices' => 'accounting', 'recurring_invoice_items' => 'accounting',
|
||||
'quotes' => 'accounting', 'quote_items' => 'accounting', 'products' => 'accounting', 'contracts' => 'accounting', 'contract_hours' => 'accounting',
|
||||
'taxes' => 'accounting', 'expenses' => 'accounting', 'recurring_expenses' => 'accounting', 'payments' => 'accounting', 'revenues' => 'accounting',
|
||||
'accounts' => 'bookkeeping', 'transfers' => 'bookkeeping',
|
||||
'portal_invites' => 'portal',
|
||||
];
|
||||
// The switches themselves - an endpoint loads the settings, if at all, after this runs
|
||||
moduleSwitchesLoad();
|
||||
if (isset($resource_feature[$resource]) && !moduleOn($resource_feature[$resource])) {
|
||||
apiDeny(moduleOffText($resource_feature[$resource]));
|
||||
}
|
||||
|
||||
$required_level = $resource_operation_level[$resource][$operation_file] ?? $operation_level[$operation_file] ?? 2;
|
||||
if ($resource_module[$resource] !== '' && lookupUserPermission($resource_module[$resource]) < $required_level) {
|
||||
apiDeny(apiPermissionText($resource_module[$resource], $required_level));
|
||||
|
||||
@@ -20,6 +20,10 @@ function tagApiKind($value, $level) {
|
||||
if (!$entity) {
|
||||
apiDeny("Unknown kind - one of " . implode(', ', tagKinds()) . ", or its tag type number.");
|
||||
}
|
||||
// A kind of a part of ITFlow switched off (Admin > Settings > Modules)
|
||||
if (tagKindModule($entity) !== null && !moduleOn(tagKindModule($entity))) {
|
||||
apiDeny(moduleOffText(tagKindModule($entity)));
|
||||
}
|
||||
if (lookupUserPermission(tagEntity($entity)['module']) < $level) {
|
||||
apiDeny("The user linked to this API key does not have permission for " . tagEntity($entity)['plural'] . ".");
|
||||
}
|
||||
@@ -29,7 +33,7 @@ function tagApiKind($value, $level) {
|
||||
/* The tag types the key's user can read. */
|
||||
function tagApiReadableTypes() {
|
||||
$types = [];
|
||||
foreach (tagKinds() as $type => $entity) {
|
||||
foreach (tagKindsOn() as $type => $entity) {
|
||||
if (lookupUserPermission(tagEntity($entity)['module']) >= 1) {
|
||||
$types[] = $type;
|
||||
}
|
||||
|
||||
@@ -183,8 +183,11 @@ function portalNav() {
|
||||
|
||||
$nav = [
|
||||
'home' => ['label' => 'Home', 'icon' => 'fa-home', 'href' => '/client/index.php', 'pages' => ['index.php']],
|
||||
'tickets' => ['label' => 'Tickets', 'icon' => 'fa-life-ring', 'href' => '/client/tickets.php', 'pages' => ['tickets.php', 'ticket.php', 'ticket_add.php', 'ticket_view_all.php']],
|
||||
];
|
||||
// Ticketing switched off (Admin > Settings > Modules) - no Tickets
|
||||
if (moduleOn('ticketing')) {
|
||||
$nav['tickets'] = ['label' => 'Tickets', 'icon' => 'fa-life-ring', 'href' => '/client/tickets.php', 'pages' => ['tickets.php', 'ticket.php', 'ticket_add.php', 'ticket_view_all.php']];
|
||||
}
|
||||
|
||||
if (contactCan('accounting') && $config_module_enable_accounting == 1) {
|
||||
$cards = billingStripeProvider() !== null;
|
||||
|
||||
@@ -173,5 +173,8 @@ $session_client_name = $client['client_name'];
|
||||
// A managed instance its manager has made read-only or suspended (functions/managed.php)
|
||||
managedRequestGuard('portal');
|
||||
|
||||
// A part of the portal whose module is switched off - tickets, billing, IT documentation, help (functions/settings.php)
|
||||
moduleRequestGuard();
|
||||
|
||||
// The demo - what visitors can't change there (functions/demo.php)
|
||||
demoModeGuard();
|
||||
|
||||
@@ -161,7 +161,9 @@ $portal_contact_name = (string) ($contact['contact_name'] ?? '');
|
||||
</div>
|
||||
</form>
|
||||
<a class="btn btn-outline-secondary d-none d-xl-inline-flex d-xxl-none" href="/client/search.php" title="Search" aria-label="Search"><i class="fas fa-search"></i></a>
|
||||
<a class="btn btn-primary d-none d-sm-inline-flex align-items-center text-nowrap" href="/client/ticket_add.php"><i class="fas fa-plus me-2"></i>New Ticket</a>
|
||||
<?php if (isset($portal_nav['tickets'])) { ?>
|
||||
<a class="btn btn-primary d-none d-sm-inline-flex align-items-center text-nowrap" href="/client/ticket_add.php"><i class="fas fa-plus me-2"></i>New Ticket</a>
|
||||
<?php } ?>
|
||||
|
||||
<div class="dropdown">
|
||||
<button type="button" class="itflow-portal-account" data-bs-toggle="dropdown" aria-expanded="false" aria-label="Your account">
|
||||
@@ -198,8 +200,10 @@ $portal_contact_name = (string) ($contact['contact_name'] ?? '');
|
||||
reaches them, and everything else in a menu that slides in. */ ?>
|
||||
<nav class="itflow-portal-tabbar d-lg-none" aria-label="Portal">
|
||||
<a href="/client/index.php" class="<?= $portal_page === 'index.php' ? 'active' : '' ?>"><i class="fas fa-home"></i><span>Home</span></a>
|
||||
<a href="/client/tickets.php" class="<?= in_array($portal_page, $portal_nav['tickets']['pages'], true) && $portal_page !== 'ticket_add.php' ? 'active' : '' ?>"><i class="fas fa-life-ring"></i><span>Tickets</span></a>
|
||||
<a href="/client/ticket_add.php" class="itflow-portal-tabbar-new<?= $portal_page === 'ticket_add.php' ? ' active' : '' ?>"><i class="fas fa-plus"></i><span>New</span></a>
|
||||
<?php if (isset($portal_nav['tickets'])) { ?>
|
||||
<a href="/client/tickets.php" class="<?= in_array($portal_page, $portal_nav['tickets']['pages'], true) && $portal_page !== 'ticket_add.php' ? 'active' : '' ?>"><i class="fas fa-life-ring"></i><span>Tickets</span></a>
|
||||
<a href="/client/ticket_add.php" class="itflow-portal-tabbar-new<?= $portal_page === 'ticket_add.php' ? ' active' : '' ?>"><i class="fas fa-plus"></i><span>New</span></a>
|
||||
<?php } ?>
|
||||
<?php if (isset($portal_nav['billing'])) { ?>
|
||||
<a href="/client/invoices.php" class="<?= in_array($portal_page, $portal_nav['billing']['pages'], true) ? 'active' : '' ?>"><i class="fas fa-file-invoice-dollar"></i><span>Billing</span></a>
|
||||
<?php } ?>
|
||||
|
||||
@@ -21,6 +21,8 @@ $scope_sql = portalTicketScopeSql();
|
||||
$sees_all = portalSeesAllTickets();
|
||||
$can_billing = contactCan('accounting') && $config_module_enable_accounting == 1;
|
||||
$can_it = $config_module_enable_itdoc && contactCan('itdoc');
|
||||
// Ticketing switched off (Admin > Settings > Modules) - no tickets, approvals or request forms here
|
||||
$can_tickets = moduleOn('ticketing');
|
||||
$ticket_from = "FROM tickets LEFT JOIN ticket_statuses ON ticket_status = ticket_status_id WHERE $scope_sql AND tickets.ticket_archived_at IS NULL";
|
||||
|
||||
// Tickets - counted, and the ones that need the contact
|
||||
@@ -36,7 +38,7 @@ $you_count = intval(mysqli_fetch_row(mysqli_query($mysqli, "SELECT COUNT(*) $tic
|
||||
$needs_you = [];
|
||||
$sql = mysqli_query($mysqli, "SELECT " . portalTicketColumnsSql() . " $ticket_from AND ({$tabs['you']['where']} OR {$tabs['resolved']['where']})
|
||||
ORDER BY COALESCE(tickets.ticket_updated_at, tickets.ticket_created_at) DESC LIMIT 6");
|
||||
while ($row = mysqli_fetch_assoc($sql)) {
|
||||
while ($can_tickets && $row = mysqli_fetch_assoc($sql)) {
|
||||
$resolved = !empty($row['ticket_resolved_at']);
|
||||
$needs_you[] = [
|
||||
'href' => 'ticket.php?id=' . intval($row['ticket_id']),
|
||||
@@ -54,7 +56,7 @@ $sql = mysqli_query($mysqli, "SELECT tickets.ticket_id, ticket_prefix, ticket_nu
|
||||
LEFT JOIN ticket_statuses ON ticket_status = ticket_status_id
|
||||
WHERE $scope_sql AND approval_scope = 'client' AND approval_status = 'pending' AND task_completed_at IS NULL AND tickets.ticket_closed_at IS NULL
|
||||
ORDER BY approval_id DESC LIMIT 4");
|
||||
while ($row = mysqli_fetch_assoc($sql)) {
|
||||
while ($can_tickets && $row = mysqli_fetch_assoc($sql)) {
|
||||
$needs_you[] = [
|
||||
'href' => 'ticket.php?id=' . intval($row['ticket_id']),
|
||||
'icon' => 'fa-clipboard-check',
|
||||
@@ -149,12 +151,12 @@ if ($can_it) {
|
||||
$devices = [];
|
||||
$sql = mysqli_query($mysqli, "SELECT asset_id, asset_name, asset_type, asset_make, asset_model, asset_warranty_expire, asset_uri_client FROM assets
|
||||
WHERE asset_contact_id = $session_contact_id AND asset_client_id = $session_client_id AND asset_archived_at IS NULL ORDER BY asset_name ASC LIMIT 6");
|
||||
while ($row = mysqli_fetch_assoc($sql)) {
|
||||
while ($config_module_enable_itdoc && $row = mysqli_fetch_assoc($sql)) {
|
||||
$devices[] = $row;
|
||||
}
|
||||
|
||||
// The request forms they can use - ticket templates offered in the portal
|
||||
$request_forms = ticketTemplatePortalForms($session_client_id, $sees_all);
|
||||
$request_forms = $can_tickets ? ticketTemplatePortalForms($session_client_id, $sees_all) : [];
|
||||
|
||||
// How to reach us
|
||||
$company = mysqli_fetch_assoc(mysqli_query($mysqli, "SELECT company_phone, company_phone_country_code, company_email, company_website FROM companies WHERE company_id = 1"));
|
||||
@@ -192,6 +194,7 @@ $first_name = strtok(trim((string) $contact['contact_name']), ' ') ?: '';
|
||||
<?php } ?>
|
||||
|
||||
<div class="row g-3 mb-4">
|
||||
<?php if ($can_tickets) { ?>
|
||||
<div class="col-6 col-lg-3">
|
||||
<a class="itflow-portal-stat" href="tickets.php">
|
||||
<span class="itflow-portal-stat-icon"><i class="fas fa-life-ring"></i></span>
|
||||
@@ -210,6 +213,7 @@ $first_name = strtok(trim((string) $contact['contact_name']), ' ') ?: '';
|
||||
</span>
|
||||
</a>
|
||||
</div>
|
||||
<?php } ?>
|
||||
<?php if ($can_billing) { ?>
|
||||
<div class="col-6 col-lg-3">
|
||||
<a class="itflow-portal-stat<?= $overdue > 0 ? ' itflow-portal-stat-danger' : '' ?>" href="<?= $balance > 0 ? $pay_href : 'invoices.php' ?>">
|
||||
@@ -269,6 +273,7 @@ $first_name = strtok(trim((string) $contact['contact_name']), ' ') ?: '';
|
||||
<?php } ?>
|
||||
</section>
|
||||
|
||||
<?php if ($can_tickets) { ?>
|
||||
<section class="itflow-portal-panel">
|
||||
<div class="itflow-portal-panel-head">
|
||||
<h2><i class="fas fa-life-ring"></i><?= $sees_all ? 'Open tickets' : 'Your open tickets' ?></h2>
|
||||
@@ -300,6 +305,7 @@ $first_name = strtok(trim((string) $contact['contact_name']), ' ') ?: '';
|
||||
</ul>
|
||||
<?php } ?>
|
||||
</section>
|
||||
<?php } ?>
|
||||
|
||||
</div>
|
||||
<div class="col-lg-4">
|
||||
@@ -391,7 +397,7 @@ $first_name = strtok(trim((string) $contact['contact_name']), ' ') ?: '';
|
||||
<h2><i class="fas fa-headset"></i>Need us fast?</h2>
|
||||
</div>
|
||||
<div class="itflow-portal-panel-body">
|
||||
<p class="text-body-secondary small mb-2">For anything urgent, call us - and raise a ticket so it is on record.</p>
|
||||
<p class="text-body-secondary small mb-2">For anything urgent, call us<?= $can_tickets ? ' - and raise a ticket so it is on record' : '' ?>.</p>
|
||||
<?php if (!empty($company['company_phone'])) { ?>
|
||||
<div class="mb-1"><i class="fas fa-fw fa-phone me-2 text-body-secondary"></i><a href="tel:<?= escapeHtml(phoneDialNumber($company['company_phone'], $company['company_phone_country_code'])) ?>"><?= escapeHtml(formatPhoneNumber($company['company_phone'], $company['company_phone_country_code'])) ?></a></div>
|
||||
<?php } ?>
|
||||
|
||||
@@ -19,27 +19,32 @@ $q = trim(mb_substr((string) ($_GET['q'] ?? ''), 0, 200));
|
||||
$limit = 8;
|
||||
$can_documents = $config_module_enable_itdoc && contactCan('itdoc');
|
||||
$can_help = kbOn() && kbClientHas($session_client_id);
|
||||
// What there is to look through, for the words at the top - tickets only while ticketing is on
|
||||
$search_kinds = array_values(array_filter([moduleOn('ticketing') ? 'tickets' : '', $can_documents ? 'documents' : '', $can_help ? 'Help' : '']));
|
||||
$search_list = count($search_kinds) > 1 ? implode(', ', array_slice($search_kinds, 0, -1)) . ' and ' . end($search_kinds) : (string) ($search_kinds[0] ?? 'nothing');
|
||||
$sections = [];
|
||||
|
||||
if ($q !== '') {
|
||||
$q_sql = escapeSql($q);
|
||||
$q_number = intval(preg_replace('/\D/', '', $q));
|
||||
|
||||
// Tickets - the subject, the number, or something said on it they can see
|
||||
$where = portalTicketScopeSql() . " AND tickets.ticket_archived_at IS NULL
|
||||
AND (tickets.ticket_subject LIKE '%$q_sql%' OR CONCAT(tickets.ticket_prefix, tickets.ticket_number) LIKE '%$q_sql%'" . ($q_number ? " OR tickets.ticket_number = $q_number" : '') . "
|
||||
OR EXISTS (SELECT 1 FROM ticket_replies WHERE ticket_reply_ticket_id = tickets.ticket_id AND ticket_reply_type != 'Internal'
|
||||
AND ticket_reply_archived_at IS NULL AND ticket_reply LIKE '%$q_sql%'))";
|
||||
$total = intval(mysqli_fetch_row(mysqli_query($mysqli, "SELECT COUNT(*) FROM tickets WHERE $where"))[0]);
|
||||
$rows = [];
|
||||
if ($total) {
|
||||
$sql = mysqli_query($mysqli, "SELECT " . portalTicketColumnsSql() . " FROM tickets LEFT JOIN ticket_statuses ON ticket_status = ticket_status_id
|
||||
WHERE $where ORDER BY " . TICKET_OPEN_SQL . " DESC, COALESCE(tickets.ticket_updated_at, tickets.ticket_created_at) DESC LIMIT $limit");
|
||||
while ($row = mysqli_fetch_assoc($sql)) {
|
||||
$rows[] = $row;
|
||||
// Tickets - the subject, the number, or something said on it they can see; none while ticketing is switched off (Admin > Settings > Modules)
|
||||
if (moduleOn('ticketing')) {
|
||||
$where = portalTicketScopeSql() . " AND tickets.ticket_archived_at IS NULL
|
||||
AND (tickets.ticket_subject LIKE '%$q_sql%' OR CONCAT(tickets.ticket_prefix, tickets.ticket_number) LIKE '%$q_sql%'" . ($q_number ? " OR tickets.ticket_number = $q_number" : '') . "
|
||||
OR EXISTS (SELECT 1 FROM ticket_replies WHERE ticket_reply_ticket_id = tickets.ticket_id AND ticket_reply_type != 'Internal'
|
||||
AND ticket_reply_archived_at IS NULL AND ticket_reply LIKE '%$q_sql%'))";
|
||||
$total = intval(mysqli_fetch_row(mysqli_query($mysqli, "SELECT COUNT(*) FROM tickets WHERE $where"))[0]);
|
||||
$rows = [];
|
||||
if ($total) {
|
||||
$sql = mysqli_query($mysqli, "SELECT " . portalTicketColumnsSql() . " FROM tickets LEFT JOIN ticket_statuses ON ticket_status = ticket_status_id
|
||||
WHERE $where ORDER BY " . TICKET_OPEN_SQL . " DESC, COALESCE(tickets.ticket_updated_at, tickets.ticket_created_at) DESC LIMIT $limit");
|
||||
while ($row = mysqli_fetch_assoc($sql)) {
|
||||
$rows[] = $row;
|
||||
}
|
||||
}
|
||||
$sections['tickets'] = ['label' => 'Tickets', 'icon' => 'fa-life-ring', 'total' => $total, 'rows' => $rows, 'all' => 'tickets.php?' . http_build_query(['tab' => 'all', 'q' => $q])];
|
||||
}
|
||||
$sections['tickets'] = ['label' => 'Tickets', 'icon' => 'fa-life-ring', 'total' => $total, 'rows' => $rows, 'all' => 'tickets.php?' . http_build_query(['tab' => 'all', 'q' => $q])];
|
||||
|
||||
// Documents shared with them - for those who see the company's IT
|
||||
if ($can_documents) {
|
||||
@@ -85,7 +90,7 @@ $found = array_sum(array_column($sections, 'total'));
|
||||
<div class="itflow-portal-page-head">
|
||||
<div>
|
||||
<h1>Search</h1>
|
||||
<p><?= $q === '' ? 'Your tickets' . ($can_documents ? ', documents' : '') . ($can_help ? ' and Help' : '') . ', all at once' : ($found ? $found . ' found for “' . escapeHtml($q) . '”' : 'Nothing found for “' . escapeHtml($q) . '”') ?></p>
|
||||
<p><?= $q === '' ? escapeHtml(ucfirst(moduleOn('ticketing') ? 'Your ' . $search_list : $search_list)) . (count($search_kinds) > 1 ? ', all at once' : '') : ($found ? $found . ' found for “' . escapeHtml($q) . '”' : 'Nothing found for “' . escapeHtml($q) . '”') ?></p>
|
||||
</div>
|
||||
<form method="get" class="d-flex" role="search">
|
||||
<div class="input-group">
|
||||
@@ -97,7 +102,7 @@ $found = array_sum(array_column($sections, 'total'));
|
||||
|
||||
<?php if ($q === '') { ?>
|
||||
<section class="itflow-portal-panel">
|
||||
<?= emptyStateHtml(['title' => 'What are you looking for?', 'text' => 'Type a word or a ticket number - it looks through your tickets and what was said on them' . ($can_documents ? ', your documents' : '') . ($can_help ? ' and our Help articles' : '') . '.', 'icon' => 'fa-search', 'filtered' => false]) ?>
|
||||
<?= emptyStateHtml(['title' => 'What are you looking for?', 'text' => moduleOn('ticketing') ? 'Type a word or a ticket number - it looks through your tickets and what was said on them' . ($can_documents ? ', your documents' : '') . ($can_help ? ' and our Help articles' : '') . '.' : 'Type a word - it looks through ' . ($can_documents ? 'your documents' . ($can_help ? ' and our Help articles' : '') : 'our Help articles') . '.', 'icon' => 'fa-search', 'filtered' => false]) ?>
|
||||
</section>
|
||||
<?php } elseif (!$found) { ?>
|
||||
<section class="itflow-portal-panel">
|
||||
|
||||
@@ -87,6 +87,8 @@ $config_ticket_email_parse = intval($row['config_ticket_email_parse']);
|
||||
$config_module_enable_itdoc = intval($row['config_module_enable_itdoc']);
|
||||
$config_module_enable_ticketing = intval($row['config_module_enable_ticketing']);
|
||||
$config_module_enable_accounting = intval($row['config_module_enable_accounting']);
|
||||
// A part switched off in Admin > Settings > Modules does nothing here either - no recurring tickets or invoices,
|
||||
// no autopay or payment reminders, no ticket closing, and none of its notifications
|
||||
$config_telemetry = intval($row['config_telemetry']);
|
||||
|
||||
// Alerts
|
||||
@@ -250,7 +252,7 @@ if ($config_whitelabel_enabled && !validateWhitelabelKey($config_whitelabel_key)
|
||||
|
||||
|
||||
// CONTRACTS - renew the ones that renew themselves, end the ones that don't, and remind owners before the notice date
|
||||
$contracts_done = contractsNightly();
|
||||
$contracts_done = $config_module_enable_accounting ? contractsNightly() : [];
|
||||
if (array_sum($contracts_done)) {
|
||||
logApp("Cron", "info", "Contracts: {$contracts_done['renewed']} renewed, {$contracts_done['ended']} ended, {$contracts_done['reminded']} owner(s) reminded, {$contracts_done['drawn']} ticket(s) drawn from prepaid hours, {$contracts_done['paused']} recurring invoice(s) paused");
|
||||
}
|
||||
@@ -271,7 +273,7 @@ if ($user_invites_cleared) {
|
||||
|
||||
// DOMAINS EXPIRING
|
||||
|
||||
if ($config_enable_alert_domain_expire == 1) {
|
||||
if ($config_enable_alert_domain_expire == 1 && $config_module_enable_itdoc) {
|
||||
|
||||
$domainAlertArray = [1,7,45];
|
||||
|
||||
@@ -310,7 +312,7 @@ if ($config_enable_alert_domain_expire == 1) {
|
||||
// certificate (Let's Encrypt and friends) renews itself with about 30 days
|
||||
// left, so its 45-day mark is routine - only the week and the day are said,
|
||||
// and by then it should already have renewed.
|
||||
$certificateAlertArray = [1,7,45];
|
||||
$certificateAlertArray = $config_module_enable_itdoc ? [1,7,45] : [];
|
||||
|
||||
foreach ($certificateAlertArray as $day) {
|
||||
|
||||
@@ -359,7 +361,7 @@ while ($row = mysqli_fetch_assoc($sql)) {
|
||||
|
||||
// Asset Warranties Expiring
|
||||
|
||||
$warranty_alert_array = [1,7,45];
|
||||
$warranty_alert_array = $config_module_enable_itdoc ? [1,7,45] : [];
|
||||
|
||||
foreach ($warranty_alert_array as $day) {
|
||||
|
||||
@@ -389,7 +391,7 @@ foreach ($warranty_alert_array as $day) {
|
||||
// UPS batteries due for replacing - the same days ahead as warranties (asset_specs, functions/asset_type.php) - and the
|
||||
// dates your own types flag as they near, like an inspection: on the types that have them
|
||||
$flagged_dates = [];
|
||||
foreach (assetSpecsReady() ? assetTypes() : [] as $flag_type => $flag_info) {
|
||||
foreach (assetSpecsReady() && $config_module_enable_itdoc ? assetTypes() : [] as $flag_type => $flag_info) {
|
||||
foreach (assetTypeSpecs($flag_type) as $flag_key => $flag_spec) {
|
||||
if (!empty($flag_spec['flag'])) {
|
||||
$flagged_dates[$flag_key]['types'][] = $flag_type;
|
||||
@@ -424,7 +426,7 @@ foreach ($flagged_dates as $flag_key => $flagged) {
|
||||
$sql = mysqli_query($mysqli, "SELECT service_id, service_name, service_importance, client_id, client_name FROM services
|
||||
JOIN clients ON service_client_id = client_id
|
||||
WHERE service_review_due = CURDATE() AND service_archived_at IS NULL AND client_archived_at IS NULL");
|
||||
while ($row = mysqli_fetch_assoc($sql)) {
|
||||
while ($config_module_enable_itdoc && $row = mysqli_fetch_assoc($sql)) {
|
||||
$service_id = intval($row['service_id']);
|
||||
$service_name = escapeSql($row['service_name']);
|
||||
$client_id = intval($row['client_id']);
|
||||
@@ -438,7 +440,7 @@ $sql_tickets_pending_assignment = mysqli_query($mysqli,"SELECT ticket_id FROM ti
|
||||
|
||||
$tickets_pending_assignment = mysqli_num_rows($sql_tickets_pending_assignment);
|
||||
|
||||
if ($tickets_pending_assignment > 0) {
|
||||
if ($tickets_pending_assignment > 0 && $config_module_enable_ticketing) {
|
||||
|
||||
appNotify("Pending Tickets", "There are $tickets_pending_assignment new tickets pending assignment", "/agent/tickets.php?status=New");
|
||||
|
||||
@@ -455,7 +457,7 @@ $sql_recurring_tickets = mysqli_query($mysqli, "SELECT recurring_ticket_id, recu
|
||||
FROM recurring_tickets WHERE " . recurringTicketDueSql() . " AND recurring_ticket_paused_at IS NULL");
|
||||
|
||||
$recurring_tickets_raised = 0;
|
||||
while ($row = mysqli_fetch_assoc($sql_recurring_tickets)) {
|
||||
while ($config_module_enable_ticketing && $row = mysqli_fetch_assoc($sql_recurring_tickets)) {
|
||||
if (recurringTicketRunNow($row, 'Cron')) {
|
||||
$recurring_tickets_raised++;
|
||||
}
|
||||
@@ -480,7 +482,7 @@ $sql_resolved_tickets_to_close = mysqli_query(
|
||||
AND ticket_updated_at < NOW() - INTERVAL $config_ticket_autoclose_hours HOUR"
|
||||
);
|
||||
|
||||
while ($row = mysqli_fetch_assoc($sql_resolved_tickets_to_close)) {
|
||||
while ($config_module_enable_ticketing && $row = mysqli_fetch_assoc($sql_resolved_tickets_to_close)) {
|
||||
|
||||
$ticket_id = $row['ticket_id'];
|
||||
$ticket_prefix = escapeSql($row['ticket_prefix']);
|
||||
@@ -518,7 +520,7 @@ while ($row = mysqli_fetch_assoc($sql_resolved_tickets_to_close)) {
|
||||
*/
|
||||
$reminder_rules = billingReminderRules(true);
|
||||
$reminded_clients = [];
|
||||
if ($reminder_rules['enabled']) {
|
||||
if ($reminder_rules['enabled'] && $config_module_enable_accounting) {
|
||||
|
||||
// One invoice's own reminder - emailed, texted, and written in its history
|
||||
$remind_invoice = function (array $invoice, int $days, array $recipients) use ($reminder_rules) {
|
||||
@@ -680,7 +682,7 @@ if ($weekly_summary_sent) {
|
||||
}
|
||||
|
||||
// Recurring invoices paused until today run again first - so one due today bills today
|
||||
$recurring_invoices_resumed = recurringInvoiceResumePaused();
|
||||
$recurring_invoices_resumed = $config_module_enable_accounting ? recurringInvoiceResumePaused() : 0;
|
||||
if ($recurring_invoices_resumed) {
|
||||
logApp("Cron", "info", "Cron resumed $recurring_invoices_resumed recurring invoice(s) at the end of their pause");
|
||||
}
|
||||
@@ -700,7 +702,7 @@ $sql_recurring_invoices = mysqli_query($mysqli, "SELECT recurring_invoice_id, re
|
||||
ORDER BY recurring_invoice_next_date ASC, recurring_invoice_id ASC");
|
||||
|
||||
$recurring_invoices_made = 0;
|
||||
while ($row = mysqli_fetch_assoc($sql_recurring_invoices)) {
|
||||
while ($config_module_enable_accounting && $row = mysqli_fetch_assoc($sql_recurring_invoices)) {
|
||||
if (recurringInvoiceGenerate($row['recurring_invoice_id'], 'Cron', $row['recurring_invoice_next_date'] > date('Y-m-d'), $row['recurring_invoice_next_date'])) {
|
||||
$recurring_invoices_made++;
|
||||
}
|
||||
@@ -713,7 +715,7 @@ if ($recurring_invoices_made) {
|
||||
// Start Flag any active recurring "next run" dates that are in the past - too far behind for the run above to bill
|
||||
$sql_invalid_recurring_invoices = mysqli_query($mysqli, "SELECT recurring_invoice_id, recurring_invoice_number, recurring_invoice_prefix, recurring_invoice_client_id FROM recurring_invoices
|
||||
WHERE recurring_invoice_next_date < CURDATE() AND recurring_invoice_status = 1 AND recurring_invoice_archived_at IS NULL");
|
||||
while ($row = mysqli_fetch_assoc($sql_invalid_recurring_invoices)) {
|
||||
while ($config_module_enable_accounting && $row = mysqli_fetch_assoc($sql_invalid_recurring_invoices)) {
|
||||
$invoice_prefix = $row['recurring_invoice_prefix'];
|
||||
$invoice_number = intval($row['recurring_invoice_number']);
|
||||
appNotify("Invoice", escapeSql("Recurring invoice $invoice_prefix$invoice_number is behind - its next date has passed and it won't bill until it is invoiced or moved on"), "/agent/recurring_invoice.php?recurring_invoice_id=" . intval($row['recurring_invoice_id']), intval($row['recurring_invoice_client_id']));
|
||||
@@ -725,7 +727,7 @@ $drafts = mysqli_fetch_row(mysqli_query($mysqli, "SELECT COUNT(*), COALESCE(SUM(
|
||||
$invoices_pending_send = intval($drafts[0]);
|
||||
$invoices_pending_stale = intval($drafts[1]);
|
||||
|
||||
if ($invoices_pending_send > 0) {
|
||||
if ($invoices_pending_send > 0 && $config_module_enable_accounting) {
|
||||
|
||||
appNotify("Draft Invoices", "There are $invoices_pending_send draft invoices pending review" . ($invoices_pending_stale ? ", $invoices_pending_stale of them left more than " . INVOICE_DRAFT_STALE_DAYS . " days" : ''),
|
||||
$invoices_pending_stale ? "/agent/invoices.php?status=StaleDraft" : "/agent/invoices.php?&status=Draft");
|
||||
@@ -736,7 +738,7 @@ if ($invoices_pending_send > 0) {
|
||||
$sql_quotes_expiring = mysqli_query($mysqli, "SELECT quote_id, quote_prefix, quote_number, quote_scope, quote_expire, quote_client_id, client_name FROM quotes
|
||||
JOIN clients ON client_id = quote_client_id
|
||||
WHERE quote_status IN ('Sent', 'Viewed') AND quote_archived_at IS NULL AND quote_expire = CURDATE() + INTERVAL " . QUOTE_EXPIRY_NUDGE_DAYS . " DAY");
|
||||
while ($row = mysqli_fetch_assoc($sql_quotes_expiring)) {
|
||||
while ($config_module_enable_accounting && $row = mysqli_fetch_assoc($sql_quotes_expiring)) {
|
||||
$quote_label = billingNumber('quote', $row) . (trim((string) $row['quote_scope']) !== '' ? ' (' . $row['quote_scope'] . ')' : '');
|
||||
appNotify("Quote Expiring", escapeSql("Quote $quote_label for {$row['client_name']} runs out on {$row['quote_expire']}, in " . QUOTE_EXPIRY_NUDGE_DAYS . " days, with no answer yet - a good time to follow it up"),
|
||||
"/agent/quote.php?quote_id=" . intval($row['quote_id']), intval($row['quote_client_id']), intval($row['quote_id']));
|
||||
@@ -745,7 +747,7 @@ while ($row = mysqli_fetch_assoc($sql_quotes_expiring)) {
|
||||
|
||||
|
||||
// Saved cards running out - read back from Stripe, and the client and the team told about the ones on autopay (functions/card_expiry.php)
|
||||
$card_expiry = cardExpiryNightly();
|
||||
$card_expiry = $config_module_enable_accounting ? cardExpiryNightly() : ['checked' => 0, 'notified' => 0];
|
||||
if ($card_expiry['checked'] || $card_expiry['notified']) {
|
||||
echo "Saved cards: {$card_expiry['checked']} checked with Stripe ({$card_expiry['updated']} updated), {$card_expiry['notified']} running out on autopay, {$card_expiry['emailed']} client(s) emailed\n";
|
||||
}
|
||||
@@ -763,7 +765,7 @@ $sql_recurring_payments = mysqli_query($mysqli, "
|
||||
AND invoice_status IN ('Sent', 'Viewed', 'Partial')
|
||||
");
|
||||
|
||||
while ($row = mysqli_fetch_assoc($sql_recurring_payments)) {
|
||||
while ($config_module_enable_accounting && $row = mysqli_fetch_assoc($sql_recurring_payments)) {
|
||||
// Development mode charges no cards (functions/dev_mode.php)
|
||||
if (devModeOn()) {
|
||||
echo "Development mode - autopay doesn't charge cards\n";
|
||||
@@ -955,7 +957,7 @@ $sql_recurring_expenses = mysqli_query($mysqli, "SELECT recurring_expense_id, re
|
||||
WHERE " . recurringExpenseRunningSql() . "
|
||||
AND recurring_expense_next_date <= CURDATE() AND recurring_expense_next_date >= CURDATE() - INTERVAL " . RECURRING_EXPENSE_GRACE_DAYS . " DAY
|
||||
ORDER BY recurring_expense_next_date ASC, recurring_expense_id ASC");
|
||||
while ($row = mysqli_fetch_assoc($sql_recurring_expenses)) {
|
||||
while ($config_module_enable_accounting && $row = mysqli_fetch_assoc($sql_recurring_expenses)) {
|
||||
$expense_id = recurringExpenseRecord(intval($row['recurring_expense_id']), 0, $row['recurring_expense_next_date']);
|
||||
if ($expense_id) {
|
||||
$expense = expenseRow($expense_id, false);
|
||||
@@ -965,7 +967,7 @@ while ($row = mysqli_fetch_assoc($sql_recurring_expenses)) {
|
||||
|
||||
$sql_recurring_expenses = mysqli_query($mysqli, "SELECT recurring_expense_id FROM recurring_expenses
|
||||
WHERE " . recurringExpenseRunningSql() . " AND recurring_expense_next_date = CURDATE() - INTERVAL " . (RECURRING_EXPENSE_GRACE_DAYS + 1) . " DAY");
|
||||
while ($row = mysqli_fetch_assoc($sql_recurring_expenses)) {
|
||||
while ($config_module_enable_accounting && $row = mysqli_fetch_assoc($sql_recurring_expenses)) {
|
||||
$recurring = recurringExpenseRow(intval($row['recurring_expense_id']), false);
|
||||
appNotify("Expense", escapeSql("The recurring expense " . recurringExpenseLabel($recurring) . " is " . (RECURRING_EXPENSE_GRACE_DAYS + 1) . " days behind and won't be recorded by itself - record the missed runs or move it on"),
|
||||
"/agent/recurring_expenses.php?status=late", intval($recurring['recurring_expense_client_id']));
|
||||
|
||||
@@ -365,7 +365,12 @@ function auditLogRecords(array $rows) {
|
||||
$fill = function ($template) use ($id, $client_id) {
|
||||
return str_replace(['{id}', '{client}', '{client_q}'], [$id, $client_id, $client_id ? "client_id=$client_id&" : ''], $template);
|
||||
};
|
||||
$records["$type|$id"] = ['name' => (string) $row['record_name'], 'url' => $fill($kind['url'])];
|
||||
$url = $fill($kind['url']);
|
||||
// A record of a part of ITFlow that is switched off (Admin > Settings > Modules) is named, not linked
|
||||
if (modulePathOff((string) parse_url($url, PHP_URL_PATH))) {
|
||||
$url = '';
|
||||
}
|
||||
$records["$type|$id"] = ['name' => (string) $row['record_name'], 'url' => $url];
|
||||
}
|
||||
}
|
||||
return $records;
|
||||
@@ -378,6 +383,9 @@ function auditLogRecordLink(array $row, array $records, $label = null) {
|
||||
return '';
|
||||
}
|
||||
$text = $label === null ? escapeHtml($record['name']) : $label;
|
||||
if ($record['url'] === '') {
|
||||
return '<span>' . $text . '</span>';
|
||||
}
|
||||
return '<a href="' . escapeHtml($record['url']) . '" title="Open ' . escapeHtml($record['name']) . '">' . $text . '</a>';
|
||||
}
|
||||
|
||||
|
||||
@@ -601,28 +601,28 @@ function calendarIsDate($value) {
|
||||
|
||||
/**
|
||||
* The schedule other modules contribute, each a source that can be shown or
|
||||
* hidden: [key => label, icon, colour, the module it needs, shown by default].
|
||||
* Only the ones this agent may see.
|
||||
* hidden: [key => label, icon, colour, the module it needs, the part of ITFlow it is (Admin > Settings > Modules),
|
||||
* shown by default]. Only the ones this agent may see, of the parts switched on.
|
||||
*/
|
||||
function calendarSources() {
|
||||
$sources = [
|
||||
'tickets' => ['label' => 'Scheduled tickets', 'icon' => 'fa-life-ring', 'color' => '#0d6efd', 'module' => 'module_support', 'default' => true,
|
||||
'tickets' => ['label' => 'Scheduled tickets', 'icon' => 'fa-life-ring', 'color' => '#0d6efd', 'module' => 'module_support', 'part' => 'ticketing', 'default' => true,
|
||||
'title' => 'Onsite and remote work booked on tickets'],
|
||||
'projects' => ['label' => 'Projects', 'icon' => 'fa-project-diagram', 'color' => '#0f9d8a', 'module' => 'module_support', 'default' => true,
|
||||
'projects' => ['label' => 'Projects', 'icon' => 'fa-project-diagram', 'color' => '#0f9d8a', 'module' => 'module_support', 'part' => 'ticketing', 'default' => true,
|
||||
'title' => 'When open projects start and are due'],
|
||||
'reviews' => ['label' => 'Service reviews', 'icon' => 'fa-clipboard-check', 'color' => '#64748b', 'module' => 'module_support', 'default' => true,
|
||||
'reviews' => ['label' => 'Service reviews', 'icon' => 'fa-clipboard-check', 'color' => '#64748b', 'module' => 'module_support', 'part' => 'itdoc', 'default' => true,
|
||||
'title' => 'When each service is next due for review'],
|
||||
'recurring' => ['label' => 'Recurring tickets', 'icon' => 'fa-redo-alt', 'color' => '#7c3aed', 'module' => 'module_support', 'default' => false,
|
||||
'recurring' => ['label' => 'Recurring tickets', 'icon' => 'fa-redo-alt', 'color' => '#7c3aed', 'module' => 'module_support', 'part' => 'ticketing', 'default' => false,
|
||||
'title' => 'When each recurring ticket is next raised'],
|
||||
'renewals' => ['label' => 'Renewals', 'icon' => 'fa-hourglass-half', 'color' => '#d97706', 'module' => 'module_support', 'default' => false,
|
||||
'renewals' => ['label' => 'Renewals', 'icon' => 'fa-hourglass-half', 'color' => '#d97706', 'module' => 'module_support', 'part' => 'itdoc', 'default' => false,
|
||||
'title' => 'Domains, certificates, licenses and warranties expiring'],
|
||||
'invoices' => ['label' => 'Invoices due', 'icon' => 'fa-file-invoice-dollar', 'color' => '#15803d', 'module' => 'module_sales', 'default' => false,
|
||||
'invoices' => ['label' => 'Invoices due', 'icon' => 'fa-file-invoice-dollar', 'color' => '#15803d', 'module' => 'module_sales', 'part' => 'accounting', 'default' => false,
|
||||
'title' => 'Unpaid invoices on the day they fall due'],
|
||||
'holidays' => ['label' => 'Holidays', 'icon' => 'fa-calendar-times', 'color' => '#dc3545', 'module' => 'module_support', 'default' => true,
|
||||
'holidays' => ['label' => 'Holidays', 'icon' => 'fa-calendar-times', 'color' => '#dc3545', 'module' => 'module_support', 'part' => 'ticketing', 'default' => true,
|
||||
'title' => 'Days the office is closed - the closure days in Admin > SLA'],
|
||||
];
|
||||
return array_filter($sources, function ($source) {
|
||||
return lookupUserPermission($source['module']) >= 1;
|
||||
return lookupUserPermission($source['module']) >= 1 && moduleOn($source['part']);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1589,7 +1589,8 @@ function calendarFirstName($name) {
|
||||
* calendarAgentColorSave() reads. Nothing before the update.
|
||||
*/
|
||||
function calendarAgentColorField($user_id, $col = 'col-md-6', $own = false) {
|
||||
if (!calendarAgentSettingsReady()) {
|
||||
// Shown on the calendar and the Dispatch board - with both switched off (Admin > Settings > Modules) there is nowhere to see it
|
||||
if (!calendarAgentSettingsReady() || (!moduleOn('calendar') && !moduleOn('dispatch'))) {
|
||||
return '';
|
||||
}
|
||||
$user_id = intval($user_id);
|
||||
|
||||
@@ -148,6 +148,22 @@ function categoryKinds() {
|
||||
];
|
||||
}
|
||||
|
||||
/* The part of ITFlow a kind of category belongs to (Admin > Settings > Modules) - null for one every install uses. */
|
||||
function categoryKindModule($kind) {
|
||||
return [
|
||||
'Expense' => 'accounting', 'Income' => 'accounting', 'Ticket' => 'ticketing', 'kb' => 'kb',
|
||||
'network_interface' => 'itdoc', 'asset_status' => 'itdoc', 'software_type' => 'itdoc', 'rack_type' => 'itdoc', 'asset_note_type' => 'itdoc',
|
||||
][(string) $kind] ?? null;
|
||||
}
|
||||
|
||||
/* The kinds of category of the parts of ITFlow switched on - what Admin > Categories lists. */
|
||||
function categoryKindsOn() {
|
||||
return array_filter(categoryKinds(), function ($kind) {
|
||||
$module = categoryKindModule($kind);
|
||||
return $module === null || moduleOn($module);
|
||||
}, ARRAY_FILTER_USE_KEY);
|
||||
}
|
||||
|
||||
/* One kind's settings, with 'kind' (its category_type) - or null. */
|
||||
function categoryKind($kind) {
|
||||
$kinds = categoryKinds();
|
||||
|
||||
@@ -183,6 +183,8 @@ function dashboardAccess() {
|
||||
|
||||
return [
|
||||
'support' => lookupUserPermission('module_support') >= 1,
|
||||
// Assets, domains, certificates, licenses and services - IT documentation (Admin > Settings > Modules)
|
||||
'itdoc' => moduleOn('itdoc') && lookupUserPermission('module_support') >= 1,
|
||||
'tickets' => $ticketing && lookupUserPermission('module_support') >= 1,
|
||||
'sales' => $accounting && lookupUserPermission('module_sales') >= 1,
|
||||
'financial' => $accounting && lookupUserPermission('module_financial') >= 1,
|
||||
@@ -293,7 +295,7 @@ function dashboardAttention($access) {
|
||||
'url' => '/agent/products_reprice.php',
|
||||
];
|
||||
// Hardware sold in the last 90 days that isn't on the client's assets yet
|
||||
if ($access['support']) {
|
||||
if ($access['itdoc']) {
|
||||
$hardware = productHardwarePending(90);
|
||||
$items[] = [
|
||||
'count' => $hardware['units'],
|
||||
@@ -327,14 +329,14 @@ function dashboardAttention($access) {
|
||||
'url' => '/agent/expenses.php?show=to_reimburse',
|
||||
];
|
||||
// Trips to bill to clients, and the driving in their own vehicles not paid for yet
|
||||
$trips_to_bill = tripUnbilledCount();
|
||||
$trips_to_bill = moduleOn('trips') ? tripUnbilledCount() : ['count' => 0, 'value' => 0];
|
||||
$items[] = [
|
||||
'count' => $trips_to_bill['count'],
|
||||
'label' => 'Trips to bill', 'one' => 'Trip to bill', 'icon' => 'route', 'tone' => 'info',
|
||||
'detail' => $trips_to_bill['count'] ? dashboardMoney($trips_to_bill['value']) . ' of travel' : null,
|
||||
'url' => '/agent/unbilled_time.php',
|
||||
];
|
||||
if (tripPayBackOn()) {
|
||||
if (moduleOn('trips') && tripPayBackOn()) {
|
||||
$mileage = tripToClaimCount();
|
||||
$items[] = [
|
||||
'count' => $mileage['count'],
|
||||
@@ -346,7 +348,7 @@ function dashboardAttention($access) {
|
||||
}
|
||||
}
|
||||
|
||||
if ($access['support']) {
|
||||
if ($access['itdoc']) {
|
||||
$soon = "BETWEEN CURDATE() AND CURDATE() + INTERVAL 30 DAY";
|
||||
$items[] = [
|
||||
'count' => dashboardCount("SELECT COUNT(domain_id) FROM domains WHERE domain_archived_at IS NULL AND domain_expire $soon " . clientScopeSql('domain_client_id')),
|
||||
|
||||
@@ -119,6 +119,10 @@ function notificationActionUrl($action) {
|
||||
if ($action[0] !== '/') {
|
||||
$action = '/agent/' . $action;
|
||||
}
|
||||
// A page of a part of ITFlow that is switched off (Admin > Settings > Modules) - no link
|
||||
if (modulePathOff((string) parse_url($action, PHP_URL_PATH))) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return $action;
|
||||
}
|
||||
|
||||
@@ -2005,9 +2005,11 @@ function reportLifecycleAssets($client_id = 0, $type = '') {
|
||||
|
||||
/** An asset's type tile and name, opening its page. */
|
||||
function reportAssetCell($row) {
|
||||
return '<a class="d-inline-flex align-items-center gap-2 text-body text-decoration-none" href="/agent/asset.php?client_id=' . intval($row['asset_client_id']) . '&asset_id=' . intval($row['asset_id']) . '">'
|
||||
. '<span class="itflow-asset-icon itflow-asset-icon-sm itflow-asset-tone-' . assetTypeTone($row['asset_type']) . '" aria-hidden="true"><i class="fas fa-fw fa-' . getAssetIcon($row['asset_type']) . '"></i></span>'
|
||||
. '<span class="fw-semibold text-nowrap">' . escapeHtml($row['asset_name']) . '</span></a>';
|
||||
// Named, with nothing to open, while IT documentation is switched off (Admin > Settings > Modules)
|
||||
return moduleLink('itdoc', '/agent/asset.php?client_id=' . intval($row['asset_client_id']) . '&asset_id=' . intval($row['asset_id']),
|
||||
'<span class="itflow-asset-icon itflow-asset-icon-sm itflow-asset-tone-' . assetTypeTone($row['asset_type']) . '" aria-hidden="true"><i class="fas fa-fw fa-' . getAssetIcon($row['asset_type']) . '"></i></span>'
|
||||
. '<span class="fw-semibold text-nowrap">' . escapeHtml($row['asset_name']) . '</span>',
|
||||
'class="d-inline-flex align-items-center gap-2 text-body text-decoration-none"');
|
||||
}
|
||||
|
||||
/** "3.4 yrs" from days, or '' without. */
|
||||
|
||||
@@ -108,6 +108,8 @@ function globalSearchGroups($terms, $deep) {
|
||||
|
||||
$ticketing = intval($config_module_enable_ticketing) === 1;
|
||||
$accounting = intval($config_module_enable_accounting) === 1;
|
||||
// Assets, credentials, domains, documents and the rest - IT documentation (Admin > Settings > Modules)
|
||||
$itdoc = moduleOn('itdoc');
|
||||
|
||||
$groups = [];
|
||||
|
||||
@@ -240,7 +242,7 @@ function globalSearchGroups($terms, $deep) {
|
||||
$asset_mac = normalizeMacAddress($q);
|
||||
$asset_mac_match = $asset_mac ? "OR REPLACE(REPLACE(REPLACE(UPPER(interface_mac), ':', ''), '-', ''), '.', '') = '" . str_replace(':', '', $asset_mac) . "'" : '';
|
||||
$groups[] = [
|
||||
'key' => 'assets', 'label' => 'Assets', 'icon' => 'desktop', 'module' => 'module_support',
|
||||
'key' => 'assets', 'label' => 'Assets', 'icon' => 'desktop', 'module' => 'module_support', 'enabled' => $itdoc,
|
||||
'select' => 'asset_id, asset_name, asset_type, asset_make, asset_model, asset_client_id, client_name,
|
||||
primary_interface.interface_ip AS asset_ip',
|
||||
'from' => 'assets
|
||||
@@ -282,7 +284,7 @@ function globalSearchGroups($terms, $deep) {
|
||||
= (INET_ATON(SUBSTRING_INDEX(network, '/', 1)) >> (32 - CAST(SUBSTRING_INDEX(network, '/', -1) AS UNSIGNED))))";
|
||||
$vlan_match = ctype_digit($q) ? "OR network_vlan = " . intval($q) : '';
|
||||
$groups[] = [
|
||||
'key' => 'networks', 'label' => 'Networks', 'icon' => 'network-wired', 'module' => 'module_support',
|
||||
'key' => 'networks', 'label' => 'Networks', 'icon' => 'network-wired', 'module' => 'module_support', 'enabled' => $itdoc,
|
||||
'select' => "network_id, network_name, network_description, network_type, network, network_vlan, network_client_id, client_name, location_name, $contains AS q_contains",
|
||||
'from' => 'networks
|
||||
LEFT JOIN clients ON network_client_id = client_id
|
||||
@@ -312,7 +314,7 @@ function globalSearchGroups($terms, $deep) {
|
||||
$mac = normalizeMacAddress($q);
|
||||
$mac_match = $mac ? "OR ip_mac = '$mac'" : '';
|
||||
$groups[] = [
|
||||
'key' => 'network_ips', 'label' => 'IP Addresses', 'icon' => 'map-pin', 'module' => 'module_support',
|
||||
'key' => 'network_ips', 'label' => 'IP Addresses', 'icon' => 'map-pin', 'module' => 'module_support', 'enabled' => $itdoc,
|
||||
'select' => 'ip_id, ip_address, ip_type, ip_hostname, ip_description, network_id, network_name, network_client_id, client_name',
|
||||
'from' => 'network_ips
|
||||
JOIN networks ON network_id = ip_network_id
|
||||
@@ -335,7 +337,7 @@ function globalSearchGroups($terms, $deep) {
|
||||
// Licenses by name, vendor and order reference - and by key, so a key read
|
||||
// off a sticker or a screen finds the license it belongs to
|
||||
$groups[] = [
|
||||
'key' => 'licenses', 'label' => 'Licenses', 'icon' => 'cube', 'module' => 'module_support',
|
||||
'key' => 'licenses', 'label' => 'Licenses', 'icon' => 'cube', 'module' => 'module_support', 'enabled' => $itdoc,
|
||||
'select' => 'software.software_id, software_name, software_version, software_license_type, software_expire, software_client_id, client_name, vendor_name',
|
||||
'from' => 'software
|
||||
LEFT JOIN clients ON software_client_id = client_id
|
||||
@@ -363,7 +365,7 @@ function globalSearchGroups($terms, $deep) {
|
||||
// What a client runs on - by name, category and description, and its notes in a deep search
|
||||
$service_deep_match = $deep ? "OR service_notes LIKE '%$like%' OR service_backup LIKE '%$like%'" : '';
|
||||
$groups[] = [
|
||||
'key' => 'services', 'label' => 'Services', 'icon' => 'stream', 'module' => 'module_support',
|
||||
'key' => 'services', 'label' => 'Services', 'icon' => 'stream', 'module' => 'module_support', 'enabled' => $itdoc,
|
||||
'select' => 'service_id, service_name, service_description, service_category, service_importance, service_client_id, client_name',
|
||||
'from' => 'services LEFT JOIN clients ON service_client_id = client_id',
|
||||
'where' => "service_archived_at IS NULL
|
||||
@@ -388,7 +390,7 @@ function globalSearchGroups($terms, $deep) {
|
||||
// and the results page reveals passwords through the audited endpoint, never
|
||||
// in the markup.
|
||||
$groups[] = [
|
||||
'key' => 'credentials', 'label' => 'Credentials', 'icon' => 'key', 'module' => 'module_credential',
|
||||
'key' => 'credentials', 'label' => 'Credentials', 'icon' => 'key', 'module' => 'module_credential', 'enabled' => $itdoc,
|
||||
'select' => 'credential_id, credential_name, credential_description, credential_client_id, client_name',
|
||||
'from' => 'credentials LEFT JOIN clients ON credential_client_id = client_id',
|
||||
'where' => "credential_archived_at IS NULL
|
||||
@@ -411,7 +413,7 @@ function globalSearchGroups($terms, $deep) {
|
||||
];
|
||||
|
||||
$groups[] = [
|
||||
'key' => 'domains', 'label' => 'Domains', 'icon' => 'globe', 'module' => 'module_support',
|
||||
'key' => 'domains', 'label' => 'Domains', 'icon' => 'globe', 'module' => 'module_support', 'enabled' => $itdoc,
|
||||
'select' => 'domain_id, domain_name, domain_description, domain_expire, domain_auto_renew, domain_client_id, client_name',
|
||||
'from' => 'domains LEFT JOIN clients ON domain_client_id = client_id',
|
||||
'where' => "domain_archived_at IS NULL AND (domain_name LIKE '%$like%' OR domain_description LIKE '%$like%' " . tagSearchSql('domain', $like, 'domains.domain_id') . ")",
|
||||
@@ -431,7 +433,7 @@ function globalSearchGroups($terms, $deep) {
|
||||
];
|
||||
|
||||
$groups[] = [
|
||||
'key' => 'certificates', 'label' => 'Certificates', 'icon' => 'lock', 'module' => 'module_support',
|
||||
'key' => 'certificates', 'label' => 'Certificates', 'icon' => 'lock', 'module' => 'module_support', 'enabled' => $itdoc,
|
||||
'select' => 'certificate_id, certificate_name, certificate_description, certificate_domain, certificate_expire, certificate_issued_at, certificate_check_status, certificate_client_id, client_name',
|
||||
'from' => 'certificates LEFT JOIN clients ON certificate_client_id = client_id',
|
||||
'where' => "certificate_archived_at IS NULL AND (certificate_name LIKE '%$like%' OR certificate_domain LIKE '%$like%' OR certificate_names LIKE '%$like%'
|
||||
@@ -459,7 +461,7 @@ function globalSearchGroups($terms, $deep) {
|
||||
|
||||
$document_deep_match = $deep ? "OR MATCH(document_content_raw) AGAINST ('$eq')" : '';
|
||||
$groups[] = [
|
||||
'key' => 'documents', 'label' => 'Documents', 'icon' => 'file-alt', 'module' => 'module_support',
|
||||
'key' => 'documents', 'label' => 'Documents', 'icon' => 'file-alt', 'module' => 'module_support', 'enabled' => $itdoc,
|
||||
'select' => 'document_id, document_name, document_description, document_client_id, client_name',
|
||||
'from' => 'documents LEFT JOIN clients ON document_client_id = client_id',
|
||||
'where' => "document_archived_at IS NULL
|
||||
@@ -505,7 +507,7 @@ function globalSearchGroups($terms, $deep) {
|
||||
];
|
||||
|
||||
$groups[] = [
|
||||
'key' => 'files', 'label' => 'Files', 'icon' => 'paperclip', 'module' => 'module_support',
|
||||
'key' => 'files', 'label' => 'Files', 'icon' => 'paperclip', 'module' => 'module_support', 'enabled' => $itdoc,
|
||||
'select' => 'file_id, file_name, file_ext, file_description, file_client_id, file_folder_id, client_name, folder_name',
|
||||
'from' => 'files
|
||||
LEFT JOIN clients ON file_client_id = client_id
|
||||
@@ -718,7 +720,7 @@ function globalSearchGroups($terms, $deep) {
|
||||
// Tags by name or description - each opens its kind's list filtered by it,
|
||||
// for the kinds this agent can open. Tag names aren't a client's, so no scope
|
||||
$tag_types = [];
|
||||
foreach (tagKinds() as $tag_type => $tag_entity) {
|
||||
foreach (tagKindsOn() as $tag_type => $tag_entity) {
|
||||
if (lookupUserPermission(tagEntity($tag_entity)['module']) >= 1) {
|
||||
$tag_types[] = $tag_type;
|
||||
}
|
||||
@@ -912,7 +914,7 @@ function globalSearchPages($raw_query) {
|
||||
['Dashboard', '/agent/dashboard.php', true],
|
||||
['Clients', '/agent/clients.php', $client],
|
||||
['Across clients', '/agent/contacts.php', $client && $support],
|
||||
['Services', '/agent/services.php', $support],
|
||||
['Services', '/agent/services.php', $support && moduleOn('itdoc')],
|
||||
['Vendors', '/agent/vendors.php', true],
|
||||
['Calendar', '/agent/calendar.php', moduleOn('calendar')],
|
||||
['Knowledge Base', '/agent/kb.php', kbCan(1)],
|
||||
|
||||
@@ -108,14 +108,211 @@ function moduleOn($module) {
|
||||
* that comes with another, when that one is off.
|
||||
*/
|
||||
function moduleOffText($module) {
|
||||
$names = ['dispatch' => 'Dispatch is', 'bookkeeping' => 'Bookkeeping is', 'trips' => 'Trips are', 'calendar' => 'The calendar is', 'purchasing' => 'Purchasing is', 'kb' => 'The Knowledge Base is'];
|
||||
$names = ['dispatch' => 'Dispatch is', 'bookkeeping' => 'Bookkeeping is', 'trips' => 'Trips are', 'calendar' => 'The calendar is', 'purchasing' => 'Purchasing is', 'kb' => 'The Knowledge Base is',
|
||||
'itdoc' => 'IT documentation is', 'ticketing' => 'Ticketing is', 'accounting' => 'Invoicing and accounting are', 'portal' => 'The client portal is'];
|
||||
$comes_with = ['dispatch' => 'ticketing', 'bookkeeping' => 'accounting', 'trips' => 'accounting', 'purchasing' => 'accounting'];
|
||||
$parent = $comes_with[$module] ?? '';
|
||||
if ($parent && !moduleOn($parent)) {
|
||||
return preg_replace('/ (is|are)$/', '', $names[$module]) . ' come' . ($module === 'trips' ? '' : 's') . ' with ' . ($parent === 'ticketing' ? 'ticketing' : 'invoicing')
|
||||
. ', which is switched off - an admin switches it on in Admin > Settings > Modules.';
|
||||
}
|
||||
return ($names[$module] ?? 'That is') . ' switched off - an admin switches ' . ($module === 'trips' ? 'them' : 'it') . ' on in Admin > Settings > Modules.';
|
||||
return ($names[$module] ?? 'That is') . ' switched off - an admin switches ' . (in_array($module, ['trips', 'accounting'], true) ? 'them' : 'it') . ' on in Admin > Settings > Modules.';
|
||||
}
|
||||
|
||||
/*
|
||||
* The pages, windows, portal pages and guest pages of each part of ITFlow that can be
|
||||
* switched off, from the app's folder - one ending in / is a whole folder. Asked for
|
||||
* while its part is off, any of them is turned away (moduleRequestGuard()), whatever
|
||||
* led there: a bookmark, an old email, a link left on another page. A report's parts
|
||||
* are its 'feature's in reportCatalog().
|
||||
*/
|
||||
function modulePaths() {
|
||||
return [
|
||||
'ticketing' => [
|
||||
'agent/tickets.php', 'agent/ticket.php', 'agent/ticket_attachment.php',
|
||||
'agent/recurring_tickets.php', 'agent/projects.php', 'agent/project.php', 'agent/email_unprocessed.php', 'agent/canned_response_file.php',
|
||||
'agent/modals/ticket/', 'agent/modals/recurring_ticket/', 'agent/modals/project/', 'agent/modals/email_unprocessed/', 'agent/modals/phone/phone_call_ticket.php',
|
||||
'agent/modals/asset/asset_bulk_add_ticket.php', 'agent/modals/client/client_bulk_add_ticket.php', 'agent/modals/sms/sms_ticket_open.php',
|
||||
'agent/modals/invoice/invoice_add_ticket.php', 'agent/modals/kb/kb_article_from_ticket.php',
|
||||
'agent/modals/top_nav_tickets_modal.php',
|
||||
'admin/ticket_statuses.php', 'admin/ticket_templates.php', 'admin/ticket_template.php', 'admin/project_templates.php', 'admin/project_template.php',
|
||||
'admin/settings_ticket.php', 'admin/settings_project.php', 'admin/sla.php', 'admin/canned_responses.php', 'admin/email_routing_rules.php',
|
||||
'admin/email_ignored_senders.php',
|
||||
'admin/modals/ticket_status/', 'admin/modals/ticket_template/', 'admin/modals/project_template/', 'admin/modals/sla/', 'admin/modals/canned_response/',
|
||||
'admin/modals/email_routing_rule/', 'admin/modals/email_ignored_sender/', 'admin/modals/ticket_mail/',
|
||||
'client/tickets.php', 'client/ticket.php', 'client/ticket_add.php', 'client/ticket_view_all.php', 'client/ticket_attachment.php',
|
||||
'guest/guest_view_ticket.php', 'guest/guest_ticket_attachment.php', 'guest/guest_approve_ticket_task.php',
|
||||
],
|
||||
'dispatch' => ['agent/dispatch.php'],
|
||||
'itdoc' => [
|
||||
'agent/assets.php', 'agent/asset.php', 'agent/credentials.php', 'agent/networks.php', 'agent/network.php', 'agent/racks.php', 'agent/rack.php',
|
||||
'agent/certificates.php', 'agent/domains.php', 'agent/software.php', 'agent/license.php', 'agent/services.php', 'agent/service.php',
|
||||
'agent/files.php', 'agent/document.php', 'agent/document_edit.php', 'agent/shares.php', 'agent/modals/share/',
|
||||
'agent/modals/invoice/invoice_assets.php',
|
||||
'agent/modals/asset/', 'agent/modals/credential/', 'agent/modals/network/', 'agent/modals/rack/', 'agent/modals/certificate/', 'agent/modals/domain/',
|
||||
'agent/modals/software/', 'agent/modals/service/', 'agent/modals/document/', 'agent/modals/file/', 'agent/modals/folder/',
|
||||
'admin/asset_types.php', 'admin/document_templates.php', 'admin/document_template.php', 'admin/software_templates.php', 'admin/software_template.php',
|
||||
'admin/vendor_templates.php', 'admin/vendor_template.php', 'admin/network_platforms.php',
|
||||
'admin/modals/asset_type/', 'admin/modals/document_template/', 'admin/modals/software_template/', 'admin/modals/vendor_template/',
|
||||
'client/assets.php', 'client/asset.php', 'client/licenses.php', 'client/domains.php', 'client/certificates.php', 'client/documents.php',
|
||||
'client/document.php', 'client/document_add.php', 'client/file.php',
|
||||
'guest/share.php', 'guest/guest_view_item.php',
|
||||
],
|
||||
'accounting' => [
|
||||
'agent/quotes.php', 'agent/quote.php', 'agent/invoices.php', 'agent/invoice.php', 'agent/recurring_invoices.php', 'agent/recurring_invoice.php',
|
||||
'agent/income.php', 'agent/income_import.php', 'agent/expenses.php', 'agent/expense_import.php', 'agent/expense_receipt.php', 'agent/recurring_expenses.php',
|
||||
'agent/products.php', 'agent/product.php', 'agent/products_count.php', 'agent/products_reprice.php', 'agent/unbilled_time.php',
|
||||
'agent/contracts.php', 'agent/contract.php', 'agent/contract_document.php',
|
||||
'agent/modals/quote/', 'agent/modals/invoice/', 'agent/modals/recurring_invoice/', 'agent/modals/payment/', 'agent/modals/revenue/', 'agent/modals/income/',
|
||||
'agent/modals/expense/', 'agent/modals/recurring_expense/', 'agent/modals/product/', 'agent/modals/billing/', 'agent/modals/contract/',
|
||||
'agent/modals/client/client_bulk_add_contract.php', 'agent/modals/client/client_contract_pick.php', 'agent/modals/client/client_credit_add.php',
|
||||
'agent/modals/client/client_statement.php',
|
||||
'admin/payment_methods.php', 'admin/payment_providers.php', 'admin/tax_rates.php', 'admin/labor_costs.php', 'admin/settings_invoice.php',
|
||||
'admin/settings_quote.php', 'admin/saved_payment_methods.php', 'admin/contract_templates.php',
|
||||
'admin/modals/payment_method/', 'admin/modals/payment_provider/', 'admin/modals/tax/', 'admin/modals/labor_cost/', 'admin/modals/contract_template/',
|
||||
'client/invoices.php', 'client/invoice.php', 'client/unpaid_invoices.php', 'client/pay.php', 'client/quotes.php', 'client/quote.php',
|
||||
'client/recurring_invoices.php', 'client/recurring_invoice.php', 'client/contracts.php', 'client/contract.php', 'client/payments.php',
|
||||
'client/receipt.php', 'client/statement.php', 'client/saved_payment_methods.php', 'client/pdf.php',
|
||||
'guest/guest_view_invoice.php', 'guest/guest_view_quote.php', 'guest/guest_view_contract.php', 'guest/guest_pay_invoice_stripe.php',
|
||||
'guest/guest_pay_setup_stripe_customer.php', 'guest/guest_autopay.php', 'guest/guest_card_update.php',
|
||||
],
|
||||
'purchasing' => ['agent/to_order.php', 'agent/purchase_orders.php', 'agent/purchase_order.php', 'agent/receiving.php', 'agent/modals/purchasing/',
|
||||
'admin/settings_purchase_order.php'],
|
||||
'bookkeeping' => ['agent/accounts.php', 'agent/reconcile.php', 'agent/transactions.php', 'agent/transfers.php',
|
||||
'agent/modals/account/', 'agent/modals/transfer/', 'agent/modals/transaction/'],
|
||||
'trips' => ['agent/trips.php', 'agent/modals/trip/'],
|
||||
'calendar' => ['agent/calendar.php', 'agent/modals/calendar/'],
|
||||
'kb' => ['agent/kb.php', 'agent/kb_article.php', 'agent/kb_file.php', 'agent/modals/kb/', 'admin/settings_kb.php',
|
||||
'client/kb.php', 'client/kb_article.php', 'client/kb_file.php'],
|
||||
'portal' => ['admin/settings_client_portal.php', 'admin/modals/portal_announcement/', 'admin/modals/portal_user/'],
|
||||
];
|
||||
}
|
||||
|
||||
/*
|
||||
* The parts of ITFlow a file (its path from the app's folder) belongs to - none, one,
|
||||
* or several (the Mileage report is accounting's and trips'). A report's are its
|
||||
* 'feature's in reportCatalog().
|
||||
*/
|
||||
function moduleForPath($path) {
|
||||
$path = ltrim(str_replace('\\', '/', (string) $path), '/');
|
||||
$found = [];
|
||||
foreach (modulePaths() as $module => $paths) {
|
||||
foreach ($paths as $own) {
|
||||
if ($path === $own || (str_ends_with($own, '/') && str_starts_with($path, $own))) {
|
||||
$found[] = $module;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (preg_match('#^agent/reports/([a-z0-9_]+)\.php$#', $path, $m) && function_exists('reportFind') && ($report = reportFind($m[1]))) {
|
||||
$found = array_merge($found, $report['feature'] ?? []);
|
||||
}
|
||||
return array_values(array_unique($found));
|
||||
}
|
||||
|
||||
/*
|
||||
* A link to a record of a part of ITFlow - an <a> while it is on, the same words in a <span> while it is
|
||||
* switched off, so a page that mentions a ticket or an invoice still names it but has nothing to open.
|
||||
* $href and $attrs (class, title) are HTML already; $inner_html is the link's content.
|
||||
*/
|
||||
function moduleLink($module, $href, $inner_html, $attrs = '') {
|
||||
$attrs = trim((string) $attrs);
|
||||
if (!moduleOn($module)) {
|
||||
return '<span' . ($attrs !== '' ? " $attrs" : '') . '>' . $inner_html . '</span>';
|
||||
}
|
||||
return '<a href="' . $href . '"' . ($attrs !== '' ? " $attrs" : '') . '>' . $inner_html . '</a>';
|
||||
}
|
||||
|
||||
/*
|
||||
* The module switches, for what runs without includes/load_global_settings.php - the API, the sign-in page.
|
||||
* Read from the settings row once; a page that loaded the settings has them already.
|
||||
*/
|
||||
function moduleSwitchesLoad() {
|
||||
global $mysqli;
|
||||
if (isset($GLOBALS['config_module_enable_itdoc'])) {
|
||||
return;
|
||||
}
|
||||
foreach (mysqli_fetch_assoc(mysqli_query($mysqli, "SELECT * FROM settings WHERE company_id = 1")) ?: [] as $column => $value) {
|
||||
if (str_starts_with($column, 'config_module_enable_') || $column === 'config_client_portal_enable') {
|
||||
$GLOBALS[$column] = intval($value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** Is that file in a part of ITFlow that is switched off? */
|
||||
function modulePathOff($path) {
|
||||
foreach (moduleForPath($path) as $module) {
|
||||
if (!moduleOn($module)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
* Turn away a request for a page or window of a part of ITFlow that is switched off
|
||||
* (modulePaths()). Every agent, admin and report page and window passes through it in
|
||||
* includes/check_login.php, the portal's in client/includes/check_login.php, and the
|
||||
* guest pages in guest/includes/inc_all_guest.php.
|
||||
*/
|
||||
function moduleRequestGuard($path = null) {
|
||||
$path = ltrim(str_replace('\\', '/', (string) ($path ?? ($_SERVER['SCRIPT_NAME'] ?? ''))), '/');
|
||||
foreach (moduleForPath($path) as $module) {
|
||||
if (!moduleOn($module)) {
|
||||
moduleRefuse($module, $path);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Say a part of ITFlow is switched off in the shape that was asked for, and stop - in
|
||||
* the window for a window, on the page the agent came from (or the dashboard, or for an
|
||||
* admin page the Modules settings) for a page, on the portal's home for a contact, and
|
||||
* a plain page for someone with a link. As permissionRefuse() (functions/auth.php) does
|
||||
* for a role.
|
||||
*/
|
||||
function moduleRefuse($module, $path = '') {
|
||||
$message = moduleOffText($module);
|
||||
$path = ltrim((string) $path, '/');
|
||||
|
||||
// A window (agent/modals/, admin/modals/) - its own window says so
|
||||
if (str_contains($path, '/modals/')) {
|
||||
while (ob_get_level()) {
|
||||
ob_end_clean();
|
||||
}
|
||||
if (!headers_sent()) {
|
||||
header('Content-Type: application/json');
|
||||
}
|
||||
echo json_encode(['content' => '<div class="modal-header bg-dark"><h5 class="modal-title"><i class="fas fa-fw fa-power-off me-2"></i>Switched off</h5>'
|
||||
. '<button type="button" class="btn-close btn-close-white" data-bs-dismiss="modal" aria-label="Close"></button></div>'
|
||||
. '<div class="modal-body"><p class="mb-0">' . escapeHtml($message) . '</p></div>'
|
||||
. '<div class="modal-footer"><button type="button" class="btn btn-light" data-bs-dismiss="modal"><i class="fas fa-times me-2"></i>Close</button></div>']);
|
||||
exit;
|
||||
}
|
||||
|
||||
// Someone with a link - an invoice, quote or ticket sent to a client - no settings talk
|
||||
if (str_starts_with($path, 'guest/')) {
|
||||
http_response_code(404);
|
||||
echo '<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1"><title>Not available</title></head>'
|
||||
. '<body style="font-family: system-ui, sans-serif; max-width: 34rem; margin: 15vh auto; padding: 0 1rem; text-align: center; color: #333">'
|
||||
. '<h1 style="font-size: 1.4rem">This link isn\'t available</h1><p>Get in touch with us if you need what it was for.</p></body></html>';
|
||||
exit;
|
||||
}
|
||||
|
||||
// A client's contact in the portal - its home
|
||||
if (str_starts_with($path, 'client/')) {
|
||||
flashAlert('That part of the portal isn\'t available.', 'error');
|
||||
redirect('/client/index.php');
|
||||
}
|
||||
|
||||
// An agent - back where they came from when that is still on, else the dashboard (an admin page: Modules)
|
||||
flashAlert($message, 'error');
|
||||
$back = (string) ($_SERVER['HTTP_REFERER'] ?? '');
|
||||
$back_path = (string) parse_url($back, PHP_URL_PATH);
|
||||
$here = (string) parse_url((string) ($_SERVER['REQUEST_URI'] ?? ''), PHP_URL_PATH);
|
||||
$back_ok = $back !== '' && parse_url($back, PHP_URL_HOST) === parse_url('//' . ($_SERVER['HTTP_HOST'] ?? ''), PHP_URL_HOST)
|
||||
&& $back_path !== $here && !modulePathOff(ltrim($back_path, '/'));
|
||||
redirect($back_ok ? $back : (str_starts_with($path, 'admin/') ? '/admin/settings_module.php' : '/agent/dashboard.php'));
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1139,10 +1336,10 @@ function settingsNumberingFields($kind, $prefix, $number) {
|
||||
function settingsStartPages() {
|
||||
$pages = ['dashboard.php' => 'Dashboard', 'clients.php' => 'Clients', 'tickets.php' => 'Tickets', 'calendar.php' => 'Calendar', 'projects.php' => 'Projects',
|
||||
'invoices.php' => 'Invoices', 'quotes.php' => 'Quotes', 'assets.php' => 'Assets'];
|
||||
if (!moduleOn('calendar')) {
|
||||
unset($pages['calendar.php']);
|
||||
}
|
||||
return $pages;
|
||||
// Not a page of a part of ITFlow switched off (Admin > Settings > Modules)
|
||||
return array_filter($pages, function ($page) {
|
||||
return !modulePathOff("agent/$page");
|
||||
}, ARRAY_FILTER_USE_KEY);
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -532,6 +532,20 @@ function tagKinds() {
|
||||
8 => 'license', 9 => 'service', 10 => 'network', 11 => 'document', 12 => 'ticket'] + ($kb ? [13 => 'kb_article'] : []);
|
||||
}
|
||||
|
||||
/* The part of ITFlow a kind of tag's records belong to (Admin > Settings > Modules) - null for clients, locations, contacts and vendors. */
|
||||
function tagKindModule($entity) {
|
||||
return ['credential' => 'itdoc', 'asset' => 'itdoc', 'domain' => 'itdoc', 'license' => 'itdoc', 'service' => 'itdoc', 'network' => 'itdoc',
|
||||
'document' => 'itdoc', 'ticket' => 'ticketing', 'kb_article' => 'kb'][(string) $entity] ?? null;
|
||||
}
|
||||
|
||||
/* tagKinds() of the parts of ITFlow switched on - what Admin > Tags lists and the API and search offer. */
|
||||
function tagKindsOn() {
|
||||
return array_filter(tagKinds(), function ($entity) {
|
||||
$module = tagKindModule($entity);
|
||||
return $module === null || moduleOn($module);
|
||||
});
|
||||
}
|
||||
|
||||
/* "an asset tag", "a client tag" - for messages. */
|
||||
function tagKindPhrase($type) {
|
||||
$word = strtolower(tagEntityByType($type)['title'] ?? 'unknown');
|
||||
|
||||
@@ -136,6 +136,14 @@ function ticketUrl($ticket_id, $client_id = 0) {
|
||||
function ticketLink($row, $options = []) {
|
||||
$url = escapeHtml(ticketUrl($row['ticket_id'], $row['ticket_client_id'] ?? 0));
|
||||
$reference = escapeHtml(ticketReference($row));
|
||||
// Ticketing switched off (Admin > Settings > Modules) - named, with nothing to open
|
||||
if (!moduleOn('ticketing')) {
|
||||
$html = '<span class="font-monospace text-nowrap">' . $reference . '</span>';
|
||||
if (($options['subject'] ?? true) && isset($row['ticket_subject'])) {
|
||||
$html .= ' <span class="text-body-secondary">' . escapeHtml($row['ticket_subject']) . '</span>';
|
||||
}
|
||||
return $html;
|
||||
}
|
||||
$html = '<a class="font-monospace text-nowrap" href="' . $url . '">' . $reference . '</a>';
|
||||
if (($options['subject'] ?? true) && isset($row['ticket_subject'])) {
|
||||
$html .= ' <a class="' . (ticketIsOpen($row) ? 'text-body' : 'text-body-secondary') . '" href="' . $url . '">' . escapeHtml($row['ticket_subject']) . '</a>';
|
||||
|
||||
@@ -17,6 +17,9 @@ require_once "../functions.php";
|
||||
require_once "../includes/load_global_settings.php";
|
||||
require_once "../includes/inc_set_timezone.php";
|
||||
|
||||
// Ticketing switched off (functions/settings.php)
|
||||
moduleRequestGuard();
|
||||
|
||||
// logAudit() reads these
|
||||
$session_ip = escapeSql(getIP());
|
||||
$session_user_agent = escapeSql($_SERVER['HTTP_USER_AGENT'] ?? '');
|
||||
|
||||
@@ -9,6 +9,9 @@ require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/session_init.php';
|
||||
// Set Timezone
|
||||
require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/inc_set_timezone.php';
|
||||
|
||||
// A link to a part of ITFlow that is switched off - an invoice with invoicing off, a ticket with ticketing off (functions/settings.php)
|
||||
moduleRequestGuard();
|
||||
|
||||
$ip = escapeSql(getIP());
|
||||
$user_agent = escapeSql(mb_substr((string) ($_SERVER['HTTP_USER_AGENT'] ?? ''), 0, 250)); // log_user_agent is varchar(250)
|
||||
$os = escapeSql(getOS($user_agent));
|
||||
|
||||
@@ -31,6 +31,11 @@ header('Content-Type: application/json');
|
||||
header('Cache-Control: no-store');
|
||||
header('X-Robots-Tag: noindex, nofollow');
|
||||
|
||||
// IT documentation switched off (Admin > Settings > Modules) - what was shared is its, and doesn't open while it is off
|
||||
if (!moduleOn('itdoc')) {
|
||||
exit(json_encode(['state' => 'gone', 'reason' => 'It isn\'t available.']));
|
||||
}
|
||||
|
||||
// logAudit() reads these - guest rows record where the request came from
|
||||
$session_ip = escapeSql(getIP());
|
||||
$session_user_agent = escapeSql($_SERVER['HTTP_USER_AGENT'] ?? '');
|
||||
|
||||
@@ -16,6 +16,9 @@ managedRequestGuard('agent');
|
||||
// The demo - what visitors can't change there (functions/demo.php)
|
||||
demoModeGuard();
|
||||
|
||||
// A page or window of a part of ITFlow that is switched off (functions/settings.php)
|
||||
moduleRequestGuard();
|
||||
|
||||
// 2FA keys saved before they were kept encrypted - encrypted with this agent's vault, once a
|
||||
// session until none are left (functions/credential.php)
|
||||
credentialOtpVaultStored();
|
||||
|
||||
@@ -139,8 +139,8 @@ function cronJobRegistry(): array
|
||||
'schedule' => 'Interval',
|
||||
'interval_minutes' => 1,
|
||||
'not_in_use' => function () {
|
||||
if (intval(cronJobSettings()['config_module_enable_ticketing'] ?? 0) === 0) {
|
||||
return 'Ticketing is turned off';
|
||||
if ($off = cronJobModuleOff('ticketing')) {
|
||||
return $off;
|
||||
}
|
||||
foreach (rmmProviders(true) as $provider) {
|
||||
if (rmmAlertsOn($provider)) {
|
||||
@@ -160,6 +160,9 @@ function cronJobRegistry(): array
|
||||
'interval_minutes' => 1,
|
||||
'not_in_use' => function () {
|
||||
$settings = cronJobSettings();
|
||||
if ($off = cronJobModuleOff('ticketing')) {
|
||||
return $off;
|
||||
}
|
||||
if (intval($settings['config_ticket_email_parse'] ?? 0) === 0) {
|
||||
return 'Email to ticket is off in Settings > Tickets';
|
||||
}
|
||||
@@ -177,6 +180,9 @@ function cronJobRegistry(): array
|
||||
'description' => 'Moves tickets through their SLA warning and breach stages and sends the alerts.',
|
||||
'schedule' => 'Interval',
|
||||
'interval_minutes' => 1,
|
||||
'not_in_use' => function () {
|
||||
return cronJobModuleOff('ticketing');
|
||||
},
|
||||
],
|
||||
[
|
||||
'name' => 'calendar_reminders',
|
||||
@@ -196,7 +202,7 @@ function cronJobRegistry(): array
|
||||
'schedule' => 'Interval',
|
||||
'interval_minutes' => 1,
|
||||
'not_in_use' => function () {
|
||||
return aiTriageNotInUse();
|
||||
return cronJobModuleOff('ticketing') ?: aiTriageNotInUse();
|
||||
},
|
||||
],
|
||||
[
|
||||
@@ -227,6 +233,9 @@ function cronJobRegistry(): array
|
||||
'interval_minutes' => 15,
|
||||
'not_in_use' => function () {
|
||||
global $mysqli;
|
||||
if ($off = cronJobModuleOff('accounting')) {
|
||||
return $off;
|
||||
}
|
||||
return mysqli_num_rows(mysqli_query($mysqli, "SELECT 1 FROM payment_providers WHERE payment_provider_name = 'Stripe' LIMIT 1")) ? '' : 'No Stripe payment provider - Admin > Payment Providers';
|
||||
},
|
||||
],
|
||||
@@ -235,6 +244,9 @@ function cronJobRegistry(): array
|
||||
'label' => 'Ticket Pictures',
|
||||
'icon' => 'fa-image',
|
||||
'script' => 'ticket_pictures.php',
|
||||
'not_in_use' => function () {
|
||||
return cronJobModuleOff('ticketing');
|
||||
},
|
||||
'description' => 'Moves pictures still kept inside tickets\' text - from before the update, or put there by a recurring ticket or a template - into each ticket\'s files, a batch each run, so long tickets open quickly. Once it has been through every ticket it only looks at new ones.',
|
||||
'schedule' => 'Interval',
|
||||
'interval_minutes' => 1,
|
||||
@@ -247,6 +259,9 @@ function cronJobRegistry(): array
|
||||
'description' => 'Looks up DNS, registration and expiry for domains that are due - never looked up, not in a week, or expiring within 60 days. Up to 50 a run.',
|
||||
'schedule' => 'Daily',
|
||||
'daily_at' => '04:00',
|
||||
'not_in_use' => function () {
|
||||
return cronJobModuleOff('itdoc');
|
||||
},
|
||||
],
|
||||
[
|
||||
'name' => 'nightly_tasks',
|
||||
@@ -277,6 +292,9 @@ function cronJobRegistry(): array
|
||||
'description' => 'Checks the host of every certificate once a day - what it serves now, its expiry and issuer, and whether it is OK, for another name, untrusted, expired or unreachable.',
|
||||
'schedule' => 'Daily',
|
||||
'daily_at' => '03:30',
|
||||
'not_in_use' => function () {
|
||||
return cronJobModuleOff('itdoc');
|
||||
},
|
||||
],
|
||||
[
|
||||
'name' => 'update_check',
|
||||
@@ -424,8 +442,18 @@ function cronJobSettings(): array
|
||||
global $mysqli;
|
||||
static $settings = null;
|
||||
if ($settings === null) {
|
||||
$settings = mysqli_fetch_assoc(mysqli_query($mysqli, "SELECT config_smtp_provider, config_imap_provider, config_ticket_email_parse,
|
||||
config_module_enable_ticketing FROM settings WHERE company_id = 1")) ?: [];
|
||||
// The whole row - the module switches (Admin > Settings > Modules) are there only once the update that added each has run
|
||||
$settings = mysqli_fetch_assoc(mysqli_query($mysqli, "SELECT * FROM settings WHERE company_id = 1")) ?: [];
|
||||
}
|
||||
return $settings;
|
||||
}
|
||||
|
||||
/*
|
||||
* Why a job has nothing to do because its part of ITFlow is switched off in Admin > Settings > Modules - or ''.
|
||||
* itdoc, ticketing or accounting.
|
||||
*/
|
||||
function cronJobModuleOff(string $module): string
|
||||
{
|
||||
$names = ['itdoc' => 'IT documentation is', 'ticketing' => 'Ticketing is', 'accounting' => 'Invoicing and accounting are'];
|
||||
return intval(cronJobSettings()["config_module_enable_$module"] ?? 1) === 1 ? '' : ($names[$module] ?? 'Its module is') . ' turned off in Settings > Modules';
|
||||
}
|
||||
|
||||
@@ -154,6 +154,10 @@ if (version_compare((string) ($row['config_current_database_version'] ?? '0'), '
|
||||
$config_kb_public_enable = intval(mysqli_fetch_row(mysqli_query($mysqli, "SELECT config_kb_public_enable FROM settings WHERE company_id = 1"))[0] ?? 0);
|
||||
}
|
||||
$config_client_portal_require_mfa = intval($row['config_client_portal_require_mfa']);
|
||||
// A start page whose module is switched off (Admin > Settings > Modules) opens the dashboard instead
|
||||
if (function_exists('modulePathOff') && modulePathOff('agent/' . strtok((string) $config_start_page, '?'))) {
|
||||
$config_start_page = 'dashboard.php';
|
||||
}
|
||||
|
||||
// The client record that represents this MSP's own company, or 0 for none
|
||||
$config_internal_client_id = intval($row['config_internal_client_id']);
|
||||
|
||||
@@ -728,6 +728,11 @@ if (($_SERVER['REQUEST_METHOD'] === 'POST' && (isset($_POST['login']) || isset($
|
||||
if (isset($_GET['last_visited']) && (str_starts_with(base64_decode($_GET['last_visited']), '/agent') || str_starts_with(base64_decode($_GET['last_visited']), '/admin'))) {
|
||||
redirect($_SERVER["REQUEST_SCHEME"] . "://" . $config_base_url . base64_decode($_GET['last_visited']));
|
||||
} else {
|
||||
// A start page whose module is switched off (Admin > Settings > Modules) - the dashboard instead
|
||||
moduleSwitchesLoad();
|
||||
if (modulePathOff('agent/' . strtok((string) $config_start_page, '?'))) {
|
||||
$config_start_page = 'dashboard.php';
|
||||
}
|
||||
redirect("agent/$config_start_page");
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user