diff --git a/CHANGELOG.md b/CHANGELOG.md index 2f36980a1..7761578ec 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,7 +6,7 @@ This file documents all notable changes made to ITFlow. ### Upgrading -Update from Maintenance > Update — Queue Update hands the job to cron, which updates the files and applies this release's twenty-seven database changes (3.6.6 to 3.9.3) in the same pass. They add four tables for RMM providers and their alerts, a setting for device actions and one for API keys in the address, a column marking the emails the mail queue clears once sent, a column and a table for agent banners, two columns for ticket statuses with a setting for the "ticket assigned" message, a column on tickets with a setting for the "no response" message, a table for who a ticket's email replies go to, the settings for Quick tickets, columns on recurring tickets and recurring invoices for booking and making them ahead, two columns on ticket replies for when their time was worked, the settings for cron alerts, a table and a setting for labor costs, a column on users for API / service accounts, columns on tickets and recurring tickets for how long booked work takes, a column each on recurring tickets and calendar events for repeating on a weekday, three columns on agents' settings for their calendar color, what their calendar shows and their own time zone, and a table for the agents helping on a ticket, three columns on quote lines with three settings for what a quote line costs and how it is priced, a column each on quote lines and products with a setting for their pictures, two settings and a column on tickets for keeping project tickets apart, a table for your other offices with a column each on agents and invites for which one they work from, three settings for the emails and notices your agents get about their tickets, three settings for sending and reading Microsoft 365 mail through Microsoft Graph, and five tables, four settings and a role permission for purchase orders, and change nothing that is there. Nothing else is required. This release has twelve security fixes - see Security. On Apache, ITFlow's own .htaccess now sends security headers: if you show ITFlow inside a frame on another website, it will now refuse to load there. On nginx, add the same headers to your server block if you want them - see Developer Updates. +Update from Maintenance > Update — Queue Update hands the job to cron, which updates the files and applies this release's twenty-eight database changes (3.6.6 to 3.9.4) in the same pass. They add four tables for RMM providers and their alerts, a setting for device actions and one for API keys in the address, a column marking the emails the mail queue clears once sent, a column and a table for agent banners, two columns for ticket statuses with a setting for the "ticket assigned" message, a column on tickets with a setting for the "no response" message, a table for who a ticket's email replies go to, the settings for Quick tickets, columns on recurring tickets and recurring invoices for booking and making them ahead, two columns on ticket replies for when their time was worked, the settings for cron alerts, a table and a setting for labor costs, a column on users for API / service accounts, columns on tickets and recurring tickets for how long booked work takes, a column each on recurring tickets and calendar events for repeating on a weekday, three columns on agents' settings for their calendar color, what their calendar shows and their own time zone, and a table for the agents helping on a ticket, three columns on quote lines with three settings for what a quote line costs and how it is priced, a column each on quote lines and products with a setting for their pictures, two settings and a column on tickets for keeping project tickets apart, a table for your other offices with a column each on agents and invites for which one they work from, three settings for the emails and notices your agents get about their tickets, three settings for sending and reading Microsoft 365 mail through Microsoft Graph, five tables, four settings and a role permission for purchase orders, and five settings for switching Dispatch, Bookkeeping, Purchasing, Trips and the calendar on and off, and change nothing that is there. Nothing else is required. Purchasing starts off - switch it on in Admin > Settings > Modules. This release has twelve security fixes - see Security. On Apache, ITFlow's own .htaccess now sends security headers: if you show ITFlow inside a frame on another website, it will now refuse to load there. On nginx, add the same headers to your server block if you want them - see Developer Updates. ### Security @@ -120,7 +120,7 @@ Update from Maintenance > Update — Queue Update hands the job to cron, which u - Notifications: Admin > Settings > Notifications has Emails and notices to your team - switch off the bell notice or the email an agent gets when someone else assigns them a ticket or recurring ticket, or the copy of a client's reply that goes to the agents helping on a ticket (the agent it is assigned to is still emailed). All on to start with, as before. From Mountaineer IT's build of ITFlow. - Calendar and Dispatch: onsite work is easy to spot - a booking with a visit has an orange Onsite strip with a car across the top, an orange edge on the calendar's Month view and an orange line along the top on Dispatch's Week. Remote work looks as before. From Mountaineer IT's build of ITFlow. - Dispatch: the Schedule window lists the contact's other open tickets under the ticket - with who has each and when it is booked - so a duplicate is noticed before work is booked on it. Merge beside one keeps one ticket and closes the other with a note pointing to it, as the ticket's own Merge does, with a reason and the choice to move its replies over. A booking on the ticket closed is taken off first, so its agent and the client are sent the cancellation. From Mountaineer IT's build of ITFlow. -- Purchasing: a new entry under Billing in the side menu - To Order, Purchase Orders and Receiving, as tabs across its pages - for buying from your vendors what you sell, install and keep on the shelf. It comes with invoicing. Give roles Purchasing in Admin > Roles: See them; Add items, make and send purchase orders, add tracking and receive; or Full, which also approves and cancels purchase orders and undoes a receipt. Admins have all of it. From Mountaineer IT's build of ITFlow. +- Purchasing: a new entry under Billing in the side menu - To Order, Purchase Orders and Receiving, as tabs across its pages - for buying from your vendors what you sell, install and keep on the shelf. It's off to start with: switch on Purchasing in Admin > Settings > Modules - it comes with invoicing. Give roles Purchasing in Admin > Roles: See them; Add items, make and send purchase orders, add tracking and receive; or Full, which also approves and cancels purchase orders and undoes a receipt. Admins have all of it. From Mountaineer IT's build of ITFlow. - Purchasing: To Order is the list of what needs buying. Add an item by hand - with its vendor, cost and the client it is for - or with Order on a product's page. When products are at or under their reorder level, the alert at the top adds them all in one go. Tick items, then Make a Purchase Order puts them on a new one for their vendor, or Put on a Draft adds them to one already started. From Mountaineer IT's build of ITFlow. - Purchasing: purchase orders are numbered PO-1, PO-2 and on - the prefix and the next number are in Admin > Settings > Purchase orders. While one is a draft, its lines can be added, changed and taken off, and Edit Details changes the vendor, where it ships - your main office, another of your offices or any address - the shipping and a note for the vendor. Download it as a PDF, or Email to Vendor sends it with the PDF attached and marks it ordered in the same step. Mark Ordered is for one placed by phone or on the vendor's website, with the date and their order number. From Mountaineer IT's build of ITFlow. - Purchasing: approval is off to start with. Switch on Purchase orders need approval in Admin > Settings > Purchase orders and give an amount: a purchase order over it, or with a line that has no cost, is sent for approval before it can be ordered. The admins and the agents with Full Purchasing get a notice and an email, and one of them approves it or sends it back with a note - whoever made it is told either way. Nobody approves their own purchase order, unless they are an admin or nobody else can. From Mountaineer IT's build of ITFlow. @@ -131,6 +131,9 @@ Update from Maintenance > Update — Queue Update hands the job to cron, which u - Menu: fewer entries to scroll past. Recurring Expenses is now a tab on Expenses, and Transfers a tab on Transactions, with the tabs across the top of each page. Purchasing is one entry with its pages as tabs, and its number is the purchase orders waiting for your approval - otherwise the items waiting to be ordered. - Client menu: Calendar, Racks, Certificates, Shared Links, Services and Trips stay out of a client's menu while the client has none of them, when two or more are empty, so the menu is shorter for most clients. More, at the bottom of the menu, shows them - to add a client's first rack, say. Each comes back as soon as the client has one, and always shows on its own page. - Admin menu: eight entries shorter, nine with texting set up. Templates is one entry under Lists & Templates, with Tickets, Projects, Canned Responses, Contracts, Vendors, Licenses and Documents as tabs across its pages. Logs, under Maintenance, has Audit Logs, Sign-ins and App Logs as tabs. Text Messaging has Setup and, once texting is set up, Messages, with the texts that failed to send in the last week counted on the menu. Where ITFlow points you to one of these pages, it now says where it is - Admin > Templates > Tickets, say. +- Modules: Admin > Settings > Modules has five more switches, to take out of ITFlow what your business doesn't use - Dispatch, which comes with Ticketing; Bookkeeping, Purchasing and Trips, which come with invoicing; and the Calendar. Each part is off while the one it comes with is, and shows faded under it. Switched off, a part leaves the menus, the dashboard, search, the reports and the API, and its pages and windows say it is off. Nothing in it is deleted - switched back on, it is all there. Dispatch, Bookkeeping, Trips and the Calendar start on, as before. +- Bookkeeping: switch it off when your books are kept somewhere else. Accounts, Transactions, Transfers, Reconcile and the statement imports go, and nobody picks an account: payments and income go into the default payment account, and expenses come out of the default expense account - both in Admin > Settings > Defaults, or the first account when there's no default. An expense is paid by The business or Paid personally. The dashboard leaves out the account balances, and the Tax Package its Accounts section. +- Calendar: switched off, the calendar, its events and the calendar feeds go - a subscribed calendar stops getting them. Tickets are still booked from the ticket and on Dispatch, and booked work still shows on the dashboard. ### Bug Fixes @@ -273,10 +276,11 @@ Update from Maintenance > Update — Queue Update hands the job to cron, which u - Dispatch: `ajax.php` `dispatch_contact_tickets=` (`dispatchContactTickets()` - up to 15, newest first, the same client) and `dispatch_merge` (`dispatchMerge()` - Support at Modify; both tickets open and reachable, the same client; `ticketCancelSchedule()` on a booked child first). `ticketMergeInto()` moved from `agent/post/ticket.php` to `functions/ticket.php`, unchanged but for its uploads path, so both use it. From Mountaineer IT's build of ITFlow. - Database 3.9.1: `config_notify_assigned_app`, `config_notify_assigned_email` and `config_notify_helper_replies` in `settings` (default 1), read by `ticketTeamNotifyOn($key)` in `functions/ticket.php` (on before the update). `ticketMailAssigned()` and `ticketHelpersMailReplied()` send nothing when theirs is off - unless `emailCapturing()`, so the email preview still shows them - and every "assigned to you" bell notice checks `assigned_app`: `add_ticket`, `edit_ticket`, `bulk_assign_ticket`, the ticket and recurring ticket assign fields (`functions/ticket_fields.php`), bulk-assigning recurring tickets, a portal ticket from a template, and the API's ticket and recurring ticket create. From Mountaineer IT's build of ITFlow. - Microsoft Graph mail: database 3.9.2 adds `config_mail_graph_token`, `config_mail_graph_token_expires_at` and `config_mail_graph_scopes` to `settings`. New `functions/mail_graph.php`: `mailGraphToken($permission, $fresh)` trades the mailbox's refresh token for a Graph token (scope `offline_access https://graph.microsoft.com/.default`), keeps it with the scopes it carries and the new refresh token Microsoft hands back, and returns it when it carries `Mail.Send` or `Mail.ReadWrite` - otherwise null, and SMTP or IMAP are used. An app that can't use Graph is asked again after `MAIL_GRAPH_RECHECK_MINUTES` (60), or after `mailGraphForget()` (the OAuth tab's save and Connect). When the cached scopes already had a mail permission and the renewal fails, it throws with Microsoft's reason, so the email or the run stops with it rather than falling back. `mailGraphSend()` posts the finished MIME to `/me/sendMail`, or past `MAIL_GRAPH_MIME_LIMIT` (3 MB) makes a draft, adds the attachments (upload sessions over 3 MB) and sends it, deleting the draft on failure. `mailGraphMailbox()` returns `MailGraphMailbox` (`functions/mail_graph_mailbox.php`), standing in for the parts of ImapEngine `cron/ticket_email_parser.php` uses: unread, unflagged mail oldest first, each read by ImapEngine's `FileMessage` from its MIME, with read, flagged and move done through Graph. `mailGraphMailboxTest()` and `mailGraphState()` serve the Tests and OAuth tabs. The Exchange token renewals (`cron/mail_queue.php`, `cron/ticket_email_parser.php` and the Tests tab) now send `scope` (`MAIL_MICROSOFT_EXCHANGE_SCOPE`), so a refresh token last renewed for Graph still gives an Exchange token. `MAIL_GRAPH_URL` and `MAIL_MICROSOFT_LOGIN_URL` can be defined in config.php to point at a test server. From Mountaineer IT's build of ITFlow. -- Purchase orders: database 3.9.3 adds `order_items` (the To Order list - `order_item_status` waiting / ordered / received, `order_item_source` manual / reorder), `purchase_orders` (UNIQUE `po_prefix`, `po_number`; `po_ship_to_office_id` NULL for another address in `po_ship_to`; `po_expense_id` for the vendor bill), and `po_items`, `po_receipts` and `po_tracking`, each cascading from its purchase order. `settings` gets `config_po_prefix` ('PO-'), `config_po_next_number`, `config_po_approval` (0) and `config_po_approval_over`, and `modules` gets `module_procurement` - the name and the `product_vendor_id` link match Mountaineer IT's build. Everything is in the new `functions/purchase_orders.php`: `poReady()` is false until the update has run and `poLevel()` is 0 while invoicing is off; `poRequireLevel()` and `poForRequest()` stop a page, handler or window with the reason (`poOffReason()`) or the role refusal, and `poForRequest()` also refuses a PO with a line for a client the agent can't reach (`poAccessible()`; lists use `poScopeSql()`). Numbers come from `poNextNumber()` under `GET_LOCK`, with `poCreate()` retrying on a duplicate. `poMarkOrdered()` approves a draft itself when `poNeedsApproval()` says no, noting why; `poSendForApproval()` and `poDecide()` notify through `poTell()` (bell and `emailQueue()`), and `poMayApprove()` keeps a non-admin from approving their own unless they are the only approver. `poReceive()` puts own-stock lines of a tracked product on the shelf with `productStockMove(..., 'received')` (Sales at 2) and turns client lines into assets - an asset, its primary interface '01', an asset_history row and an audit entry each, up to `PO_ASSETS_MAX` (50) a line (Support at 2) - and `poUndoReceipt()` reverses one receipt. `poRecordBill()` records the expense with `expenseSave()` and sets `stock_expense_id` on the stock it received. `poPdf()` draws on `BillingPdf`, and `poEmail()` attaches it with `billingEmailPdf()` and queues it with `emailQueue()`. History is the 'Purchase Order' kind in `auditLogKinds()`. `permissionRefusedText()` reads an optional `full` from `roleModuleInfo()` for a module whose Full level isn't deleting. Pages: `agent/to_order.php`, `purchase_orders.php`, `purchase_order.php`, `receiving.php`; windows in `agent/modals/purchasing/`; handlers in `agent/post/purchase_order.php`; settings in `admin/settings_purchase_order.php`; `js/purchase_orders.js`. From Mountaineer IT's build of ITFlow. +- Purchase orders: database 3.9.3 adds `order_items` (the To Order list - `order_item_status` waiting / ordered / received, `order_item_source` manual / reorder), `purchase_orders` (UNIQUE `po_prefix`, `po_number`; `po_ship_to_office_id` NULL for another address in `po_ship_to`; `po_expense_id` for the vendor bill), and `po_items`, `po_receipts` and `po_tracking`, each cascading from its purchase order. `settings` gets `config_po_prefix` ('PO-'), `config_po_next_number`, `config_po_approval` (0) and `config_po_approval_over`, and `modules` gets `module_procurement` - the name and the `product_vendor_id` link match Mountaineer IT's build. Everything is in the new `functions/purchase_orders.php`: `poReady()` is false until the update has run and `poLevel()` is 0 while Purchasing or invoicing is off (`moduleOn('purchasing')`, database 3.9.4); `poRequireLevel()` and `poForRequest()` stop a page, handler or window with the reason (`poOffReason()`) or the role refusal, and `poForRequest()` also refuses a PO with a line for a client the agent can't reach (`poAccessible()`; lists use `poScopeSql()`). Numbers come from `poNextNumber()` under `GET_LOCK`, with `poCreate()` retrying on a duplicate. `poMarkOrdered()` approves a draft itself when `poNeedsApproval()` says no, noting why; `poSendForApproval()` and `poDecide()` notify through `poTell()` (bell and `emailQueue()`), and `poMayApprove()` keeps a non-admin from approving their own unless they are the only approver. `poReceive()` puts own-stock lines of a tracked product on the shelf with `productStockMove(..., 'received')` (Sales at 2) and turns client lines into assets - an asset, its primary interface '01', an asset_history row and an audit entry each, up to `PO_ASSETS_MAX` (50) a line (Support at 2) - and `poUndoReceipt()` reverses one receipt. `poRecordBill()` records the expense with `expenseSave()` and sets `stock_expense_id` on the stock it received. `poPdf()` draws on `BillingPdf`, and `poEmail()` attaches it with `billingEmailPdf()` and queues it with `emailQueue()`. History is the 'Purchase Order' kind in `auditLogKinds()`. `permissionRefusedText()` reads an optional `full` from `roleModuleInfo()` for a module whose Full level isn't deleting. Pages: `agent/to_order.php`, `purchase_orders.php`, `purchase_order.php`, `receiving.php`; windows in `agent/modals/purchasing/`; handlers in `agent/post/purchase_order.php`; settings in `admin/settings_purchase_order.php`; `js/purchase_orders.js`. From Mountaineer IT's build of ITFlow. - Menus: `pageTabsHtml()` (`functions/format.php`) draws tabs across pages that share one side nav entry - `expenseTabsHtml()` for Expenses and Recurring, `poTabsHtml()` for To Order, Purchase Orders and Receiving. The side nav drops Recurring Expenses (and `$num_recurring_expenses` from `get_side_nav_counts.php`), Transfers and the PURCHASING header; the BILLING header shows for roles with Sales or Purchasing. `client_side_nav.php` marks a quiet item `data-nav-quiet hidden` when its count is 0, it isn't the page open and two or more are quiet, and adds More (`data-nav-more`, handled in `js/app.js`). `inc_all_client.php` adds `$num_calendar_bookings` - open tickets booked from today - when a client has no upcoming events, so its Calendar still shows booked work. - Admin menu: `adminNavGroups()` (`functions/settings.php`) lists the admin pages that share one side nav entry - logs, templates and text messaging - with each page's file, icon, label, record pages and badge count, leaving out pages for modules that are off and Messages until a texting provider is active. `adminNavGroupItemHtml()` draws the entry and `adminNavGroupTabsHtml()` the tabs atop each page (none for a group of one). The TEMPLATES and Sign-ins entries and the separate Audit Logs, App Logs and Text Messages entries are gone from `admin/includes/side_nav.php`, and the on-screen paths to those pages - in the import windows, onboarding, API errors and AI errors - say Admin > Templates > ..., Admin > Logs > ... or Admin > Text Messaging > Messages. - Leads: `clientNotLeadSql($keep)` (`functions/auth.php`) leaves leads out of a query on `clients`, keeping the client or clients in `$keep` - the record's own, or the lead whose page it is. It's on the client pickers in the record windows, bulk edits, Dispatch, the client switcher (`get_active_clients`), the transaction filter and export, the report client picker and coverage, the template reports and use windows, agent banners, portal announcements, RMM client linking and suggestions, and managed instances. The invoice and recurring invoice picker in `billing_form.php` leaves them out; the quote picker and `quote_copy.php` order them after the clients with `data-description="Lead"`. Global search orders a lead after the clients that match and puts Lead in its subtitle. Filters built from existing records, imports and client permissions still list leads. +- Modules: database 3.9.4 adds `config_module_enable_purchasing` (0, or 1 when `order_items` or `purchase_orders` has a row), `config_module_enable_bookkeeping`, `config_module_enable_dispatch`, `config_module_enable_trips` and `config_module_enable_calendar` (1) to `settings`. `load_global_settings.php` reads them in a second query only from 3.9.4, so an older database still loads. `moduleOn($module)` (`functions/settings.php`) answers for `itdoc`, `ticketing`, `accounting`, `portal` and the five - `dispatch` needs ticketing, and `purchasing`, `bookkeeping` and `trips` need accounting; a switch that isn't there yet counts as on - and `moduleOffText($module)` gives the message, naming the module it comes with when that is the one off. `settingsPageAvailable()`, `reportFeatureOn()`, `settingsStartPages()`, global search, both side menus, the dashboard and `poLevel()` use it; Modules marks each part `data-settings-depends-on` its parent's switch. Pages flash and redirect, windows return `error`, handlers refuse and the API answers 403 - the accounts, calendars, events and trips endpoints now require `load_global_settings.php` for it. In `functions/trips.php` each list and count is empty while trips are off and each change returns an error. `dispatchCan()` and `dispatchCanEdit()` are false while Dispatch is off. `agent/ajax.php` refuses the calendar's sources and moves (`calendar_day` stays, for the booking window), and `guest/guest_calendar_feed.php` answers not found. With bookkeeping off, `bookkeepingAccount($kind)` (`functions/accounts.php`) - the default payment or expense account, else the first open one - is posted in a hidden `account` in place of each account picker, the expense and income bulk edits lose Account, and the Tax Package leaves out its Accounts table and the Account column of its CSVs. ## [26.11.8] diff --git a/admin/database_updates/3.9.4.php b/admin/database_updates/3.9.4.php new file mode 100644 index 000000000..165244004 --- /dev/null +++ b/admin/database_updates/3.9.4.php @@ -0,0 +1,43 @@ + Settings > + * Modules (moduleOn() in functions/settings.php) - nothing in one is deleted: + * config_module_enable_purchasing - To Order, purchase orders and + * receiving. Off to start with - on where purchasing is already in use. + * config_module_enable_bookkeeping - accounts, transactions and transfers, + * reconciling and statement imports. With it off, money goes into and out + * of the default accounts without asking. + * config_module_enable_dispatch - the Dispatch board. + * config_module_enable_trips - trips and mileage. + * config_module_enable_calendar - the calendar, its events and feeds. + * Purchasing, Bookkeeping and Trips come with invoicing, Dispatch with + * ticketing. All but Purchasing are on, as they were. + * + * Re-runnable: each column is added only where it isn't there yet. + */ + +defined('FROM_DB_UPDATER') || die("Direct file access is not allowed"); + + $itflow_column = function ($table, $column) use ($mysqli) { + $result = mysqli_query($mysqli, "SELECT 1 FROM information_schema.COLUMNS + WHERE TABLE_SCHEMA = DATABASE() AND TABLE_NAME = '$table' AND COLUMN_NAME = '$column' LIMIT 1"); + return $result && mysqli_num_rows($result) > 0; + }; + + $after = 'config_module_enable_ticketing'; + foreach (['purchasing' => 0, 'bookkeeping' => 1, 'dispatch' => 1, 'trips' => 1, 'calendar' => 1] as $module => $default) { + $column = "config_module_enable_$module"; + if (!$itflow_column('settings', $column)) { + mysqli_query($mysqli, "ALTER TABLE `settings` ADD `$column` tinyint(1) NOT NULL DEFAULT $default AFTER `$after`"); + if ($module === 'purchasing') { + // Purchasing already in use stays on + mysqli_query($mysqli, "UPDATE settings SET config_module_enable_purchasing = 1 + WHERE EXISTS (SELECT 1 FROM order_items) OR EXISTS (SELECT 1 FROM purchase_orders)"); + } + } + $after = $column; + } diff --git a/admin/modals/payment_method/payment_method_delete.php b/admin/modals/payment_method/payment_method_delete.php index 9e7d82e01..0cb04012a 100644 --- a/admin/modals/payment_method/payment_method_delete.php +++ b/admin/modals/payment_method/payment_method_delete.php @@ -37,7 +37,7 @@ if (!$payment_method) { ?>
Used on . - See them + See them
diff --git a/admin/modals/payment_provider/payment_provider_edit.php b/admin/modals/payment_provider/payment_provider_edit.php index ab586ff95..5eec6ad2c 100644 --- a/admin/modals/payment_provider/payment_provider_edit.php +++ b/admin/modals/payment_provider/payment_provider_edit.php @@ -140,6 +140,9 @@ ob_start();
Payments
+ + +
@@ -154,6 +157,7 @@ ob_start();
An account of its own, named for it, makes its payouts easy to match.
+
diff --git a/admin/payment_methods.php b/admin/payment_methods.php index 4c2cf96ef..20f5918a2 100644 --- a/admin/payment_methods.php +++ b/admin/payment_methods.php @@ -150,7 +150,7 @@ $csrf = $_SESSION['csrf_token']; $records_url = '/agent/transactions.php?' . http_build_query(['method' => $row['payment_method_name']]); $edit_url = "modals/payment_method/payment_method_edit.php?id=$payment_method_id"; $use_html = '' . escapeHtml($use_info['short']) . ''; - $used_html = $used['total'] ? '' . escapeHtml($used_text) . '' : 'Not used yet'; + $used_html = $used['total'] ? (moduleOn('bookkeeping') ? '' . escapeHtml($used_text) . '' : escapeHtml($used_text)) : 'Not used yet'; ?> diff --git a/admin/payment_providers.php b/admin/payment_providers.php index 0aef3448f..fca3386dd 100644 --- a/admin/payment_providers.php +++ b/admin/payment_providers.php @@ -142,7 +142,7 @@ $csrf = $_SESSION['csrf_token']; No account - pick one in Edit - +
Archived - pick another in Edit
diff --git a/admin/post/settings_module.php b/admin/post/settings_module.php index eec5ec4c6..1785c1c31 100644 --- a/admin/post/settings_module.php +++ b/admin/post/settings_module.php @@ -15,11 +15,15 @@ if (isset($_POST['edit_module_settings'])) { validateCSRFToken(); - $before = settingsCurrent(['config_module_enable_itdoc', 'config_module_enable_ticketing', 'config_module_enable_accounting', 'config_client_portal_enable', - 'config_whitelabel_enabled', 'config_whitelabel_key']); + $modules = ['config_module_enable_itdoc', 'config_module_enable_ticketing', 'config_module_enable_accounting', 'config_client_portal_enable']; + if (isset($config_module_enable_calendar)) { + // Database 3.9.4's five + array_push($modules, 'config_module_enable_dispatch', 'config_module_enable_bookkeeping', 'config_module_enable_purchasing', 'config_module_enable_trips', 'config_module_enable_calendar'); + } + $before = settingsCurrent(array_merge($modules, ['config_whitelabel_enabled', 'config_whitelabel_key'])); $after = []; - foreach (['config_module_enable_itdoc', 'config_module_enable_ticketing', 'config_module_enable_accounting', 'config_client_portal_enable'] as $module) { + foreach ($modules as $module) { $after[$module] = empty($_POST[$module]) ? 0 : 1; } diff --git a/admin/settings.php b/admin/settings.php index ff6a4424c..3ef27f222 100644 --- a/admin/settings.php +++ b/admin/settings.php @@ -25,10 +25,15 @@ $days = function ($n) { // How each page is set now - a line or two, and whether it is switched off $start_pages = settingsStartPages(); $modules_on = array_keys(array_filter([ - 'IT documentation' => $config_module_enable_itdoc, - 'Ticketing' => $config_module_enable_ticketing, - 'Invoicing' => $config_module_enable_accounting, - 'Client portal' => $config_client_portal_enable, + 'IT documentation' => moduleOn('itdoc'), + 'Ticketing' => moduleOn('ticketing'), + 'Dispatch' => isset($config_module_enable_dispatch) && moduleOn('dispatch'), + 'Invoicing' => moduleOn('accounting'), + 'Bookkeeping' => isset($config_module_enable_bookkeeping) && moduleOn('bookkeeping'), + 'Purchasing' => isset($config_module_enable_purchasing) && moduleOn('purchasing'), + 'Trips' => isset($config_module_enable_trips) && moduleOn('trips'), + 'Calendar' => isset($config_module_enable_calendar) && moduleOn('calendar'), + 'Client portal' => moduleOn('portal'), ])); $where = array_filter([$company['company_city'] ?? '', $company['company_country'] ?? '']); $summaries = [ @@ -41,6 +46,7 @@ $summaries = [ 'ticket' => 'Next ' . escapeHtml($config_ticket_prefix . $config_ticket_next_number) . ' · email to ticket ' . $on_off($config_ticket_email_parse), 'project' => 'Next ' . escapeHtml($config_project_prefix . $config_project_next_number), 'quote' => 'Next ' . escapeHtml($config_quote_prefix . $config_quote_next_number), + 'purchase_order' => poReady() ? 'Next ' . escapeHtml(poSettings()['prefix'] . poSettings()['next']) . ' · approval ' . $on_off(poSettings()['approval']) : 'Needs the database update', 'invoice' => 'Next ' . escapeHtml($config_invoice_prefix . $config_invoice_next_number) . ' · reminders ' . $on_off($config_send_invoice_reminders) . ' · late fees ' . $on_off($config_invoice_late_fee_enable) . ' · cards ' . $on_off(billingStripeProvider()), 'mail' => 'Sending ' . ($config_smtp_provider ? 'on' : 'off') . ' · receiving ' . $on_off($config_imap_provider) diff --git a/admin/settings_default.php b/admin/settings_default.php index 3a020419d..880b6a2d3 100644 --- a/admin/settings_default.php +++ b/admin/settings_default.php @@ -88,7 +88,7 @@ echo settingsPageStart('default');
'fa-sign-out-alt', 'search' => true]) ?>
'fa-sign-in-alt', 'search' => true]) ?>
-
Accounts are in Accounts, payment methods in Payment methods.
+
Accounts are in Accounts, payment methods in Payment methods.With Bookkeeping off, payments go into the default payment account and expenses come out of the default expense account. Payment methods are in Payment methods.
diff --git a/admin/settings_module.php b/admin/settings_module.php index 29b299487..3a8dbcf89 100644 --- a/admin/settings_module.php +++ b/admin/settings_module.php @@ -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');
- [$on, $icon, $about]) { ?> -
+ [$on, $icon, $about, $comes_with]) { ?> +
>
- $about]) ?> + $about . ($comes_with ? ' Comes with ' . ($comes_with === 'config_module_enable_ticketing' ? 'Ticketing' : 'Invoicing and accounting') . ' - off while it is.' : '')]) ?>
diff --git a/agent/accounts.php b/agent/accounts.php index d7b415e8b..64f3a3113 100644 --- a/agent/accounts.php +++ b/agent/accounts.php @@ -16,6 +16,10 @@ require_once "includes/inc_all.php"; enforceUserPermission('module_financial'); +if (!moduleOn('bookkeeping')) { + flashAlert(moduleOffText('bookkeeping'), 'error'); + redirect('/agent/dashboard.php'); +} $can_edit = lookupUserPermission('module_financial') >= 2; $can_delete = lookupUserPermission('module_financial') >= 3; diff --git a/agent/ajax.php b/agent/ajax.php index 71c438665..61689a8c4 100644 --- a/agent/ajax.php +++ b/agent/ajax.php @@ -2557,6 +2557,18 @@ if (isset($_GET['get_credential_via_id'])) { } } +/* + * The calendar page's own calls - none while the calendar is switched off + * (Admin > Settings > Modules). calendar_day stays: the ticket booking window + * shows the agent's day with it. + */ +if (!moduleOn('calendar') && (array_intersect(['calendar_items', 'calendar_unscheduled', 'calendar_left_behind'], array_keys($_GET)) + || array_intersect(['calendar_move', 'calendar_state'], array_keys($_POST)))) { + http_response_code(403); + header('Content-Type: application/json'); + exit(json_encode(['error' => moduleOffText('calendar')])); +} + /* * The calendar page's items between two days: the events on the calendars * shown, and what the built-in sources shown have dated (calendarSources()), diff --git a/agent/calendar.php b/agent/calendar.php index a7b02fdb6..e6aca9e17 100644 --- a/agent/calendar.php +++ b/agent/calendar.php @@ -25,6 +25,11 @@ if (isset($_GET['client_id'])) { $page_client_id = 0; } +if (!moduleOn('calendar')) { + flashAlert(moduleOffText('calendar'), 'error'); + redirect('/agent/dashboard.php'); +} + $calendars = calendarList(); $sources = calendarSources(); $can_manage = calendarCanManage(); diff --git a/agent/client_overview.php b/agent/client_overview.php index a3b652660..7c4fdd412 100644 --- a/agent/client_overview.php +++ b/agent/client_overview.php @@ -317,7 +317,7 @@ $money_format = function ($amount) use ($currency_format, $client_currency_code,

Coming up 14 days

- Calendar + Calendar
&contact_id=" data-modal-size="lg"> Recurring Ticket + Meeting + Asset diff --git a/agent/dashboard.php b/agent/dashboard.php index 2a37117dc..af81ded45 100644 --- a/agent/dashboard.php +++ b/agent/dashboard.php @@ -41,9 +41,12 @@ if ($access['tickets']) { if ($access['financial']) { $chart_data['cash_flow'] = dashboardCashFlow($period); $chart_data['breakdowns'] = dashboardBreakdowns($period); - $chart_data['trips'] = dashboardTrips($period); + if (moduleOn('trips')) { + $chart_data['trips'] = dashboardTrips($period); + } $chart_data['currency'] = $session_company_currency; - $accounts = dashboardAccountBalances(); + // The accounts card - with Bookkeeping on (Admin > Settings > Modules) + $accounts = moduleOn('bookkeeping') ? dashboardAccountBalances() : null; $latest_income = dashboardLatestIncome(5); $latest_expenses = dashboardLatestExpenses(5); } @@ -216,7 +219,7 @@ if ($getting_started) {
@@ -247,7 +250,7 @@ if ($getting_started) {
count($schedule['items'])) { ?> - more this week + more this week
@@ -411,7 +414,7 @@ if ($getting_started) {
-
+

Cash flow

@@ -427,6 +430,7 @@ if ($getting_started) {
+
@@ -452,6 +456,7 @@ if ($getting_started) {
+
@@ -583,7 +588,7 @@ if ($getting_started) {
-
+

Latest income

@@ -607,7 +612,7 @@ if ($getting_started) {
-
+

Latest expenses

@@ -630,7 +635,8 @@ if ($getting_started) {
-
+ +

Trips

@@ -641,6 +647,7 @@ if ($getting_started) {
+
diff --git a/agent/dispatch.php b/agent/dispatch.php index 2ec3608dd..c3be102ae 100644 --- a/agent/dispatch.php +++ b/agent/dispatch.php @@ -16,9 +16,9 @@ require_once "includes/inc_all.php"; enforceUserPermission('module_support'); -if (intval($config_module_enable_ticketing) !== 1) { - flashAlert('Ticketing is switched off (Admin > Settings > Modules).', 'error'); - redirect('/agent/calendar.php'); +if (!moduleOn('dispatch')) { + flashAlert(moduleOffText('dispatch'), 'error'); + redirect('/agent/dashboard.php'); } $agents = dispatchAgents(); diff --git a/agent/expense_import.php b/agent/expense_import.php index 85526c80b..97744499c 100644 --- a/agent/expense_import.php +++ b/agent/expense_import.php @@ -24,6 +24,10 @@ require_once "includes/inc_all.php"; enforceUserPermission('module_financial', 2); +if (!moduleOn('bookkeeping')) { + flashAlert(moduleOffText('bookkeeping'), 'error'); + redirect('/agent/expenses.php'); +} $import = $_SESSION['expense_import'] ?? null; $step = (string) ($_GET['step'] ?? ''); diff --git a/agent/expenses.php b/agent/expenses.php index 234916842..037109268 100644 --- a/agent/expenses.php +++ b/agent/expenses.php @@ -159,7 +159,7 @@ $month_change = $stats['last_to_date'] > 0 ? round(($stats['month'] - $stats['la