From 2fdb28040673a1e8284a4e63c871f73a788cf168 Mon Sep 17 00:00:00 2001 From: johnnyq Date: Fri, 20 Nov 2026 12:49:34 -0500 Subject: [PATCH] Quick add: the plus beside Contact, Site, Location, Assigned to and Vendor in New Ticket, Edit Ticket and the asset form opens the usual New Contact, New Location or New Vendor window over the form, saved in the background and picked, in place of the pop-up --- CHANGELOG.md | 13 +- admin/identity_providers.php | 2 +- .../payment_provider_edit.php | 2 +- admin/modals/rmm/rmm_provider_edit.php | 2 +- .../vendor_template/vendor_template_form.php | 2 +- admin/post/settings_theme.php | 2 +- admin/post/starter_content_model.php | 2 +- admin/settings_invoice.php | 2 +- admin/settings_module.php | 2 +- admin/settings_security.php | 2 +- admin/settings_theme.php | 4 +- admin/starter_content.php | 6 +- admin/vendor_template.php | 2 +- agent/ajax.php | 55 ------ agent/assets.php | 2 +- agent/clients.php | 2 +- agent/contacts.php | 2 +- agent/credentials.php | 2 +- agent/domains.php | 2 +- agent/files.php | 2 +- agent/includes/inc_client_top_head.php | 3 +- agent/includes/inc_ticket_template_select.php | 2 +- agent/locations.php | 2 +- agent/modals/asset/asset_bulk_add_ticket.php | 4 +- agent/modals/asset/asset_bulk_edit_status.php | 2 +- agent/modals/asset/asset_form.php | 2 +- .../asset/asset_interface_bulk_edit_type.php | 2 +- agent/modals/asset/asset_interface_form.php | 2 +- .../asset/asset_interface_multiple_add.php | 2 +- agent/modals/asset/asset_note_add.php | 2 +- agent/modals/billing/billing_form.php | 2 +- agent/modals/certificate/certificate_form.php | 2 +- agent/modals/client/client_add.php | 8 +- .../modals/client/client_bulk_add_ticket.php | 4 +- .../client/client_bulk_edit_referral.php | 2 +- agent/modals/client/client_credit_add.php | 2 +- agent/modals/client/client_edit.php | 8 +- agent/modals/contact/contact_add.php | 8 +- agent/modals/contact/contact_note_add.php | 2 +- agent/modals/credential/credential_form.php | 1 - agent/modals/domain/domain_form.php | 2 +- agent/modals/expense/expense_bulk_edit.php | 2 +- agent/modals/file/file_view.php | 2 +- agent/modals/income/income_bulk_edit.php | 2 +- .../invoice/invoice_bulk_edit_category.php | 2 +- agent/modals/kb/kb_article_bulk_category.php | 2 +- agent/modals/kb/kb_article_form.php | 2 +- agent/modals/location/location_add.php | 8 +- agent/modals/location/location_form.php | 4 +- .../product/product_bulk_edit_category.php | 2 +- agent/modals/product/product_form.php | 2 +- agent/modals/purchasing/order_item.php | 2 +- agent/modals/rack/rack_form.php | 2 +- .../recurring_ticket/recurring_ticket_add.php | 4 +- .../recurring_ticket_bulk_category_edit.php | 2 +- .../recurring_ticket_edit.php | 4 +- agent/modals/software/software_form.php | 5 +- agent/modals/ticket/ticket_add.php | 45 ++--- .../ticket/ticket_bulk_edit_category.php | 2 +- agent/modals/ticket/ticket_edit.php | 2 +- agent/modals/ticket/ticket_invoice_add.php | 2 +- agent/modals/ticket/ticket_quote_add.php | 2 +- agent/modals/vendor/vendor_add.php | 8 +- agent/modals/vendor/vendor_form.php | 9 +- agent/networks.php | 2 +- agent/post/contact.php | 4 + agent/post/location.php | 3 + agent/post/vendor.php | 4 + agent/reports/geography.php | 4 +- agent/services.php | 2 +- agent/software.php | 2 +- agent/unbilled_time.php | 18 +- agent/vendor.php | 2 +- agent/vendors.php | 2 +- client/profile.php | 2 +- css/itflow_custom.css | 26 ++- functions/categories.php | 2 +- functions/client_overview.php | 42 +++-- functions/contact.php | 7 +- functions/dashboard.php | 38 ++-- functions/format.php | 8 +- functions/request.php | 15 ++ functions/settings.php | 4 +- functions/ticket.php | 7 +- functions/ticket_fields.php | 2 +- functions/ticket_status.php | 2 +- includes/filter_footer.php | 53 +++--- js/app.js | 10 +- js/quick_add.js | 173 +++++++++++------- 89 files changed, 406 insertions(+), 319 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2c51a94ab..bd96c1a9b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -169,7 +169,7 @@ Update from Maintenance > Update — Queue Update hands the job to cron, which u - Clients: Offboard, in a client's menu, does what's left when you stop working with a client in one go - portal sign-in off and invites cancelled, shared links ended, recurring invoices stopped, recurring tickets paused and the client archived - with Export Data a click away first. - Contacts: a contact whose email bounces shows Email bounced, with when and what the mail server said. It goes when mail comes in from the address, when the address is changed, or with Clear. - Contacts: New ticket in a contact's row on the contacts list raises a ticket for them without opening them first. -- Tickets and assets: the + beside Contact, Site and Vendor in New Ticket and Edit Ticket, and beside Location, Assigned to and Vendor in the asset form, adds one there and picks it - no closing the window to add it. +- Tickets and assets: the + beside Contact, Site and Vendor in New Ticket and Edit Ticket, and beside Location, Assigned to and Vendor in the asset form, opens the usual New Contact, New Location or New Vendor window over the form. What you make there is picked, and the form underneath stays as it was - no closing it to add one. - Clients: Merge into another client, in a client's menu, merges the same company added twice - every contact, ticket, invoice, document, file and the rest moves to the client you keep, whose own details stay, and the duplicate is left archived and empty. It says first what moves and which agents' access differs between the two. It takes Delete access to clients. - Assets: Copy details, on an asset's page and its quick look, copies what a vendor's support case asks for as text, ready to paste - make and model, serial, OS, its details, IP and MAC, warranty, dates, the site's address and where it is racked. - Racks: drag an item on a rack to another position, or across to the other side, and it moves there. Drag one of the client's assets from Not racked yet onto the rack and Add opens with it and where you dropped it filled in. While you drag, the rack shows where it would go, in red where something is in the way. @@ -202,6 +202,12 @@ Update from Maintenance > Update — Queue Update hands the job to cron, which u - 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. - Updated the libraries ITFlow is built on: the one that reads ticket mailboxes, the one that sends email, the text editor, the one that cleans up email and document HTML before it is shown, Stripe, the page styling, the charts, the tables, the calendar and the phone number fields. Nothing changes in how they look or work. The text editor's update fixes a security problem in its media plugin, which ITFlow doesn't use. - Pages are a little lighter: five add-on libraries are gone - three ITFlow no longer used, and two swapped for ITFlow's own code. The IP and MAC address fields on assets and the QR codes for setting up MFA and for shared links work as before. The download is about 5 MB smaller too, without the text editor add-ons and icon font files ITFlow never used. +- Lists: a row shows its tags only when it has some, so untagged rows are a line shorter - tag one from its own page, or tick it and use Tags in Bulk Action. A client's other pages show the client's tags without the +; change them on the client's overview or the clients list. +- Lists: the page numbers stay on one row - the first and last page and the ones next to yours - however long the list. +- Tickets: Unassigned is amber, as the Unassigned view and the dashboard's tile are, and Not billable a light gray - red is kept for what is late. +- Dashboard and client overview: when the last row of Needs attention is short, its tiles keep their width rather than one stretching across, and a count of one reads 1 Draft invoice, not 1 Draft invoices. +- Unbilled Time: the time logged is under the hours to bill rather than a column of its own, so the list fits beside Bill these clients. +- Forms: the + beside a picker and the Cancel button look the same in every window, a vendor's What they are is Description as on other records, and a few notes under fields that only said where a value shows are gone. ### Bug Fixes @@ -254,6 +260,8 @@ Update from Maintenance > Update — Queue Update hands the job to cron, which u - Email sent with Microsoft 365 or Google sign-in: when the mail server turned down ITFlow's sign-in, the email failed on its From address with "Authentication required" in Maintenance > Mail Queue, as if the address were the problem. It now fails saying the sign-in didn't work. - Assets: a MAC address field holding a note rather than an address ("see label", say) was cut down to the letters in it that pass for hex - "EE:AB:E" - as soon as the asset was opened for editing, and saved like that. It's now left as it is, as the IP address field already was. - Card payments: once a client's Stripe customer was deleted in Stripe - or the Stripe keys were changed to another Stripe account, or between test and live - every card payment for that client failed, and only an edit to the database put it right. The portal's card form never loaded, the invoice pay page showed Stripe's error, Charge Saved Card failed, and autopay failed every night. Now when Stripe says the customer isn't there, ITFlow forgets it along with the cards saved on it, which Stripe dropped too. A payment with a new card, from an invoice's pay link or the portal, still goes through. The client is asked to add their card again to save one, agents get a notification, and each recurring invoice whose autopay stopped says why. Reported on the forum. +- Windows: opening one put a focus ring round its X in the corner. Focus now goes to the window itself. +- Tickets: the tickets list and board showed how long ago a ticket's SLA was due, in grey, until cron next marked it breached, and showed the time left on one that had already missed its first response. A ticket past its deadline or that missed a target now says Breached, as the SLA breached view counts it. ### Developer Updates @@ -385,7 +393,7 @@ Update from Maintenance > Update — Queue Update hands the job to cron, which u - Files: `upload_files` takes `file_paths[]`, each file's path under the folder chosen, and `folderForUploadPath()` finds or makes its folders (matching names case-insensitively, ten levels at most); with `upload_json` it answers `{uploaded, skipped, folders}` instead of a flash, and `upload_folder_done` makes the flash from the totals. `file_upload.php` sends a folder (`webkitdirectory`, or dropped entries walked with `webkitGetAsEntry`) 20 files or 100 MB at a time, leaving out `.DS_Store`, `Thumbs.db`, `desktop.ini` and hidden folders; `agent/js/files.js` hands it dropped folders through `input.itflowWalk` and `input.itflowTakeFolder`. `download_folder_zip` (GET) and `bulk_download_files` build a `ZipArchive` in the temp folder with `filesZipSend()` and `filesZipFolderItems()` - files by their stored name, documents as purified HTML pages, names made safe and numbered when they clash, 2 GB at most. `files_rename` in `agent/ajax.php` renames from the list. - Contacts: database 4.0.3 adds `contacts.contact_email_bounced_at` and `contact_email_bounce`. `functions/contact_bounce.php`: `contactBounceReady()`, `contactBounceMark()` (from the parser's NDR handling, by `Final-Recipient`, case-insensitive, with an audit line per contact), `contactBounceClearEmail()` (every message the parser reads, by its From), `contactBounceClear()` (`clear_contact_bounce`, and `edit_contact` when the address changes), `contactBounce()`, `contactBounceBadge()` and `contactBounceColumns()`. - Clients: new `functions/client.php` - `clientOffboardCounts()`, `clientArchiveNow()` (now behind `archive_client` too) and `clientStopRecurringInvoices()`. `offboard_client` (`agent/modals/client/client_offboard.php`) runs the steps ticked with `portalUserAccessOff()`, `portalInviteCancel()`, `shareEnd()` (reason "Client offboarded"), the recurring invoices (`module_sales` edit) and `recurring_ticket_paused_at` (`module_support` edit), and audits one line. `js/client_card.js` (every agent page) shows `agent/ajax.php?client_card` in a Bootstrap popover on `a[data-client-card]` - added to the client-name links on the lists and record pages - and on links to `client_overview.php?client_id=`, outside the sidebar, breadcrumbs, menus and navs. -- Contacts, tickets and assets: `quickAddButton()` in `functions/contact.php` and `js/quick_add.js` (every agent page) add a contact, location or vendor through `quick_add_record` in `agent/ajax.php` (Client edit; locations through `locationFormSet()`, the first made primary; vendors through `vendorFormSet()`) from a SweetAlert2 form inside the window, then add it to the picker as picked. `contact_email_check` takes `exclude` and names the contact and client it finds; new `asset_duplicate_check` (`serial`, or `mac` compared as 12 hex digits) for the asset form's `[data-asset-duplicate]` fields. +- Contacts, tickets and assets: `quickAddButton()` in `functions/contact.php` and `js/quick_add.js` (every agent page) open `contact_add.php`, `location_add.php` or `vendor_add.php` with `inline=1` over the form, and post it in the background; `add_contact`, `add_location` and `add_vendor` answer an inline post through `inlineSaveAnswer()` in `functions/request.php` (`ok`, `value`, `label`, `message`, or `error`), and the new record is added to the picker as picked. `contact_email_check` takes `exclude` and names the contact and client it finds; new `asset_duplicate_check` (`serial`, or `mac` compared as 12 hex digits) for the asset form's `[data-asset-duplicate]` fields. - Clients: `clientMerge()` in `functions/client.php` (`merge_client`, `agent/modals/client/client_merge.php`, Client delete and access to both) moves every `*_client_id` in `clientMergeTables()` - those this database has, logs and notifications included; unions `client_tags`, `kb_article_clients` and `ticket_template_portal_clients`; keeps the kept client's row where there can be one (`sla_assignments`, `kb_search_misses`, `client_onboardings` by `UPDATE IGNORE` then delete) and one primary contact and location; moves a card provider and its saved cards only where the kept client has none for that provider, otherwise deletes the merged client's (autopay on them goes by cascade); moves `uploads/clients/`; appends the quick notes; moves `config_internal_client_id`; and renames and archives what's left. `user_client_permissions` aren't changed - `clientMergeAccessChanges()` (`client_merge_access` in `agent/ajax.php`) lists the agents whose access differs. `clientMergeSummary()` counts what moves. - Assets: `assetDetailsText()` in `functions/asset.php` - the asset as "Label: value" lines, for the Copy details buttons (`.clipboardjs`) on `agent/asset.php` and `agent/modals/asset/asset.php`. - Racks: `move_rack_unit` in `agent/post/rack.php` (`unit_id`, `unit_start`, `face`; height and depth kept; the rack's bounds and `rackUnitConflict()` checked; refused on an archived rack) is posted through `#rackMoveForm` by `agent/js/rack_drag.js`, loaded on `agent/rack.php` for agents who can edit. `agent/includes/rack_elevation.php` gives each bay `data-rack-drop` with its face, height and numbering, and each item `data-rack-unit`, `-start`, `-end` and `-name`, with `data-rack-drag` on the ones that move. An asset dropped opens `rack_device_add.php` with `asset_id`, `u` and `face`. `rackAssetDefaults()` in `functions/rack.php` is the height and depth an asset type starts from, for that window and the Not racked yet list. @@ -402,6 +410,7 @@ Update from Maintenance > Update — Queue Update hands the job to cron, which u - Tickets: `ticketMailTry($from, $subject, $auto_reply)` in `functions/ticket_mail_try.php` asks what `cron/ticket_email_parser.php` asks, in its order, with no writes - `ticketMailTryReply()` mirrors `addReply()`. Kept in step with the parser by hand. `admin/modals/ticket_mail/ticket_mail_try.php` (`?try=1` answers JSON with the result). - Weekly summary: database 4.0.7 adds `settings.config_weekly_summary`, `_day` (1 Monday to 7 Sunday), `_to` (NULL for every admin) and `_sent_at`. `functions/weekly_summary.php`: `weeklySummaryReady()`, `weeklySummarySettings()`, `weeklySummaryRecipients()`, `weeklySummaryNumbers($from, $to)`, `weeklySummaryNeeds()`, `weeklySummaryEmail($until)`, `weeklySummarySend()` and `weeklySummaryRun()`, called by `cron/nightly_tasks.php`, which sends once on the day (`config_weekly_summary_sent_at`). `send_weekly_summary_now` in `admin/post/settings_notification.php`; the `weekly_summary` email preview. - Related tickets: database 4.0.8 adds `ticket_links` (`ticket_id` as the primary key, `link_group`, `linked_by`, `linked_at`; deleted with its ticket). `functions/ticket_link.php`: `ticketLinksReady()`, `ticketLinkGroup()`, `ticketLinkMembers()`, `ticketLinkTogether()` (any number of tickets and everything already related to them into one group, with a ticket history line naming the newly related ones), `ticketUnlink()`, `ticketRelated()` and `ticketLinkCounts()` (scoped to the agent's clients), `ticketLinkHidden()`, `ticketLinkCandidates()` and `ticketLinkCarry()` (from `ticketMergeInto()`). A group is numbered by its lowest ticket id, renumbered by `ticketLinkTidy()` as tickets leave, so one number never names two groups; a group left with one ticket is deleted. `agent/post/ticket_link.php` handles `link_tickets`, `unlink_ticket` and `bulk_link_tickets`; Reply to all and Resolve all open `ticket_bulk_reply.php` and `ticket_bulk_resolve.php` with `ticket_ids[]`. +- Look and feel: `.itflow-dash-rail` is a grid (`repeat(auto-fill, minmax(10rem, 1fr))`, `.itflow-dash-rail-clear` spans it; `.itflow-ov-stats` stays flex), and the attention items of `dashboardAttention()` and `clientOverviewAttention()` take `one`, used when the count is 1. `formatAssignee()` highlights unassigned in warning, `ticketBillableHtml()` draws not billable in `bg-body-secondary`, and `ticketSlaState()` gives `breached` for an open ticket with a `ticket_response_sla_met` or `ticket_resolution_sla_met` of 0 or a deadline in the past. `includes/filter_footer.php` links the first, last and neighboring pages with an ellipsis between, in place of every tenth page. The list pages render `tagPills()` only for a row with tags, and `agent/includes/inc_client_top_head.php` passes `$can_edit` false. `categoryAddButtonHtml()` and `quickAddButton()` are called with their default `btn-outline-secondary` everywhere. `js/app.js` focuses the dialog again on the next tick when AdminLTE's `shown.bs.modal` handler has put focus on its `.btn-close`. ## [26.11.8] diff --git a/admin/identity_providers.php b/admin/identity_providers.php index b92b8670b..c88d286dd 100644 --- a/admin/identity_providers.php +++ b/admin/identity_providers.php @@ -26,7 +26,7 @@ echo settingsPageStart('identity');
The client portal is off - turn it on in Modules.
- +
diff --git a/admin/modals/payment_provider/payment_provider_edit.php b/admin/modals/payment_provider/payment_provider_edit.php index 5eec6ad2c..da79a0cbe 100644 --- a/admin/modals/payment_provider/payment_provider_edit.php +++ b/admin/modals/payment_provider/payment_provider_edit.php @@ -204,7 +204,7 @@ ob_start(); - +
Processing Fee, or the like.
diff --git a/admin/modals/rmm/rmm_provider_edit.php b/admin/modals/rmm/rmm_provider_edit.php index 16291bdab..f9e75e545 100644 --- a/admin/modals/rmm/rmm_provider_edit.php +++ b/admin/modals/rmm/rmm_provider_edit.php @@ -144,7 +144,7 @@ ob_start(); - + diff --git a/admin/modals/vendor_template/vendor_template_form.php b/admin/modals/vendor_template/vendor_template_form.php index 361d7bc0d..5796b0b5b 100644 --- a/admin/modals/vendor_template/vendor_template_form.php +++ b/admin/modals/vendor_template/vendor_template_form.php @@ -50,7 +50,7 @@ $contact_phone_value = ($vt['contact_phone'] ?? '') !== '' ? escapeHtml(formatPh
- +
diff --git a/admin/post/settings_theme.php b/admin/post/settings_theme.php index 26894148b..a4f7cb335 100644 --- a/admin/post/settings_theme.php +++ b/admin/post/settings_theme.php @@ -17,7 +17,7 @@ if (isset($_POST['edit_theme_settings'])) { $errors = []; if (!isset(settingsThemes()[$theme])) { - $errors['config_theme'] = 'Pick one of the colours.'; + $errors['config_theme'] = 'Pick one of the colors.'; } $favicon_problem = settingsImageProblem($_FILES['favicon'] ?? null, ['ico'], ['ico'], '.ico', 1048576); if ($favicon_problem !== '') { diff --git a/admin/post/starter_content_model.php b/admin/post/starter_content_model.php index eb6a10bc0..94d9412a4 100644 --- a/admin/post/starter_content_model.php +++ b/admin/post/starter_content_model.php @@ -62,7 +62,7 @@ function starterContentPacks() { 'description' => "Vendors most clients end up with - each with its support site, status page and the portal cases are opened in, and what their support asks for. Phone numbers, hours and SLAs differ by region and contract, and account numbers and PINs by account, so they are yours to add.", 'update' => [ 'button' => 'update_starter_vendor_templates', - 'confirm' => 'Bring the %d starter vendor templates you have up to date? What they are, their support site, status page, portal and notes are replaced with this version - changes you made to those are lost, and the vendors made from them that still said what they did change with them. Their support line, hours, SLA, email, account details and who should have them stay as they are.', + 'confirm' => 'Bring the %d starter vendor templates you have up to date? Their description, support site, status page, portal and notes are replaced with this version - changes you made to those are lost, and the vendors made from them that still said what they did change with them. Their support line, hours, SLA, email, account details and who should have them stay as they are.', ], ], 'document_templates' => [ diff --git a/admin/settings_invoice.php b/admin/settings_invoice.php index e88905f1d..85ed16c80 100644 --- a/admin/settings_invoice.php +++ b/admin/settings_invoice.php @@ -184,7 +184,7 @@ echo settingsPageStart('invoice'); 'placeholder' => '0.70', 'help' => 'For driving their own vehicle - your reimbursement rate, such as the IRS standard mileage rate. Empty turns paying back off.']) ?>
'fa-list', 'search' => true, 'options_html' => '' . categoryOptionsHtml('Expense', intval(settingsValue('config_mileage_category_id', $trip_rules['category_id']))), - 'append' => categoryAddButtonHtml('Expense', 'btn btn-secondary'), + 'append' => categoryAddButtonHtml('Expense'), 'help' => 'The expense category of the mileage paid back. The expenses are to the vendor Mileage, made the first time.']) ?>
diff --git a/admin/settings_module.php b/admin/settings_module.php index 8806ae607..4f1433389 100644 --- a/admin/settings_module.php +++ b/admin/settings_module.php @@ -66,7 +66,7 @@ echo settingsPageStart('module');
- White-labelled - thank you for supporting ITFlow. + White-labeled - thank you for supporting ITFlow.
· · until
diff --git a/admin/settings_security.php b/admin/settings_security.php index ea4325181..c33828a65 100644 --- a/admin/settings_security.php +++ b/admin/settings_security.php @@ -28,7 +28,7 @@ echo settingsPageStart('security');
- 3, 'maxlength' => 65000, 'placeholder' => 'Authorised users only', + 3, 'maxlength' => 65000, 'placeholder' => 'Authorized users only', 'help' => 'Shown above the sign-in form - plain text, each new line kept.']) ?> 'Agents sign in only from the address with the key in it.']) ?>
diff --git a/admin/settings_theme.php b/admin/settings_theme.php index 87a75a908..662d10b9f 100644 --- a/admin/settings_theme.php +++ b/admin/settings_theme.php @@ -25,9 +25,9 @@ echo settingsPageStart('theme');
- + -
+
$theme_name) { ?>
> diff --git a/admin/starter_content.php b/admin/starter_content.php index d8f1f957d..bb18caa32 100644 --- a/admin/starter_content.php +++ b/admin/starter_content.php @@ -152,17 +152,17 @@ foreach ($starter_content_status as $pack_status) { infrastructure, a documented switch port map, IP addresses and a supplier list. Managed, co-managed, break fix and hosting only clients are all represented, most of them paid up to date and a few of them not. Your own side of the business is generated too - bank accounts, suppliers, operating costs, recurring expenses, - transfers, catalogue lines for the things you sell, closure days, monthly budgets, and a working diary of team + transfers, catalog lines for the things you sell, closure days, monthly budgets, and a working diary of team meetings, maintenance windows and the unbilled running around that never gets logged against a client. Everything is spread across the last two years and dated relative to today, so the dashboard, ticket queue, aging, profit and loss and every other report have real history behind them rather than one flat month.

- This is sample data, not configuration. Nothing in it is labelled as demo data - the clients, tags and references + This is sample data, not configuration. Nothing in it is labeled as demo data - the clients, tags and references all read as real, which is the point. Removal matches the client names in the library, so renaming a demo client stops it being removable. Contacts use addresses on the reserved .example domain, which cannot receive mail, and the agreements are created with email - notification switched off. Anything shared - accounts, suppliers, response targets, tax rates, catalogue lines and + notification switched off. Anything shared - accounts, suppliers, response targets, tax rates, catalog lines and calendars - is matched on more than its name, so records this install already had are never touched, and the company side of the books is always built against accounts this page created rather than yours.

diff --git a/admin/vendor_template.php b/admin/vendor_template.php index e86a3a081..26403e737 100644 --- a/admin/vendor_template.php +++ b/admin/vendor_template.php @@ -100,7 +100,7 @@ $manager = array_filter([ trim((string) $t['vendor_template_contact_email']) !== '' ? '' . escapeHtml($t['vendor_template_contact_email']) . '' : '', ]); $facts = array_filter([ - 'What they are' => escapeHtml((string) $t['vendor_template_description']), + 'Description' => escapeHtml((string) $t['vendor_template_description']), 'Support line' => vendorTemplatePhoneHtml($t['vendor_template_phone'], $t['vendor_template_phone_country_code'], $t['vendor_template_extension']), 'Support hours' => escapeHtml((string) $t['vendor_template_hours']), 'SLA' => escapeHtml((string) $t['vendor_template_sla']), diff --git a/agent/ajax.php b/agent/ajax.php index fb985ad6f..e79039a1a 100644 --- a/agent/ajax.php +++ b/agent/ajax.php @@ -946,61 +946,6 @@ if (isset($_GET['client_card'])) { exit; } -/* - * Add a contact, location or vendor without leaving the window that needs it (js/quick_add.js - - * the + beside those pickers in New Ticket, Edit Ticket and the asset form). Only what the picker - * needs: a name, and an email and title, an address, or a phone. Answers {ok, id, label} or {error}. - */ -if (isset($_POST['quick_add_record'])) { - validateCSRFToken(); - header('Content-Type: application/json'); - - $type = (string) $_POST['quick_add_record']; - $client_id = intval($_POST['client_id'] ?? 0); - $name = mb_substr(trim((string) ($_POST['name'] ?? '')), 0, 200); - $fail = function ($error) { - echo json_encode(['error' => $error]); - exit; - }; - - if (!in_array($type, ['contact', 'location', 'vendor'], true) || lookupUserPermission('module_client') < 2) { - $fail("You can't add those here."); - } - if (!$client_id || !hasClientAccess($client_id) || !mysqli_num_rows(mysqli_query($mysqli, "SELECT 1 FROM clients WHERE client_id = $client_id"))) { - $fail('Pick the client first.'); - } - if ($name === '') { - $fail('It needs a name.'); - } - $name_sql = escapeSql($name); - - if ($type === 'contact') { - $email = trim((string) ($_POST['email'] ?? '')); - if ($email !== '' && !filter_var($email, FILTER_VALIDATE_EMAIL)) { - $fail("That email address doesn't look right."); - } - mysqli_query($mysqli, "INSERT INTO contacts SET contact_name = '$name_sql', contact_email = '" . escapeSql(mb_substr($email, 0, 200)) . "', - contact_title = '" . escapeSql(mb_substr(trim((string) ($_POST['title'] ?? '')), 0, 200)) . "', contact_client_id = $client_id"); - $id = mysqli_insert_id($mysqli); - logAudit("Contact", "Create", "$session_name created contact $name_sql", $client_id, $id); - } elseif ($type === 'location') { - mysqli_query($mysqli, "INSERT INTO locations SET " . locationFormSet(['name' => $name, 'address' => $_POST['address'] ?? '', 'city' => $_POST['city'] ?? ''], $client_id) . ", location_client_id = $client_id"); - $id = mysqli_insert_id($mysqli); - // The client's first location is its primary one, as from Add Location - if (!intval(mysqli_fetch_row(mysqli_query($mysqli, "SELECT COUNT(*) FROM locations WHERE location_client_id = $client_id AND location_primary = 1 AND location_archived_at IS NULL"))[0])) { - locationMakePrimary($id, $client_id); - } - logAudit("Location", "Create", "$session_name created location $name_sql", $client_id, $id); - } else { - mysqli_query($mysqli, "INSERT INTO vendors SET " . vendorFormSet(['name' => $name, 'phone' => $_POST['phone'] ?? '']) . ", vendor_client_id = $client_id"); - $id = mysqli_insert_id($mysqli); - logAudit("Vendor", "Create", "$session_name created vendor $name_sql", $client_id, $id); - } - - echo json_encode(['ok' => true, 'id' => $id, 'label' => $name]); - exit; -} - /* * Rename a file or a document from its name on the files list (agent/js/files.js) - the name only; * the Rename window still changes the description. Answers {ok, name} or {error}. diff --git a/agent/assets.php b/agent/assets.php index 076b1494e..71828bee8 100644 --- a/agent/assets.php +++ b/agent/assets.php @@ -624,7 +624,7 @@ $search_noun = $type_filter ? $asset_type_tabs[$type_filter]['label'] : 'assets'
- = 2) { ?> +
diff --git a/agent/clients.php b/agent/clients.php index 11f6e0084..830f35b9b 100644 --- a/agent/clients.php +++ b/agent/clients.php @@ -589,7 +589,7 @@ $total_leads = intval($row['leads']);
- +
diff --git a/agent/contacts.php b/agent/contacts.php index 59730c9a3..963a0c99a 100644 --- a/agent/contacts.php +++ b/agent/contacts.php @@ -630,7 +630,7 @@ $search_placeholder = $invites_view ? 'Search invites by email, name or client'
- +
diff --git a/agent/credentials.php b/agent/credentials.php index c8675e573..f6c2187a1 100644 --- a/agent/credentials.php +++ b/agent/credentials.php @@ -383,7 +383,7 @@ $filter_url = function ($changes) use ($client_url) {
- +
diff --git a/agent/domains.php b/agent/domains.php index 302cf2732..7cb95f3fd 100644 --- a/agent/domains.php +++ b/agent/domains.php @@ -371,7 +371,7 @@ $bulk_vendor_options = $can_edit ? domainVendorChoices($client_url ? $client_id
- +
diff --git a/agent/files.php b/agent/files.php index c16b29e0e..df68465d8 100644 --- a/agent/files.php +++ b/agent/files.php @@ -729,7 +729,7 @@ $preview = []; // the grid's previewer payload
- +
diff --git a/agent/includes/inc_client_top_head.php b/agent/includes/inc_client_top_head.php index 50efc580b..f6a1a0d42 100644 --- a/agent/includes/inc_client_top_head.php +++ b/agent/includes/inc_client_top_head.php @@ -47,7 +47,8 @@ if (empty($client_top_head_skip)) { - + + diff --git a/agent/includes/inc_ticket_template_select.php b/agent/includes/inc_ticket_template_select.php index 2d2f780a0..c1b2a2ee3 100644 --- a/agent/includes/inc_ticket_template_select.php +++ b/agent/includes/inc_ticket_template_select.php @@ -26,7 +26,7 @@ $selected_ticket_template_id = intval($selected_ticket_template_id ?? 0); $ticket_template_field = $ticket_template_field ?? 'ticket_template_id'; $ticket_template_apply_on_load = !empty($ticket_template_apply_on_load); -$ticket_template_hint = $ticket_template_hint ?? 'Picking one fills in the ticket - change anything before it is made. [Client], [Month] and the like are filled in when it is saved.'; +$ticket_template_hint = $ticket_template_hint ?? '[Client], [Month] and the like in it are filled in when the ticket is saved.'; $ticket_template_fill_in_values = $ticket_template_fill_in_values ?? []; diff --git a/agent/locations.php b/agent/locations.php index 30b3fadfa..4b7be319e 100644 --- a/agent/locations.php +++ b/agent/locations.php @@ -311,7 +311,7 @@ $locations_counts = locationCounts(array_keys($locations));
- +
diff --git a/agent/modals/asset/asset_bulk_add_ticket.php b/agent/modals/asset/asset_bulk_add_ticket.php index 053384d53..e2fc89504 100644 --- a/agent/modals/asset/asset_bulk_add_ticket.php +++ b/agent/modals/asset/asset_bulk_add_ticket.php @@ -23,7 +23,7 @@ ob_start(); [Asset], [Contact] and the like are filled in for each; with [Asset] in the subject, the asset's name isn't put in front. What the template asks for is answered once, for them all."; + $ticket_template_hint = "[Asset], [Contact] and the like in it are filled in for each ticket - with [Asset] in the subject, the asset's name isn't put in front too."; require_once '../../includes/inc_ticket_template_select.php'; ?> @@ -65,7 +65,7 @@ ob_start(); - + diff --git a/agent/modals/asset/asset_bulk_edit_status.php b/agent/modals/asset/asset_bulk_edit_status.php index d502a7b9f..0dd43dde3 100644 --- a/agent/modals/asset/asset_bulk_edit_status.php +++ b/agent/modals/asset/asset_bulk_edit_status.php @@ -28,7 +28,7 @@ ob_start(); - + diff --git a/agent/modals/asset/asset_form.php b/agent/modals/asset/asset_form.php index 427aab852..66f460218 100644 --- a/agent/modals/asset/asset_form.php +++ b/agent/modals/asset/asset_form.php @@ -195,7 +195,7 @@ $asset_form_icons = [ - +
diff --git a/agent/modals/asset/asset_interface_bulk_edit_type.php b/agent/modals/asset/asset_interface_bulk_edit_type.php index e43bc8d99..ffe3d1d5e 100644 --- a/agent/modals/asset/asset_interface_bulk_edit_type.php +++ b/agent/modals/asset/asset_interface_bulk_edit_type.php @@ -31,7 +31,7 @@ ob_start(); - +
diff --git a/agent/modals/asset/asset_interface_form.php b/agent/modals/asset/asset_interface_form.php index a27d99608..6bd20f4a3 100644 --- a/agent/modals/asset/asset_interface_form.php +++ b/agent/modals/asset/asset_interface_form.php @@ -69,7 +69,7 @@ $form_type = (string) ($form['interface_type'] ?? ''); - +
diff --git a/agent/modals/asset/asset_interface_multiple_add.php b/agent/modals/asset/asset_interface_multiple_add.php index 4160faadf..ee594e7a1 100644 --- a/agent/modals/asset/asset_interface_multiple_add.php +++ b/agent/modals/asset/asset_interface_multiple_add.php @@ -78,7 +78,7 @@ ob_start(); - +
diff --git a/agent/modals/asset/asset_note_add.php b/agent/modals/asset/asset_note_add.php index 899d464f9..fb3eee434 100644 --- a/agent/modals/asset/asset_note_add.php +++ b/agent/modals/asset/asset_note_add.php @@ -35,7 +35,7 @@ ob_start(); - +
diff --git a/agent/modals/billing/billing_form.php b/agent/modals/billing/billing_form.php index 7774035aa..7ce8f1a49 100644 --- a/agent/modals/billing/billing_form.php +++ b/agent/modals/billing/billing_form.php @@ -99,7 +99,7 @@ $form_scope_placeholder = [ $form_edit ? $form_value('created_at') : null]) ?> - + diff --git a/agent/modals/certificate/certificate_form.php b/agent/modals/certificate/certificate_form.php index 0caed1d7e..b2b5b5c10 100644 --- a/agent/modals/certificate/certificate_form.php +++ b/agent/modals/certificate/certificate_form.php @@ -124,7 +124,7 @@ $has_pem = trim(html_entity_decode($certificate_public_key, ENT_QUOTES, 'UTF-8')
-
For a host ITFlow can't reach. The issuer, dates, names it covers and fingerprint are read from it - a whole chain is fine, only the first certificate is kept. Never paste the private key.
+
For a host ITFlow can't reach - its details are read from it, and a whole chain is fine. Never paste the private key.
Nothing to paste? By hand
diff --git a/agent/modals/client/client_add.php b/agent/modals/client/client_add.php index 4e971ef73..a5e08cac1 100644 --- a/agent/modals/client/client_add.php +++ b/agent/modals/client/client_add.php @@ -60,7 +60,7 @@ ob_start();
- +
@@ -68,7 +68,7 @@ ob_start();
- +
@@ -80,7 +80,7 @@ ob_start(); - + @@ -297,7 +297,7 @@ ob_start(); diff --git a/agent/modals/client/client_bulk_add_ticket.php b/agent/modals/client/client_bulk_add_ticket.php index a1118af1d..49dffba8e 100644 --- a/agent/modals/client/client_bulk_add_ticket.php +++ b/agent/modals/client/client_bulk_add_ticket.php @@ -24,7 +24,7 @@ ob_start(); [Client], [Month] and the like are filled in for each. What the template asks for is answered once, for them all."; + $ticket_template_hint = "[Client], [Month] and the like in it are filled in for each ticket."; require_once '../../includes/inc_ticket_template_select.php'; ?> @@ -66,7 +66,7 @@ ob_start(); - + diff --git a/agent/modals/client/client_bulk_edit_referral.php b/agent/modals/client/client_bulk_edit_referral.php index 66484dd3e..951f9effe 100644 --- a/agent/modals/client/client_bulk_edit_referral.php +++ b/agent/modals/client/client_bulk_edit_referral.php @@ -28,7 +28,7 @@ ob_start(); - + diff --git a/agent/modals/client/client_credit_add.php b/agent/modals/client/client_credit_add.php index 81be66557..1a252f5ae 100644 --- a/agent/modals/client/client_credit_add.php +++ b/agent/modals/client/client_credit_add.php @@ -77,7 +77,7 @@ diff --git a/agent/modals/client/client_edit.php b/agent/modals/client/client_edit.php index 69a69659c..0bb517e88 100644 --- a/agent/modals/client/client_edit.php +++ b/agent/modals/client/client_edit.php @@ -91,7 +91,7 @@ ob_start();
- +
@@ -99,7 +99,7 @@ ob_start();
-
@@ -112,7 +112,7 @@ ob_start(); - + @@ -191,7 +191,7 @@ ob_start(); diff --git a/agent/modals/contact/contact_add.php b/agent/modals/contact/contact_add.php index 5a398746d..644475a3d 100644 --- a/agent/modals/contact/contact_add.php +++ b/agent/modals/contact/contact_add.php @@ -35,6 +35,10 @@ $contact_location_id = $client_id ? assetClientOwnedId('location', $_GET['locati $auth_method = ''; $contact_tag_id_array = []; +// Opened by the + beside a contact picker in another window (quickAddButton()) - js/quick_add.js +// saves it in the background and picks it there +$inline = !empty($_GET['inline']); + ob_start(); ?> @@ -44,13 +48,15 @@ ob_start();
+ data-itflow-phone-country=""> + diff --git a/agent/modals/credential/credential_form.php b/agent/modals/credential/credential_form.php index 8b99be249..bad05ff05 100644 --- a/agent/modals/credential/credential_form.php +++ b/agent/modals/credential/credential_form.php @@ -163,7 +163,6 @@ $form_id = 'credentialForm' . ($credential_form_mode === 'edit' ? $credential_id -
The device this login is for - it shows on the asset's Credentials tab.
diff --git a/agent/modals/domain/domain_form.php b/agent/modals/domain/domain_form.php index c6a7012d9..8bda8bdb0 100644 --- a/agent/modals/domain/domain_form.php +++ b/agent/modals/domain/domain_form.php @@ -96,7 +96,7 @@ $form_id = 'domainForm' . ($domain_form_mode === 'edit' ? $domain_id : 'New');
-
One per line - or separated by spaces or commas. Each is looked up as it is added; ones already on the client are skipped. The registrar, hosts, auto-renew and tags you set here go on all of them.
+
One per line, or separated by spaces or commas. The registrar, hosts, auto-renew and tags here go on all of them.
diff --git a/agent/modals/expense/expense_bulk_edit.php b/agent/modals/expense/expense_bulk_edit.php index 112773cbc..14b451781 100644 --- a/agent/modals/expense/expense_bulk_edit.php +++ b/agent/modals/expense/expense_bulk_edit.php @@ -57,7 +57,7 @@ ob_start(); - + - + - +
Reports group income by it.
diff --git a/agent/modals/kb/kb_article_bulk_category.php b/agent/modals/kb/kb_article_bulk_category.php index 945ba76db..5a9cfdff5 100644 --- a/agent/modals/kb/kb_article_bulk_category.php +++ b/agent/modals/kb/kb_article_bulk_category.php @@ -37,7 +37,7 @@ ob_start(); - + diff --git a/agent/modals/kb/kb_article_form.php b/agent/modals/kb/kb_article_form.php index d031c2afe..26b1b8fd2 100644 --- a/agent/modals/kb/kb_article_form.php +++ b/agent/modals/kb/kb_article_form.php @@ -52,7 +52,7 @@ $kb_form_audience = $kb_form_mode === 'edit' ? kbAudienceFields($kb_form) : ['vi - +
diff --git a/agent/modals/location/location_add.php b/agent/modals/location/location_add.php index d6f8048c6..62ccf1313 100644 --- a/agent/modals/location/location_add.php +++ b/agent/modals/location/location_add.php @@ -28,6 +28,10 @@ $location_tag_ids = []; $client_has_location = $client_id ? intval(mysqli_fetch_row(mysqli_query($mysqli, "SELECT COUNT(*) FROM locations WHERE location_client_id = $client_id AND location_archived_at IS NULL"))[0]) : 1; $location_primary = !empty($_GET['primary']) || !$client_has_location ? 1 : 0; +// Opened by the + beside a location picker in another window (quickAddButton()) - js/quick_add.js +// saves it in the background and picks it there +$inline = !empty($_GET['inline']); + ob_start(); ?> @@ -35,13 +39,15 @@ ob_start();
- +> + @@ -182,7 +182,6 @@ $form_id = 'locationForm' . ($location_form_mode === 'edit' ? $location_id : 'Ne -
Who to ask for when you get there - shown with their number on the location.
@@ -222,7 +221,6 @@ $form_id = 'locationForm' . ($location_form_mode === 'edit' ? $location_id : 'Ne
-
Shown on the location page, its quick look and on tickets for this location.
diff --git a/agent/modals/product/product_bulk_edit_category.php b/agent/modals/product/product_bulk_edit_category.php index c4ec07497..927f770a1 100644 --- a/agent/modals/product/product_bulk_edit_category.php +++ b/agent/modals/product/product_bulk_edit_category.php @@ -30,7 +30,7 @@ ob_start(); - + diff --git a/agent/modals/product/product_form.php b/agent/modals/product/product_form.php index 1259784fc..6aa0ed109 100644 --- a/agent/modals/product/product_form.php +++ b/agent/modals/product/product_form.php @@ -80,7 +80,7 @@ if ($form_vendor_id && !isset($form_vendors[$form_vendor_id]) && $form_value('ve - +
diff --git a/agent/modals/purchasing/order_item.php b/agent/modals/purchasing/order_item.php index 401e1e6ed..36ac4e2b7 100644 --- a/agent/modals/purchasing/order_item.php +++ b/agent/modals/purchasing/order_item.php @@ -78,7 +78,7 @@ ob_start();
- +
diff --git a/agent/modals/rack/rack_form.php b/agent/modals/rack/rack_form.php index aa05368c6..f774795b8 100644 --- a/agent/modals/rack/rack_form.php +++ b/agent/modals/rack/rack_form.php @@ -41,7 +41,7 @@ isset($mysqli) || die("Direct file access is not allowed"); Categories - one the rack has that is archived or isn't a type any more stays an option, or the required select would change it on every edit ?> - +
diff --git a/agent/modals/recurring_ticket/recurring_ticket_add.php b/agent/modals/recurring_ticket/recurring_ticket_add.php index 175bf381a..39a3d9828 100644 --- a/agent/modals/recurring_ticket/recurring_ticket_add.php +++ b/agent/modals/recurring_ticket/recurring_ticket_add.php @@ -93,7 +93,7 @@ ob_start(); [Client], [Month] and the like are filled in each time it raises a ticket, and what the template asks for is answered once here."; + $ticket_template_hint = "[Client], [Month] and the like in it are filled in each time it raises a ticket."; require_once '../../includes/inc_ticket_template_select.php'; ?> @@ -135,7 +135,7 @@ ob_start(); - + diff --git a/agent/modals/recurring_ticket/recurring_ticket_bulk_category_edit.php b/agent/modals/recurring_ticket/recurring_ticket_bulk_category_edit.php index 81932d58a..0e684242f 100644 --- a/agent/modals/recurring_ticket/recurring_ticket_bulk_category_edit.php +++ b/agent/modals/recurring_ticket/recurring_ticket_bulk_category_edit.php @@ -31,7 +31,7 @@ ob_start(); - + diff --git a/agent/modals/recurring_ticket/recurring_ticket_edit.php b/agent/modals/recurring_ticket/recurring_ticket_edit.php index 15b5685bd..af1d00eb7 100644 --- a/agent/modals/recurring_ticket/recurring_ticket_edit.php +++ b/agent/modals/recurring_ticket/recurring_ticket_edit.php @@ -112,7 +112,7 @@ ob_start(); foreach (ticketFillInsStored('recurring_ticket', $recurring['recurring_ticket_id']) as $answer) { $ticket_template_fill_in_values[$answer['name']] = $answer['value']; } - $ticket_template_hint = "Picking one fills in the recurring ticket - change anything before it is saved. [Client], [Month] and the like are filled in each time it raises a ticket, and what the template asks for is answered once here."; + $ticket_template_hint = "[Client], [Month] and the like in it are filled in each time it raises a ticket."; require_once '../../includes/inc_ticket_template_select.php'; ?> @@ -151,7 +151,7 @@ ob_start(); - + diff --git a/agent/modals/software/software_form.php b/agent/modals/software/software_form.php index 391d845cb..e686e098f 100644 --- a/agent/modals/software/software_form.php +++ b/agent/modals/software/software_form.php @@ -141,7 +141,7 @@ $form_id = 'softwareForm' . ($software_form_mode === 'edit' ? $software_id : 'Ne -
Fills in the name, type, license type, description, seats, vendor, renewal date and notes - change anything after. The license remembers it.
+
Fills in the details - change anything after.
@@ -172,7 +172,7 @@ $form_id = 'softwareForm' . ($software_form_mode === 'edit' ? $software_id : 'Ne - + @@ -268,7 +268,6 @@ $form_id = 'softwareForm' . ($software_form_mode === 'edit' ? $software_id : 'Ne -
Shows on the client overview's renewals and the dashboard as it gets close.
diff --git a/agent/modals/ticket/ticket_add.php b/agent/modals/ticket/ticket_add.php index cf964eb66..e5bf2faa6 100644 --- a/agent/modals/ticket/ticket_add.php +++ b/agent/modals/ticket/ticket_add.php @@ -182,7 +182,7 @@ ob_start(); - + @@ -231,7 +231,7 @@ ob_start(); - + @@ -273,11 +273,11 @@ ob_start(); - +
- +
- - -
-
When, how long and where. Leave it empty to book the work later.
+
+
- + +
+ + + + +
+
Leave it empty to book the work later.
@@ -366,7 +367,7 @@ ob_start(); - + @@ -379,7 +380,7 @@ ob_start(); - + diff --git a/agent/modals/ticket/ticket_bulk_edit_category.php b/agent/modals/ticket/ticket_bulk_edit_category.php index 537f70143..2bbfd601b 100644 --- a/agent/modals/ticket/ticket_bulk_edit_category.php +++ b/agent/modals/ticket/ticket_bulk_edit_category.php @@ -33,7 +33,7 @@ ob_start(); - + diff --git a/agent/modals/ticket/ticket_edit.php b/agent/modals/ticket/ticket_edit.php index 4225b7bb0..8360c4a93 100644 --- a/agent/modals/ticket/ticket_edit.php +++ b/agent/modals/ticket/ticket_edit.php @@ -135,7 +135,7 @@ ob_start(); - + diff --git a/agent/modals/ticket/ticket_invoice_add.php b/agent/modals/ticket/ticket_invoice_add.php index 25b23f5c3..cd81b1aff 100644 --- a/agent/modals/ticket/ticket_invoice_add.php +++ b/agent/modals/ticket/ticket_invoice_add.php @@ -138,7 +138,7 @@ ob_start(); - +
diff --git a/agent/modals/ticket/ticket_quote_add.php b/agent/modals/ticket/ticket_quote_add.php index ec314cf25..2babd73b0 100644 --- a/agent/modals/ticket/ticket_quote_add.php +++ b/agent/modals/ticket/ticket_quote_add.php @@ -115,7 +115,7 @@ ob_start(); - +
diff --git a/agent/modals/vendor/vendor_add.php b/agent/modals/vendor/vendor_add.php index 6d8206def..6c3c0581b 100644 --- a/agent/modals/vendor/vendor_add.php +++ b/agent/modals/vendor/vendor_add.php @@ -28,6 +28,10 @@ $vendor_template_id = 0; $vendor_tag_ids = []; $vendor_template_focus = !empty($_GET['from_template']); +// Opened by the + beside a vendor picker in another window (quickAddButton()) - js/quick_add.js +// saves it in the background and picks it there +$inline = !empty($_GET['inline']); + // Started from a template - its fields, escaped like the rest $template = vendorTemplateRow($_GET['template_id'] ?? 0); if ($template) { @@ -47,13 +51,15 @@ ob_start(); - +> +
- +
@@ -135,7 +135,6 @@ $form_id = 'vendorForm' . ($vendor_form_mode === 'edit' ? $vendor_id : 'New');
-
Template changes can be pushed to every vendor based on it, from Admin › Vendor Templates.
@@ -207,7 +206,7 @@ $form_id = 'vendorForm' . ($vendor_form_mode === 'edit' ? $vendor_id : 'New');
-
Where they post outages, and where you sign in to open a case - link the login itself from the vendor's Logins tab.
+
Where they post outages, and where you sign in to open a case.
@@ -230,7 +229,7 @@ $form_id = 'vendorForm' . ($vendor_form_mode === 'edit' ? $vendor_id : 'New');
-
What support asks for to check it's you - shown beside the support line, with the PIN hidden until you click it.
+
What support asks for to check it's you.
@@ -260,7 +259,7 @@ $form_id = 'vendorForm' . ($vendor_form_mode === 'edit' ? $vendor_id : 'New');
- +
Shown on the vendor's page and its quick look.
diff --git a/agent/networks.php b/agent/networks.php index 02e47a906..136ab993b 100644 --- a/agent/networks.php +++ b/agent/networks.php @@ -356,7 +356,7 @@ $csrf = $_SESSION['csrf_token'];
- +
diff --git a/agent/post/contact.php b/agent/post/contact.php index ac3bf2759..bd8d99b4b 100644 --- a/agent/post/contact.php +++ b/agent/post/contact.php @@ -87,6 +87,10 @@ if (isset($_POST['add_contact'])) { triggerCustomAction('contact_create', $contact_id); + $contact_label = getFieldById('contacts', $contact_id, 'contact_name'); + inlineSaveAnswer(['ok' => true, 'value' => (string) $contact_id, 'label' => $contact_label, + 'message' => "Contact $contact_label created" . ($invited === false ? ' - the portal invite was not sent' : ''), 'warning' => $invited === false]); + flashAlert("Contact " . stripslashes($name) . " created" . ($invited ? ' and invited to the client portal' : ($invited === false ? ' - the portal invite was not sent, as ' . (portalMailReady() ? 'their email address is not valid' : 'outgoing mail is not set up') : '')), $invited === false ? 'warning' : 'success'); redirect(); diff --git a/agent/post/location.php b/agent/post/location.php index c94ede0f2..6d5242d31 100644 --- a/agent/post/location.php +++ b/agent/post/location.php @@ -50,6 +50,7 @@ if (isset($_POST['add_location'])) { $set = locationFormSet($_POST, $client_id); if ($set === null) { + inlineSaveAnswer(['ok' => false, 'error' => 'A location needs a name.']); flashAlert('A location needs a name.', 'error'); redirect(); } @@ -70,6 +71,8 @@ if (isset($_POST['add_location'])) { $name = trim($_POST['name']); logAudit("Location", "Create", "$session_name created location " . escapeSql($name), $client_id, $location_id); + inlineSaveAnswer(['ok' => true, 'value' => (string) $location_id, 'label' => $name, 'message' => "Location $name created"]); + flashAlert("Location $name created"); redirect(); diff --git a/agent/post/vendor.php b/agent/post/vendor.php index 4c74b7e49..b341915e8 100644 --- a/agent/post/vendor.php +++ b/agent/post/vendor.php @@ -51,12 +51,14 @@ if (isset($_POST['add_vendor'])) { $client_id = intval($_POST['client_id'] ?? 0); vendorEnforce($client_id, 2); if ($client_id && !getFieldById('clients', $client_id, 'client_name')) { + inlineSaveAnswer(['ok' => false, 'error' => 'That client no longer exists.']); flashAlert('That client no longer exists.', 'error'); redirect(); } $vendor_id = vendorCreate($_POST, $client_id); if (!$vendor_id) { + inlineSaveAnswer(['ok' => false, 'error' => 'A vendor needs a name.']); flashAlert('A vendor needs a name.', 'error'); redirect(); } @@ -67,6 +69,8 @@ if (isset($_POST['add_vendor'])) { $template_note = intval($_POST['vendor_template_id'] ?? 0) ? ' from a template' : ''; logAudit("Vendor", "Create", "$session_name created vendor " . escapeSql($name) . $template_note, $client_id, $vendor_id); + inlineSaveAnswer(['ok' => true, 'value' => (string) $vendor_id, 'label' => $name, 'message' => "Vendor $name created"]); + flashAlert("Vendor $name created"); redirect(); diff --git a/agent/reports/geography.php b/agent/reports/geography.php index 75499bf58..dc44b55bb 100644 --- a/agent/reports/geography.php +++ b/agent/reports/geography.php @@ -170,7 +170,7 @@ if ($next_label !== '') { 'sub' => $next_named ? 'Most: ' . escapeHtml($next_named[0]['name']) . ' (' . geographyNoun($next_named[0]['clients'], 'client') . ')' : '']; } $stats[] = ['label' => 'Incomplete addresses', 'value' => reportCount($gaps), 'tone' => $gaps ? 'warning' : 'success', - 'sub' => '' . ($gaps ? 'No city, or a country or state not recognised' : 'Every location placed') . '']; + 'sub' => '' . ($gaps ? 'No city, or a country or state not recognized' : 'Every location placed') . '']; // The map: the world by country, or this country's states - shaded by clients or locations $map_name = $level === 0 ? 'world' : (REPORT_GEO_MAPS[$country] ?? ''); @@ -241,7 +241,7 @@ $controls .= reportSwitchControl('leads', $leads, 'Include leads'); diff --git a/agent/services.php b/agent/services.php index f568e9e6b..91c93f272 100644 --- a/agent/services.php +++ b/agent/services.php @@ -331,7 +331,7 @@ $link_icons = ['asset' => ['fa-desktop', 'asset', 'assets'], 'credential' => ['f
- +
diff --git a/agent/software.php b/agent/software.php index 10c3df2da..e608e35b7 100644 --- a/agent/software.php +++ b/agent/software.php @@ -479,7 +479,7 @@ while ($license_type_row = mysqli_fetch_row($sql_license_types)) { Archived
- +
diff --git a/agent/unbilled_time.php b/agent/unbilled_time.php index 20bd3e434..2260d4d97 100644 --- a/agent/unbilled_time.php +++ b/agent/unbilled_time.php @@ -360,7 +360,6 @@ $hours_text = function ($hours) { Client Tickets - Logged Bill Rate @@ -444,13 +443,20 @@ $hours_text = function ($hours) {
with no time
- -' ?> - -' ?> + + + + +
logged
+ + - + + - 1) { ?> - Each its own + Varies 0 || !$c['default_rate']) { ?> Settings > Defaults">default' : (in_array($c['rate_source'] ?? '', ['contract', 'after_hours'], true) ? '
contract
' : '') ?> @@ -539,7 +545,7 @@ $hours_text = function ($hours) { - +
@@ -568,7 +574,7 @@ $hours_text = function ($hours) {
- data-unbilled-rate> + data-unbilled-rate>
diff --git a/agent/vendor.php b/agent/vendor.php index ce0421a45..7bec595b4 100644 --- a/agent/vendor.php +++ b/agent/vendor.php @@ -466,7 +466,7 @@ if (!$vendor || (isset($_GET['client_id']) && $vendor_client_id !== intval($clie

Notes

- diff --git a/agent/vendors.php b/agent/vendors.php index 0a8db94f5..77654be2f 100644 --- a/agent/vendors.php +++ b/agent/vendors.php @@ -362,7 +362,7 @@ $missing_templates = $view === 'client' && !$archived ? vendorTemplatesMissingFo
- +
diff --git a/client/profile.php b/client/profile.php index fd714f53c..48c322b8d 100644 --- a/client/profile.php +++ b/client/profile.php @@ -397,7 +397,7 @@ $csrf = escapeHtml($_SESSION['csrf_token']); -
Somewhere you don't recognise? Change your password and let us know.
+
Somewhere you don't recognize? Change your password and let us know.
diff --git a/css/itflow_custom.css b/css/itflow_custom.css index 7c204465d..88d4a5574 100644 --- a/css/itflow_custom.css +++ b/css/itflow_custom.css @@ -718,6 +718,13 @@ a:focus { padding-top: .5rem; padding-bottom: .5rem; } +/* On a phone the page numbers fit one row */ +@media (max-width: 575.98px) { + .itflow-filter-footer .page-link { + padding-left: .55rem; + padding-right: .55rem; + } +} /* --- Primary button follows the theme ----------------------------------- Bootstrap 5 buttons are entirely variable driven, so these set --bs-btn-* @@ -2888,10 +2895,11 @@ body { /* Needs attention: one card split into cells, each with a severity bar on top. The -1px margins tuck every cell's left/top hairline under the card edge, so - only the lines between cells show however the row wraps. */ + only the lines between cells show however the row wraps. A grid, so a short + last row keeps the tiles' width rather than stretching one across the card. */ .itflow-dash-rail { - display: flex; - flex-wrap: wrap; + display: grid; + grid-template-columns: repeat(auto-fill, minmax(10rem, 1fr)); margin: -1px 0 0 -1px; } .itflow-dash-rail-item { @@ -2929,7 +2937,7 @@ a.itflow-dash-rail-item:focus-visible { color: var(--bs-secondary-color); } .itflow-dash-rail-clear { - flex-basis: 100%; + grid-column: 1 / -1; } /* Finance: the period figures side by side, then "Right now" beside them */ @@ -3783,7 +3791,11 @@ button.itflow-client-nav-identity:focus-visible { min-height: 12rem; resize: vertical; } -/* The money strip is the attention rail's layout without the coloured bar */ +/* The money strip is the attention rail's cells without the coloured bar, stretched to fill its row */ +.itflow-dash-rail.itflow-ov-stats { + display: flex; + flex-wrap: wrap; +} .itflow-ov-stats .itflow-dash-rail-item { --itflow-dash-tone: transparent; flex-basis: 12rem; @@ -5784,7 +5796,7 @@ tr:hover .itflow-files-rename, max-width: 20rem; } .itflow-project-list .itflow-ticket-who-cell > * { - max-width: 10.5rem; + max-width: 10rem; } @media (max-width: 1399.98px) { .itflow-project-main { @@ -5792,7 +5804,7 @@ tr:hover .itflow-files-rename, } } .itflow-project-desc { - max-width: 20rem; + max-width: 14rem; } .itflow-project-icon { --itflow-asset-tone: #5a61c9; diff --git a/functions/categories.php b/functions/categories.php index 3489e87d5..fb83e5a61 100644 --- a/functions/categories.php +++ b/functions/categories.php @@ -98,7 +98,7 @@ function categoryKinds() { ], 'asset_status' => [ 'label' => 'Asset Status', 'one' => 'asset status', 'many' => 'asset statuses', 'icon' => 'fa-heartbeat', - 'about' => 'Where an asset stands - deployed, out for repair, retired. Its colour is the status badge\'s; without one the built-in statuses keep theirs.', + 'about' => 'Where an asset stands - deployed, out for repair, retired. Its color is the status badge\'s; without one the built-in statuses keep theirs.', 'by' => 'name', 'ordered' => true, 'max' => 200, 'modules' => ['module_support'], 'uses' => [ $use('assets', 'asset_status', 'asset', 'assets', '/agent/assets.php?status={name}', 'asset_archived_at', 'asset_updated_at'), diff --git a/functions/client_overview.php b/functions/client_overview.php index aa9652bc8..993b19697 100644 --- a/functions/client_overview.php +++ b/functions/client_overview.php @@ -50,7 +50,7 @@ function clientOverviewAttention($client_id, $access, $renewals) { ]; $items[] = [ 'count' => dashboardCount("SELECT COUNT(ticket_id) FROM tickets WHERE $open AND ticket_assigned_to = 0"), - 'label' => 'Unassigned tickets', 'icon' => 'user-slash', 'tone' => 'warning', + 'label' => 'Unassigned tickets', 'one' => 'Unassigned ticket', 'icon' => 'user-slash', 'tone' => 'warning', 'url' => "/agent/tickets.php?client_id=$client_id&assigned=unassigned", ]; $items[] = [ @@ -61,7 +61,7 @@ function clientOverviewAttention($client_id, $access, $renewals) { // The same rule as projects.php?show=overdue $items[] = [ 'count' => dashboardCount("SELECT COUNT(project_id) FROM projects WHERE project_client_id = $client_id AND " . projectViews()['overdue']['where']), - 'label' => 'Overdue projects', 'icon' => 'project-diagram', 'tone' => 'danger', + 'label' => 'Overdue projects', 'one' => 'Overdue project', 'icon' => 'project-diagram', 'tone' => 'danger', 'url' => "/agent/projects.php?client_id=$client_id&show=overdue", ]; } @@ -73,7 +73,7 @@ function clientOverviewAttention($client_id, $access, $renewals) { - dashboardSum("SELECT SUM(payment_amount) FROM payments JOIN invoices ON payment_invoice_id = invoice_id WHERE $overdue_where"); $items[] = [ 'count' => $overdue_count, - 'label' => 'Overdue invoices', 'icon' => 'file-invoice-dollar', 'tone' => 'danger', + 'label' => 'Overdue invoices', 'one' => 'Overdue invoice', 'icon' => 'file-invoice-dollar', 'tone' => 'danger', 'detail' => $overdue_count ? dashboardMoney($overdue_amount) . ' outstanding' : null, 'url' => "/agent/invoices.php?client_id=$client_id&status=Overdue", ]; @@ -82,13 +82,13 @@ function clientOverviewAttention($client_id, $access, $renewals) { $soon = contractViews()['soon']['where']; $items[] = [ 'count' => dashboardCount("SELECT COUNT(contract_id) FROM contracts WHERE contract_client_id = $client_id AND contract_archived_at IS NULL AND $soon AND contract_auto_renew = 0"), - 'label' => 'Contracts ending', 'icon' => 'file-contract', 'tone' => 'warning', + 'label' => 'Contracts ending', 'one' => 'Contract ending', 'icon' => 'file-contract', 'tone' => 'warning', 'detail' => "They don't renew themselves", 'url' => "/agent/contracts.php?client_id=$client_id&show=soon", ]; $items[] = [ 'count' => dashboardCount("SELECT COUNT(contract_id) FROM contracts WHERE contract_client_id = $client_id AND contract_archived_at IS NULL AND $soon AND contract_auto_renew = 1"), - 'label' => 'Contracts renewing', 'icon' => 'sync-alt', 'tone' => 'info', + 'label' => 'Contracts renewing', 'one' => 'Contract renewing', 'icon' => 'sync-alt', 'tone' => 'info', 'detail' => 'Time to review them with the client', 'url' => "/agent/contracts.php?client_id=$client_id&show=soon", ]; @@ -104,14 +104,14 @@ function clientOverviewAttention($client_id, $access, $renewals) { $to_bill = expenseUnbilledCount($client_id); $items[] = [ 'count' => $to_bill['count'], - 'label' => 'Expenses to bill', 'icon' => 'shopping-cart', 'tone' => 'info', + 'label' => 'Expenses to bill', 'one' => 'Expense to bill', 'icon' => 'shopping-cart', 'tone' => 'info', 'detail' => $to_bill['count'] ? dashboardMoney($to_bill['value']) . ' to bill on' : null, 'url' => "/agent/unbilled_time.php?client_id=$client_id", ]; $trips_to_bill = tripUnbilledCount($client_id); $items[] = [ 'count' => $trips_to_bill['count'], - 'label' => 'Trips to bill', 'icon' => 'route', 'tone' => 'info', + '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?client_id=$client_id", ]; @@ -123,14 +123,14 @@ function clientOverviewAttention($client_id, $access, $renewals) { $items[] = [ 'count' => dashboardCount("SELECT COUNT(software_id) FROM software WHERE software_client_id = $client_id AND software_archived_at IS NULL AND " . softwareStatusFilters()['over']['sql']), - 'label' => 'Licenses over seats', 'icon' => 'cube', 'tone' => 'danger', + 'label' => 'Licenses over seats', 'one' => 'License over seats', 'icon' => 'cube', 'tone' => 'danger', 'url' => "/agent/software.php?client_id=$client_id&status=over", ]; // What the last check of a host found wrong - the same rule as certificates.php?show=problems $items[] = [ 'count' => dashboardCount("SELECT COUNT(certificate_id) FROM certificates WHERE certificate_client_id = $client_id AND certificate_archived_at IS NULL AND " . certificateProblemSql()), - 'label' => 'Certificate problems', 'icon' => 'lock', 'tone' => 'warning', + 'label' => 'Certificate problems', 'one' => 'Certificate problem', 'icon' => 'lock', 'tone' => 'warning', 'detail' => 'Name mismatch, untrusted, expired or unreachable', 'url' => "/agent/certificates.php?client_id=$client_id&show=problems", ]; @@ -138,34 +138,34 @@ function clientOverviewAttention($client_id, $access, $renewals) { $service_views = serviceViews(); $items[] = [ 'count' => dashboardCount("SELECT COUNT(service_id) FROM services WHERE service_client_id = $client_id AND " . $service_views['attention']['where']), - 'label' => 'Services needing attention', 'icon' => 'stream', 'tone' => 'danger', + 'label' => 'Services needing attention', 'one' => 'Service needing attention', 'icon' => 'stream', 'tone' => 'danger', 'detail' => 'What they run on needs a look', 'url' => "/agent/services.php?client_id=$client_id&show=attention", ]; $items[] = [ 'count' => dashboardCount("SELECT COUNT(service_id) FROM services WHERE service_client_id = $client_id AND " . $service_views['review']['where']), - 'label' => 'Service reviews due', 'icon' => 'clipboard-check', 'tone' => 'warning', + 'label' => 'Service reviews due', 'one' => 'Service review due', 'icon' => 'clipboard-check', 'tone' => 'warning', 'detail' => 'Next ' . SERVICE_REVIEW_SOON_DAYS . ' days or overdue', 'url' => "/agent/services.php?client_id=$client_id&show=review", ]; // Document templates it should have a document from - the strip across the top of its Files $items[] = [ 'count' => count(documentTemplatesMissingFor($client_id)), - 'label' => 'Documents missing', 'icon' => 'file-medical', 'tone' => 'warning', + 'label' => 'Documents missing', 'one' => 'Document missing', 'icon' => 'file-medical', 'tone' => 'warning', 'detail' => 'Ones every client like it should have', 'url' => "/agent/files.php?client_id=$client_id", ]; // The same rule as files.php?type=due $items[] = [ 'count' => count(documentsReviewDue("documents.document_client_id = $client_id")), - 'label' => 'Document reviews due', 'icon' => 'calendar-check', 'tone' => 'warning', + 'label' => 'Document reviews due', 'one' => 'Document review due', 'icon' => 'calendar-check', 'tone' => 'warning', 'detail' => 'As their templates ask', 'url' => "/agent/files.php?client_id=$client_id&type=due", ]; // License templates it should have a license from - the strip across the top of its Licenses $items[] = [ 'count' => count(softwareTemplatesMissingFor($client_id)), - 'label' => 'Licenses missing', 'icon' => 'cube', 'tone' => 'warning', + 'label' => 'Licenses missing', 'one' => 'License missing', 'icon' => 'cube', 'tone' => 'warning', 'detail' => 'Ones every client like it should have', 'url' => "/agent/software.php?client_id=$client_id", ]; @@ -176,7 +176,7 @@ function clientOverviewAttention($client_id, $access, $renewals) { $items[] = [ 'count' => dashboardCount("SELECT COUNT(credential_id) FROM credentials WHERE credential_client_id = $client_id AND credential_archived_at IS NULL AND (credential_password_changed_at IS NULL OR credential_password_changed_at < NOW() - INTERVAL " . CREDENTIAL_ROTATE_DAYS . " DAY)"), - 'label' => 'Passwords due for a change', 'icon' => 'history', 'tone' => 'warning', + 'label' => 'Passwords due for a change', 'one' => 'Password due for a change', 'icon' => 'history', 'tone' => 'warning', 'detail' => 'Not changed in ' . CREDENTIAL_ROTATE_DAYS . ' days', 'url' => "/agent/credentials.php?client_id=$client_id&show=due&sort=credential_password_changed_at&order=ASC", ]; @@ -186,7 +186,7 @@ function clientOverviewAttention($client_id, $access, $renewals) { // Vendor templates it should have a vendor from - the strip across the top of its Vendors $items[] = [ 'count' => count(vendorTemplatesMissingFor($client_id)), - 'label' => 'Vendors missing', 'icon' => 'building', 'tone' => 'warning', + 'label' => 'Vendors missing', 'one' => 'Vendor missing', 'icon' => 'building', 'tone' => 'warning', 'detail' => 'Ones every client like it should have', 'url' => "/agent/vendors.php?client_id=$client_id", ]; @@ -201,9 +201,15 @@ function clientOverviewAttention($client_id, $access, $renewals) { 'detail' => 'Next ' . $renewals['days'] . ' days', 'url' => '#clientRenewals']; } - return array_values(array_filter($items, function ($item) { + // "1 Draft invoice", not "1 Draft invoices" + return array_values(array_map(function ($item) { + if (intval($item['count']) === 1 && isset($item['one'])) { + $item['label'] = $item['one']; + } + return $item; + }, array_filter($items, function ($item) { return $item['count'] > 0; - })); + }))); } /** Open tickets, the ones most in need of attention first: past SLA, then priority, then waiting longest. */ diff --git a/functions/contact.php b/functions/contact.php index b122dce6b..80c97a6f2 100644 --- a/functions/contact.php +++ b/functions/contact.php @@ -189,8 +189,9 @@ function contactQuickRecord($contact_id) { } /** - * The + in a picker's input group that adds a contact, location or vendor there and then - * (js/quick_add.js, agent/ajax.php quick_add_record) - '' for an agent who can't add them. + * The + in a picker's input group that adds a contact, location or vendor there and then - it + * opens the usual New Contact, New Location or New Vendor window over the form (js/quick_add.js), + * and what is made there is picked in the picker - '' for an agent who can't add them. * $client_id when the window's client is fixed; otherwise the form's client_id is used. Styled * like the + beside a category picker (categoryAddButtonHtml()) - $class to match it where it differs. */ @@ -201,5 +202,5 @@ function quickAddButton($type, $client_id = 0, $class = 'btn btn-outline-seconda $titles = ['contact' => 'New contact', 'location' => 'New location', 'vendor' => 'New vendor']; return ''; + . ' title="' . $titles[$type] . '" aria-label="' . $titles[$type] . '">'; } diff --git a/functions/dashboard.php b/functions/dashboard.php index e25b252ef..538deaf6a 100644 --- a/functions/dashboard.php +++ b/functions/dashboard.php @@ -250,13 +250,13 @@ function dashboardAttention($access) { ]; $items[] = [ 'count' => dashboardCount("SELECT COUNT(ticket_id) FROM tickets WHERE ticket_resolved_at IS NULL AND ticket_assigned_to = 0 $ticket_scope" . projectTicketsServiceSql()), - 'label' => 'Unassigned tickets', 'icon' => 'user-slash', 'tone' => 'warning', + 'label' => 'Unassigned tickets', 'one' => 'Unassigned ticket', 'icon' => 'user-slash', 'tone' => 'warning', 'url' => '/agent/tickets.php?assigned=unassigned', ]; // The same rule as projects.php?show=overdue $items[] = [ 'count' => dashboardCount("SELECT COUNT(project_id) FROM projects WHERE " . projectViews()['overdue']['where'] . ' ' . clientScopeSql('project_client_id')), - 'label' => 'Overdue projects', 'icon' => 'project-diagram', 'tone' => 'danger', + 'label' => 'Overdue projects', 'one' => 'Overdue project', 'icon' => 'project-diagram', 'tone' => 'danger', 'url' => '/agent/projects.php?show=overdue', ]; } @@ -269,13 +269,13 @@ function dashboardAttention($access) { - dashboardSum("SELECT SUM(payment_amount) FROM payments JOIN invoices ON payment_invoice_id = invoice_id WHERE $overdue_where"); $items[] = [ 'count' => $overdue_count, - 'label' => 'Overdue invoices', 'icon' => 'file-invoice-dollar', 'tone' => 'danger', + 'label' => 'Overdue invoices', 'one' => 'Overdue invoice', 'icon' => 'file-invoice-dollar', 'tone' => 'danger', 'detail' => $overdue_count ? dashboardMoney($overdue_amount) . ' outstanding' : null, 'url' => '/agent/invoices.php?status=Overdue', ]; $items[] = [ 'count' => dashboardCount("SELECT COUNT(invoice_id) FROM invoices WHERE invoice_status = 'Draft' $invoice_scope"), - 'label' => 'Draft invoices', 'icon' => 'pen', 'tone' => 'secondary', + 'label' => 'Draft invoices', 'one' => 'Draft invoice', 'icon' => 'pen', 'tone' => 'secondary', 'url' => '/agent/invoices.php?status=Draft', ]; // The same rule as products.php?type=reorder @@ -288,7 +288,7 @@ function dashboardAttention($access) { $reprice = productRepriceCount(); $items[] = [ 'count' => intval($reprice['lines']), - 'label' => 'Lines at an old price', 'icon' => 'tags', 'tone' => 'warning', + 'label' => 'Lines at an old price', 'one' => 'Line at an old price', 'icon' => 'tags', 'tone' => 'warning', 'detail' => $reprice['monthly'] > 0 ? '+' . dashboardMoney($reprice['monthly']) . ' a month on recurring' : ($reprice['lines'] ? 'On recurring invoices, drafts and quotes' : null), 'url' => '/agent/products_reprice.php', ]; @@ -314,7 +314,7 @@ function dashboardAttention($access) { $to_bill = expenseUnbilledCount(); $items[] = [ 'count' => $to_bill['count'], - 'label' => 'Expenses to bill', 'icon' => 'shopping-cart', 'tone' => 'info', + 'label' => 'Expenses to bill', 'one' => 'Expense to bill', 'icon' => 'shopping-cart', 'tone' => 'info', 'detail' => $to_bill['count'] ? dashboardMoney($to_bill['value']) . ' to bill on' : null, 'url' => '/agent/expenses.php?show=to_bill', ]; @@ -322,7 +322,7 @@ function dashboardAttention($access) { $owed = expenseToReimburseCount(); $items[] = [ 'count' => $owed['count'], - 'label' => 'Expenses to reimburse', 'icon' => 'hand-holding-usd', 'tone' => 'warning', + 'label' => 'Expenses to reimburse', 'one' => 'Expense to reimburse', 'icon' => 'hand-holding-usd', 'tone' => 'warning', 'detail' => $owed['count'] ? dashboardMoney($owed['total']) . ' owed to ' . ($owed['agents'] === 1 ? '1 agent' : $owed['agents'] . ' agents') : null, 'url' => '/agent/expenses.php?show=to_reimburse', ]; @@ -330,7 +330,7 @@ function dashboardAttention($access) { $trips_to_bill = tripUnbilledCount(); $items[] = [ 'count' => $trips_to_bill['count'], - 'label' => 'Trips to bill', 'icon' => 'route', 'tone' => 'info', + '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', ]; @@ -350,22 +350,22 @@ function dashboardAttention($access) { $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')), - 'label' => 'Domains expiring', 'icon' => 'globe', 'tone' => 'warning', 'detail' => 'Next 30 days', + 'label' => 'Domains expiring', 'one' => 'Domain expiring', 'icon' => 'globe', 'tone' => 'warning', 'detail' => 'Next 30 days', 'url' => '/agent/domains.php?expire_days=30&sort=domain_expire&order=ASC', ]; $items[] = [ 'count' => dashboardCount("SELECT COUNT(certificate_id) FROM certificates WHERE certificate_archived_at IS NULL AND " . certificateSoonSql() . ' ' . clientScopeSql('certificate_client_id')), - 'label' => 'Certificates expiring', 'icon' => 'lock', 'tone' => 'warning', 'detail' => 'Next 30 days', + 'label' => 'Certificates expiring', 'one' => 'Certificate expiring', 'icon' => 'lock', 'tone' => 'warning', 'detail' => 'Next 30 days', 'url' => '/agent/certificates.php?show=soon&sort=certificate_expire&order=ASC', ]; $items[] = [ 'count' => dashboardCount("SELECT COUNT(software_id) FROM software WHERE software_archived_at IS NULL AND software_expire $soon " . clientScopeSql('software_client_id')), - 'label' => 'Licenses expiring', 'icon' => 'cube', 'tone' => 'warning', 'detail' => 'Next 30 days', + 'label' => 'Licenses expiring', 'one' => 'License expiring', 'icon' => 'cube', 'tone' => 'warning', 'detail' => 'Next 30 days', 'url' => '/agent/software.php?status=renewing&sort=software_expire&order=ASC', ]; $items[] = [ 'count' => dashboardCount("SELECT COUNT(asset_id) FROM assets WHERE asset_archived_at IS NULL AND asset_warranty_expire $soon " . clientScopeSql('asset_client_id')), - 'label' => 'Warranties expiring', 'icon' => 'shield-alt', 'tone' => 'warning', 'detail' => 'Next 30 days', + 'label' => 'Warranties expiring', 'one' => 'Warranty expiring', 'icon' => 'shield-alt', 'tone' => 'warning', 'detail' => 'Next 30 days', 'url' => '/agent/assets.php?expire_days=30&sort=asset_warranty_expire&order=ASC&show_column[]=Warranty_Expire', ]; // The same rules as services.php?show=attention and ?show=review @@ -373,19 +373,25 @@ function dashboardAttention($access) { $service_scope = "FROM services JOIN clients ON client_id = service_client_id WHERE client_archived_at IS NULL " . clientScopeSql('service_client_id'); $items[] = [ 'count' => dashboardCount("SELECT COUNT(service_id) $service_scope AND " . $service_views['attention']['where']), - 'label' => 'Services needing attention', 'icon' => 'stream', 'tone' => 'danger', 'detail' => 'What they depend on', + 'label' => 'Services needing attention', 'one' => 'Service needing attention', 'icon' => 'stream', 'tone' => 'danger', 'detail' => 'What they depend on', 'url' => '/agent/services.php?show=attention', ]; $items[] = [ 'count' => dashboardCount("SELECT COUNT(service_id) $service_scope AND " . $service_views['review']['where']), - 'label' => 'Service reviews due', 'icon' => 'clipboard-check', 'tone' => 'warning', 'detail' => 'Next ' . SERVICE_REVIEW_SOON_DAYS . ' days', + 'label' => 'Service reviews due', 'one' => 'Service review due', 'icon' => 'clipboard-check', 'tone' => 'warning', 'detail' => 'Next ' . SERVICE_REVIEW_SOON_DAYS . ' days', 'url' => '/agent/services.php?show=review&sort=service_review_due&order=ASC', ]; } - return array_values(array_filter($items, function ($item) { + // "1 Draft invoice", not "1 Draft invoices" + return array_values(array_map(function ($item) { + if (intval($item['count']) === 1 && isset($item['one'])) { + $item['label'] = $item['one']; + } + return $item; + }, array_filter($items, function ($item) { return $item['count'] > 0; - })); + }))); } /* diff --git a/functions/format.php b/functions/format.php index 325d878f1..86b9e38b1 100644 --- a/functions/format.php +++ b/functions/format.php @@ -209,9 +209,11 @@ function formatAssignee($user_id, $user_name, $user_avatar, $highlight_unassigne $user_id = intval($user_id); if (!$user_id) { - $tone = $highlight_unassigned ? 'danger' : 'secondary'; - $colors = $highlight_unassigned ? 'text-danger-emphasis bg-danger-subtle' : 'text-body-secondary bg-body-secondary'; - return "" . escapeHtml($none_label) . ""; + // Amber, as the Unassigned view and the dashboard's tile are - red is kept for what is late + $tone = $highlight_unassigned ? 'warning' : 'secondary'; + $colors = $highlight_unassigned ? 'text-warning-emphasis bg-warning-subtle' : 'text-body-secondary bg-body-secondary'; + $icon = $highlight_unassigned ? 'text-dark' : 'text-white'; + return "" . escapeHtml($none_label) . ""; } $user_avatar = escapeHtml($user_avatar); diff --git a/functions/request.php b/functions/request.php index 3a73c529c..453a0cfdc 100644 --- a/functions/request.php +++ b/functions/request.php @@ -119,6 +119,21 @@ function redirect($url = null, $permanent = false) { } } +/* + * A New Contact, New Location or New Vendor window opened by the + beside a picker in another + * window (quickAddButton(), js/quick_add.js) posts inline=1: answer it with the new record for the + * picker - ['ok' => true, 'value', 'label', 'message'] - or ['ok' => false, 'error'], in place of + * a message and a reload. Does nothing for an ordinary post. + */ +function inlineSaveAnswer(array $answer): void { + if (empty($_POST['inline'])) { + return; + } + header('Content-Type: application/json'); + echo json_encode($answer); + exit; +} + //Flash Alert Function function flashAlert(string $message, string $type = 'success'): void { $_SESSION['alert_type'] = $type; diff --git a/functions/settings.php b/functions/settings.php index eb130b2bb..cac707e32 100644 --- a/functions/settings.php +++ b/functions/settings.php @@ -40,7 +40,7 @@ function settingsPages() { 'localization' => ['group' => 'company', 'title' => 'Localization', 'icon' => 'fa-globe', 'url' => 'settings_localization.php', 'about' => 'The language dates and numbers are written in, the currency you bill in, and your timezone.'], 'theme' => ['group' => 'company', 'title' => 'Theme', 'icon' => 'fa-paint-brush', 'url' => 'settings_theme.php', - 'about' => 'The colour of the top bar, links, buttons and highlights, and the icon on the browser tab.'], + 'about' => 'The color of the top bar, links, buttons and highlights, and the icon on the browser tab.'], 'default' => ['group' => 'work', 'title' => 'Defaults', 'icon' => 'fa-cogs', 'url' => 'settings_default.php', 'about' => 'Where ITFlow opens, what a client is billed on without a contract, and what new payments, expenses and transfers start with.'], 'ticket' => ['group' => 'work', 'title' => 'Tickets', 'icon' => 'fa-life-ring', 'url' => 'settings_ticket.php', 'module' => 'ticketing', @@ -239,7 +239,7 @@ function settingsFields() { 'config_timezone' => ['page' => 'localization', 'section' => 'Timezone', 'label' => 'Timezone', 'words' => 'time zone clock utc'], // Theme - 'config_theme' => ['page' => 'theme', 'section' => 'Colour', 'label' => 'Theme colour', 'kind' => 'select', 'options' => 'themes', + 'config_theme' => ['page' => 'theme', 'section' => 'Color', 'label' => 'Theme color', 'kind' => 'select', 'options' => 'themes', 'words' => 'theme color colour accent top bar branding'], 'favicon' => ['page' => 'theme', 'section' => 'Browser tab icon', 'label' => 'Browser tab icon', 'kind' => 'file', 'words' => 'favicon ico icon tab'], diff --git a/functions/ticket.php b/functions/ticket.php index 44a5998c8..c00c4473b 100644 --- a/functions/ticket.php +++ b/functions/ticket.php @@ -1757,12 +1757,17 @@ function ticketSlaState($row) { 'due' => $responded ? ($row['ticket_resolution_due_at'] ?? null) : ($row['ticket_response_due_at'] ?? null), 'what' => $responded ? 'Resolution due' : 'First response due', ]; - if ($stage === 2) { + // Missed already - as the SLA breached view and the dashboard count it + if ($stage === 2 || ($row['ticket_response_sla_met'] ?? null) === '0' || ($row['ticket_resolution_sla_met'] ?? null) === '0') { return ['key' => 'breached'] + $state; } if (intval($row['ticket_status_pauses_sla'] ?? 0)) { return ['key' => 'paused'] + $state; } + // Past its deadline is a breach whether or not cron has got round to marking it + if (!empty($state['due']) && strtotime($state['due']) < time()) { + return ['key' => 'breached'] + $state; + } if ($stage === 1) { return ['key' => 'at_risk'] + $state; } diff --git a/functions/ticket_fields.php b/functions/ticket_fields.php index f8da66153..6db256abc 100644 --- a/functions/ticket_fields.php +++ b/functions/ticket_fields.php @@ -238,7 +238,7 @@ function ticketBillableHtml($billable, $style = 'list') { } return $billable ? '' - : ''; + : ''; } /* A status as its badge - text that reads on its colour, and what it is for on hover (functions/ticket_status.php). */ diff --git a/functions/ticket_status.php b/functions/ticket_status.php index 19c7d52f1..cb890acc1 100644 --- a/functions/ticket_status.php +++ b/functions/ticket_status.php @@ -312,7 +312,7 @@ function ticketStatusUpdate(array $row, array $f) { 'name' => (string) $row['ticket_status_name'], 'color' => ticketStatusColor($row['ticket_status_color']), 'description' => trim((string) ($row['ticket_status_description'] ?? '')), ]; - foreach (['name' => 'name', 'color' => 'colour', 'description' => 'description'] as $key => $label) { + foreach (['name' => 'name', 'color' => 'color', 'description' => 'description'] as $key => $label) { if ($was[$key] !== $f[$key]) { $changes[] = "$label from " . ($was[$key] !== '' ? $was[$key] : 'none') . ' to ' . ($f[$key] !== '' ? $f[$key] : 'none'); } diff --git a/includes/filter_footer.php b/includes/filter_footer.php index eb3272f23..816081e34 100644 --- a/includes/filter_footer.php +++ b/includes/filter_footer.php @@ -16,11 +16,9 @@ require __DIR__ . '/inc_empty_state.php'; $total_found_rows = $num_rows[0]; -$total_pages = ceil($total_found_rows / $user_config_records_per_page); +$total_pages = (int) ceil($total_found_rows / $user_config_records_per_page); if ($total_found_rows > 5) { - $i = 0; - ?> -
-
    +
    +
      1) { $prev_class = ""; } else { @@ -96,23 +88,40 @@ if ($total_found_rows > 5) { $next_page = $page + 1; if ($page > 1) { - echo "
    • Prev
    • "; + echo "
    • Prev
    • "; } - while ($i < $total_pages) { - $i++; - if (($i == 1) || (($page <= 3) && ($i <= 6)) || (($i > $total_pages - 6) && ($page > $total_pages - 3)) || (is_int($i / $pages_split)) || (($page > 3) && ($i >= $page - 2) && ($i <= $page + 3)) || ($i == $total_pages)) { - if ($page == $i) { - $page_class = "active"; - } else { - $page_class = ""; - } - echo "
    • $i
    • "; + // Prev and Next are arrows on a phone. The first and last pages and the ones either side of this one, with a gap + // between - one short row however many pages there are + if ($page <= 4) { + $from = 1; + $to = min($total_pages, 5); + } elseif ($page >= $total_pages - 3) { + $from = max(1, $total_pages - 4); + $to = $total_pages; + } else { + $from = $page - 1; + $to = $page + 1; + } + $page_numbers = range($from, $to); + // A gap of one page shows that page, not "..." in its place + if ($from > 1) { + array_unshift($page_numbers, 1, $from === 3 ? 2 : ($from > 3 ? 0 : null)); + } + if ($to < $total_pages) { + array_push($page_numbers, $to === $total_pages - 2 ? $total_pages - 1 : ($to < $total_pages - 2 ? 0 : null), $total_pages); + } + foreach (array_filter($page_numbers, function ($n) { return $n !== null; }) as $i) { + if ($i === 0) { + echo "
    • …
    • "; + continue; } + $page_class = $page == $i ? "active" : ""; + echo "
    • $i
    • "; } if ($page <> $total_pages) { - echo "
    • Next
    • "; + echo "
    • Next
    • "; } ?> diff --git a/js/app.js b/js/app.js index 1ba12086d..bacb19073 100644 --- a/js/app.js +++ b/js/app.js @@ -957,7 +957,15 @@ itflowBindOnce('itflowModalFocus', 'shown.bs.modal', '.modal', function () { if (this.querySelector('[autofocus]')) { return; } - this.focus(); + const modal = this; + modal.focus(); + // AdminLTE's own shown handler runs after this one and puts focus on the first + // button - the X - so take it back once the handlers are done + setTimeout(function () { + if (document.activeElement && document.activeElement.matches('.btn-close') && modal.contains(document.activeElement)) { + modal.focus(); + } + }, 0); }); /** diff --git a/js/quick_add.js b/js/quick_add.js index 1603f0534..2ea125b86 100644 --- a/js/quick_add.js +++ b/js/quick_add.js @@ -1,8 +1,10 @@ /* - * ITFlow - add a missing contact, location or vendor from the window that needs it. A + button - * ([data-quick-add="contact|location|vendor"]) in a picker's input group asks for the few things - * it needs, adds it (agent/ajax.php quick_add_record) and picks it - no closing the window, adding - * it elsewhere and starting again. + * ITFlow - add a missing contact, location or vendor from the window that needs it. The + in a + * picker's input group (quickAddButton(), [data-quick-add="contact|location|vendor"]) opens the + * usual New Contact, New Location or New Vendor window over the form, for the client picked + * (&inline=1). Its Create saves in the background (inlineSaveAnswer() in the add handlers) and the + * new one is put in that picker, picked, leaving the form underneath as it was - as the + beside a + * category picker does (js/category_form.js). * * The client is the button's data-quick-add-client, or the form's client_id - the picker New Ticket * and the asset form change - so it follows the client picked. @@ -17,11 +19,21 @@ } window.itflowQuickAdd = true; - const FIELDS = { - contact: { title: 'New contact', fields: [['name', 'Name', 'text', true], ['email', 'Email', 'email'], ['title', 'Title', 'text']] }, - location: { title: 'New location', fields: [['name', 'Name', 'text', true], ['address', 'Address', 'text'], ['city', 'City', 'text']] }, - vendor: { title: 'New vendor', fields: [['name', 'Name', 'text', true], ['phone', 'Phone', 'tel']] } + const WINDOWS = { + contact: '/agent/modals/contact/contact_add.php', + location: '/agent/modals/location/location_add.php', + vendor: '/agent/modals/vendor/vendor_add.php' }; + const SAVE_BUTTONS = { contact: 'add_contact', location: 'add_location', vendor: 'add_vendor' }; + + // The picker the open window was opened from + let target = null; + + function toast(message, type) { + if (typeof itflowToast === 'function') { + itflowToast(message, type); + } + } function clientOf(button) { if (button.dataset.quickAddClient) { @@ -44,81 +56,106 @@ document.addEventListener('click', function (e) { const button = e.target.closest('[data-quick-add]'); - const kind = button && FIELDS[button.dataset.quickAdd]; - if (!kind || typeof Swal === 'undefined') { + const url = button && WINDOWS[button.dataset.quickAdd]; + if (!url) { return; } e.preventDefault(); - const select = button.closest('.input-group') && button.closest('.input-group').querySelector('select'); - const client = clientOf(button); + const group = button.closest('.input-group'); + const select = group && group.querySelector('select'); if (!select) { return; } + const client = clientOf(button); if (!client) { - if (typeof itflowToast === 'function') { - itflowToast('Pick the client first', 'warning'); + toast('Pick the client first', 'warning'); + return; + } + target = { select: select, kind: button.dataset.quickAdd }; + + // Opened as any window is (js/ajax_modal.js) - over this one + const opener = document.createElement('a'); + opener.className = 'ajax-modal d-none'; + opener.href = '#'; + opener.dataset.modalUrl = url + '?client_id=' + encodeURIComponent(client) + '&inline=1'; + opener.dataset.modalSize = 'lg'; + document.body.appendChild(opener); + opener.click(); + opener.remove(); + }); + + // On the document, so it runs after the form's own submit handlers (phone numbers are tidied + // on submit) and sends what they leave + document.addEventListener('submit', function (e) { + const form = e.target.closest('form[data-quick-add-inline]'); + if (!form || e.defaultPrevented) { + return; + } + const from = target; + if (!from || !from.select.isConnected) { + // Nothing to put it in - a plain post, back to the page + const flag = form.querySelector('input[name="inline"]'); + if (flag) { + flag.remove(); } return; } - const csrf = button.dataset.csrf; + e.preventDefault(); - // Static markup - nothing typed by anyone goes through this string - const html = kind.fields.map(function (field) { - return '' - + ''; - }).join(''); + const error = form.querySelector('[data-quick-add-error]'); + const save = form.querySelector('button[type="submit"]'); + if (save) { + save.disabled = true; + } + const data = new FormData(form); + data.append(SAVE_BUTTONS[from.kind], '1'); - Swal.fire({ - title: kind.title, - html: html, - target: button.closest('.modal') || 'body', - showCancelButton: true, - confirmButtonText: 'Add', - focusConfirm: false, - returnFocus: false, - didOpen: function () { - const first = document.getElementById('itflowQuickAdd_name'); - if (first) { - first.focus(); + fetch(form.action, { method: 'POST', body: data, credentials: 'same-origin', headers: { 'Accept': 'application/json' } }) + .then(function (res) { + if (!res.ok) { + throw new Error('HTTP ' + res.status); } - }, - preConfirm: function () { - const body = new FormData(); - body.append('quick_add_record', button.dataset.quickAdd); - body.append('client_id', client); - body.append('csrf_token', csrf); - kind.fields.forEach(function (field) { - body.append(field[0], document.getElementById('itflowQuickAdd_' + field[0]).value); + return res.json(); + }) + .then(function (result) { + if (!result.ok) { + throw new Error(result.error || "It wasn't saved"); + } + target = null; + const picker = from.select; + let option = Array.prototype.find.call(picker.options, function (o) { + return o.value === String(result.value); }); - if (!body.get('name').trim()) { - Swal.showValidationMessage('It needs a name.'); - return false; + if (!option) { + option = new Option(result.label, result.value); + picker.add(option); } - return fetch('/agent/ajax.php', { method: 'POST', body: body, credentials: 'same-origin' }) - .then(function (r) { return r.json(); }) - .then(function (answer) { - if (!answer.ok) { - Swal.showValidationMessage(answer.error || "Couldn't add it."); - return false; - } - return answer; - }) - .catch(function () { - Swal.showValidationMessage("Couldn't add it."); - return false; + if (!picker.multiple) { + Array.prototype.forEach.call(picker.options, function (o) { + o.selected = false; }); - } - }).then(function (result) { - if (!result.isConfirmed || !result.value) { - return; - } - const option = new Option(result.value.label, result.value.id, true, true); - select.add(option); - select.value = String(result.value.id); - select.dispatchEvent(new Event('change', { bubbles: true })); - if (typeof itflowToast === 'function') { - itflowToast(result.value.label + ' added', 'success'); - } - }); + } + option.selected = true; + picker.dispatchEvent(new Event('input', { bubbles: true })); + picker.dispatchEvent(new Event('change', { bubbles: true })); + const modal = form.closest('.modal'); + if (modal && window.bootstrap) { + bootstrap.Modal.getOrCreateInstance(modal).hide(); + } + toast(result.message, result.warning ? 'warning' : 'success'); + }) + .catch(function (err) { + if (save) { + save.disabled = false; + } + if (error) { + // An answer that isn't JSON, or a failed request: the save page answered with something else + error.textContent = err instanceof SyntaxError || err.message.indexOf('HTTP ') === 0 + ? "It couldn't be saved - reload the page and try again." + : err.message; + error.hidden = false; + error.scrollIntoView({ block: 'nearest' }); + } + }); }); })();