From 73145616e44ec01cf44d71ecf407fd990e356519 Mon Sep 17 00:00:00 2001 From: johnnyq Date: Tue, 17 Nov 2026 21:42:00 -0500 Subject: [PATCH] Invoices: Copy Invoice and Make Recurring leave off the Card Fee line ITFlow added when the invoice was paid by card, with the total without it and the windows saying so, while a typed line of that name is still copied; Tickets: moving a ticket to another client gives it a new guest link and its tasks' client approvals new links so those emailed to the old client stop working, and the Change Client window says so; Keep project tickets apart is on for a new install and stays off on an updated one; 26.11.9 changelog entries --- CHANGELOG.md | 10 +++++--- agent/modals/invoice/invoice_copy.php | 6 +++-- .../modals/invoice/invoice_recurring_add.php | 6 +++-- agent/modals/ticket/ticket_change_client.php | 2 +- agent/post/invoice.php | 8 +++--- agent/post/recurring_invoice.php | 11 ++++++-- agent/post/ticket.php | 4 +++ functions/billing_pay.php | 25 +++++++++++++++++++ functions/ticket.php | 15 +++++++++++ setup/seed_data.php | 2 +- 10 files changed, 75 insertions(+), 14 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6e77b0a58..442fa747b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,7 +6,7 @@ This file documents all notable changes made to ITFlow. ### Upgrading -Update from Maintenance > Update — Queue Update hands the job to cron, which updates the files and applies this release's twenty-four database changes (3.6.6 to 3.9.0) in the same pass. They add four tables for RMM providers and their alerts, a setting for device actions and one for API keys in the address, a column marking the emails the mail queue clears once sent, a column and a table for agent banners, two columns for ticket statuses with a setting for the "ticket assigned" message, a column on tickets with a setting for the "no response" message, a table for who a ticket's email replies go to, the settings for Quick tickets, columns on recurring tickets and recurring invoices for booking and making them ahead, two columns on ticket replies for when their time was worked, the settings for cron alerts, a table and a setting for labor costs, a column on users for API / service accounts, columns on tickets and recurring tickets for how long booked work takes, a column each on recurring tickets and calendar events for repeating on a weekday, three columns on agents' settings for their calendar color, what their calendar shows and their own time zone, and a table for the agents helping on a ticket, three columns on quote lines with three settings for what a quote line costs and how it is priced, a column each on quote lines and products with a setting for their pictures, two settings and a column on tickets for keeping project tickets apart, and a table for your other offices with a column each on agents and invites for which one they work from, and change nothing that is there. Nothing else is required. This release has eleven security fixes - see Security. On Apache, ITFlow's own .htaccess now sends security headers: if you show ITFlow inside a frame on another website, it will now refuse to load there. On nginx, add the same headers to your server block if you want them - see Developer Updates. +Update from Maintenance > Update — Queue Update hands the job to cron, which updates the files and applies this release's twenty-four database changes (3.6.6 to 3.9.0) in the same pass. They add four tables for RMM providers and their alerts, a setting for device actions and one for API keys in the address, a column marking the emails the mail queue clears once sent, a column and a table for agent banners, two columns for ticket statuses with a setting for the "ticket assigned" message, a column on tickets with a setting for the "no response" message, a table for who a ticket's email replies go to, the settings for Quick tickets, columns on recurring tickets and recurring invoices for booking and making them ahead, two columns on ticket replies for when their time was worked, the settings for cron alerts, a table and a setting for labor costs, a column on users for API / service accounts, columns on tickets and recurring tickets for how long booked work takes, a column each on recurring tickets and calendar events for repeating on a weekday, three columns on agents' settings for their calendar color, what their calendar shows and their own time zone, and a table for the agents helping on a ticket, three columns on quote lines with three settings for what a quote line costs and how it is priced, a column each on quote lines and products with a setting for their pictures, two settings and a column on tickets for keeping project tickets apart, and a table for your other offices with a column each on agents and invites for which one they work from, and change nothing that is there. Nothing else is required. This release has twelve security fixes - see Security. On Apache, ITFlow's own .htaccess now sends security headers: if you show ITFlow inside a frame on another website, it will now refuse to load there. On nginx, add the same headers to your server block if you want them - see Developer Updates. ### Security @@ -14,6 +14,7 @@ Update from Maintenance > Update — Queue Update hands the job to cron, which u - Credentials: a login saved with a piece of web page code as its username or password could run that code in the browser of an agent who followed a link made for the purpose. The address ITFlow's own pages use to fetch a login's username and password answered as a web page, so a browser sent straight to it drew what the login held instead of showing it as text - and the code then acted as that agent. It took someone able to get such a login saved - an agent who can edit credentials, or a person sent an Ask for a login link, once an agent had saved what they sent back - and then an agent with access to that login opening the link while signed in. The pages that list and show logins were never affected. That answer now says it is data, which no browser draws as a page, and so do sixteen like it that carried only text ITFlow had already made safe. Releases from 26.10 to 26.11.8 are affected, and there is nothing to do after updating. - Invites: with a login key required, the page behind an agent's invite link went on showing the sign-in address with the key in it after the invite had been cancelled or had run out. Someone whose invite was withdrawn could still read the key from their old link. The key signs no one in by itself - it only opens the agents' sign-in page, which still asks for an email and password. A cancelled or run-out link now leads to the plain sign-in page. Releases from 26.11 to 26.11.8 are affected. If you cancelled an invite because the person should never have had it, change the login key in Admin > Settings > Security. - Client access: an agent limited to some clients could read a few names belonging to the others, by putting a record's number in a page's address - a project's name on the tickets list, a site's name, a ticket's subject and an invoice's number on Trips and its export window, a vendor's name in the domains export window, and a client's name on Update Prices and in the message when an AI request was turned away. Nothing else of those records showed, and nothing could be changed. These names now show only for clients the agent can open. Releases from 26.09 to 26.11.8 are affected. +- Tickets: a ticket moved to another client kept its link, so the old client's contact could go on opening it from an email they had - its details, its status and the new client's replies from then on - and a task approval emailed to them still opened, with the ticket's details. Moving a ticket now gives it a new link, and its tasks' approvals new ones, so those the old client was sent stop working; the new client gets the new link with the next email. The Change Client window says so. Every release before 26.11.9 is affected, and there is nothing to do after updating. - Tickets: a link in an email or a client portal reply could be written so that an agent who clicked it on the ticket opened a page from another website inside ITFlow, where it ran as that agent - able to do anything they could, such as reading the logins they have access to. It took someone sending such a message and an agent clicking its link. Links in tickets, and in documents, now open as ordinary links, and ITFlow's windows only ever load ITFlow's own pages. On an ITFlow without HTTPS, the key that unlocks a signed-in agent's saved logins is also kept out of reach of the page, as it already was with HTTPS. Releases from 25.12 to 26.11.8 are affected, and there is nothing to do after updating. Found by Mountaineer IT. @@ -111,11 +112,12 @@ Update from Maintenance > Update — Queue Update hands the job to cron, which u - Dispatch: a new page under Support puts each agent's booked work beside the tickets still to give out. The queue on the left has three tabs - No agent, Not booked (with an agent, nothing booked) and Left behind - most urgent first, with a search, a client and a priority filter. Day shows a column for each agent through the day; Week a row for each agent with a column for each day. Drag a ticket from the queue onto an agent and a time, or drag a booking to another agent or time, and the Schedule window opens with the agent, the time, how long and onsite or remote filled in - Schedule it gives the ticket to that agent and books it, emailing them the calendar file, the agent who had it the cancellation, and the contact and watchers unless you switch that off. Drag a booking back onto the queue to take it off the schedule. One-off events move the same way, to another time or agent. Workload shows each agent's open tickets (leading and helping), SLAs breached or close to it, tickets past due, not booked or gone quiet, and the hours booked today and this week against the working hours in Admin > SLA - flagged Falling behind, Watch, Overloaded or Has room against the team. Click an agent for their tickets, or drop a ticket from the queue on one to give it to them. Under it, This week shows tickets in and closed each day, against last week and the last four, the week's SLA results and each agent's share. Which agents show, the view and weekends are kept to your account, and an agent on their own time zone sees it on their clock. Seeing Dispatch takes Support in your role; booking from it takes Support at Modify. From Mountaineer IT's build of ITFlow. - Quotes: a quote line can carry what it costs you, and its price can come from that cost. In a line's Edit window, Your cost has Cost each, Price by - Markup (a % added to the cost), Margin (a % of the price) or Set price - and the %, with buttons for the ones you use most: the Price is worked out as you type, and says what the line makes each. Typing the Price yourself makes it a set price. A line added from a product takes the product's cost and keeps its price. On the quote, while it can be changed, each line with a cost shows it under its name with its markup or margin, and the quote's Margin counts each line's own cost. Only agents see any of it - never the PDF, the guest link, the client portal or the invoice made from the quote. Admin > Settings > Quotes has what a line is priced by to start with, its % and the quick picks. From Mountaineer IT's build of ITFlow. - Quotes: a quote line can have a picture beside its name - on the quote, the guest link, the client portal and the PDF. In the line's Edit window, upload one or paste a link: a picture, or the product's web page, whose main picture is taken. A product keeps a picture too, in its Edit window, and a quote line added from it takes a copy; copying a quote copies them. ITFlow keeps its own copy of each, made smaller, and only fetches from public websites. Admin > Settings > Quotes can switch pictures off. From Mountaineer IT's build of ITFlow. -- Projects: a project's tickets can be kept apart from the service desk - switch on Keep project tickets apart under Admin > Settings > Projects. A ticket in a project is then left off the tickets list's Open, Unassigned, Needs reply and other views - it has a Projects view of its own - and out of the dashboard's unassigned count, the count beside Tickets in the menu and the Dispatch queue, and has no SLA: the project's dates are what count. It stays under Mine, Mentioned me, Closed and All, in Dispatch's Workload and on the calendar and Dispatch, drawn in the project's calendar color with the project named under it and, on the calendar, a dot in the agent's color. A ticket taken out of its project gets its SLA back counted from then, so it isn't overdue at once - and so do they all when the setting is switched off. Off to start with, so nothing changes until you switch it on. From Mountaineer IT's build of ITFlow. +- Projects: a project's tickets can be kept apart from the service desk - switch on Keep project tickets apart under Admin > Settings > Projects. A ticket in a project is then left off the tickets list's Open, Unassigned, Needs reply and other views - it has a Projects view of its own - and out of the dashboard's unassigned count, the count beside Tickets in the menu and the Dispatch queue, and has no SLA: the project's dates are what count. It stays under Mine, Mentioned me, Closed and All, in Dispatch's Workload and on the calendar and Dispatch, drawn in the project's calendar color with the project named under it and, on the calendar, a dot in the agent's color. A ticket taken out of its project gets its SLA back counted from then, so it isn't overdue at once - and so do they all when the setting is switched off. Off when you update, so nothing changes until you switch it on, and on for a new ITFlow. From Mountaineer IT's build of ITFlow. - Offices: if you work from more than one place, list the others under Admin > Settings > Company Details, Offices - each with its name, address, phone and email, and who works there. An agent's office can also be picked in Admin > Users, and given with an invite. A new trip starts from the driver's office, From offers every office, and changing the driver on a new trip moves From to theirs unless you typed it. Emails about a ticket show the office of the agent on it - the one assigned, else the one sending - at the foot: its address, and its phone and email, or the main office's phone and the ticket email address when it has none. Invoices, quotes and contracts keep the main address. Removing an office puts those who worked there back in the main one. With no other office, nothing changes. From Mountaineer IT's build of ITFlow. ### Bug Fixes +- Invoices: Copy Invoice and Make Recurring copied the Card Fee line of an invoice paid by card, so the copy or every invoice the recurring one made charged the fee before anyone paid - and a client who paid the copy by card was charged a second fee on top. The card fee ITFlow added is now left off, the total without it, and the Copy Invoice and Make Recurring windows say so. A line you typed yourself with that name is still copied. Releases from 26.11.4 to 26.11.8 are affected. - Quotes: Copy Quote dropped each line's link to the product it came from, so the copy's Margin left those lines out. The copy now keeps it. Found by Mountaineer IT. - Backups: restoring a backup rewrote the uploads folder's settings in a form Apache with PHP-FPM refuses - as HestiaCP, cPanel and Plesk run it - so your logo, avatars and photos stopped loading after a restore. Found by Mountaineer IT. - Contacts: archiving several contacts at once left the client's primary contact in place, as it should, but archived its client portal login, so they could no longer sign in. Found by Mountaineer IT. @@ -244,8 +246,10 @@ Update from Maintenance > Update — Queue Update hands the job to cron, which u - Dispatch (`agent/dispatch.php`, `agent/js/dispatch.js`, `functions/dispatch.php`): `dispatchCan()` (Support at View), `dispatchCanEdit()` (`calendarCanScheduleTickets()`), `dispatchAgents()` (active agents who are admins or have Support at Modify, with `calendarAgentColor()`), `dispatchState()` / `dispatchStateSave()` (the `dispatch` key of `user_settings.user_config_calendar_state`, which `calendarUserStateSave()` now keeps: `view`, `hidden`, `weekends`), `dispatchBusinessHours()` and `dispatchWorkingDay()` from `getSlaSettings()`, `dispatchQueue($tab, $filters)` (`unassigned`, `unbooked`, `left_behind` via `calendarLeftBehindSql()`, with each tab's count), `dispatchItems($from, $to, $agent_ids)` (the tickets, helper bookings, events and holidays sources per agent, `extendedProps.agent` and `reference` added, only tickets and one-off events editable, through `timezoneItems()`), `dispatchBook()` (`ticketChangeAssignee()`, `ticketMailScheduleAgentCancelled()` for the agent who had it, then `ticketSetSchedule()`), `dispatchUnbook()` (`ticketCancelSchedule()`), `dispatchAssign()` (refused for a booked ticket), `dispatchEventMove()` (a one-off event in time and from one agent to another with `calendarEventSetAgents()`, `calendarSendInvites()` with `update` to those who have it), `dispatchWorkload()` with `dispatchWorkloadFlags()`, and `dispatchWeekStats()` (tickets given this week read from the `assigned the ticket to ` history lines). `agent/ajax.php`: GET `dispatch_queue`, `dispatch_items`, `dispatch_workload`, `dispatch_week`; POST (CSRF) `dispatch_state`, and with `dispatchCanEdit()`, after `timezoneMovePost()`, `dispatch_book`, `dispatch_unbook`, `dispatch_assign` and `dispatch_event_move` - JSON `{ok, message, conflicts}` or `{error}` with 400/403. `ticketSetSchedule()` and `ticketMailSchedule()` take `$tell_client` (default true) to leave the contact and watchers out. Day is a FullCalendar `timeGridDay` per agent in one scroller (`drop` for the queue's `FullCalendar.Interaction.Draggable`, `eventReceive` between columns, `eventDragStop` over the queue to unbook); Week and Workload use SortableJS. From Mountaineer IT's build of ITFlow. - Database 3.8.7: `quote_items.item_cost`, `item_price_method` (`markup`, `margin` or `price`) and `item_price_percent` - the names MountaineerIT's build uses - and `config_quote_price_method`, `config_quote_price_percent` and `config_quote_price_presets` - `quotePricingReady()`. `functions/quote_pricing.php`: `QUOTE_PRICE_METHODS`, `quotePricingSettings()` (read from `settings` directly, not `load_global_settings.php`), `quotePriceFromCost()`, `quotePricingFromInput()`, `quotePricingSetSql()` - `billingItemSave()` takes `pricing` with `cost`, `price_method` and `price_percent` on a quote, and gives a new line from a product its `product_cost` as a set price - `quotePricingCopySql()` (`add_quote_copy`, which now also keeps `item_product_id`, and `billingCopyLines()` to a quote), `quotePricingMethodNow()` (a markup or margin whose price was changed by hand reads as a set price), `quotePricingLineHtml()` (under the line in `includes/billing_paper.php` while `edit`) and `quotePricingFields()` with `itflowBillingPricingForm()` in `js/billing_items.js`. `billingItems()` returns the three columns for a quote; `billingMargin()` uses `item_cost` before the product's cost. The API's quote line read returns them as it returns every column. From Mountaineer IT's build of ITFlow. - Database 3.8.8: `quote_items.item_image`, `products.product_image` (paths under `uploads/`, the names MountaineerIT's build uses; their `uploads/mit_images/` files are taken as they are) and `config_quote_show_images` - `quoteImagesReady()`, `quoteImagesShown()`. `functions/quote_images.php`: `quoteImageStore()` redraws a JPG, PNG, GIF or WebP with GD at up to 800 pixels a side into `uploads/quote_images/<32 hex>.jpg|png`; `quoteImageFromUpload()`, `quoteImageFromUrl()` (the image, or a page's `og:image` / `twitter:image` / `image_src`) through `quoteImageFetch()` - http(s) on ports 80, 443, 8080 and 8443, every resolved address checked by `quoteImageIpIsPublic()` and pinned with `CURLOPT_RESOLVE`, no proxy, three redirects each checked, 8 MB and 25 seconds in all; `quoteImageSave($table, $id, $in, $files)` for `item_image` / `product_image` with `_url` and `_remove`, `quoteImageField()`, `quoteImageThumbHtml()`, `quoteImageFromProduct()` (a new quote line in `billingItemSave()`), `quoteImageCopySql()` (`add_quote_copy`, `billingCopyLines()` to a quote) and `quoteImagesDeleteFor()` (`billingItemDelete()`, `delete_quote`, deleting a client from the page or the API, the API's quote delete, demo data); `productDelete()` throws the product's away. `includes/billing_paper.php` and `billingPdfRender()` show it; the Edit Line and product windows post `multipart/form-data`, and `js/app.js` previews the file picked. From Mountaineer IT's build of ITFlow. -- Database 3.8.9: `config_project_tickets_apart` (default 0), `config_project_ticket_color` (NULL is `PROJECT_TICKET_COLOR`) and `tickets.ticket_sla_from` (when the SLA counts from; NULL is `ticket_created_at`) - `projectTicketsReady()`. `functions/project_tickets.php`: `projectTicketsSettings()`, `projectTicketsApart()`, `projectTicketsServiceSql()` (the side menu's count, the dashboard's two unassigned counts, `dispatchQueue()`), `projectTicketsShows()` (`agent/tickets.php`'s views; not with a Project filter), `projectTicketsSlaOff()` - `applyTicketSla()` reads `ticket_project_id`, `ticket_sla_id`, `ticket_closed_at` and `ticket_sla_from`, gives an open project ticket SLA 0, leaves a done one with none, and counts targets from `ticket_sla_from` - `projectTicketLeft()` / `projectTicketMoved()` (`edit_ticket`, `edit_ticket_project`, bulk project, `projectAddTicket()`, `projectRemoveTicket()`, `projectDelete()`, the API's ticket update), `projectTicketsSwitched()` (the settings save) and `projectTicketsCalendarItems()` (the tickets source: `color`, `extendedProps.agent_color`, `project`; `agent/js/calendar.js` draws the dot). No cron job: every way a ticket's project changes calls it. From Mountaineer IT's build of ITFlow. +- Database 3.8.9: `config_project_tickets_apart` (default 0), `config_project_ticket_color` (NULL is `PROJECT_TICKET_COLOR`) and `tickets.ticket_sla_from` (when the SLA counts from; NULL is `ticket_created_at`) - `projectTicketsReady()`. `functions/project_tickets.php`: `projectTicketsSettings()`, `projectTicketsApart()`, `projectTicketsServiceSql()` (the side menu's count, the dashboard's two unassigned counts, `dispatchQueue()`), `projectTicketsShows()` (`agent/tickets.php`'s views; not with a Project filter), `projectTicketsSlaOff()` - `applyTicketSla()` reads `ticket_project_id`, `ticket_sla_id`, `ticket_closed_at` and `ticket_sla_from`, gives an open project ticket SLA 0, leaves a done one with none, and counts targets from `ticket_sla_from` - `projectTicketLeft()` / `projectTicketMoved()` (`edit_ticket`, `edit_ticket_project`, bulk project, `projectAddTicket()`, `projectRemoveTicket()`, `projectDelete()`, the API's ticket update), `projectTicketsSwitched()` (the settings save) and `projectTicketsCalendarItems()` (the tickets source: `color`, `extendedProps.agent_color`, `project`; `agent/js/calendar.js` draws the dot). No cron job: every way a ticket's project changes calls it. A new install has `config_project_tickets_apart` on (`seedDefaultData()` in `setup/seed_data.php`); the column's default stays 0, so an updated ITFlow keeps it off and db.sql matches. From Mountaineer IT's build of ITFlow. - Database 3.9.0: the `offices` table (the same `office_` columns as Mountaineer IT's `mit_offices`; `office_archived_at` when removed), `users.user_office_id` and `user_invites.invite_office_id` (0 is the main office - the `companies` row) - `officesReady()`. `functions/offices.php`: `offices()`, `office()`, `officeMain()`, `officesAll()`, `officeIdForUser()`, `officeSetUser()`, `officePeople()`, `officeSave()` / `officeRemove()` (`admin/post/office.php`: `save_office`, `remove_office`; the window is `admin/modals/office/office.php`), `officesSection()` (Company Details), `officeUserField()` / `officeUserSave()` (`add_user`, `edit_user`; `userInviteSave()` takes `office_id` and `userInviteAccept()` sets it), `officeTripStart()` / `officeTripPlaces()` / `officeTripStarts()` (the trip form, `tripStartPlaces()` and the API's trip create), and `officeTicketFoot()` - an `office` key (`address`, `contact`) on the four ticket emails that set `contact`, which `emailHtml()` puts in the foot in place of the company's address and contact line. From Mountaineer IT's build of ITFlow. +- Card fees: `billingCardFeeLine($item)` (named `BILLING_CARD_FEE_NAME`, a description starting "For paying by card on ", no product - as `billingCardFeeAdd()` writes it) and `billingWithoutCardFees($items)` (the lines without them, and what they came to). `add_invoice_copy` and `add_invoice_recurring` leave those lines off and take them off the amount they copy. +- Tickets: `ticketNewGuestKeys($ticket_id)` gives a ticket a new `ticket_url_key` and its tasks' client approvals (`approval_scope` client) a new `approval_url_key`; `change_client_ticket` calls it when the client changes. ## [26.11.8] diff --git a/agent/modals/invoice/invoice_copy.php b/agent/modals/invoice/invoice_copy.php index 4e0d1d5ab..b2d5eb00a 100644 --- a/agent/modals/invoice/invoice_copy.php +++ b/agent/modals/invoice/invoice_copy.php @@ -18,7 +18,9 @@ if (!$doc) { $client_id = intval($doc['client_id']); enforceClientAccess(); $doc_number = billingNumber($doc_type, $doc); -$lines = count(billingItems('invoice', intval($doc['invoice_id']))); +// Without the card fee it was paid with - that was for the payment (billingWithoutCardFees()) +[$copy_lines, $card_fees] = billingWithoutCardFees(billingItems('invoice', intval($doc['invoice_id']))); +$lines = count($copy_lines); // 0 is On Receipt - a contract in force's net terms, else the default [$terms, $terms_from] = contractNetTermsWhose($client_id, date('Y-m-d')); @@ -34,7 +36,7 @@ ob_start();