From 76c572c67e8414fa724a637a4bb996e8a04226d9 Mon Sep 17 00:00:00 2001 From: johnnyq Date: Thu, 3 Dec 2026 18:44:24 -0500 Subject: [PATCH 01/14] 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 --- CHANGELOG.md | 24 ++ CONTRIBUTING.md | 2 + admin/agent_banners.php | 2 +- admin/categories.php | 8 +- admin/includes/side_nav.php | 2 + admin/modals/category/category_form.php | 2 +- .../contract_template_form.php | 7 + admin/modals/tag/tag_form.php | 2 +- admin/payment_methods.php | 2 +- admin/post/settings_notification.php | 5 +- admin/rmm_clients.php | 2 +- admin/settings.php | 2 +- admin/settings_default.php | 4 +- admin/settings_invoice.php | 4 + admin/settings_mail.php | 13 +- admin/settings_notification.php | 2 + admin/tags.php | 6 +- admin/tax_rates.php | 9 + agent/asset.php | 13 +- agent/assets.php | 2 + agent/audit_log.php | 4 +- agent/calls.php | 8 +- agent/client_overview.php | 2 +- agent/contact.php | 35 ++- agent/contract.php | 4 +- agent/dashboard.php | 2 +- agent/includes/client_actions_menu.php | 6 +- agent/invoice.php | 4 +- agent/invoices.php | 2 +- agent/license.php | 2 + agent/location.php | 30 ++- agent/modals/client/client_offboard.php | 2 +- agent/modals/contact/contact.php | 8 + agent/modals/contract/contract_form.php | 7 + agent/modals/location/location.php | 7 + agent/modals/ticket/ticket.php | 2 +- agent/modals/vendor/vendor.php | 13 +- agent/quote.php | 8 +- agent/reports/client_review.php | 6 +- agent/service.php | 8 + agent/services.php | 2 + agent/texts.php | 2 +- agent/ticket.php | 23 +- agent/trips.php | 2 +- agent/unbilled_time.php | 12 +- agent/vendor.php | 23 +- api/v1/categories/categories_model.php | 6 +- api/v1/enforce_api_rbac.php | 20 ++ api/v1/tags/tags_model.php | 6 +- client/functions.php | 5 +- client/includes/check_login.php | 3 + client/includes/header.php | 10 +- client/index.php | 16 +- client/search.php | 35 +-- cron/nightly_tasks.php | 40 ++-- functions/audit_log.php | 10 +- functions/calendar.php | 23 +- functions/categories.php | 16 ++ functions/dashboard.php | 10 +- functions/notifications.php | 4 + functions/reports.php | 8 +- functions/search.php | 26 ++- functions/settings.php | 209 +++++++++++++++++- functions/tags.php | 14 ++ functions/ticket.php | 8 + guest/guest_ticket_attachment.php | 3 + guest/includes/inc_all_guest.php | 3 + guest/share_ajax.php | 5 + includes/check_login.php | 3 + includes/cron_jobs.php | 38 +++- includes/load_global_settings.php | 4 + login.php | 5 + 72 files changed, 717 insertions(+), 150 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 536b5bf9c..49e2ff39c 100644 --- a/CHANGELOG.md +++ b/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 `` or, with the module off, a ``; `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 ``; `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 diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 92036aa27..8293fb3d1 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -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. diff --git a/admin/agent_banners.php b/admin/agent_banners.php index 9ca549f07..aa08fb8bc 100644 --- a/admin/agent_banners.php +++ b/admin/agent_banners.php @@ -90,7 +90,7 @@ $csrf = $_SESSION['csrf_token'];
Banners come with the 3.7.2 database update - run it in Update.
-

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 ⋮ menu. Clients don't see them; for a note on the client portal, use announcements.

+

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 ⋮ menu. Clients don't see themannouncements' : '' ?>.

diff --git a/admin/categories.php b/admin/categories.php index e50959df5..240405f8b 100644 --- a/admin/categories.php +++ b/admin/categories.php @@ -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']); diff --git a/admin/includes/side_nav.php b/admin/includes/side_nav.php index 876667706..d1a21c7ac 100644 --- a/admin/includes/side_nav.php +++ b/admin/includes/side_nav.php @@ -157,6 +157,7 @@

RMM Providers

+ +
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. + Settings > Modules) + foreach (CONTRACT_SLA_PRIORITIES as $priority => $part) { ?> + "> + $part) { ?>
@@ -159,6 +165,7 @@ $tab = 'templateTab' . bin2hex(random_bytes(3));
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.
+
diff --git a/admin/modals/tag/tag_form.php b/admin/modals/tag/tag_form.php index aef2c54fd..c02a30ae2 100644 --- a/admin/modals/tag/tag_form.php +++ b/admin/modals/tag/tag_form.php @@ -49,7 +49,7 @@ if (!in_array($t_icon, $t_icons, true)) {
>
+ + + +
>
+ + +
> diff --git a/agent/asset.php b/agent/asset.php index b66cb31c8..9abd44920 100644 --- a/agent/asset.php +++ b/agent/asset.php @@ -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) {