* 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>
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.
* 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
* 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.
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 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>
* 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>
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>
* 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.
* 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.
* 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>
* 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>
* 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>
* 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>
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.
* 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
* 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>
* 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>
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>
* 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>
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 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>
* 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>
* 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>
* 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>
* 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.
* 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.
* 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().
* 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>