From 928fc5f10a3dfe7b2acbbd1065654e31c6c82b4c Mon Sep 17 00:00:00 2001 From: johnnyq Date: Tue, 20 Oct 2026 11:29:58 -0400 Subject: [PATCH] Settings stage 2: move Tickets, Projects, Quotes, Invoices and billing and Defaults onto the settings frame with sections and live next-number previews that refuse a number already in use, validate email addresses instead of blanking them, check the ticket close time and stop its PHP warnings, warn when late fees are on but reminders are off, limit the start page to real ITFlow pages and escape it where shown, keep archived default accounts, rename the Defaults fields to their columns, and keep the reminder, billing time, expense and mileage anchors --- CHANGELOG.md | 6 + admin/includes/side_nav.php | 2 +- admin/post/settings_default.php | 71 +++- admin/post/settings_invoice.php | 162 +++++--- admin/post/settings_project.php | 18 +- admin/post/settings_quote.php | 36 +- admin/post/settings_ticket.php | 63 ++- admin/settings.php | 2 +- admin/settings_default.php | 301 ++++---------- admin/settings_invoice.php | 429 ++++++-------------- admin/settings_project.php | 48 +-- admin/settings_quote.php | 66 ++- admin/settings_ticket.php | 138 +++---- agent/custom/includes/custom_side_nav.php | 2 +- agent/index.php | 2 +- agent/reports/includes/reports_side_nav.php | 2 +- agent/user/includes/user_side_nav.php | 2 +- css/itflow_custom.css | 21 + functions/settings.php | 213 ++++++++-- js/settings.js | 43 ++ 20 files changed, 810 insertions(+), 817 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a1b9d4b54..5574730e4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1026,6 +1026,7 @@ If you are coming from 26.08 or earlier, the database update still has to be run - Find a setting: type what you are after - late fee, logo, two-step, timezone - and it lists every setting that matches, with the page and section it is on. Picking one opens the page with that setting lit up and ready to change, on the right tab for Mail. - The pages are laid out alike: what the page is for at the top, then sections, each with what it is for beside its fields. Once something is changed the bar at the foot says so, with Undo changes beside Save, and leaving the page asks first. A save with something wrong in it comes back with what is wrong beside each field and everything typed still there, and saves nothing. The audit log says what changed, from what to what - "Next ticket number 4021 → 4100" - and a save that changed nothing says so. - Company details, Localization, Theme, Modules and Telemetry are the first pages in it. Company details shows the logo, and a new one before it is saved, with a button to take it off; the phone takes its country code from the country picked; the website is kept without its https://. Localization shows money and the time now as the language, currency and timezone picked will write them. A theme colour shows across the page as soon as it is picked, and Save keeps it; the browser tab icon is shown, with a way back to ITFlow's. Modules says what each one holds, and that switching one off deletes nothing. Telemetry is one switch, with exactly what the nightly report holds. + - Tickets, Projects, Quotes, Invoices and billing, and Defaults are in it too. Each prefix and next number shows the number the next one will get as it is typed, and the last one made; a number already used is said at once, and can't be saved. Tickets is in sections - numbering, email to ticket, new tickets, time and billing, closing, and the tickets page - with what happens to an email from an unknown sender when they are left out. Invoices and billing holds numbering for invoices and recurring invoices, the footer and tax ID, late fees (with a warning when reminders are off, as no fee is added then), who hears of a payment made online, reminders and statements, billing time, billable expenses, and trips and mileage. Defaults is grouped into opening ITFlow, new clients and accounts; the start page can be any page of ITFlow typed in, and an account archived since it was picked stays picked. ### Bug Fixes @@ -1170,6 +1171,10 @@ If you are coming from 26.08 or earlier, the database update still has to be run - Settings > Modules: saving with a white-label key that had run out wiped it, and the key's details were shown without escaping. - Settings > Company details: an email or website that wasn't one was saved as it was. - Settings > Localization: a language, currency or timezone not on the list was saved. +- Settings > Tickets, Projects, Quotes and Invoices: the next number could be set back to one already used, so two tickets, projects, quotes or invoices got the same number. +- Settings > Tickets, Quotes and Invoices: an email address that wasn't one was quietly blanked when saved. +- Settings > Tickets: the time before a resolved ticket closes was only checked by the browser, and saving logged PHP warnings. +- Settings > Defaults: the start page could be anything typed in, and was put into every page's logo link as it was. A default account archived since was dropped the next time Defaults was saved. - `setup_cli.php`: a name with an apostrophe in it stopped the install part-way, a password with a space at either end couldn't sign in, and it wrote config.php before knowing the tables could be made - over a database that already had tables in it, too. ### Developer Updates @@ -1732,6 +1737,7 @@ If you are coming from 26.08 or earlier, the database update still has to be run - Restore: the page sends the upload itself with `X-Setup-Upload: 1`, and `setupGo()` answers it in JSON with where to go. A POST to `?restore` that PHP emptied (over `post_max_size`) is answered too. `?restored` is shown once, from `$_SESSION['setup_restored']`, even though setup is closed. Finish makes the backup key with `backupEncryptionKey()`. - `.itflow-setup*` styles in `css/itflow_custom.css`. - Settings: `functions/settings.php` - `settingsPages()` (the menu, the overview and each page's header), `settingsFields()` (every setting: its page, section, label, kind and what else it is searched by - Find a setting and the audit log read it), and the frame: `settingsPageStart()`, `settingsSectionStart()`/`settingsSectionEnd()`, `settingsInput()`, `settingsSelect()`, `settingsSwitch()`, `settingsTextarea()`, `settingsField()` and `settingsSaveBar()`. Handlers read with `settingsCurrent()`, refuse with `settingsRefuse($page, $errors)` (the form comes back once, from `$_SESSION['settings_kept']`), and save with `settingsSave()`, or `settingsWrite()` per table and `settingsSaid()`, which write only what changed and log it. New `admin/settings.php` and `js/settings.js` (loaded on admin pages: `form[data-settings-form]`, `#setting=`, Find a setting, picture previews, the theme preview and the Localization sample). The Settings menu is built from `settingsPages()`. Form fields renamed to their columns on Company details (`company_*`), Localization (`company_locale`, `company_currency`, `config_timezone`) and Theme (`config_theme`, `favicon`). The Preferences light/dark swatch is `.itflow-mode-swatch`. +- Settings: Tickets, Projects, Quotes, Invoices and billing and Defaults use the frame. New in `functions/settings.php`: `settingsNumbering($kind)`, `settingsNumberInUse()`, `settingsNumberingCheck($kind, $post, $saved)` (prefix and next number checked against the highest in use with that prefix - skipped when both are as saved, so a clash already there doesn't block the rest of the page) and `settingsNumberingFields()` (with `[data-settings-next]` in `js/settings.js`, and `[data-settings-depends-on=name]` to fade fields while a switch is off); `settingsEmailProblem()`; `settingsStartPages()`, `settingsStartPageProblem()` and `settingsNetTerms()`. `settingsSectionStart()` takes the section's element id, so `#reminders`, `#billing-time`, `#billable-expenses` and `#mileage` still work; `settingsSelect()` takes `options_html`, `append` and `search => false`; `settingsSwitch()` takes `id`. `settingsSame()` treats NULL as 0 or empty and ignores Windows line ends; the log names accounts, calendars and categories. Values kept from a refused save are only used for five minutes. These handlers keep a setting that isn't sent (`$_POST + saved`), a switch not sent being off. Defaults' fields are renamed to their columns (`config_start_page`, `config_default_*`). The start page is escaped where it is printed. - `js/app.js`: the four `tinymce.init()` calls go through `itflowTinyMce`, which does nothing where TinyMCE isn't loaded. ### Library Updates diff --git a/admin/includes/side_nav.php b/admin/includes/side_nav.php index b6b0d9f0b..998ddfb47 100644 --- a/admin/includes/side_nav.php +++ b/admin/includes/side_nav.php @@ -1,7 +1,7 @@