Commit Graph
6477 Commits
Author SHA1 Message Date
renovate[bot] 2afd52b2af Lock file maintenance 2026-06-16 05:52:53 +00:00
renovate[bot] cd92d51a6f Update composer:2 Docker digest to e8fdff9 2026-06-16 03:48:28 +00:00
Adam Daley e5ccf2d688 Fix invoice layout and add company logo width (#3778)
Invoice fixes and add company logo width
2026-06-15 18:37:59 +01:00
renovate[bot] 15e846184c Update phpmyadmin:5 Docker digest to 51b7480 2026-06-15 06:05:11 +00:00
renovate[bot] 1e0337c704 Update composer:2 Docker digest to 1c62c57 2026-06-15 02:52:37 +00:00
Adam DaleyandCopilot Autofix powered by AI 7f5de0de88 Fix for 1 code quality finding in Huraga (#3777)
Apply suggested fix to src/themes/huraga/html/partial_pending_messages.html.twig from Copilot Autofix

Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>
2026-06-14 19:53:30 +01:00
Adam Daley d6c2b718ea Refactor API handling and switch to Composer autoload (#3776)
* Remove AntLoader and switch to Composer autoload

* Use DI-provided http_client and remove include_path

* Introduce Api_Dispatcher and refactor Api_Handler

* Add FOSSBilling\Api\Proxy and refactor API dispatcher

* Replace Api_Handler with FOSSBilling\Api\Identity

* Move/rename API base class and update DI key

* Fix Docker Composer autoload build

* Fix Docker runtime autoload paths

* Preserve vendor autoload in Docker runtime

* Fix cron task calls without params

* Fix update autoload fallbacks
2026-06-14 19:28:11 +01:00
Adam Daley bbda2e4cf0 Fix Huraga pending flash message timing (#3775)
Fix Huraga pending message initialization
2026-06-14 16:13:15 +01:00
Adam DaleyandCopilot Autofix powered by AI 98f68a8654 Refactor esbuild helpers and add JS checker with asset optimization (#3774)
* Refactor esbuild helpers and theme builds

* Add JS checker, esbuild splitting, lazy-load assets

* Refactor esbuild scripts; add flag icons

* Fix for pull request finding 'Useless conditional'

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-06-14 15:56:35 +01:00
Adam Daley 0a9c16c528 Add module-level company logo partial fallback (#3773)
Add module logo partial fallback
2026-06-14 15:46:50 +01:00
Adam Daley 1f9a677695 Refactor icon sprite generation and update logo handling (#3772)
* Refactor icon sprite generation and theme builds

* Add svg-sprite to root deps, remove from themes

* Use public_logo_url and logo fallbacks in templates

* Replace xlink:href with href and add icon tools

* Refactor icon sprite build and theme paths

* Replace flag icon styles and update TomSelect

* Replace em dash with colon in update template
2026-06-14 15:13:01 +01:00
FOSSBilling BotandFOSSBilling Bot 638d8a5015 Apply PHP Code Styling & Quality Changes (#3771)
Co-authored-by: FOSSBilling Bot <fossbilling-bot>
2026-06-14 14:15:33 +01:00
Adam Daley d04256f89c Clear stale unpaid_invoice references, and update queries & tests (#3770)
Clear stale unpaid_invoice refs; update queries & tests
2026-06-14 07:07:55 +01:00
Adam Daley 7927792fe1 Enhance API with batch retrieval and admin transaction handling (#3769)
* Set X-Requested-With for same-origin requests

* Add string type hints and update copyrights

* Make addon API output admin-aware

* Admin mark-as-paid: save transaction and mark processed

* Use batch API fetch for order list

* Use batch API retrieval for orders

* Remove hardcoded 'Payment gateway' fallback

* Allow mixed value type for hash filter

* Fix custom admin transaction handling
2026-06-14 03:11:52 +01:00
renovate[bot]andAdam Daley 94893fb315 Update dependency dicebear/core to v10.3.0 (#3768)
* Update dependency dicebear/core to v10.3.0

* Use Style::fromJson to load avatar style

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Adam Daley <admdly@users.noreply.github.com>
2026-06-14 00:56:49 +01:00
renovate[bot] 008c2c18cd Update dependency prinsfrank/standards to v3.16.5 2026-06-13 21:31:01 +00:00
renovate[bot] cf7641a616 Update dependency friendsofphp/php-cs-fixer to v3.95.7 2026-06-13 21:11:03 +00:00
Adam Daley cb412f3e16 Fix admin order templates and enhance PayPalEmail service (#3765)
* Fix admin order templates null and binding checks

* Use Invoice service in PayPalEmail; add defaults/tests

* Guard against undefined permissions and category
2026-06-13 13:10:10 +01:00
renovate[bot] 164ab76889 Lock file maintenance 2026-06-13 02:05:45 +00:00
Adam Daley fbfb7746f4 Render email example and add tests for Twig tags (#3764)
* Render email example verbatim and add test

* Fix typo and prevent raw Twig apply tags in sample

* Update cspell.json
2026-06-13 02:57:32 +01:00
renovate[bot] 450774f6dc Update dependency stripe/stripe-php to v20.2.1 2026-06-13 01:08:52 +00:00
renovate[bot] 7baecf60ff Update dependency pestphp/pest to v4.7.3 2026-06-13 00:47:26 +00:00
Adam Daley 106198ad92 Add legacy IPN query mappings and reorder rules (#3763)
* Add legacy IPN query mappings and reorder rules

* Clarify IPN rewrite comments in .htaccess

* Add ipn.php rewrite rules for bb_* params
2026-06-13 01:46:17 +01:00
renovate[bot] e3a49f5310 Update dependency sass to v1.101.0 (#3761)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2026-06-12 02:47:35 +01:00
Adam DaleyandCopilot Autofix powered by AI b73e4ce09c Replace legacy icons and standardize SVG icon markup (#3758)
* Replace legacy icons and add icon sprite generator

* Update package-lock.json

* Standardize SVG icon markup and fallback

* Render client email as plain text

* Fix for pull request finding 'Unused variable, import, function or class'

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

* Add dedicated email signature for templates

* Fix Huraga SVG sprite theme resolution (#3760)

🐛 Fix SVG sprite theme resolution

---------

Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>
2026-06-12 02:14:40 +01:00
renovate[bot] 402e98617a Update dependency esbuild to v0.28.1 (#3759)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2026-06-12 02:00:06 +01:00
renovate[bot] bbe375226d Update dependency sentry/sentry to v4.28.0 (#3757)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2026-06-12 01:34:03 +01:00
renovate[bot] 7c8a129fff Update phpmyadmin:5 Docker digest to c9f2c37 2026-06-11 20:32:44 +00:00
renovate[bot] 1ca173f5bd Update composer:2 Docker digest to c883af1 2026-06-11 18:54:32 +00:00
Adam Daley c50725cd3a Persist selected period in product configuration (#3754)
* Persist selected period in product config

* Add period default to edgeCaseRequest
2026-06-11 19:44:50 +01:00
Adam Daley 219ad9c79a Enhance email templates and Twig templates with defaults (#3753)
* Quote avatar data URI; add .db-avatar styles

* Pagination partial - require url & append hash

* Use defaults in email templates; add delay msg

* Guard Twig template vars with default()

* Replace arrow fn with static closure in test

* Add defaults to email templates and Twig policy

* Guard Twig templates with default filters

* Assert no strict-variable findings with toBeEmpty

* Guard email templates against missing order data

* Make activated_at null-safe in email templates

* 🐛 Use admin recipient in staff reset emails
2026-06-11 19:19:12 +01:00
Adam Daley 408013d3ea Add rewrite alias for bb-ipn.php to ipn.php (#3749) 2026-06-11 05:40:23 +01:00
renovate[bot] 3baaf2e215 Update dependency dicebear/core to v10.2.0 (#3748)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2026-06-11 05:12:46 +01:00
Adam DaleyandCopilot Autofix powered by AI 261f399361 Fixes for 3 code quality findings in Index (#3740)
* Apply suggested fix to src/modules/Index/templates/client/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/modules/Index/templates/client/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/modules/Index/templates/client/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-06-09 21:34:33 +01:00
renovate[bot] dedb05c078 Update dependency friendsofphp/php-cs-fixer to v3.95.5 2026-06-09 18:21:19 +00:00
FOSSBilling BotandFOSSBilling Bot 3c6ab0bd4f Apply PHP Code Styling & Quality Changes (#3739)
Co-authored-by: FOSSBilling Bot <fossbilling-bot>
2026-06-09 19:17:44 +01:00
renovate[bot] 31ea1d2487 Update dependency dicebear/styles to v10.2.0 (#3738) 2026-06-09 03:53:36 +01:00
renovate[bot] fc80442183 Update shivammathur/setup-php digest to f3e473d 2026-06-08 21:08:33 +00:00
renovate[bot]andAdam Daley 42a5c6b9be Lock file maintenance (#3735)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Adam Daley <admdly@users.noreply.github.com>
2026-06-08 08:04:00 +01:00
Adam Daley 8e34b8f64d Fix button class and restore selected options in currency settings (#3736)
* Use explicit currency and fix button class

* Restore selected options and fix JS in currency settings
2026-06-08 07:43:34 +01:00
renovate[bot] 7cca0bd7a4 Update dependency dicebear/core to v10.1.0 (#3732) 2026-06-08 04:29:06 +01:00
Yağızhan Burak Yakar 9bd64e99a2 Add widget slots to Huraga dashboard (#3734) 2026-06-07 17:05:59 +03:00
Yağızhan Burak Yakar 2cf48e23c8 Fix currency settings throwing on missing sync rates (#3733)
* Fix currency settings throwing on missing sync rates

* Update cspell.json and GOVERNANCE.md

* Escape sync_rate and provider values

* Update cspell.json
2026-06-07 16:32:04 +03:00
Adam Daley 5ecfeb335e Harden templates and API responses against missing data (#3730)
* Guard Activity index template against missing client/staff nested data

The activity log API at Activity/Api/Admin.php:38-49 only injects a
nested 'client' or 'staff' key when the corresponding *_id is set
(via isset() which returns false for null). System events and
client-only events therefore have no 'client' key, while staff-only
events have no 'client' key.

Under strict_variables, '{% if event.client %}' (line 191) throws
"Key 'client' ... does not exist" for any event without a client.

Switch the conditional to event.client_id / event.staff_id (always
present as SQL columns) and add '|default("")' to the nested
event.client.email / event.client.name / event.staff.email / event.staff.name
accesses so deleted-but-referenced records render gracefully.

* Guard Security iplookup template against empty country/asn data

When the GeoIP or ASN lookup fails (IncompleteRecord from MaxMind), the
Service catches and substitutes [] for the missing data. Under
strict_variables, the empty mapping at record.asn / record.country
causes line 48 to throw "sequence/mapping is empty".

Twig's |default filter on a GetAttrExpression compiles to a safe
is-defined check, so it correctly falls through to the placeholder
when the underlying array is empty or the key is missing.

Verified:
- /admin/security/iplookup?ip=192.168.1.1 (private IP, empty asn)
  renders the row with 'Unknown' ASN cells.
- /admin/security/iplookup?ip=8.8.8.8 still renders
  '15169' / 'GOOGLE' / 'United States'.

* Initialize notes/rel arrays in Support toApiArray so templates render without errors

Two related issues surfaced under strict_variables on the admin support
ticket page:

1. toApiArray only set $data['notes'] inside the foreach loop over
   ticket notes. Tickets without any notes therefore had no 'notes' key
   and 'ticket.notes|length' in mod_support_ticket.html.twig:42 threw
   'Key "notes" does not exist'.

2. _getRelDetails returned [] (empty array) when a ticket has no
   related entity. mod_support_ticket.html.twig sets {% set task =
   ticket.rel %} and then accesses task.task, task.type, task.status
   etc. on the next lines. Any access into an empty mapping throws
   under strict_variables.

Fixes:
- Service::toApiArray: always initialize $data['notes'] = [] for admin
  identity so the key is present even when empty.
- Service::_getRelDetails: always return the base structure with all
  fields (id, type, task, new_value, status) set to null when there
  is no related entity. Skip the DB lookups for the non-rel case.

Template hardening (defense-in-depth, in case other code paths return
a different shape):
- mod_support_ticket.html.twig:42: 'ticket.notes|length' -> 'is defined and
  ticket.notes|length'.
- mod_support_ticket.html.twig:222: 'ticket.notes' -> 'ticket.notes|default([])'.
- mod_support_tickets.html.twig:238: same is defined guard.

Verified on dev:
- /admin/support/ticket/1 renders without errors.
- API now returns rel as {id: null, type: null, ...} and notes: [] for
  tickets without related data.
- 1777 local tests pass, PHPStan clean.

* Harden tests and add Twig/ToApi linters

* Remove redundant setAccessible calls in tests

* Update cspell.json word list

* Add UrlAwarePermissiveContainer & trim errors

* Add geoip stub and fix ParserFactory usage

* Enforce and apply parentheses for new expressions
2026-06-06 18:32:19 +01:00
Adam Daley e8db6000ad Simplify tests and suppress notices in renderer (#3729) 2026-06-06 10:49:59 +01:00
Adam DaleyandCopilot Autofix powered by AI 422378d62a Fixes for several code quality findings (#3728)
* Apply suggested fix to src/modules/Theme/Service.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/Theme/Service.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/Theme/Service.php from Copilot Autofix

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

* Capitalize 'View System Information' display_name

* Guard Orderbutton templates against undefined fields

* Use buildThemeConfig instead of _loadTheme

* Fix Theme ServiceTest::deletePreset mock for findOneByExtensionAndScope

The test invokes deletePreset which internally calls getCurrentThemePreset,
which queries findOneByExtensionAndScope on the repository. The test only
mocked deleteByExtensionAndScope (twice), so the unmocked query threw a
Mockery BadMethodCallException.

Add a mock ExtensionMeta that returns the preset name being deleted, so
getCurrentThemePreset resolves to the same preset and both deleteBy calls
fire as the test already expected.

---------

Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>
2026-06-06 09:30:39 +01:00
Adam DaleyandCopilot Autofix powered by AI 7baa28e22f Enhance Twig strict variables handling and improve test coverage (#3721)
* Import template macros and fix invoices tab id

* Handle nulls in Twig extensions and add tests

* Enable Twig strict_variables and add tests

* Improve Twig strict-variables test harness

Fix several undefined-variable issues in admin templates and harden the strict-variables test harness.

- Templates: guard against missing variables by using default() for order_actions and checking header/type in partial_extensions.twig.
- Loader: CombinedTwigLoader now registers theme and module template paths with namespaces (module_area), and includes email template directories.
- Variable collection: VariableCollectorVisitor now collects keys passed via {% embed %} and {% include %} with { ... } so embedded templates get proper stubs.
- Renderer: StrictTemplateRenderer gains better relative template naming for module templates, additional logging for kb_article parsing, and broader classification of render errors as test-infra (typed-return mismatches, NumberFormatter issues, callable/iterable errors, loader quirks) to reduce false positives.
- Tests: add baseline marker files for strict findings, adjust StrictVariablesTest to treat infra findings as informational while failing on real-bug findings, and write findings JSON for review.

Overall these changes reduce noise from the render-everything harness and make the strict-variables suite more robust and actionable.

* Bump test memory limit to 2G via ini_set in bootstrap

The strict-variables render-everything harness parses every FOSSBilling
template and allocates many stubs and AST nodes, which exceeds the
default 128M limit and causes the pest process to exit with 255
mid-suite. Setting the limit in tests/Pest.php means it applies to both
local 'composer test' and CI 'pest --ci' invocations without needing
to modify the workflow file.

* Fix for pull request finding

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

* Fix for pull request finding

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

* Fix for pull request finding

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

* Fix for pull request finding

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

* Fix for pull request finding

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

* Fix for pull request finding

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

* Fix for pull request finding

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

* Scope error_reporting suppression to the render-everything harness

* Replace unsupported 'now' Twig global with 'now'|date filter

The reserved 'now' Twig global is only defined in some contexts and is
not present in the install or admin email-template environments. Under
strict_variables it throws a fatal 'Variable "now" does not exist'
error, which crashes the installer and the email template playground.

Both call sites use the date filter to format the current year, so the
correct fix is to feed the filter a string literal: 'now'|date('Y').
This is the same pattern we used for the admin_default and huraga theme
layouts.

Discovered by hitting the install page on the dev instance after the
strict_variables rollout.

* Make sitemap tolerant of missing product.updated_at

The product guest API (Box\Mod\Product\Service::toApiArray) returns
updated_at only for admin requests, not for guests. The sitemap uses
the guest API, so product.updated_at was always undefined for it.

Before strict_variables this was harmless: the date filter silently
returned null and the template rendered. With strict_variables enabled,
the missing key throws 'Key updated_at does not exist', which
get_custom_page catches and converts to a 404.

Pipe through |default('now') so we fall back to the current date when
the field is missing, while still using the real value when present.

Discovered by the live test 'urls return ok status' failing on sitemap.xml
in CI.

* Remove stray blank line in StrictTemplateRenderer

* Fix four templates for strict_variables Cypress failures

The Cypress tests run against a fresh install with strict_variables
enabled, which catches undefined key access in templates that the
non-strict mode silently allowed.

1. mod_invoice_index.html.twig:432
   productId is a JavaScript variable, not a Twig variable. The
   Twig expression tried to evaluate it server-side and threw
   'Variable productId does not exist'. Build the URL with JS
   template literal interpolation instead.

2. mod_client_profile.html.twig:158
   guest.client_custom_fields is not a real field in the guest
   API response. The current lookup threw 'sequence/mapping is
   empty' when no custom fields exist. Default to an empty
   mapping, then null, and add a truthy guard.

3. mod_support_ticket.html.twig:60
   ticket.rel_type is only populated for tickets linked to an
   order; the guest response omits it otherwise. Default to
   empty string so the comparison still works.

4. mod_support_ticket.html.twig:80
   message.author exposes only name and role for client-side
   messages, no email. Pass through |default('') so the avatar
   function gets a string and renders its fallback.

* Fix client invoice page for strict_variables

The tab labels on the client invoice index reference
unpaid_invoices.total and paid_invoices.total on lines 33/37
to show count badges, but the corresponding {% set %} calls
sit inside the table bodies on lines 53/85. Under
strict_variables this throws 'Variable unpaid_invoices does
not exist' before the lists are ever fetched.

Move both fetches to the top of the content block so the
variables are defined when first read.

* Allow guest checkout rendering under strict vars

* Rename test helper and tweak test expectations

* Guard optional adapter form fields in gateway and build_form templates

The admin payment gateway edit page and the domain registrar build_form
macro both test element[1].description directly in an if condition,
and both read gateway.config[name] / values[name] without a default.
Built-in adapters (Stripe, PayPalEmail, Custom, the Custom registrar)
define form fields with only a label and sometimes validators or
required_when, so on a fresh install the page throws:

  Key 'description' for sequence/mapping with keys 'label, validators'
  does not exist in 'mod_invoice_gateway.html.twig' at line 115.

The outer '?? ''' on the inner expression does not help: the
exception is thrown when evaluating the if condition, not when
rendering the markdown. With strict_variables on, that becomes a 500.

Replace each 'if element[1].description' with the short-circuit
'is defined and ...' pattern already used in the same file for
required_when, and drop the now-redundant '?? ''' from the inner
expression. Guard the gateway.config[name] / values[name] reads
with |default('') (or |default([]) for the iterable check) so
fields that have not been configured yet do not throw on a fresh
or upgraded install.

Verified on the dev instance:
  /admin/invoice/gateway/{1,2}        HTTP 200
  /admin/servicedomain/registrar/{1,2} HTTP 200
PayPal gateway form save+reload round-trips correctly.

* Fix for pull request finding

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

* Fix for pull request finding

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
2026-06-06 08:53:52 +01:00
Adam Daley 09ae454b8f Add id to composer cache mounts in Dockerfile (#3727)
Add id to composer cache mounts in Dockerfile
2026-06-06 06:24:26 +01:00
renovate[bot] 5a30518cbf Lock file maintenance 2026-06-06 04:25:07 +00:00
renovate[bot] 79deb5dc54 Update PHPStan packages to v2.2.2 2026-06-06 03:31:14 +00:00