diff --git a/CHANGELOG.md b/CHANGELOG.md index e19dfd4f1..7437ce0f0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -222,6 +222,7 @@ Update from Maintenance > Update — Queue Update hands the job to cron, which u - Menus, icons and questions: every More menu has the same ⋮ button, and Delete, Restore and Export each have one icon everywhere. The required-field star sits the same way on every form, and Incident response has the usual dark window with its warning in red. A question before an action names it on its button - Delete, Remove, Archive - rather than Yes. Resetting a ticket's timer, removing an approval request, redacting with nothing selected and a window that fails to open now use ITFlow's own question and message rather than the browser's. Every list's search box reads Search ..., with what it looks in shown when you point at it. - Dropdowns: the empty first choice reads the same way everywhere - - Select a client -, - Select an account - and so on where you pick one, - Any client -, - Any status - where a list is filtered, and - None -, - No contact -, - Nobody - where it can be left blank. They had said - Select Client -, - Pick a role -, - Which account -, - How it was paid -, - All Clients -, Not Assigned and the like. - Capitals: page and window titles, menu items and buttons are in Title Case - New Ticket, Mark Reviewed, Back Up Now, Turn Off Portal Access - and field labels, section headings, tabs and help are in sentence case - Postal code, Tax rate, Physical location - in the agent pages, Admin and the client portal alike. The settings pages in the menu are now Company Details, Invoices and Billing, Purchase Orders, Client Portal and Single Sign-on. +- Lists: the first click on a column you aren't sorting by sorts names A-Z and dates, money and counts newest or largest first, and a second click flips it. It used to go the opposite way to the column you were on, so the first click could go either way. ### Bug Fixes @@ -445,6 +446,7 @@ Update from Maintenance > Update — Queue Update hands the job to cron, which u - Code: `intval()` and `floatval()` in place of `(int)` and `(float)` casts, and `(string)` in place of `strval()`, as the rest of the code has them. `redirect()` in place of a raw `Location` header wherever `functions.php` is loaded - the sign-in check, the client portal's sign-up, join, reset and Microsoft 365 sign-in, the guest Knowledge Base and card payment pages and the tax package report. `redirect()`'s fallback for when output has already started writes the URL with `json_encode()` (tags, quotes and ampersands escaped) and `escapeHtml()` rather than `addslashes()` and a bare `htmlspecialchars()`. `escapeHtml()` replaces the last `htmlspecialchars()` on a page, and the plain-HTTP cookie notice goes through `flashAlert()` as a warning. Raw `mysqli_real_escape_string()` stays where HTML is stored (ticket details, replies, documents, signatures), since `escapeSql()` strips tags. - Confirms: `itflowConfirm({title, text, button, icon, danger})` in `js/confirm_modal.js` asks the SweetAlert question from script and resolves true when confirmed; `confirm-link` goes through it, and with no `data-confirm-button` takes the link's own text (three words or fewer) for the button. `fa-ellipsis-v`, `fa-trash`, `fa-redo` and `fa-download` are the icons for More, Delete, Restore and Export - `fa-redo-alt` stays for recurring and `fa-undo` for restoring a backup or a version. - UI text: titles, menu items and buttons in Title Case, with a, an, the, and, but, or, for, as, at, by, in, of, on, to, via, from, with and into lower case unless first or last, and a verb's particle capitalised (Turn Off, Back Up, Sign In); field labels, section headings, tabs and help in sentence case. Proper names and acronyms keep their capitals either way. The empty-state and header `'actions'` labels are buttons, so Title Case too. +- Lists: `sortLink($column, $label, $first, $title, $class)` in `functions/format.php` draws a sortable column header from what `includes/filter_header.php` sets, and `sortFirstOrder()` picks the first direction from the column's name. It replaces the 48 copied `$sort_link` closures and the 115 header links written out by hand; a page with its own first directions passes `$first`. ## [26.11.8] diff --git a/admin/agent_banners.php b/admin/agent_banners.php index 404b34630..32b636548 100644 --- a/admin/agent_banners.php +++ b/admin/agent_banners.php @@ -69,10 +69,6 @@ if ($ready) { } $state_badges = ['showing' => 'text-bg-success', 'scheduled' => 'text-bg-info', 'ended' => 'text-bg-secondary', 'archived' => 'text-bg-secondary']; -$sort_link = function ($column, $label) use ($url_query_strings_sort, $sort, $disp, $order_icon) { - return '' - . $label . ($sort === $column ? " $order_icon" : '') . ''; -}; $pill_url = function ($view) use ($client_filter) { return '?' . http_build_query(array_filter(['q' => $_GET['q'] ?? '', 'client' => $client_filter, 'show' => $view])); }; @@ -127,10 +123,10 @@ $csrf = $_SESSION['csrf_token']; "> - - - - + + + + diff --git a/admin/ai_models.php b/admin/ai_models.php index e32a86623..70c4e17ad 100644 --- a/admin/ai_models.php +++ b/admin/ai_models.php @@ -56,10 +56,6 @@ $unused = aiUseCaseMap()['unused']; $providers = mysqli_query($mysqli, "SELECT ai_provider_id, ai_provider_name, ai_provider_kind FROM ai_providers ORDER BY ai_provider_name"); $any_provider = mysqli_num_rows($providers) > 0; -$sort_link = function ($column, $label) use ($url_query_strings_sort, $sort, $disp, $order_icon) { - return '' - . $label . ($sort === $column ? " $order_icon" : '') . ''; -}; $add_url = 'modals/ai/ai_model_edit.php' . ($provider_filter ? "?provider=$provider_filter" : ''); $csrf = $_SESSION['csrf_token']; @@ -109,11 +105,11 @@ $csrf = $_SESSION['csrf_token'];
"> - - - + + + - + diff --git a/admin/ai_providers.php b/admin/ai_providers.php index 4678192f8..176ef7191 100644 --- a/admin/ai_providers.php +++ b/admin/ai_providers.php @@ -58,10 +58,6 @@ while ($model = mysqli_fetch_assoc($model_sql)) { $unused = aiUseCaseMap()['unused']; $any_provider = intval(mysqli_fetch_row(mysqli_query($mysqli, "SELECT COUNT(*) FROM ai_providers"))[0]) > 0; -$sort_link = function ($column, $label) use ($url_query_strings_sort, $sort, $disp, $order_icon) { - return '' - . $label . ($sort === $column ? " $order_icon" : '') . ''; -}; $add_url = 'modals/ai/ai_provider_edit.php'; $csrf = $_SESSION['csrf_token']; @@ -96,11 +92,11 @@ $csrf = $_SESSION['csrf_token'];
Instructions
"> - - + + - - + + diff --git a/admin/ai_usage.php b/admin/ai_usage.php index 0e956146a..dddb3a6c2 100644 --- a/admin/ai_usage.php +++ b/admin/ai_usage.php @@ -91,10 +91,6 @@ $people = mysqli_query($mysqli, "SELECT DISTINCT user_id, user_name FROM ai_usag $model_row = $model_filter ? aiModelRow($model_filter) : null; $retention = appLogRetention(); -$sort_link = function ($column, $label) use ($url_query_strings_sort, $sort, $disp, $order_icon) { - return '' - . $label . ($sort === $column ? " $order_icon" : '') . ''; -}; // A view keeps the filters, and starts from its first page $view_url = function ($key) { $query = $_GET; @@ -204,13 +200,13 @@ $ms_text = function ($ms) {
Key
"> - - - - - - - + + + + + + + diff --git a/admin/api_keys.php b/admin/api_keys.php index 9f9868785..df716fb71 100644 --- a/admin/api_keys.php +++ b/admin/api_keys.php @@ -62,10 +62,6 @@ $address_taken = apiKeyInAddressAccepted(); $counts = mysqli_fetch_row(mysqli_query($mysqli, "SELECT COALESCE(SUM(api_key_expire > '$today'), 0), COALESCE(SUM(api_key_expire <= '$today'), 0) FROM api_keys LEFT JOIN users ON user_id = api_key_user_id WHERE $search")); -$sort_link = function ($column, $label) use ($url_query_strings_sort, $sort, $disp, $order_icon) { - return '' - . $label . ($sort === $column ? " $order_icon" : '') . ''; -}; $csrf = $_SESSION['csrf_token']; @@ -138,10 +134,10 @@ $csrf = $_SESSION['csrf_token']; - - + + - + diff --git a/admin/app_logs.php b/admin/app_logs.php index b154f9fa4..f495717bc 100644 --- a/admin/app_logs.php +++ b/admin/app_logs.php @@ -59,10 +59,6 @@ $categories = appLogCategories(); $any_filter = $q !== '' || $category_filter !== '' || $dtf !== '1970-01-01' || $dtt !== '2099-12-31'; $retention = appLogRetention(); -$sort_link = function ($column, $label) use ($url_query_strings_sort, $sort, $disp, $order_icon) { - return '' - . $label . ($sort === $column ? " $order_icon" : '') . ''; -}; // A view keeps the filters, and starts from its first page $view_url = function ($key) { $query = $_GET; @@ -153,9 +149,9 @@ $filters_url = function ($modal) use ($dtf, $dtt, $view, $category_filter) {
Can open Calls (30 days)
"> - - - + + + diff --git a/admin/audit_logs.php b/admin/audit_logs.php index e33344878..fe657ddb4 100644 --- a/admin/audit_logs.php +++ b/admin/audit_logs.php @@ -72,10 +72,6 @@ $entity_filter = is_scalar($_GET['entity'] ?? null) ? intval($_GET['entity']) : $more_filters = $action_filter !== '' || $entity_filter; $any_filter = $q !== '' || $client_filter || $user_filter !== '' || $type_filter !== '' || $action_filter !== '' || $entity_filter || $dtf !== '1970-01-01' || $dtt !== '2099-12-31'; -$sort_link = function ($column, $label) use ($url_query_strings_sort, $sort, $disp, $order_icon) { - return '' - . $label . ($sort === $column ? " $order_icon" : '') . ''; -}; // A view keeps the filters, and starts from its first page $view_url = function ($key) { $query = $_GET; @@ -211,12 +207,12 @@ $view_empty = [
Details
"> - - - - + + + + - + diff --git a/admin/backup.php b/admin/backup.php index 4fd12ce11..e14757664 100644 --- a/admin/backup.php +++ b/admin/backup.php @@ -173,10 +173,6 @@ $sql = mysqli_query($mysqli, "SELECT SQL_CALC_FOUND_ROWS backup_id, backup_type, $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()")); -$sort_link = function ($column, $label) use ($url_query_strings_sort, $sort, $disp, $order_icon) { - return '' - . $label . ($sort === $column ? " $order_icon" : '') . ''; -}; $type_looks = [ BACKUP_TYPE_FULL => ['icon' => 'fa-box-open', 'tone' => 'itflow-asset-tone-server'], @@ -342,10 +338,10 @@ $status_looks = [
Description
- - - - + + + + diff --git a/admin/canned_responses.php b/admin/canned_responses.php index e7d90b4f1..a8f4493f0 100644 --- a/admin/canned_responses.php +++ b/admin/canned_responses.php @@ -82,10 +82,6 @@ $counts = mysqli_fetch_row(mysqli_query($mysqli, "SELECT " . implode(', ', array }, $views)) . " FROM canned_responses WHERE $filters")); $view_counts = array_combine(array_keys($views), $counts); -$sort_link = function ($column, $label) use ($url_query_strings_sort, $sort, $disp, $order_icon) { - return '' - . $label . ($sort === $column ? " $order_icon" : '') . ''; -}; $pill_url = function ($view) use ($category_filter) { return '?' . http_build_query(array_filter(['q' => $_GET['q'] ?? '', 'category' => $category_filter, 'show' => $view])); }; @@ -155,10 +151,10 @@ $csrf = $_SESSION['csrf_token'];
"> - + - - + + diff --git a/admin/categories.php b/admin/categories.php index 085c70ba8..fa451de8d 100644 --- a/admin/categories.php +++ b/admin/categories.php @@ -82,9 +82,8 @@ while ($row = mysqli_fetch_row($sql)) { } // A column first sorts the way it reads best - A to Z, most used, first to last - then flips -$sort_link = function ($column, $label) use ($url_query_strings_sort, $sort, $disp, $order_icon, $sort_first) { - return '' - . $label . ($sort === $column ? " $order_icon" : '') . ''; +$sort_link = function ($column, $label) use ($sort_first) { + return sortLink($column, $label, $sort_first[$column] ?? null); }; $pill_url = function ($archived) use ($kind) { return '?' . http_build_query(array_filter(['category' => $kind, 'q' => $_GET['q'] ?? '', 'show' => $archived ? 'archived' : ''])); diff --git a/admin/contract_templates.php b/admin/contract_templates.php index 28866230a..a98a537c0 100644 --- a/admin/contract_templates.php +++ b/admin/contract_templates.php @@ -59,10 +59,6 @@ foreach (CONTRACT_SLA_PRIORITIES as $priority => $part) { $template_default_slas[$priority] = intval(getTicketSlaId(0, $priority, false)); } -$sort_link = function ($column, $label) use ($url_query_strings_sort, $sort, $disp, $order_icon) { - return '' - . $label . ($sort === $column ? " $order_icon" : '') . ''; -}; $pill_url = function ($view) { return '?' . http_build_query(array_filter(['q' => $_GET['q'] ?? '', 'show' => $view])); }; @@ -103,10 +99,10 @@ $csrf = $_SESSION['csrf_token'];
Offered on
"> - - + + - + diff --git a/admin/cron.php b/admin/cron.php index f737af7aa..04d3608a9 100644 --- a/admin/cron.php +++ b/admin/cron.php @@ -234,9 +234,8 @@ uasort($jobs, function ($a, $b) use ($sort_keys, $sort, $order) { }); // A heading sorts its own way round first - names A to Z, the latest run and what needs a look at the top - then the other $sort_first = ['job' => 'ASC', 'schedule' => 'ASC', 'last_run' => 'DESC', 'status' => 'ASC']; -$sort_link = function ($column, $label) use ($url_query_strings_sort, $sort, $disp, $order_icon, $sort_first) { - return '' - . $label . ($sort === $column ? " $order_icon" : '') . ''; +$sort_link = function ($column, $label) use ($sort_first) { + return sortLink($column, $label, $sort_first[$column] ?? null); }; $status_looks = [ diff --git a/admin/custom_links.php b/admin/custom_links.php index 122ab1946..73e6d80da 100644 --- a/admin/custom_links.php +++ b/admin/custom_links.php @@ -60,10 +60,6 @@ $view_counts = array_combine(array_keys($views), $counts); // Dragging into order: one menu's links, in its order, with nothing searched $can_reorder = $show_location && $sort === 'custom_link_order' && $order === 'ASC' && $q === '' && $num_rows[0] > 1; -$sort_link = function ($column, $label) use ($url_query_strings_sort, $sort, $disp, $order_icon) { - return '' - . $label . ($sort === $column ? " $order_icon" : '') . ''; -}; $pill_url = function ($view) { return '?' . http_build_query(array_filter(['q' => $_GET['q'] ?? '', 'show' => $view])); }; @@ -105,11 +101,11 @@ $csrf = $_SESSION['csrf_token']; "> - + - + - + diff --git a/admin/document_templates.php b/admin/document_templates.php index 324a4e96d..61a6bde0d 100644 --- a/admin/document_templates.php +++ b/admin/document_templates.php @@ -80,10 +80,6 @@ foreach ($rows as $template_id => $row) { $counts = mysqli_fetch_row(mysqli_query($mysqli, "SELECT COALESCE(SUM(document_template_archived_at IS NULL), 0), COALESCE(SUM(document_template_archived_at IS NOT NULL), 0), COALESCE(SUM(document_template_archived_at IS NULL AND document_template_required > 0), 0) FROM document_templates WHERE $search")); -$sort_link = function ($column, $label) use ($url_query_strings_sort, $sort, $disp, $order_icon) { - return '' - . $label . ($sort === $column ? " $order_icon" : '') . ''; -}; $pill_url = function ($view) { return '?' . http_build_query(array_filter(['q' => $_GET['q'] ?? '', 'show' => $view])); }; @@ -142,10 +138,10 @@ $csrf = $_SESSION['csrf_token'];
Cover
Order
"> - - - - + + + + diff --git a/admin/labor_costs.php b/admin/labor_costs.php index 3fae21532..da158cdc3 100644 --- a/admin/labor_costs.php +++ b/admin/labor_costs.php @@ -78,10 +78,6 @@ usort($rows, function ($a, $b) use ($key, $order) { $num_rows = [count($rows)]; $rows = array_slice($rows, $record_from, $record_to); -$sort_link = function ($column, $label) use ($url_query_strings_sort, $sort, $disp, $order_icon) { - return '' - . $label . ($sort === $column ? " $order_icon" : '') . ''; -}; $pill_url = function ($view) { return '?' . http_build_query(array_filter(['q' => $_GET['q'] ?? '', 'show' => $view])); }; @@ -128,9 +124,9 @@ $money = function ($amount) use ($currency_format, $session_company_currency) {
"> - - - + + + diff --git a/admin/mail_queue.php b/admin/mail_queue.php index 45820476a..a818a2867 100644 --- a/admin/mail_queue.php +++ b/admin/mail_queue.php @@ -56,10 +56,6 @@ $counts = array_combine(array_keys($tabs), array_map('intval', mysqli_fetch_row( $health = mailQueueHealth(); -$sort_link = function ($column, $label) use ($url_query_strings_sort, $sort, $disp, $order_icon) { - return '' - . $label . ($sort === $column ? " $order_icon" : '') . ''; -}; $pill_url = function ($show) { return '?' . http_build_query(array_filter(['q' => $_GET['q'] ?? '', 'show' => $show, 'canned_date' => $_GET['canned_date'] ?? '', 'dtf' => $_GET['dtf'] ?? '', 'dtt' => $_GET['dtt'] ?? ''])); }; @@ -171,10 +167,10 @@ $filtered_dates = isset($_GET['dtf']) && $_GET['dtf'] !== '' && $_GET['dtf'] !== - - - - + + + + diff --git a/admin/managed_instances.php b/admin/managed_instances.php index 6bae80c26..7814425cc 100644 --- a/admin/managed_instances.php +++ b/admin/managed_instances.php @@ -58,10 +58,6 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()")); $counts = mysqli_fetch_row(mysqli_query($mysqli, "SELECT COALESCE(SUM(managed_instance_archived_at IS NULL), 0), COALESCE(SUM(managed_instance_archived_at IS NOT NULL), 0) FROM managed_instances LEFT JOIN clients ON client_id = managed_instance_client_id WHERE $search")); -$sort_link = function ($column, $label) use ($url_query_strings_sort, $sort, $disp, $order_icon) { - return '' - . $label . ($sort === $column ? " $order_icon" : '') . ''; -}; $csrf = $_SESSION['csrf_token']; @@ -96,11 +92,11 @@ $csrf = $_SESSION['csrf_token'];
Rates
"> - - + + - + diff --git a/admin/modules.php b/admin/modules.php index 1f891b71a..3b72106b5 100644 --- a/admin/modules.php +++ b/admin/modules.php @@ -44,9 +44,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()")); text-nowrap"> diff --git a/admin/payment_methods.php b/admin/payment_methods.php index b0034686f..f0248a3ed 100644 --- a/admin/payment_methods.php +++ b/admin/payment_methods.php @@ -65,10 +65,6 @@ $rows = array_slice($rows, $record_from, $record_to); $missing = $show === '' && $search === '' ? paymentMethodsNotSetUp() : []; -$sort_link = function ($column, $label) use ($url_query_strings_sort, $sort, $disp, $order_icon) { - return '' - . $label . ($sort === $column ? " $order_icon" : '') . ''; -}; $pill_url = function ($view) { return '?' . http_build_query(array_filter(['q' => $_GET['q'] ?? '', 'show' => $view])); }; @@ -128,10 +124,10 @@ $csrf = $_SESSION['csrf_token'];
Health Agents
- - Module - + Action
"> - - - - + + + + diff --git a/admin/payment_providers.php b/admin/payment_providers.php index 2ae946064..383d7ad3d 100644 --- a/admin/payment_providers.php +++ b/admin/payment_providers.php @@ -57,10 +57,6 @@ $set_up = intval(mysqli_fetch_row(mysqli_query($mysqli, "SELECT COUNT(DISTINCT p . implode("', '", array_map('escapeSql', array_keys(paymentProviderKinds()))) . "')"))[0]); $can_add = $set_up < count(paymentProviderKinds()); -$sort_link = function ($column, $label) use ($url_query_strings_sort, $sort, $disp, $order_icon) { - return '' - . $label . ($sort === $column ? " $order_icon" : '') . ''; -}; $add_url = 'modals/payment_provider/payment_provider_add.php'; $csrf = $_SESSION['csrf_token']; @@ -93,12 +89,12 @@ $csrf = $_SESSION['csrf_token'];
"> - - - + + + - - + + diff --git a/admin/project_templates.php b/admin/project_templates.php index 84221e15c..7de470306 100644 --- a/admin/project_templates.php +++ b/admin/project_templates.php @@ -43,10 +43,6 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()")); $counts = mysqli_fetch_row(mysqli_query($mysqli, "SELECT COALESCE(SUM(project_template_archived_at IS NULL), 0), COALESCE(SUM(project_template_archived_at IS NOT NULL), 0) FROM project_templates WHERE $search")); -$sort_link = function ($column, $label) use ($url_query_strings_sort, $sort, $disp, $order_icon) { - return '' - . $label . ($sort === $column ? " $order_icon" : '') . ''; -}; ?> @@ -80,10 +76,10 @@ $sort_link = function ($column, $label) use ($url_query_strings_sort, $sort, $di
Fees
"> - - - - + + + + diff --git a/admin/rmm_clients.php b/admin/rmm_clients.php index afdda21c6..8f90086ee 100644 --- a/admin/rmm_clients.php +++ b/admin/rmm_clients.php @@ -86,10 +86,6 @@ if ($suggestions) { } } -$sort_link = function ($column, $label) use ($url_query_strings_sort, $sort, $disp, $order_icon) { - return '' - . $label . ($sort === $column ? " $order_icon" : '') . ''; -}; $dashboard = rmmDashboardUrl($provider); $devices_in = intval(mysqli_fetch_row(mysqli_query($mysqli, "SELECT COUNT(*) FROM rmm_devices WHERE rmm_device_provider_id = $provider_id AND rmm_device_removed_at IS NULL AND rmm_device_asset_id > 0"))[0]); @@ -176,10 +172,10 @@ $devices_in = intval(mysqli_fetch_row(mysqli_query($mysqli, "SELECT COUNT(*) FRO
"> - - - - + + + + diff --git a/admin/rmm_providers.php b/admin/rmm_providers.php index a0a51b0f4..6c8a5ad2d 100644 --- a/admin/rmm_providers.php +++ b/admin/rmm_providers.php @@ -66,10 +66,6 @@ $cron_on = intval(mysqli_fetch_row(mysqli_query($mysqli, "SELECT config_enable_c $job = mysqli_fetch_assoc(mysqli_query($mysqli, "SELECT cron_job_enabled FROM cron_jobs WHERE cron_job_name = 'rmm_sync' LIMIT 1")); $job_on = !$job || intval($job['cron_job_enabled']) === 1; -$sort_link = function ($column, $label) use ($url_query_strings_sort, $sort, $disp, $order_icon) { - return '' - . $label . ($sort === $column ? " $order_icon" : '') . ''; -}; $add_url = 'modals/rmm/rmm_provider_add.php'; $csrf = $_SESSION['csrf_token']; @@ -104,12 +100,12 @@ $csrf = $_SESSION['csrf_token'];
"> - - - - + + + + - + diff --git a/admin/roles.php b/admin/roles.php index a2c6a51f0..ebf3f517e 100644 --- a/admin/roles.php +++ b/admin/roles.php @@ -54,10 +54,6 @@ $agents = roleAgents(array_keys($roles), 5); $counts = mysqli_fetch_row(mysqli_query($mysqli, "SELECT COALESCE(SUM(role_archived_at IS NULL), 0), COALESCE(SUM(role_archived_at IS NOT NULL), 0) FROM user_roles WHERE $search")); -$sort_link = function ($column, $label) use ($url_query_strings_sort, $sort, $disp, $order_icon) { - return '' - . $label . ($sort === $column ? " $order_icon" : '') . ''; -}; $csrf = $_SESSION['csrf_token']; @@ -91,10 +87,10 @@ $csrf = $_SESSION['csrf_token'];
Alerts
"> - + - - + + diff --git a/admin/saved_payment_methods.php b/admin/saved_payment_methods.php index 5b075317b..efb3a42de 100644 --- a/admin/saved_payment_methods.php +++ b/admin/saved_payment_methods.php @@ -81,10 +81,6 @@ $clients = mysqli_query($mysqli, "SELECT client_id, client_name FROM clients WHERE client_id IN (SELECT saved_payment_client_id FROM client_saved_payment_methods) OR client_id = $client_filter ORDER BY client_name ASC"); $provider_count = mysqli_num_rows($providers); -$sort_link = function ($column, $label) use ($url_query_strings_sort, $sort, $disp, $order_icon) { - return '' - . $label . ($sort === $column ? " $order_icon" : '') . ''; -}; $pill_url = function ($show) { return '?' . http_build_query(array_filter(['q' => $_GET['q'] ?? '', 'provider' => $_GET['provider'] ?? '', 'client' => $_GET['client'] ?? '', 'show' => $show])); }; @@ -142,11 +138,11 @@ $page_title = 'Saved Cards';
Access
"> - - - - - + + + + + diff --git a/admin/sign_ins.php b/admin/sign_ins.php index 09c46402f..0c95b12c2 100644 --- a/admin/sign_ins.php +++ b/admin/sign_ins.php @@ -144,10 +144,6 @@ if ($view === 'ips') { } } -$sort_link = function ($column, $label) use ($url_query_strings_sort, $sort, $disp, $order_icon) { - return '' - . $label . ($sort === $column ? " $order_icon" : '') . ''; -}; // A view keeps the search and dates, and starts from the top $view_url = function ($key) { $query = array_diff_key($_GET, ['page' => 1, 'sort' => 1, 'order' => 1]); @@ -207,22 +203,22 @@ $audit_url = function (array $query) use ($dates_query) { "> - - - - - - + + + + + + - + - - - - + + + + diff --git a/admin/sla.php b/admin/sla.php index 4f385e33d..397103cdd 100644 --- a/admin/sla.php +++ b/admin/sla.php @@ -208,9 +208,8 @@ $day_distance = function ($date) use ($today) { // A heading sorts its own way round first - names A to Z, the shortest target and the most used at the top - then the other $sort_first = ['sla_name' => 'ASC', 'sla_response_minutes' => 'ASC', 'sla_resolution_minutes' => 'ASC', 'tickets' => 'DESC', 'holiday_name' => 'ASC', 'holiday_date' => $show === 'past' ? 'DESC' : 'ASC']; -$sort_link = function ($column, $label) use ($url_query_strings_sort, $sort, $disp, $order_icon, $sort_first) { - return '' - . $label . ($sort === $column ? " $order_icon" : '') . ''; +$sort_link = function ($column, $label) use ($sort_first) { + return sortLink($column, $label, $sort_first[$column] ?? null); }; // A view keeps the search only on its own side - a name typed for an SLA is no use against closure days $pill_url = function ($view) use ($on_days) { diff --git a/admin/software_templates.php b/admin/software_templates.php index 8c7007e42..ef00c8506 100644 --- a/admin/software_templates.php +++ b/admin/software_templates.php @@ -95,10 +95,6 @@ foreach ($rows as $template_id => $row) { $counts = mysqli_fetch_row(mysqli_query($mysqli, "SELECT COALESCE(SUM(software_template_archived_at IS NULL), 0), COALESCE(SUM(software_template_archived_at IS NOT NULL), 0), COALESCE(SUM(software_template_archived_at IS NULL AND software_template_required > 0), 0) FROM software_templates $joins WHERE $search")); -$sort_link = function ($column, $label) use ($url_query_strings_sort, $sort, $disp, $order_icon) { - return '' - . $label . ($sort === $column ? " $order_icon" : '') . ''; -}; $pill_url = function ($show) { return '?' . http_build_query(array_filter(['q' => $_GET['q'] ?? '', 'show' => $show])); }; @@ -157,12 +153,12 @@ $csrf = $_SESSION['csrf_token'];
Last sign in
"> - - - - - - + + + + + + diff --git a/admin/tags.php b/admin/tags.php index 771fb7a05..362ecd30d 100644 --- a/admin/tags.php +++ b/admin/tags.php @@ -69,10 +69,6 @@ while ($row = mysqli_fetch_row($sql)) { $kind_counts[intval($row[0])] = intval($row[1]); } -$sort_link = function ($column, $label) use ($url_query_strings_sort, $sort, $disp, $order_icon) { - return '' - . $label . ($sort === $column ? " $order_icon" : '') . ''; -}; $pill_url = function ($archived) use ($type) { return '?' . http_build_query(array_filter(['type' => $type, 'q' => $_GET['q'] ?? '', 'show' => $archived ? 'archived' : ''])); }; @@ -169,8 +165,8 @@ $csrf = $_SESSION['csrf_token']; - - + + diff --git a/admin/tax_rates.php b/admin/tax_rates.php index ef8087fb2..6636fedd7 100644 --- a/admin/tax_rates.php +++ b/admin/tax_rates.php @@ -63,10 +63,6 @@ $used_text = function (array $u) { return $parts; }; -$sort_link = function ($column, $label) use ($url_query_strings_sort, $sort, $disp, $order_icon) { - return '' - . $label . ($sort === $column ? " $order_icon" : '') . ''; -}; ?> @@ -101,9 +97,9 @@ $sort_link = function ($column, $label) use ($url_query_strings_sort, $sort, $di
"> - - - + + + diff --git a/admin/text_messages.php b/admin/text_messages.php index 8609c47a8..363da1073 100644 --- a/admin/text_messages.php +++ b/admin/text_messages.php @@ -62,10 +62,6 @@ foreach ($tabs as $key => [, , $where]) { } $counts = array_combine(array_keys($tabs), array_map('intval', mysqli_fetch_row(mysqli_query($mysqli, "SELECT " . implode(', ', $count_sql) . " FROM sms_messages $joins WHERE $search")))); -$sort_link = function ($column, $label) use ($url_query_strings_sort, $sort, $disp, $order_icon) { - return '' - . $label . ($sort === $column ? " $order_icon" : '') . ''; -}; $pill_url = function ($show) { return '?' . http_build_query(array_filter(['q' => $_GET['q'] ?? '', 'show' => $show, 'canned_date' => $_GET['canned_date'] ?? '', 'dtf' => $_GET['dtf'] ?? '', 'dtt' => $_GET['dtt'] ?? ''])); }; @@ -163,10 +159,10 @@ $ready = smsReady(); - - + + - + diff --git a/admin/text_messaging.php b/admin/text_messaging.php index 7288a82b8..78f0a3aeb 100644 --- a/admin/text_messaging.php +++ b/admin/text_messaging.php @@ -49,10 +49,6 @@ $numbers = mysqli_fetch_row(mysqli_query($mysqli, "SELECT COALESCE(SUM(sms_numbe $opted_out = intval($numbers[0]); $blocked = intval($numbers[1]); -$sort_link = function ($column, $label) use ($url_query_strings_sort, $sort, $disp, $order_icon) { - return '' - . $label . ($sort === $column ? " $order_icon" : '') . ''; -}; $add_url = 'modals/sms_provider/sms_provider_add.php'; $csrf = $_SESSION['csrf_token']; @@ -93,10 +89,10 @@ $csrf = $_SESSION['csrf_token'];
Text
"> - - + + - + diff --git a/admin/ticket_statuses.php b/admin/ticket_statuses.php index e7596b98f..0fe265aa2 100644 --- a/admin/ticket_statuses.php +++ b/admin/ticket_statuses.php @@ -56,10 +56,6 @@ $view_counts = array_combine(array_keys($views), $counts); // Dragging into order: the ones in use, in their order, with nothing searched $can_reorder = $show === '' && $sort === 'ticket_status_order' && $order === 'ASC' && $q === '' && $num_rows[0] > 1; -$sort_link = function ($column, $label) use ($url_query_strings_sort, $sort, $disp, $order_icon) { - return '' - . $label . ($sort === $column ? " $order_icon" : '') . ''; -}; $pill_url = function ($view) { return '?' . http_build_query(array_filter(['q' => $_GET['q'] ?? '', 'show' => $view])); }; @@ -100,9 +96,9 @@ $csrf = $_SESSION['csrf_token']; "> - - - + + + diff --git a/admin/ticket_templates.php b/admin/ticket_templates.php index 916c8e14b..6ab4e3524 100644 --- a/admin/ticket_templates.php +++ b/admin/ticket_templates.php @@ -71,10 +71,6 @@ if ($templates) { $counts = mysqli_fetch_row(mysqli_query($mysqli, "SELECT COALESCE(SUM(ticket_template_archived_at IS NULL), 0), COALESCE(SUM(ticket_template_archived_at IS NOT NULL), 0) FROM ticket_templates WHERE $search")); -$sort_link = function ($column, $label) use ($url_query_strings_sort, $sort, $disp, $order_icon) { - return '' - . $label . ($sort === $column ? " $order_icon" : '') . ''; -}; $csrf = $_SESSION['csrf_token']; @@ -130,11 +126,11 @@ $csrf = $_SESSION['csrf_token'];
Texts come back to
Order When the client replies
"> - + - - - + + + diff --git a/admin/users.php b/admin/users.php index 519cdc274..6f4874693 100644 --- a/admin/users.php +++ b/admin/users.php @@ -219,10 +219,6 @@ $filter_url = function ($changes) { return '?' . http_build_query(array_filter($params, function ($v) { return $v !== '' && $v !== null; })); }; -$sort_link = function ($column, $label) use ($url_query_strings_sort, $sort, $disp, $order_icon) { - return '' - . $label . ($sort === $column ? " $order_icon" : '') . ''; -}; $csrf = $_SESSION['csrf_token']; @@ -424,10 +420,10 @@ $csrf = $_SESSION['csrf_token']; - - - - + + + + @@ -561,11 +557,11 @@ $csrf = $_SESSION['csrf_token'];
Sets up
text-nowrap table-light"> - - - + + + - + @@ -683,11 +679,11 @@ $csrf = $_SESSION['csrf_token']; - - - + + + - + diff --git a/admin/vendor_templates.php b/admin/vendor_templates.php index 865a4eead..3a0a8e410 100644 --- a/admin/vendor_templates.php +++ b/admin/vendor_templates.php @@ -104,10 +104,6 @@ $counts = mysqli_fetch_row(mysqli_query($mysqli, "SELECT COALESCE(SUM(vendor_tem COALESCE(SUM(vendor_template_archived_at IS NULL AND vendor_template_required > 0), 0), COALESCE(SUM(vendor_template_archived_at IS NULL AND vendor_template_id IN ($out_ids)), 0) FROM vendor_templates WHERE $search")); -$sort_link = function ($column, $label) use ($url_query_strings_sort, $sort, $disp, $order_icon) { - return '' - . $label . ($sort === $column ? " $order_icon" : '') . ''; -}; $pill_url = function ($show) { return '?' . http_build_query(array_filter(['q' => $_GET['q'] ?? '', 'show' => $show])); }; @@ -174,11 +170,11 @@ $csrf = $_SESSION['csrf_token'];
Clients
Clients
"> - + - - - + + + diff --git a/agent/archived.php b/agent/archived.php index bc0c7ec77..56c06cd85 100644 --- a/agent/archived.php +++ b/agent/archived.php @@ -139,24 +139,16 @@ while ($row = mysqli_fetch_assoc($sql_clients)) { diff --git a/agent/assets.php b/agent/assets.php index 302fb5984..a633ab916 100644 --- a/agent/assets.php +++ b/agent/assets.php @@ -485,39 +485,27 @@ $search_noun = $type_filter ? $asset_type_tabs[$type_filter]['label'] : 'assets' @@ -525,40 +513,28 @@ $search_noun = $type_filter ? $asset_type_tabs[$type_filter]['label'] : 'assets' diff --git a/agent/audit_log.php b/agent/audit_log.php index 8b948f68f..0d5359849 100644 --- a/agent/audit_log.php +++ b/agent/audit_log.php @@ -81,10 +81,6 @@ $entity_filter = is_scalar($_GET['entity'] ?? null) ? intval($_GET['entity']) : $more_filters = $action_filter !== '' || $entity_filter; $any_filter = $q !== '' || $user_filter !== '' || $type_filter !== '' || $action_filter !== '' || $entity_filter || $dtf !== '1970-01-01' || $dtt !== '2099-12-31'; -$sort_link = function ($column, $label) use ($url_query_strings_sort, $sort, $disp, $order_icon) { - return '' - . $label . ($sort === $column ? " $order_icon" : '') . ''; -}; $view_url = function ($key) { $query = $_GET; unset($query['page']); @@ -200,11 +196,11 @@ $view_empty = [
Support
- - Name - + - - Kind - + - - Client - + - - Archived - +
- - Name - + - - Type / OS - + - - Model / Serial - + - - IP - + - - MAC - + - - Purchased - + - - Installed - + - - Warranty - + - - Assigned To - + - - Location - + - - Status - + - - Client - +
"> - - - + + + - + diff --git a/agent/certificates.php b/agent/certificates.php index 4ca98501a..bfba47985 100644 --- a/agent/certificates.php +++ b/agent/certificates.php @@ -282,35 +282,23 @@ $export_extra = [ diff --git a/agent/contacts.php b/agent/contacts.php index f6dcb60e9..8746bea9c 100644 --- a/agent/contacts.php +++ b/agent/contacts.php @@ -474,22 +474,16 @@ $search_title = $invites_view ? 'Email, name or client' : 'Name, title, email, p text-nowrap table-light"> @@ -562,26 +556,18 @@ $search_title = $invites_view ? 'Email, name or client' : 'Name, title, email, p diff --git a/agent/contracts.php b/agent/contracts.php index 34f13d964..0037e381a 100644 --- a/agent/contracts.php +++ b/agent/contracts.php @@ -117,10 +117,6 @@ $filter_url = function ($changes) { unset($params['page']); return '?' . http_build_query(array_filter($params, function ($v) { return $v !== '' && $v !== null; })); }; -$sort_link = function ($column, $label) use ($url_query_strings_sort, $sort, $disp, $order_icon) { - return '' - . $label . ($sort === $column ? " $order_icon" : '') . ''; -}; $add_url = 'modals/contract/contract_add.php' . ($client_url ? "?client_id=$client_id" : ''); $csrf = $_SESSION['csrf_token']; @@ -221,13 +217,13 @@ $csrf = $_SESSION['csrf_token'];
Description
- - Certificate - + - - Host - + - - Issuer - + - - Expires - + - - Last check - + - - Client - +
- - Invited - + Sees - - Sent - + Link - - Client - + Actions - - Name - + - - Reach - + - - Location - + Linked - - Client - + Actions
- + - + - - - + + + diff --git a/agent/credentials.php b/agent/credentials.php index 05b402ad6..1eeff732a 100644 --- a/agent/credentials.php +++ b/agent/credentials.php @@ -325,22 +325,16 @@ $filter_url = function ($changes) use ($client_url) { diff --git a/agent/domains.php b/agent/domains.php index 4f00e4437..188b49546 100644 --- a/agent/domains.php +++ b/agent/domains.php @@ -314,26 +314,18 @@ $bulk_vendor_options = $can_edit ? domainVendorChoices($client_url ? $client_id diff --git a/agent/expenses.php b/agent/expenses.php index 7117da277..359ae2acd 100644 --- a/agent/expenses.php +++ b/agent/expenses.php @@ -337,12 +337,12 @@ $month_change = $stats['last_to_date'] > 0 ? round(($stats['month'] - $stats['la - - - - - - + + + + + + diff --git a/agent/income.php b/agent/income.php index c76bf26b4..e1507ab7b 100644 --- a/agent/income.php +++ b/agent/income.php @@ -288,14 +288,14 @@ $invoices_url = 'invoices.php?' . ($client_page ? "client_id=$client_id&" : '') - - - + + + - + - - + + diff --git a/agent/invoices.php b/agent/invoices.php index 4561246b4..8a36570a9 100644 --- a/agent/invoices.php +++ b/agent/invoices.php @@ -346,15 +346,15 @@ $stat_money = function ($amount) use ($session_company_currency) { - + - + - - - - - + + + + + diff --git a/agent/kb.php b/agent/kb.php index 7fbe96557..46cb71bee 100644 --- a/agent/kb.php +++ b/agent/kb.php @@ -114,10 +114,6 @@ $filter_url = function ($changes) { return '?' . http_build_query(array_filter($params, function ($v) { return $v !== '' && $v !== null && $v !== []; })); }; -$sort_link = function ($column, $label) use ($url_query_strings_sort, $sort, $disp, $order_icon) { - return '' - . $label . ($sort === $column ? " $order_icon" : '') . ''; -}; $add_url = 'modals/kb/kb_article_add.php' . (intval($category_filter) > 0 ? '?category=' . intval($category_filter) : ''); $csrf = $_SESSION['csrf_token']; @@ -252,12 +248,12 @@ $csrf = $_SESSION['csrf_token']; - - + + - + - + diff --git a/agent/locations.php b/agent/locations.php index 79acd0d12..a1fa70f64 100644 --- a/agent/locations.php +++ b/agent/locations.php @@ -240,31 +240,21 @@ $locations_counts = locationCounts(array_keys($locations)); diff --git a/agent/networks.php b/agent/networks.php index 13bbf6ad5..78312b251 100644 --- a/agent/networks.php +++ b/agent/networks.php @@ -144,10 +144,6 @@ $filter_url = function ($changes) { return '?' . http_build_query(array_filter($params, function ($v) { return $v !== '' && $v !== null; })); }; -$sort_link = function ($column, $label) use ($url_query_strings_sort, $sort, $disp, $order_icon) { - return '' - . $label . ($sort === $column ? " $order_icon" : '') . ''; -}; $csrf = $_SESSION['csrf_token']; @@ -309,9 +305,9 @@ $csrf = $_SESSION['csrf_token']; - - - + + + diff --git a/agent/products.php b/agent/products.php index cc38afbcd..f45bb999e 100644 --- a/agent/products.php +++ b/agent/products.php @@ -322,12 +322,12 @@ $add_type = in_array($view, ['product', 'hardware', 'stocked', 'reorder'], true) - - - - - - + + + + + + diff --git a/agent/projects.php b/agent/projects.php index 2ab6a1639..d3c3f2814 100644 --- a/agent/projects.php +++ b/agent/projects.php @@ -136,10 +136,6 @@ $filter_url = function ($changes) { return '?' . http_build_query(array_filter($params, function ($v) { return $v !== '' && $v !== null; })); }; -$sort_link = function ($column, $label) use ($url_query_strings_sort, $sort, $disp, $order_icon) { - return '' - . $label . ($sort === $column ? " $order_icon" : '') . ''; -}; $hidden_filter_count = $date_filter_active ? 1 : 0; @@ -300,13 +296,13 @@ $hidden_filter_count = $date_filter_active ? 1 : 0; - - + + - - - + + + diff --git a/agent/purchase_orders.php b/agent/purchase_orders.php index 037b814a2..437cbd261 100644 --- a/agent/purchase_orders.php +++ b/agent/purchase_orders.php @@ -96,10 +96,6 @@ $filter_url = function ($changes) { unset($params['page']); return '?' . http_build_query(array_filter($params, function ($v) { return $v !== '' && $v !== null; })); }; -$sort_link = function ($column, $label) use ($url_query_strings_sort, $sort, $disp, $order_icon) { - return '' - . $label . ($sort === $column ? " $order_icon" : '') . ''; -}; $csrf = $_SESSION['csrf_token']; ?> @@ -187,12 +183,12 @@ $csrf = $_SESSION['csrf_token'];
- - Credential - + Login For - - Changed - + - - Client - + - - Domain - + - - Expires - + - - Registrar and hosts - + Email - - Client - + Date Vendor Category Client Paid from Amount
Date From Category Client Paid into Amount
Invoice Client Date Due Total Balance Status
Who can read it Review
- - Location - + - - Address - + - - Phone & hours - + - - Ask for - + On site - - Client - + Gateway, DNS & DHCP In use Item Billed Stock Vendor Price Margin
Progress
- - + + - - - + + + diff --git a/agent/quotes.php b/agent/quotes.php index 928e46c08..7dcbf2f3a 100644 --- a/agent/quotes.php +++ b/agent/quotes.php @@ -231,14 +231,14 @@ $stat_monthly = function ($amount) use ($stat_money) {
For
- + - + - - - - + + + + diff --git a/agent/recurring_expenses.php b/agent/recurring_expenses.php index 38bb5b3df..a32a83db6 100644 --- a/agent/recurring_expenses.php +++ b/agent/recurring_expenses.php @@ -210,13 +210,13 @@ $any_filter = $q || $vendor_filter || $category_filter || $client_filter;
Quote Client Date Valid until Total Status
- - - - - - - + + + + + + + diff --git a/agent/recurring_invoices.php b/agent/recurring_invoices.php index 886c766cc..48e16be72 100644 --- a/agent/recurring_invoices.php +++ b/agent/recurring_invoices.php @@ -255,14 +255,14 @@ $stat_money = function ($amount) use ($session_company_currency) { - + - + - - - - + + + + diff --git a/agent/recurring_tickets.php b/agent/recurring_tickets.php index ded0be1c8..9a50113ca 100644 --- a/agent/recurring_tickets.php +++ b/agent/recurring_tickets.php @@ -128,10 +128,6 @@ $filter_url = function ($changes) { return '?' . http_build_query(array_filter($params, function ($v) { return $v !== '' && $v !== null; })); }; -$sort_link = function ($column, $label) use ($url_query_strings_sort, $sort, $disp, $order_icon) { - return '' - . $label . ($sort === $column ? " $order_icon" : '') . ''; -}; ?> @@ -277,12 +273,12 @@ $sort_link = function ($column, $label) use ($url_query_strings_sort, $sort, $di - - - - + + + + - + diff --git a/agent/services.php b/agent/services.php index 6f4654b8a..7c0687d3f 100644 --- a/agent/services.php +++ b/agent/services.php @@ -118,10 +118,6 @@ $filter_url = function ($changes) { return '?' . http_build_query(array_filter($params, function ($v) { return $v !== '' && $v !== null; })); }; -$sort_link = function ($column, $label) use ($url_query_strings_sort, $sort, $disp, $order_icon) { - return '' - . $label . ($sort === $column ? " $order_icon" : '') . ''; -}; $link_icons = ['asset' => ['fa-desktop', 'asset', 'assets'], 'credential' => ['fa-key', 'login', 'logins'], 'domain' => ['fa-globe', 'domain', 'domains'], 'certificate' => ['fa-lock', 'certificate', 'certificates'], 'contact' => ['fa-user', 'person', 'people'], 'vendor' => ['fa-building', 'vendor', 'vendors'], @@ -280,12 +276,12 @@ $link_icons = ['asset' => ['fa-desktop', 'asset', 'assets'], 'credential' => ['f - - - + + + - + diff --git a/agent/shares.php b/agent/shares.php index 3175d0d35..8a0ecbe76 100644 --- a/agent/shares.php +++ b/agent/shares.php @@ -231,36 +231,24 @@ $filter_url = function ($changes) { diff --git a/agent/software.php b/agent/software.php index bbc6f0324..ba6f32dc1 100644 --- a/agent/software.php +++ b/agent/software.php @@ -385,52 +385,36 @@ while ($license_type_row = mysqli_fetch_row($sql_license_types)) { diff --git a/agent/texts.php b/agent/texts.php index f623ba787..feb70fcda 100644 --- a/agent/texts.php +++ b/agent/texts.php @@ -81,10 +81,6 @@ foreach ($tabs as $key => $tab) { $counts = array_combine(array_keys($tabs), array_map('intval', mysqli_fetch_row(mysqli_query($mysqli, "SELECT " . implode(', ', $count_sql) . " FROM sms_messages $joins WHERE $scope")))); $latest_code = $can_codes ? intval(mysqli_fetch_row(mysqli_query($mysqli, "SELECT COALESCE(MAX(sms_message_id), 0) FROM sms_messages WHERE sms_message_direction = 'in' AND sms_message_status = 'code'"))[0]) : 0; -$sort_link = function ($column, $label) use ($url_query_strings_sort, $sort, $disp, $order_icon) { - return '' - . $label . ($sort === $column ? " $order_icon" : '') . ''; -}; $csrf = $_SESSION['csrf_token']; $provider = smsProvider(); @@ -129,10 +125,10 @@ $provider = smsProvider();
Vendor Category Client Amount A month Next Last
Recurring invoice Client Amount A month Next Last
Last ticket
Depends on Attention
- - Shared - + - - With - + - - Made - + - - Works until - + - - Opened - + Status - - Client - + - - License - + - - Type - + - - Seats - + - - Renews - + Key - - Purchased - + - - Order ref - + - - Vendor - + - - Client - +
"> - + - + diff --git a/agent/ticket_list.php b/agent/ticket_list.php index b809d3195..e4f8fd4c9 100644 --- a/agent/ticket_list.php +++ b/agent/ticket_list.php @@ -73,10 +73,6 @@ $link_counts = ticketLinkCounts(array_keys($tickets)); // A Due column only when there is something to put in it $show_due = $sla_in_use || mysqli_num_rows(mysqli_query($mysqli, "SELECT 1 FROM tickets WHERE ticket_due_at IS NOT NULL AND ticket_closed_at IS NULL LIMIT 1")); -$sort_link = function ($column, $label, $class = '') use ($url_query_strings_sort, $sort, $disp, $order_icon) { - return '' - . $label . ($sort === $column ? " $order_icon" : '') . ''; -}; ?> @@ -101,22 +97,22 @@ $sort_link = function ($column, $label, $class = '') use ($url_query_strings_sor - + - - - + + + - + - + - + diff --git a/agent/to_order.php b/agent/to_order.php index d85d08616..81e93d711 100644 --- a/agent/to_order.php +++ b/agent/to_order.php @@ -67,10 +67,6 @@ $filter_url = function ($changes) { unset($params['page']); return '?' . http_build_query(array_filter($params, function ($v) { return $v !== '' && $v !== null && $v !== 0; })); }; -$sort_link = function ($column, $label) use ($url_query_strings_sort, $sort, $disp, $order_icon) { - return '' - . $label . ($sort === $column ? " $order_icon" : '') . ''; -}; $csrf = $_SESSION['csrf_token']; $drafts = poReady() ? intval(mysqli_fetch_row(mysqli_query($mysqli, "SELECT COUNT(*) FROM purchase_orders WHERE po_status = 'draft'" . poScopeSql('po_id')))[0]) : 0; @@ -176,13 +172,13 @@ $drafts = poReady() ? intval(mysqli_fetch_row(mysqli_query($mysqli, "SELECT COUN - - - - - + + + + + - + diff --git a/agent/transactions.php b/agent/transactions.php index 117731533..c9d8c6598 100644 --- a/agent/transactions.php +++ b/agent/transactions.php @@ -378,14 +378,14 @@ $is_card = $account && $account['type'] === 3;
Code Text
- / + / - +
Amount
- + - + - - - - + + + + diff --git a/agent/trips.php b/agent/trips.php index 5a0eddb34..7db83888a 100644 --- a/agent/trips.php +++ b/agent/trips.php @@ -315,15 +315,15 @@ $add_url = 'modals/trip/trip_add.php' . ($client_page ? "?client_id=$client_id" - - + + - + - - + + diff --git a/agent/user/user_activity.php b/agent/user/user_activity.php index b52312159..7023b381e 100644 --- a/agent/user/user_activity.php +++ b/agent/user/user_activity.php @@ -71,10 +71,6 @@ $counts = array_combine(array_keys($views), array_map('intval', mysqli_fetch_row $any_filter = $q !== '' || $dtf !== '1970-01-01' || $dtt !== '2099-12-31'; -$sort_link = function ($column, $label) use ($url_query_strings_sort, $sort, $disp, $order_icon) { - return '' - . $label . ($sort === $column ? " $order_icon" : '') . ''; -}; $view_url = function ($key) { $query = $_GET; unset($query['page']); @@ -134,11 +130,11 @@ $view_empty = [
Date Account Who or what Category Client In Out Balance Date Trip Client Site Driver
"> - - + + - - + + diff --git a/agent/user/user_canned_responses.php b/agent/user/user_canned_responses.php index 7ec00ce1e..8d8ddb224 100644 --- a/agent/user/user_canned_responses.php +++ b/agent/user/user_canned_responses.php @@ -79,10 +79,6 @@ $counts = mysqli_fetch_row(mysqli_query($mysqli, "SELECT " . implode(', ', array }, $views)) . " FROM canned_responses WHERE $filters")); $view_counts = array_combine(array_keys($views), $counts); -$sort_link = function ($column, $label) use ($url_query_strings_sort, $sort, $disp, $order_icon) { - return '' - . $label . ($sort === $column ? " $order_icon" : '') . ''; -}; $pill_url = function ($view) use ($category_filter) { return '?' . http_build_query(array_filter(['q' => $_GET['q'] ?? '', 'category' => $category_filter, 'show' => $view])); }; @@ -130,10 +126,10 @@ $csrf = $_SESSION['csrf_token'];
Description
"> - + - - + + diff --git a/agent/vendors.php b/agent/vendors.php index a27ff1552..354f94924 100644 --- a/agent/vendors.php +++ b/agent/vendors.php @@ -293,26 +293,18 @@ $missing_templates = $view === 'client' && !$archived ? vendorTemplatesMissingFo diff --git a/functions/format.php b/functions/format.php index fbb4f7d59..cb2bf00dd 100644 --- a/functions/format.php +++ b/functions/format.php @@ -659,6 +659,34 @@ function emptyStatePill(array $pills, $key, $default = '', array $good = []) { return $view + ['icon' => $pill['icon'] ?? 'fa-filter']; } +/* + * A sortable column header. includes/filter_header.php sets $sort, $disp, $order_icon and + * $url_query_strings_sort. A click on the column being sorted flips it; the first click on + * another sorts names A-Z and dates, money and counts newest or largest first, or $first + * ('ASC' or 'DESC') where the page knows better. + */ +function sortLink($column, $label, $first = null, $title = '', $class = '') { + global $sort, $disp, $order_icon, $url_query_strings_sort; + $active = isset($sort) && (string) $sort === (string) $column; + $order = $active ? $disp : (in_array($first, ['ASC', 'DESC'], true) ? $first : sortFirstOrder($column)); + return '' + . $label . ($active ? " $order_icon" : '') . ''; +} + +/** The first way a column sorts: DESC for dates, money, counts and record numbers, ASC for the rest. */ +function sortFirstOrder($column) { + $column = strtolower((string) $column); + $name = preg_replace('/^.*\./', '', $column); + if (preg_match('/(^|_)(at|date|due|expire|expires|expiry|updated|created|run|seen|login|paid|used|checkin|synced|inbound|since|starts|ends|now)$/', $name) + || preg_match('/(^|_)(amount|total|balance|price|cost|margin|profit|value|stock|seats|threshold|percent|rate|count|views|size|ms|minutes|hours|miles|quantity|qty|devices|months|tokens|use|uses|failures|requests|activity|sign_ins|ips|linked|in)$/', $name) + || preg_match('/^(tickets|contracts|accounts|agents|used|clients|documents|invoices|assets)$/', $name) + || preg_match('/^(ticket|invoice|quote|po|project|recurring_invoice|contract)_number$/', $name)) { + return 'DESC'; + } + return 'ASC'; +} + /** * A list's empty state. $o: * thing - what the list holds, plural ('vendors')
Offered on
- - Vendor - + - - Support - + - - Account - + - - Client - +