Module switches: Dispatch, Bookkeeping, Purchasing, Trips and Calendar can be switched off in Admin > Settings > Modules, Dispatch coming with ticketing and the other three with invoicing, each hidden from menus, dashboard, search, reports and the API and refused on its pages, windows and handlers while off; Purchasing starts off unless already in use, Bookkeeping off posts the default accounts in place of account pickers, database 3.9.4, new moduleOn, moduleOffText and bookkeepingAccount helpers, purchase order settings tile summary, 26.11.9 changelog entries

This commit is contained in:
johnnyq
2026-11-18 14:27:16 -05:00
parent 00724866e3
commit 9bcf0e433b
108 changed files with 772 additions and 167 deletions

View File

@@ -2,8 +2,10 @@
/*
* Admin > Settings > Modules - the parts of ITFlow in use: IT documentation,
* ticketing, invoicing and the client portal, each switched off hiding it
* (nothing is deleted); and white-labelling the client portal with a key.
* ticketing with Dispatch, invoicing with Bookkeeping, Purchasing and Trips,
* the calendar and the client portal, each switched off hiding it (nothing is
* deleted; moduleOn() in functions/settings.php); and white-labelling the
* client portal with a key.
* Saved by edit_module_settings (admin/post/settings_module.php).
*/
@@ -17,12 +19,22 @@ $whitelabel_expires = $whitelabel ? strtotime((string) $whitelabel['expires']) :
// A managed instance whose manager sets the key - shown, not changed here (functions/managed.php)
$whitelabel_managed = managedLocks()['white_label'];
// Each: whether it's on, its icon, what it holds, and the switch of the module it comes with - shown under that one, faded while it's off
$modules = [
'config_module_enable_itdoc' => [$config_module_enable_itdoc, 'fa-laptop', 'A client\'s assets, credentials, documents, networks, domains, certificates and the rest of their IT documentation.'],
'config_module_enable_ticketing' => [$config_module_enable_ticketing, 'fa-life-ring', 'Tickets, recurring tickets and projects - and their settings.'],
'config_module_enable_accounting' => [$config_module_enable_accounting, 'fa-file-invoice-dollar', 'Quotes, invoices, payments, expenses, accounts and the money reports - and their settings.'],
'config_client_portal_enable' => [$config_client_portal_enable, 'fa-user-shield', 'Where your clients\' contacts sign in to raise tickets, see their invoices and pay.'],
'config_module_enable_itdoc' => [$config_module_enable_itdoc, 'fa-laptop', 'A client\'s assets, credentials, documents, networks, domains, certificates and the rest of their IT documentation.', ''],
'config_module_enable_ticketing' => [$config_module_enable_ticketing, 'fa-life-ring', 'Tickets, recurring tickets and projects - and their settings.', ''],
'config_module_enable_dispatch' => [$config_module_enable_dispatch ?? 1, 'fa-people-arrows', 'The Dispatch board - each technician\'s booked work side by side, and the tickets waiting for a time.', 'config_module_enable_ticketing'],
'config_module_enable_accounting' => [$config_module_enable_accounting, 'fa-file-invoice-dollar', 'Quotes, invoices, payments, expenses and the money reports - and their settings.', ''],
'config_module_enable_bookkeeping' => [$config_module_enable_bookkeeping ?? 1, 'fa-piggy-bank', 'Accounts and their balances, transactions and transfers, reconciling statements and importing them. Off, payments and expenses go into and out of your default accounts without asking - for when your books are kept somewhere else.', 'config_module_enable_accounting'],
'config_module_enable_purchasing' => [$config_module_enable_purchasing ?? 0, 'fa-truck-loading', 'To Order, purchase orders to your vendors, and receiving into stock or client assets.', 'config_module_enable_accounting'],
'config_module_enable_trips' => [$config_module_enable_trips ?? 1, 'fa-route', 'Trips and mileage - logged, billed to clients and claimed back.', 'config_module_enable_accounting'],
'config_module_enable_calendar' => [$config_module_enable_calendar ?? 1, 'fa-calendar-alt', 'The calendar, its events and the calendar feeds. Tickets are still booked, and show on Dispatch.', ''],
'config_client_portal_enable' => [$config_client_portal_enable, 'fa-user-shield', 'Where your clients\' contacts sign in to raise tickets, see their invoices and pay.', ''],
];
// Before database 3.9.4 adds them, only the first four are there to switch
if (!isset($config_module_enable_calendar)) {
$modules = array_intersect_key($modules, array_flip(['config_module_enable_itdoc', 'config_module_enable_ticketing', 'config_module_enable_accounting', 'config_client_portal_enable']));
}
echo settingsPageStart('module');
@@ -35,11 +47,11 @@ echo settingsPageStart('module');
<div class="card-body">
<?= settingsSectionStart('modules', 'Modules', 'Switching one off takes it out of the menus for everyone. Nothing in it is deleted - switched back on, it is all there.') ?>
<?php foreach ($modules as $name => [$on, $icon, $about]) { ?>
<div class="itflow-settings-module d-flex gap-3 align-items-start">
<?php foreach ($modules as $name => [$on, $icon, $about, $comes_with]) { ?>
<div class="itflow-settings-module d-flex gap-3 align-items-start<?= $comes_with ? ' itflow-settings-module-part' : '' ?>"<?= $comes_with ? ' data-settings-depends-on="' . $comes_with . '"' : '' ?>>
<span class="itflow-settings-tile-icon"><i class="fas fa-fw <?= $icon ?>"></i></span>
<div class="flex-grow-1 min-w-0">
<?= settingsSwitch($name, $on, ['help' => $about]) ?>
<?= settingsSwitch($name, $on, ['help' => $about . ($comes_with ? ' Comes with ' . ($comes_with === 'config_module_enable_ticketing' ? 'Ticketing' : 'Invoicing and accounting') . ' - off while it is.' : '')]) ?>
</div>
</div>
<?php } ?>