Commit Graph
6658 Commits
Author SHA1 Message Date
Adam Daleyandcubic-dev-ai[bot] 60ef50108d Fix duplicate domain activation from stale order object during checkout (#3948)
* Fix duplicate domain activation caused by stale order object

Cart checkout can activate an order that was already activated
synchronously via an invoice paid with account credit, since the
in-memory order held by the checkout loop is never refreshed after
the credit-payment path activates it through its own freshly-loaded
copy. activateOrder() now re-fetches the order before checking its
status, closing the gap that let EPP domain registration run twice
and fail with "Domain is not available: In use".

* Treat already-active orders as a no-op in activateOrder

The reload alone turned the stale-order race into a thrown exception
for orders that were already correctly activated by another code
path in the same request. Cart::checkoutCart()'s catch block then
tried to record an 'error' order status, which isn't a valid status
and threw a second exception that broke the whole checkout. An
already-active order (without force) should just be a no-op success.

* Update src/modules/Order/Service.php

Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>

---------

Co-authored-by: cubic-dev-ai[bot] <191113872+cubic-dev-ai[bot]@users.noreply.github.com>
2026-07-09 16:13:13 +01:00
Adam Daley 81ae63c820 Fix undefined method error in UpdatePatcher after Doctrine migration (#3949)
PR #3863 migrated the Extension module to Doctrine and removed
Service::findExtension(), but missed three call sites in
UpdatePatcher.php that still used it. Users upgrading from 0.6.x
hit "Call to undefined method ...findExtension()" when these
update patches ran.
2026-07-09 15:43:50 +01:00
Adam Daley a54d94f570 Refactor API and frontend helpers with improved testing (#3947)
* Fix GET fetch body and DRY DirectAdmin fields

* Remove unused bindings in Support module

* Gate dashboard invoice and order cards

* Extract and test data-fb-api parser

* Refactor API helpers and add unit tests

* Extract link action and loading state helpers

* Refactor icon checks into tested helpers

* Refactor frontend helpers and slim tests

* Harden API CSRF handling and icon checks
2026-07-09 11:47:34 +01:00
Adam Daley 372ca39aa3 Fix crash on Product Promotions page for promo rows with NULL flags (#3946)
* Fix crash on Product Promotions page for promo rows with NULL flags

The `promo` table's maxuses/used/freesetup/once_per_client/recurring/
active columns are nullable in the DB, but the Doctrine entity mapped
them as non-nullable typed properties. When a row (typically from a
legacy install) has NULL in one of these columns, Doctrine's
TypedNoDefaultPropertyAccessor unsets the property instead of applying
the PHP default, so any read throws "must not be accessed before
initialization" — crashing the admin Product Promotions page.

Align the entity mapping with the actual nullable schema and coalesce
null to the intended defaults in the getters and toApiArray().

Fixes #3942

* Coalesce NULL used counts in promo usage SQL

promoCanBeApplied() now treats a NULL used column as 0, but
PromoRepository's raw SQL for incrementing/decrementing usage did not:
`used + 1` and `GREATEST(used - ?, 0)` both propagate NULL in MySQL,
and `maxuses > used` is unknown (never true) when used IS NULL. That
let checkout accept a legacy promo with a NULL used count and then
immediately fail to reserve it, throwing "maximum number of uses
reached". Coalesce used to 0 in both the SET and WHERE clauses so
reservation matches what promoCanBeApplied() already allows.
2026-07-09 10:00:44 +01:00
Adam Daley 457f2e85ab Use zstd compression for Docker image artifacts (#3945) 2026-07-09 07:35:52 +01:00
Adam Daley c6e6ad0e09 Optimise CI workflows with ubuntu-slim and Docker caching (#3944)
* Use ubuntu-slim in GitHub workflows

* Optimize CI Docker caching and test startup
2026-07-09 06:44:36 +01:00
renovate[bot] 5e6ba4610d Update actions/labeler digest to b8dd2d9 2026-07-09 04:48:08 +00:00
0eb6610f5a Apply PHP Code Styling & Quality Changes (#3940)
* Apply PHP Code Styling & Quality Changes

* Fix fingerprint PHPStan error

---------

Co-authored-by: FOSSBilling Bot <fossbilling-bot>
Co-authored-by: Adam Daley <admdly@users.noreply.github.com>
2026-07-09 05:44:18 +01:00
renovate[bot] 052856a4fa Update github/codeql-action digest to 99df26d 2026-07-09 04:11:51 +00:00
Adam DaleyandCopilot Autofix powered by AI 5c65c7e191 Fix for 1 code quality finding in admin theme (#3943)
Apply suggested fix to src/themes/admin_default/html/mod_index_dashboard.html.twig from Copilot Autofix

Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>
2026-07-09 05:10:51 +01:00
renovate[bot] c36666f802 Update dependency friendsofphp/php-cs-fixer to v3.95.12 2026-07-08 05:45:22 +00:00
renovate[bot] af9f63d3f1 Update composer:2 Docker digest to 5946476 2026-07-08 01:33:01 +00:00
Adam DaleyandCopilot Autofix powered by AI bf607e3baf Fixes for 2 code quality findings in i18n tests (#3939)
* Apply suggested fix to tests/Unit/FOSSBilling/i18nTest.php from Copilot Autofix

Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>

* Apply suggested fix to tests/Unit/FOSSBilling/i18nTest.php from Copilot Autofix

Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>

---------

Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>
2026-07-07 09:27:44 +01:00
Adam DaleyandCopilot Autofix powered by AI 76aebab95a Fixes for 2 code quality findings in admin_default theme (#3938)
* Apply suggested fix to src/themes/admin_default/html/mod_index_dashboard.html.twig from Copilot Autofix

Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>

* Apply suggested fix to src/themes/admin_default/html/mod_index_dashboard.html.twig from Copilot Autofix

Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>

---------

Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>
2026-07-07 08:23:48 +01:00
Adam Daley b1195d4b5d Remove legacy class header template (#3937)
* Remove legacy class header template

* Remove unused legacy class header template

* Revert "Remove unused legacy class header template"

This reverts commit 41c5bd9454.
2026-07-07 08:15:40 +01:00
Adam Daley ba988ecf04 Use ribbons for suspended status badges (#3936) 2026-07-07 07:40:40 +01:00
Adam DaleyandCopilot Autofix powered by AI 2d0e476ee2 Fix for 1 code quality finding in i18n tests (#3935)
Apply suggested fix to tests/Unit/FOSSBilling/i18nTest.php from Copilot Autofix

Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>
2026-07-07 07:20:20 +01:00
Adam Daley fe7d293df4 Refactor to use Request object for locale and cookie handling (#3934)
* Use Request object instead of superglobals

* Use Request in locale resolution

* Queue cookies and remove direct header writes

* Fix flaky i18nTest: de_DE locale isn't installed in CI

CI builds with INSTALL_TRANSLATIONS=false, so only en_US exists on
disk and getLocales() never considers de_DE "enabled". Use en_US as
the cookie value (always installed) against a different config
default to still prove the cookie takes precedence.
2026-07-07 07:01:45 +01:00
Adam Daley 1f70144e71 Speed up CI: share Docker test image, dedupe PHPStan, fix cache contention (#3933)
* Speed up CI: share Docker test image, dedupe PHPStan, fix cache contention

live-tests and cypress-tests each independently rebuilt the same PHP 8.5
test image already built by the php-build-test matrix, paying for a
registry-cache pull each time. Build it once, export it as a workflow
artifact, and have live-tests/cypress-tests just docker load it.

PHPStan analyzes source, not runtime behavior, so running it identically
across all 3 PHP versions in the matrix was pure duplication. Now it runs
once, on PHP 8.3.

php-build-test-push and preview-build-push wrote to the shared GHCR
registry cache on every push to every branch, not just main. Concurrent
branch pushes (including frequent bot autofix branches) could stomp on
each other's cache entries, degrading hit rates for everyone. Cache
writes are now restricted to main; other branches read-only, same as the
existing PR path.

* Trim comment verbosity to match existing workflow style

The repo's existing workflow comments are single-line "why" notes; tighten
the multi-line ones added in the previous commit to match, and drop an
unused step id.
2026-07-07 06:34:37 +01:00
Adam DaleyandCopilot Autofix powered by AI 11fe0ca774 Fixes for 2 code quality findings in PayPalEmail adapter (#3932)
* Apply suggested fix to src/library/Payment/Adapter/PayPalEmail.php from Copilot Autofix

Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>

* Apply suggested fix to src/library/Payment/Adapter/PayPalEmail.php from Copilot Autofix

Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>

---------

Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>
2026-07-07 06:09:45 +01:00
Adam DaleyandCopilot Autofix powered by AI e2e9ff1125 Fixes for 2 code quality findings in RouterMatcherTest (#3930)
* Apply suggested fix to tests/Unit/FOSSBilling/RouteMatcherTest.php from Copilot Autofix

Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>

* Apply suggested fix to tests/Unit/FOSSBilling/RouteMatcherTest.php from Copilot Autofix

Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>

---------

Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>
2026-07-07 06:00:42 +01:00
Adam DaleyandCopilot Autofix powered by AI d6c21c4b4a Fixes for 2 code quality findings in PayPalEmail adapter (#3931)
* Apply suggested fix to src/library/Payment/Adapter/PayPalEmail.php from Copilot Autofix

Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>

* Apply suggested fix to src/library/Payment/Adapter/PayPalEmail.php from Copilot Autofix

Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>

* Fix syntax error from orphaned brace in PayPalEmail adapter

A prior autofix commit closed the `payment_status == 'Completed'` if-block
early with an else/break, but left the block's original closing brace in
place, breaking the rest of the switch statement.

---------

Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>
2026-07-07 05:53:20 +01:00
Adam DaleyandCopilot Autofix powered by AI 7c5699be80 Fixes for 4 code quality findings in PayPalEmail adapter (#3929)
* Apply suggested fix to src/library/Payment/Adapter/PayPalEmail.php from Copilot Autofix

Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>

* Apply suggested fix to src/library/Payment/Adapter/PayPalEmail.php from Copilot Autofix

Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>

* Apply suggested fix to src/library/Payment/Adapter/PayPalEmail.php from Copilot Autofix

Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>

* Apply suggested fix to src/library/Payment/Adapter/PayPalEmail.php from Copilot Autofix

Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>

---------

Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>
2026-07-07 05:28:07 +01:00
Adam Daley 85cd7aac2a Modernize HTTP response flow (#3928)
* Modernize HTTP response flow

* Fix route matcher test spelling
2026-07-07 05:15:39 +01:00
Adam Daley 50d315406b Prevent duplicate PayPal subscriptions on repeated subscr_signup IPNs (#3927)
PayPal can resend/duplicate the subscr_signup IPN for a subscription,
and the handler had no idempotency check before creating a new
Subscription row (unlike subscr_payment, which is well-guarded). This
could result in duplicate subscription records and duplicate renewal
notifications, matching reports on issue #3055.
2026-07-07 04:52:35 +01:00
Adam Daley eac0dd8f95 Refactor Staff entities and improve Support ticket handling (#3926)
* Refresh legacy headers and manifests

* Add Staff Doctrine entities and service fixes

Introduces Doctrine-backed Staff entities/repositories for `admin` and `admin_password_reset`, including lifecycle timestamps and typed lookup helpers. Staff service list retrieval now uses DBAL `fetchAllKeyValue`.

Also refactors Support ticket creation to pass `clientId` instead of loading `Model_Client`, and uses an order lookup by client/order IDs for related ticket data. Product promo failure compensation was tightened to be idempotent by returning early when no redemptions remain and decrementing promo usage by the actual number of removed redemptions. Includes minor import/whitespace/docblock cleanup.

* Fix AdminRepository return type annotation
2026-07-07 03:46:20 +01:00
Adam DaleyandCopilot Autofix powered by AI 0ed3c50036 Fixes for 2 code quality findings in FOSSBilling i18n tests (#3925)
* Apply suggested fix to tests/Unit/FOSSBilling/i18nTest.php from Copilot Autofix

Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>

* Apply suggested fix to tests/Unit/FOSSBilling/i18nTest.php from Copilot Autofix

Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>

---------

Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>
2026-07-07 03:02:16 +01:00
Adam Daley c183e91c7a Move migrated module lookups to repositories (#3924) 2026-07-07 02:52:59 +01:00
renovate[bot] 0b19ac818a Update dependency pestphp/pest to v4.7.5 2026-07-07 01:23:32 +00:00
renovate[bot] 1cb8fdfe6d Update composer:2 Docker digest to 805ff9b 2026-07-07 00:59:48 +00:00
Adam DaleyandCopilot Autofix powered by AI 1be5a8e72d Fixes for 2 code quality findings in i18n tests (#3923)
* Apply suggested fix to tests/Unit/FOSSBilling/i18nTest.php from Copilot Autofix

Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>

* Apply suggested fix to tests/Unit/FOSSBilling/i18nTest.php from Copilot Autofix

Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>

* Fix failing timezone alias test to match actual validateTimezone behavior

US/Eastern is a legacy tzdata backward-compatibility alias excluded from
DateTimeZone::listIdentifiers(), so validateTimezone() correctly rejects
it. The test asserted the opposite and failed CI.

---------

Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>
2026-07-07 01:58:59 +01:00
Adam Daley 0880c60501 Expose custom client IDs (#3922) 2026-07-07 01:41:15 +01:00
Adam DaleyandCopilot Autofix powered by AI 0ad2ad1f41 Fix for 1 code quality finding in i18n tests (#3921)
Apply suggested fix to tests/Unit/FOSSBilling/i18nTest.php from Copilot Autofix

Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>
2026-07-07 01:25:01 +01:00
Adam DaleyandCopilot Autofix powered by AI 62d235e130 Fixes for 2 code quality findings in i18n tests (#3920)
* Apply suggested fix to tests/Unit/FOSSBilling/i18nTest.php from Copilot Autofix

Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>

* Apply suggested fix to tests/Unit/FOSSBilling/i18nTest.php from Copilot Autofix

Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>

---------

Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>
2026-07-07 01:11:16 +01:00
Adam DaleyandCopilot Autofix powered by AI 0e64aed45f Fix for 1 code quality finding in i18n tests (#3919)
Apply suggested fix to tests/Unit/FOSSBilling/i18nTest.php from Copilot Autofix

Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>
2026-07-07 00:51:00 +01:00
Adam DaleyandCopilot Autofix powered by AI 53b8bef1de Fixes for 2 code quality findings in Invoice tests (#3918)
* Apply suggested fix to src/modules/Invoice/tests/Unit/ServiceTest.php from Copilot Autofix

Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>

* Apply suggested fix to src/modules/Invoice/tests/Unit/ServiceTest.php from Copilot Autofix

Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>

---------

Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>
2026-07-07 00:38:03 +01:00
Adam DaleyandCopilot Autofix powered by AI 9ab5256a33 Fixes for 2 code quality findings in Twig EdgeCaseRenderer tests (#3917)
* Apply suggested fix to tests/Unit/FOSSBilling/Twig/EdgeCaseRenderingTest.php from Copilot Autofix

Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>

* Apply suggested fix to tests/Unit/FOSSBilling/Twig/EdgeCaseRenderingTest.php from Copilot Autofix

Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>

* Fix incorrect assertion flip in admin ticket edited-message test

The prior "code quality" pass flipped the editMessage2 assertion to
not->toContain, but the admin ticket template renders an edit link for
every admin-authored message regardless of whether it was edited, so
the assertion should remain toContain.

---------

Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>
2026-07-07 00:23:15 +01:00
Adam Daley fd46d31f6a Add configurable invoice reminder intervals (#3914)
* Add configurable invoice reminder intervals

* Address invoice reminder review feedback
2026-07-07 00:07:10 +01:00
Adam DaleyandCopilot Autofix powered by AI ddb7875cf8 Fixes for 2 code quality findings in i18n tests (#3915)
* Apply suggested fix to tests/Unit/FOSSBilling/i18nTest.php from Copilot Autofix

Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>

* Apply suggested fix to tests/Unit/FOSSBilling/i18nTest.php from Copilot Autofix

Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>

---------

Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>
2026-07-06 23:52:19 +01:00
Adam DaleyandCopilot Autofix powered by AI c4c648c2a6 Fixes for 2 code quality findings in Twig EdgeCaseRendering tests (#3916)
* Apply suggested fix to tests/Unit/FOSSBilling/Twig/EdgeCaseRenderingTest.php from Copilot Autofix

Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>

* Apply suggested fix to tests/Unit/FOSSBilling/Twig/EdgeCaseRenderingTest.php from Copilot Autofix

Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>

---------

Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>
2026-07-06 23:44:59 +01:00
Adam Daley d144dfdc07 Attach PDF invoices to invoice emails (#3913)
* Attach PDF invoices to invoice emails (#1724)

Adds generic file-attachment support to the email pipeline (Mail, QueuedEmail,
Email\Service) and wires it into invoice notifications via a new
"Attach PDF Copy to Invoice Emails" setting, so clients who pay by bank
transfer can view the invoice without logging in.

Also carries the same attachment into the sent-email activity log so a
later "resend" (client or admin) reattaches the PDF instead of dropping it.

* Address PR review: avoid blob hydration in email history list, fix checkbox uncheck

- ActivityClientEmailRepository::getSearchQueryBuilder() now selects a partial
  entity that excludes attachment_content, so the paginated admin/client email
  history list no longer hydrates every PDF into memory just to render
  has_attachment. Verified against a real Doctrine EntityManager that the DQL
  parses, the generated SQL excludes the blob column, and toApiArray() still
  works correctly on the partial entity.
- mod_invoice_settings.html.twig: add the hidden-input-before-checkbox pattern
  already used elsewhere in this codebase (e.g. mod_client_new_form.html.twig),
  so unchecking "Attach PDF Copy to Invoice Emails" actually persists as
  disabled instead of being silently dropped from the form submission.
2026-07-06 23:32:12 +01:00
Adam Daley feb6794a80 Ignore WIP/Draft PR titles in CodeRabbit (#3912) 2026-07-06 22:59:15 +01:00
Adam Daley c8cd721e49 Fix cron settings defaults (#3911) 2026-07-06 22:08:46 +01:00
Adam Daley 038ba75f84 Add CodeRabbit configuration for manual reviews (#3910)
* Add CodeRabbit config for manual reviews

* Update cspell.json

* Update .coderabbit.yaml
2026-07-06 21:39:41 +01:00
Adam Daley d9b211c9cd Sort client custom fields alphabetically and raise field cap to 20 (#3909)
* Sort client custom fields alphabetically and raise field cap to 20

Addresses #3174: client-facing forms (profile, signup, orderbutton)
now render custom fields sorted by their configured title instead of
a fixed numeric order, and the hardcoded limit of 10 custom fields is
raised to 20 via a new client table migration (patch85).

Also ignores src/config.old.php, the backup file the config patcher
creates automatically during config version migrations.

* Show custom fields 11-20 in the admin client management form

mod_client_manage.html.twig still looped 1..10 for the per-client
custom field editor, so staff couldn't view or edit values for the
new custom_11..custom_20 fields from the admin profile UI.

* Cover all 20 custom fields in the Profile updateClient test

CodeRabbit nitpick: the test payload only exercised custom_11 and
custom_20, unlike the full custom_1..custom_10 coverage it already
had, leaving custom_12..custom_19 untested.
2026-07-06 21:03:54 +01:00
Adam Daley f1f5a41ca3 Add CodeRabbit config for manual reviews (#3908)
* Add CodeRabbit config for manual reviews

* Update cspell.json
2026-07-06 20:09:19 +01:00
Adam Daley 800a7456d8 Stop mapping timers before debugbar collection (#3907)
* Stop mapping timers before debugbar collection

* Fix DebugBar timing PHPStan type

* Refactor timing measure stop checks in Box_App
2026-07-06 19:55:33 +01:00
Adam Daley 9ea2095ce1 Allow admins to edit ticket replies, with edit history (#3906)
* Allow admins to edit ticket replies, with edit history (#2317)

Admins previously had no way to fix a typo or correct a reply without
editing the database directly. Adds an Edit action to admin-authored
messages in the admin ticket view; client-authored messages remain
uneditable so an admin can never alter a client's own words.

Every edit snapshots the message's prior content into a new
support_ticket_message_history table before overwriting it, so the
original wording sent to a client is never silently lost. Admins can
view a message's revision history via a lazy-loaded modal.

Also fixes ticket_message_update, which existed but was never wired
into any UI and skipped the markdown sanitization that ticket_reply
already applies.

* Bump fresh-install last_patch to 83

Fresh installs seed last_patch from content.sql so the patcher doesn't
try to reapply migrations already baked into structure.sql. Missed
bumping this when patch83 (support_ticket_message_history) was added.

* Fix message history modal getting stuck on Loading... after a failed fetch

dataset.loaded was set before the API call resolved, so a failed
request left the modal permanently stuck on "Loading..." with no way
to retry short of a page reload. Move the flag to the success
callback and add an error handler that shows a retryable message.

* Make support_ticket_message_history.support_ticket_message_id required

A history row is meaningless without the message it snapshots; allowing
NULL let orphaned rows exist. Tightened the column in patch84,
structure.sql, and the entity's JoinColumn to NOT NULL.

* Delete message edit history when a ticket is removed

Service::rm() explicitly removes a ticket's notes and messages rather
than relying on the entity mapping's onDelete: CASCADE, because this
schema has no real FK constraints anywhere (referential integrity is
handled at the application layer throughout this codebase). History
rows were missed by that pattern and were left orphaned after a ticket
delete. Now removed alongside their message, following the same
explicit-cleanup convention as notes/messages.

Also cache SupportTicketMessageHistoryRepository via setDi(), matching
every other repository on this service, and add direct coverage for
getMessageHistory().
2026-07-06 19:01:45 +01:00
Adam Daley c207e12313 Skip renewals for pending paid invoice items (#3905)
* Skip renewals with pending paid invoice items

* Add index for pending renewal invoice items

* Adjust invoice_item renewal index definition
2026-07-06 18:13:59 +01:00
Adam DaleyandCopilot Autofix powered by AI 3763246051 Fixes for 2 code quality findings in Twig FOSSBillingExtension tests (#3904)
* Apply suggested fix to tests/Unit/FOSSBilling/Twig/Extension/FOSSBillingExtensionTest.php from Copilot Autofix

Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>

* Apply suggested fix to tests/Unit/FOSSBilling/Twig/Extension/FOSSBillingExtensionTest.php from Copilot Autofix

Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>

---------

Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>
2026-07-06 17:33:35 +01:00