diff --git a/CHANGELOG.md b/CHANGELOG.md index 25f71b480..c8f214fdf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1065,6 +1065,14 @@ If you are coming from 26.08 or earlier, the database update still has to be run - Removing a card says first which recurring invoices stop autopaying with it. It is taken off Stripe as well, each of those recurring invoices says in its history that its autopay stopped and why, and when Stripe can't be reached the card is still removed and you are told it is saved there. - What goes through it: each provider shows its card payments in the last 30 days and when the last came, what its fees came to, and how many are still to record - flagged once they are more than two days old, as the nightly run should have had them. Record fees now does what the nightly run does, and says what it recorded, what Stripe hasn't settled yet and what it wouldn't say. Check connection asks Stripe whose account the key is, and says so - or why it isn't connected. - Settings > Invoices and billing says how card payments stand, under Paid online: none set up, turned off, or on - with live or test keys, where payments go, the card limit and how many came in the last 30 days. The Settings overview flags test keys, card payments going into an archived account, and Stripe's fees not being recorded, and the Invoices and billing tile says whether cards are on. +- **Custom Links** (rebuilt) + - Admin > Custom Links has a tab for each menu a link can show in - the agent menu, the top bar, the client portal, the admin menu and the reports menu - with how many each holds, plus All and Archived. Search looks at the name, the address and the description. + - Each link shows its icon, what it is for, where it goes and whether it opens in a new tab. A link whose address can't work is flagged. + - On a menu's tab, drag the links into the order the menu shows them in, or use Move up and Move down. A new link goes at the end of its menu - the Order number is gone. + - New Link and Edit are one window with a preview of the link in its menu, as it will look. There's an icon picker with search, and a description that shows when the link is hovered. Open in a new tab switches itself on for another site and off for a page of ITFlow, until you change it. + - A link can be copied, to put it in a second menu, archived to hide it without losing it, restored, or opened to try it. Delete asks first. + - The address has to be a web address, a page of ITFlow, mailto:, tel:, or one of the remote tools and shares that asset links open (rdp:, ssh:, smb: and the like). A javascript: or data: address is refused, and one saved before now goes nowhere. + - In the menus: the agent menu's links sit under Tools, with the heading even for a role without Reports. The admin menu's links get a heading of their own, Links. A link that opens in a new tab has a small arrow, a link without an icon gets the link arrow, and every link shows its description on hover - in the top bar as well as its name. - **AI Providers** (rebuilt) - Admin > AI Providers lists each provider with its kind and address, whether its key is saved (it is never shown), whether it runs on your own network, whether passwords and keys go to it as they are, its models and what each is for, and its requests and tokens in the last 30 days, with how many failed. Above the list, which model General, Tickets, Documentation and Billing each use - their own, or General's. Search finds a provider by a model on it too, and the list sorts by name, kind, models, requests or when it was last used. - Add and Edit are one window. Pick its kind - OpenAI, Anthropic (Claude), Azure OpenAI, Google Gemini, Mistral, Groq, OpenRouter, Ollama, LM Studio, or any other OpenAI-compatible service - and its address and name are filled in, with a link to where its keys are made. Test asks it for its models: it says it answered and how many there are, or why not - a key it turned away, an address that isn't there or doesn't answer - beside the field. Save checks first the same way, and a provider that doesn't answer right now (one on your network that is off, say) can still be saved, once it has said so. The key is no longer put into the window; left empty it stays, and Remove the saved key takes it off. @@ -1277,6 +1285,8 @@ If you are coming from 26.08 or earlier, the database update still has to be run - API: `credentials/create` and `credentials/update` ignored `credential_vendor_id` and `credential_software_id`, and took another client's contact or asset. The vendor and license are linked now, and another client's contact, asset, vendor or license is left off. - API: `assets/update` without `asset_ip`, `asset_mac` or `asset_network_id` wiped those on the asset's primary interface. - API: `tickets/resolve` answered success False although it had resolved the ticket. `software/read` by `software_name` failed with a database error. `clients/create` without `client_currency_code` made a client with no currency - it gets the company's now. `certificates/create` said only that it failed - it says what was wrong. `clients/archive` logged as a contact being archived. A request that wasn't GET or POST printed its method back. +- Custom links: an email (mailto:) or phone (tel:) link in the agent, admin or reports menu went to "unsupported://" instead. The client portal's menu took any address, javascript: included. +- Custom links: deleting one said "Custom Link deleted" without its name, and the list's new-tab tick never showed. - Ticket emails: resolving a ticket with the Resolve button or on the board emailed the client a Resolved email with nothing about the ticket in it. It now carries the conversation. - Email parser: a reply sent as plain text kept the whole email it quoted - it is now cut at the reply line, like an HTML reply. - Ticket link: reopening a resolved ticket from it left the resolution SLA as it was, and closing it didn't stop the SLA clock. Both now work as they do from the client portal. @@ -1875,6 +1885,7 @@ If you are coming from 26.08 or earlier, the database update still has to be run - Guest ticket page: `guest/guest_view_ticket.php` is built on the portal's ticket helpers in `client/functions.php` (`portalTicketState()`, `portalAvatarHtml()`, `portalDateTime()`, `portalTicketEventText()`) and sends `Referrer-Policy: no-referrer` (the key is in the address), `X-Frame-Options: DENY` and `frame-ancestors 'none'`. `ticketByGuestKey($ticket_id, $url_key)` (`functions/ticket.php`) returns `ticketRow()` only when the key matches exactly (`hash_equals()`); the page, the handlers and the new `guest/guest_ticket_attachment.php` use it, and `ticketGuestPath($row)` is the page's address from `guest/`. The attachment endpoint follows `client/ticket_attachment.php`'s rules (never an internal or archived reply's file, inline only for `getInlineViewableMimeTypes()`), never serves `Original-parsed-email.eml`, and logs each download. - Guest ticket page: in `guest/guest_post.php`, `close_ticket`, `reopen_ticket` and `add_ticket_feedback` are POST only, with `ticket_id` and `url_key`; the GET forms are gone. Each acts once, on the state it expects, so a second press logs nothing. Reopen calls `resetTicketResolutionSla()` and `syncTicketSlaClock()` and `appNotify()`; close calls `syncTicketSlaClock()`. `add_ticket_feedback` takes Good or Bad only. `ticket_calendar` (GET) sends the booking's calendar file. `ticketScheduleRow($ticket_id)` and `ticketScheduleIcs($row, $schedule)` are what `ticketSetSchedule()` used to build inline, so both give the same UID and event. The CSS class `.itflow-portal-todo-wrap` lets a portal to-do row's title wrap instead of being cut off. - Ticket emails: `emailHtml()` takes a `history` block (a heading and items of who, organisation, action, when and plain text, or a `gap` count) drawn after the button. `emailPlainText($html, $limit)` (`functions/email.php`) is HTML as plain text, keeping line breaks, dropping pictures and the reply line, and cut at a word. `ticketEmailHistory($row, $opts)` (`functions/ticket.php`) builds the history: public and client replies newest first, never internal, archived or the portal's "Ticket ... by X." lines, then the request. `skip` leaves out the reply the email shows and anything newer, `request` and `replies` choose the parts, and `limit` (4) caps the replies. `ticketEmailExcerpt()` takes off the parser's "Email from" line. `ticketEmailContent()` and `ticketAgentEmailContent()` add it per kind and set the preview line through `ticketEmailPreview()`. `ticketMailColleaguesNew()` shows the details unless `ticket_source` is Email. `cron/ticket_email_parser.php` also cuts a reply at a plain-text reply line, quoted or not. +- Custom links: new `functions/custom_link.php` holds the link helpers. `customLinkLocations()` lists the menus (1 agent menu, 2 top bar, 3 client portal, 4 admin menu, 5 reports menu). `customLinkUriProblem()` and `customLinkHref()` check addresses: escapeUrl()'s schemes plus mailto and tel, relative paths allowed, anything else drawn as `#`. `customLinksFor($location)` is a menu's current links, read once a page, with `href` and `icon` added; `customLinkNavItemHtml()` draws a side menu line. Also `customLinkFromInput()`, `customLinkProblem()`, `customLinkCreate()`, `customLinkUpdate()` (returns the from-to changes for the audit log), `customLinkCopy()`, `customLinkReorder()`, `customLinkMenuIds()` and `customLinkIconChoices()`. `admin/includes/side_nav.php`, `agent/includes/side_nav.php`, `agent/reports/includes/reports_side_nav.php`, `includes/top_nav.php` and `portalNav()` read `customLinksFor()`; the portal's nav items take a `title`. `admin/post/custom_link.php` adds `copy_custom_link`, `archive_custom_link`, `restore_custom_link`, `move_custom_link` and `reorder_custom_links` (POST, JSON, like `reorder_categories`). The add and edit windows share `admin/modals/custom_link/custom_link_form.php` with `js/custom_link_form.js`. `custom_link_description` is now used; `custom_link_order` is set by position. No database change. ### Library Updates diff --git a/admin/custom_links.php b/admin/custom_links.php index 96da211cd..0c2d1a774 100644 --- a/admin/custom_links.php +++ b/admin/custom_links.php @@ -1,151 +1,273 @@ Custom Links - your own links in ITFlow's menus: your RMM, your + * documentation, a booking page for clients. Tabs for each menu - the agent + * menu, the top bar, the client portal, the admin menu and the reports menu - + * with how many each holds, and the archived ones, which are kept but not + * shown. Each row shows the link as its menu draws it, what it is for, where + * it goes and whether it opens in a new tab. On a menu's tab they are in that + * menu's order and can be dragged into another (or moved up and down from + * the row's menu). The work is in functions/custom_link.php; the handlers + * are admin/post/custom_link.php. + */ + +// Default Column Sortby Filter - the order the menus show them in +$sort = "custom_link_order"; $order = "ASC"; require_once "includes/inc_all_admin.php"; -$sql = mysqli_query( - $mysqli, - "SELECT SQL_CALC_FOUND_ROWS custom_link_icon, custom_link_id, custom_link_location, custom_link_name, - custom_link_new_tab, custom_link_order, custom_link_uri FROM custom_links - WHERE custom_link_name LIKE '%$q%' - ORDER BY $sort $order LIMIT $record_from, $record_to" -); +$locations = customLinkLocations(); + +// The tabs: every menu, each menu, and the archived ones +$views = ['' => ['label' => 'All menus', 'icon' => 'fa-th-list', 'where' => 'custom_link_archived_at IS NULL', 'title' => 'Every link that shows in a menu']]; +foreach ($locations as $location => $location_config) { + $views[(string) $location] = ['label' => $location_config['label'], 'icon' => $location_config['icon'], 'where' => "custom_link_archived_at IS NULL AND custom_link_location = $location", 'title' => $location_config['about']]; +} +$views['archived'] = ['label' => 'Archived', 'icon' => 'fa-archive', 'where' => 'custom_link_archived_at IS NOT NULL', 'title' => 'Kept, but not shown in any menu']; +$show = (string) ($_GET['show'] ?? ''); +$show = isset($views[$show]) ? $show : ''; +$show_location = $show !== '' && $show !== 'archived' ? intval($show) : 0; + +// Only these sort - an unknown column would take the page down +$sortable_columns = [ + 'custom_link_order' => "custom_link_location ASC, custom_link_order $order, custom_link_name ASC", + 'custom_link_name' => "custom_link_name $order", + 'custom_link_location' => "custom_link_location $order, custom_link_order ASC, custom_link_name ASC", + 'custom_link_uri' => "custom_link_uri $order", +]; +if (!isset($sortable_columns[$sort])) { + $sort = 'custom_link_order'; +} + +$filters = "(custom_link_name LIKE '%$q%' OR custom_link_uri LIKE '%$q%' OR custom_link_description LIKE '%$q%')"; + +$sql = mysqli_query($mysqli, "SELECT SQL_CALC_FOUND_ROWS custom_link_id, custom_link_name, custom_link_description, custom_link_uri, custom_link_new_tab, custom_link_icon, + custom_link_location, custom_link_order, custom_link_archived_at + FROM custom_links + WHERE $filters AND {$views[$show]['where']} + ORDER BY {$sortable_columns[$sort]}, custom_link_id ASC + LIMIT $record_from, $record_to"); $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()")); +$counts = mysqli_fetch_row(mysqli_query($mysqli, "SELECT " . implode(', ', array_map(function ($view) { + return "COALESCE(SUM({$view['where']}), 0)"; +}, $views)) . " FROM custom_links WHERE $filters")); +$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])); +}; + +$add_url = 'modals/custom_link/custom_link_add.php' . ($show_location ? "?location=$show_location" : ''); +$csrf = $_SESSION['csrf_token']; + ?>