Commit Graph
84 Commits
Author SHA1 Message Date
Adam Daley 59fae43df5 Fix client sessions, form fields, and error pages (#4011)
* Fix client sessions, form fields, and error pages

* Redirect authenticated clients away from login
2026-07-17 20:03:05 +01:00
Adam Daleyandcoderabbitai[bot] 4035563b72 Simplify API Resolution and Product Accessors Across Modules (#3954)
* Simplify service implementation

* Inject test API containers explicitly

* Update src/modules/Staff/tests/Unit/Api/GuestTest.php

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

---------

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
2026-07-11 13:17:03 +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 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
Yağızhan Burak YakarandAdam Daley 6a03d7db9b #3863 Followup Cleanup (#3879)
* Switch to using InformationException where possible

* Email: Remove dead methods and cleanup

* Extension: Move appropriate logic to the repository

* Support: Remove dead methods and cleanup

* Addressed code review comments

---------

Co-authored-by: Adam Daley <admdly@users.noreply.github.com>
2026-07-04 21:15:20 +03:00
Adam DaleyandCopilot Autofix powered by AI 3e933bbfd4 Enforce manage_settings in extension configuration (#3856)
* Enforce manage_settings for extension config

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

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

* 🔒 Add settings permissions for config modules

---------

Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>
2026-06-28 10:59:44 +01:00
Adam Daley a56767e1fc Fix API permission identity forwarding and IPN subscription/deposit payment handling (#3788)
* Add AbstractApi::checkPermissions and patch71

* Bump last_patch setting to 71

* Add tests for AbstractApi::checkPermissions

* Handle subscription renewals and validate payments

* Add overpayments to cspell word list

* Treat null transaction amounts as 0

* Mark deposit invoices as paid; add unit test

* Test overpayment warnings in validatePaymentAmount
2026-06-16 20:33:47 +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 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
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
Adam Daley dd3dcbfd52 Enhance type safety, authentication checks, and testing framework (#3701)
* Improve type safety, auth checks and PHPStan fixes (#3250)

* Improve type safety, auth checks and PHPStan fixes

* Remove @phpstan-ignore annotations

* Improve type safety, auth checks and PHPStan fixes

* Remove @phpstan-ignore annotations

* Remove redundant @phpstan-ignore comment

* Improve code robustness and reliability (#3248)

* Harden code against null/undefined values

* Update dependency lockfiles

* Sanitize ticket input and use IDs in email list

* Restructure tests and add test utilities

* Move E2E tests to `Library\E2E` namespace

* Update `php-build` action ref in workflows

* Switch tests to Pest and add test scaffolding

* Refactor E2E tests to Pest-style tests

m

Skip E2E tests when env not configured

* Refactor Unit tests and update test config

Add test datasets and refine test helpers

* Add DEBUG guard, fix API JSON decode, update tests

* Refactor tests: add types and Mockery expectations

* Adjust tests, phpstan config, and composer script

* Instantiate test APIs locally, remove beforeEach

* Refactor runtime checks, types & logging

* Apply PHP Code Styling Changes

m

* Add PHPStan ignores, test renames & small fixes

* Enable Pest tests in CI workflow

* Remove legacy tests; add new unit tests/config

* Avoid undefined index in fingerprint comparison

* Ignore properties absent in both fingerprints

* Remove public_ticket_create API method

* Add Fingerprint unit tests

* Remove em dash from fingerprint test name

* Switch to Pest; assorted bug fixes & refactors

* Prefer getDi() and guard DEBUG define

* Refactor tests: DBAL, Antispam rename, helpers

* Refactor email tests to use Doctrine entities

* Update tests, use DBAL mocks & improve Formbuilder admin

* Validate plan_id and update unit tests

* Replace error_log with DI logger and update tests

* Expect db->store in Invoice Service test

* Use DI logger instead of error_log; fix tests

* Fix typo in Hook Service test

* Fix Staff test spelling fixture

* Complete Pest test migration

* Fix Product test spelling fixtures

* Fix Product test spelling fixtures

* Run live tests with Pest and load helpers

* Migrate tests to ApiClient; remove legacy APIHelper

* Fix Email test spelling

* Remove unused PHPUnit bridge

* Organize Cypress end-to-end tests

* Document Pest test directory root

* Remove noisy Pest comments
2026-06-02 07:43:01 +01:00
Adam Daley 6b9f775150 Refactor frontend, build process, and update documentation (#3625)
* Add frontend core, editor adapter & API refactor

* Remove unused Twig macro import and legacy filter

* Move gateway assets to public/gateways

* Include frontend build and assets in Docker image

* Move branding assets to public and refactor build

* Refine update page UI text and styles

* Add 'miterlimit' to cspell word list

* Bump dependencies in composer.lock

* Add esbuild helpers and update imports

* ddev: Node 24, tighten /data & build checks

* Remove .qwen/settings.json

* Docs: expand frontend, build and dev setup

* Add 'docroot' to cspell word list
2026-05-28 12:47:37 +01:00
a7ef873368 Revamp admin UI and improve dashboard layout and functionality (#3596)
* Adjust admin alerts and installer warning

* Make dashboard cards full-height and align badges

* Split dashboard cards into partials and add AJAX

* Replace status badges with ribbon elements

* Revamp activity panel layout and responsiveness

* Adjust dashboard card spacing and styles

* Style dashboard links and adjust chart heights

* Back-to-top: update classes and styles

* Fix client admin UI labels and flags

* Improve API response parsing and errors

* Mark action columns no-sort, add table-hover

* Update table classes for hover and wrapping

* Refactor admin templates to card-header layout

* Update admin templates layout and semantics

* Tidy admin templates; remove tabs, update notice

* Standardize admin alert styles and messages

* Handle null/empty status in status_name macro

* Validate resolved renewal price before invoicing

* Keep IP actions inline in activity table

* Right-align activity pagination controls

* Align pagination and export buttons in admin lists

* Improve admin pagination & per-page defaults

* Extract record selector into partial

* Add tab deep-linking and URL hash persistence

* Refactor search controls & capitalize 'One Time'

* Refactor client search filters and toggle state

* Refactor activity filters UI and tomselect styling

* Redesign admin filters; capitalize 'On Hold'

* Revamp admin filter panels (Invoice & Support)

* Group search clause in Massmailer query

* Add filters and expanded search for pages/gateways

* Add filter panels, refine search logic, tests

* Add advanced search filters for activity modules

* Add structured filters, date/ip search & tests

* Add Email queue filters and admin tab

* Add collapsible filter panel to Staff settings

* Refactor badges to use shared macros

* Add massmailer statuses & boolean badges

* Add search icon and refine search input layout

* Update admin templates layout and markup

* Use modals for creating clients/groups

* Centralize tab header action buttons

* Centralize toolbar actions; add Order modal

* Bump Composer dependencies (lockfile)

* Capitalize 'One Time' payment label

* Return raw API body; use button for search

* Wrap search button in input-group-text

* Make search max width configurable

* Fix malformed aria-label Twig expression in layout_default.html.twig

Agent-Logs-Url: https://github.com/FOSSBilling/FOSSBilling/sessions/c8db6ba9-bda4-413a-989f-e4777e06bd12

Co-authored-by: admdly <2807620+admdly@users.noreply.github.com>

* Fix XSS risk in updateExternalIP: append IP via createTextNode instead of innerHTML concat

Agent-Logs-Url: https://github.com/FOSSBilling/FOSSBilling/sessions/0c435e52-1784-4466-a8dc-c41e12443a6f

Co-authored-by: admdly <2807620+admdly@users.noreply.github.com>

* Refactor New Client modal layout and styles

* Limit and style phone country code field

* Use `country_names` helper and `country_name` filter

* Use Symfony Intl for currencies & locales

* Use Symfony Intl for currencies; drop built-in country lists

* Refactor Currency module API, entity and service

* Remove system checkLimits usages from modules and tests

* Remove `currency.title` column and update APIs

* Add inputmode and maxlength to cspell dictionary

* Fix dropdown toggle accessibility: use button instead of anchor

Agent-Logs-Url: https://github.com/FOSSBilling/FOSSBilling/sessions/b7f9474b-1988-4c08-aec0-f8991edfea71

Co-authored-by: admdly <2807620+admdly@users.noreply.github.com>

* Improve multi-currency handling and installer

* Log currency code when changing cart currency

* Use removeCurrency in Admin API and update tests

* Use Intl currency symbols and fraction digits

* Use currency filters in templates

* Rename currency title to name and update schema

* Remove deprecated Service::getLanguages

* Capitalize system permission labels and fix messages

* Use Symfony Countries and remove phone codes list

* Validate country codes; use country select

* Set fb_locale cookie and fix admin locale display

* Validate locales and add default locale selector

* Use Locales::getNames; tweak language selector CSS

* Tweak header spacing and make nav links icon-only

* Localize client login texts

* Add phone country-code attrs and styles

* Center .modal-dialog in two themes

* Add phone_codes API to list calling codes

* Make form the modal-content wrapper

* Move create forms to Bootstrap modals

* Convert new-item tabs to modals in admin UI

* Revamp admin UI, embed snippets & modal

* Revamp admin settings UI and templates

* Revamp Formbuilder & Redirect admin UIs

* Add 'Segoe' and 'minmax' to cspell dictionary

* Rename warning() to warn() in test logger

* Refactor admin templates to card-based layout

* Expose initAvatars globally and scoped init

* Add 'view' permissions and enforce checks

* Refactor Servicehosting admin UI and scripts

* Add staff permission checks and module permissions

* Refactor admin templates layout and forms

* Add staff permission checks and module perms

* Add staff permission checks and module perms

* Refactor admin Twig templates and UI

* Refactor client admin UI to use summary/form cards

* Refactor admin invoice/subscription/transaction templates

* Refactor Order admin UI; fix country labels

* Refactor admin templates and add IP country filter

* Add 'view' permissions and checks to admin APIs

* Use detail/related partials in admin templates

* Refactor admin product templates to use partials

* Add endembed to cspell ignoreWords to fix spellcheck CI failure

Agent-Logs-Url: https://github.com/FOSSBilling/FOSSBilling/sessions/e8973bef-7364-4b30-8dd8-13701ca15c5d

Co-authored-by: admdly <2807620+admdly@users.noreply.github.com>

* Refactor admin templates to use common partials

* Validate order status, add permission checks

* Center form buttons and add horizontal padding

* Introduce createAdminApi and BBTestCaseContainer

* Refactor admin UI templates and forms

* Run intl compression after composer install

* Disable provenance in buildx outputs

* Revamp admin templates for UI and previews

* Refactor admin templates, pricing UI & styles

* Refactor admin invoice sidebar and SEO settings UI

* Use minor currency units, country list & API fixes

* Rename language selector class to locale-selector

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: admdly <2807620+admdly@users.noreply.github.com>
2026-05-24 23:10:28 +01:00
Adam Daley 53eb4f2fca Refactor Twig environments and extensions (#2752)
* Replace Custom Twig components

Replace custom Twig components with native Twig components, remove unused custom Twig components, and move functionality to macros where appropriate.

m

Update partial_extensions.html.twig

* Update Twig components and migrate to FOSSBilling namespace

* Update Currency module...

* Refactor Twig environment config and loading

* Switch CSRF to cookie-based double-submit

* Add Api Twig extension and restore widget/svg helpers

* Cast language flags; improve JSON parsing

* Add markdown DI service and use in Admin API

* Refactor Twig extensions and markdown, simplify APIs

* Add sandboxed email Twig env, update render APIs

* Fix pagination URL usage and menu class

* Fix HTML markup in email templates

* Use macro for avatars and status badges

* Fix Twig spacing and pagination URL filter order

* Replace Custom Twig components

Replace custom Twig components with native Twig components, remove unused custom Twig components, and move functionality to macros where appropriate.

m

Update partial_extensions.html.twig

* Update Twig components and migrate to FOSSBilling namespace

* Refactor Twig environment config and loading

* Add Api Twig extension and restore widget/svg helpers

* Cast language flags; improve JSON parsing

* Add markdown DI service and use in Admin API

* Refactor Twig extensions and markdown, simplify APIs

* Fix pagination URL usage and menu class

* Fix Twig spacing and pagination URL filter order

* Use `current_theme` global and refactor `period_title`

* Allow markdown and date in email Twig sandbox

* Update email template examples

* Fix Twig URLs, quoting, and logo alt text

* Fix Twig templates: URLs, i18n, search params

* Use `templates/*` directories for module templates

* Tighten Twig sandbox and add tests

* Add Twig environment and template docs to `AGENTS.md`

* Use Symfony Filesystem/Finder and assorted fixes

* Fix ticket reply link fragment concatenation

* Close missing divs in dashboard template

* Use detailed `toApiArray` for client

* Fix module name resolution for email templates

* Regenerate `composer.lock`

* Use `markdown_to_html` filter in admin macro

* Handle null price/quantity and rename test method

* Use `Tools::isHTTPS()` for HTTPS checks

* Add 'area' param to `url` filter and update templates

* Use client area URLs in admin templates

* Use client area and guest API URLs in templates

* Remove client-side invoice delete feature

* Create Twig env via `TwigFactory` for PDF rendering

* Add embedded orderbutton JS and update render

* Add 'srclink' to cspell allowlist

* Use `renderEmailTplString` for email rendering

* Bump twig/markdown-extra to v3.24

* Use `markdown_to_html` for privacy policy

* Escape API JSON, handle null IP, client URLs

* Remove initial admin creation flow

* Handle HTTP failures and make tests robust

* Use `api_url` helper in admin templates

* Use `url` filter for footer link 5

* Add patch53 to remove legacy html templates

* Bump setting last_patch to 53

* Add patch54 to restore legacy email templates

* Use renderEmailTplString for email templating

* Remove redundant else/endif in order template

* Add file-hash cache buster for asset URLs

* Remove raw Twig filter and handle missing modules dir

* Return '-' for future timestamps

* Register and reuse TwigFactory and add CSRF cookie

* Adjust API URL helper and add Twig error handling

* Update composer.lock and package-lock.json

* Add twig_factory to ServiceTest DI

* Use url filter for link_page in template

* Composer - update deps and add markdown-extra

* Remove docblocks and inline comments in `TwigFactory`

* Add patches 53-55 and update `last_patch`

* Add `has_permission` Twig function; exclude `href`

* Remove duplicate network interface form

* Guard removal of legacy dirs; add network input

* Handle null category descriptions in template

* Add Twig adapter env and sandbox policy

* Add 'striptags' to cspell word list

* Update composer.lock (deps updated/removed)

* Sanitize custom payment adapter templates

* Remove redundant legacy API tests

* Bump `last_patch` setting to 56

* Coalesce null before `markdown_to_html`

* Move update patcher to system CLI command

* Remove stray `endif` from recaptcha macro

* Update composer.lock

* Fix extra closing brace in Api ServiceTest

* Fix test errors from main merge

- Remove testGetRequestCount tests (method moved to RateLimiter)
- Remove testGetDi from Staff and System GuestTest (protected method)
- Fix IP error message in testLoginCheckIpException
- Add rate_limiter mock to Staff GuestTest tests that need it

* Fix remaining Staff GuestTest issues

- Add extension service mock for captcha check
- Fix error message from 'User not found' to 'Admin not found'

* Fix Staff GuestTest: update query and add logger mock

* Fix Staff GuestTest: set admin status to active for password reset flow

* Fix stale API calls and inverted required condition

- Notification: replace removed system_string_render with direct output
- Antispam settings: replace |alink/|link with |url/|api_url filters
- build_form macro: fix inverted required condition for non-textarea inputs

* Sanitize JS/data URIs and disable buttons by permission

* Use client login/profile links in support emails

* Encode fb-api JSON and tighten URL sanitization

* Prefer session auth for API key methods

* Remove stray endif and fix template formatting

* Add CSRF token to CSV exports; fix template

* Remove stray endif in currency template

* Make invoice PDF generation return Response

* Fix Twig filters, templates, and form handling

* Remove readonly from anonymous class in test

* Inline DebugBar CSS/JS in renderHead

* Add Bootstrap Tab to global bootstrap

* Capitalize template UI strings

* Use CKEditor API for reply quotes

* Remove WYSIWYG module and move CKEditor to themes

* Bump `last_patch` in install SQL to 59

* Remove Spamchecker module

* Run domain management script only for active orders

* Standardize UI text capitalization & minor fixes

* Remove Spamchecker legacy tests; fix period test

* Rename Spamchecker tests to Antispam

* Restore antispam config in tests; remove fixture

* Refactor Antispam Guest tests for config checks

* Update theme build docs; remove Wysiwyg module

* Remove spamchecker from cspell and tweak comment

* Add spamchecker to cspell word list

* Capitalize 'Update Graphs' button label
2026-05-06 21:02:16 +01:00
b2f4cb8ffa Enhance API rate limiting, validation, and subscription features (#3459)
* Validate redirect paths and targets

* Sanitize guest client data and misc cleanups

* Implement API rate limiting and pruning

* Bump `last_patch` setting to 54

* Add tests for `shouldUseTokenLogin` logic

Add tests to cover logic added in #3451.

* Add order/renewal line config for domain pricing

Resolves #2793.

* Add PayPalEmail adapter subscription test

* Add width/height styling for textarea fields

Resolves #2448.

* Send invoice-created email on approve

Resolves #3012.

* Enforce cumulative cart stock and stockSale

Resolves #3130.

* Centralize subscription period retrieval

Resolves #1035.

* Support wildcard staff permissions (default.all)

Resolves #2376.

* Enable quantity selection and enforce stock max

Resolves #2573.

* Extend order expiry on first paid invoice

Resolves #2864.

* Rate-limit request prefix; invoice & promo fixes

* Update src/modules/Redirect/templates/admin/mod_redirect_settings.html.twig

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

* Update src/modules/Api/Service.php

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

* Update src/modules/Client/Controller/Client.php

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

* Update src/modules/Cron/Service.php

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

* Fix quantity not passed to getOrderLineConfig in createOrder

Agent-Logs-Url: https://github.com/FOSSBilling/FOSSBilling/sessions/669f845c-50c4-4f7e-95cd-f44de162ad72

Co-authored-by: admdly <2807620+admdly@users.noreply.github.com>

* Simplify quantity injection into getOrderLineConfig call

Agent-Logs-Url: https://github.com/FOSSBilling/FOSSBilling/sessions/669f845c-50c4-4f7e-95cd-f44de162ad72

Co-authored-by: admdly <2807620+admdly@users.noreply.github.com>

* Fix rate limit prefix isolation, whitelist headers, and staff controller prefix

Agent-Logs-Url: https://github.com/FOSSBilling/FOSSBilling/sessions/11f3fd58-bb44-46a5-a6cf-0992b038f4a7

Co-authored-by: admdly <2807620+admdly@users.noreply.github.com>

* Enforce promo usage limit and add test

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: admdly <2807620+admdly@users.noreply.github.com>
2026-04-28 22:11:39 +01:00
52081d284a Improved type casting and removed unnecessary parameters (#3431)
* Cast ticket ID to integer

* Added type casting and removed unnecessary $per_page params

* Fixed tests

* Updated ddev PHP and nginx config

* Support ticket validation and upgrade checks

* Add order mock and constants in ServiceTest

* Require active status for API auth and clear tokens

* Validate client/admin sessions against DB

* Invalidate sessions on user status deactivation

* Check locale availability before toggling

* Escape database name properly

* Validate and cast rel_id to int in ticketCreateForClient to prevent TypeError

Agent-Logs-Url: https://github.com/FOSSBilling/FOSSBilling/sessions/ce700346-2168-43cc-8309-fc6baee7cc82

Co-authored-by: admdly <2807620+admdly@users.noreply.github.com>

* Improve rel_id validation error message to include the invalid value

Agent-Logs-Url: https://github.com/FOSSBilling/FOSSBilling/sessions/ce700346-2168-43cc-8309-fc6baee7cc82

Co-authored-by: admdly <2807620+admdly@users.noreply.github.com>

* Fix Notification AdminTest mock expectation to match actual paginateDoctrineQuery call

Agent-Logs-Url: https://github.com/FOSSBilling/FOSSBilling/sessions/2fb587cf-6312-4b98-89e5-10f074646eaa

Co-authored-by: admdly <2807620+admdly@users.noreply.github.com>

* Validate interface and custom interface inputs

* Tighten custom interface hostname validation

* Accept `per_page` in paginated API responses

* Validate HTTP interfaces and normalize upgrades

* Enforce active status and secure config export

* Cast rel_type/rel_task/rel_status to string in SupportTicketValidator to prevent TypeError

Agent-Logs-Url: https://github.com/FOSSBilling/FOSSBilling/sessions/1ecf2bb3-1139-420f-8421-41ae8f6d1d5f

Co-authored-by: admdly <2807620+admdly@users.noreply.github.com>

* Use FILTER_VALIDATE_INT instead of is_numeric for rel_id validation in Service.php

Agent-Logs-Url: https://github.com/FOSSBilling/FOSSBilling/sessions/7bacd505-ba15-42da-8f52-7621afa1d634

Co-authored-by: admdly <2807620+admdly@users.noreply.github.com>

* Validate rel_new_value as a positive integer before using as Product ID in upgrade tickets

Agent-Logs-Url: https://github.com/FOSSBilling/FOSSBilling/sessions/842c7e1c-255b-4f09-8235-f34681e0392b

Co-authored-by: admdly <2807620+admdly@users.noreply.github.com>

* Tighten `sValidHttpInterface` validation

* Add page parameter to pager calls

---------

Co-authored-by: Adam Daley <admdly@users.noreply.github.com>
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: admdly <2807620+admdly@users.noreply.github.com>
2026-04-26 20:30:22 +01:00
Adam DaleyandCopilot Autofix powered by AI 5fceb5a775 Refactor API validation and enhance payment IPN handling with tests (#3432)
* Improve API validation and payment IPN security

* Validate `order_id` param before use

* Fix for PR finding

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

* Set admin transaction source; fix params/tests

* Require non-empty order_id for send_file

---------

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
2026-04-22 19:16:22 +01:00
Adam Daley 435944defa Refactor pagination and API with strict types and validation (#3391)
* Add strict types; refactor pagination, tools & API

* Replace `Box_Paginator` with FOSSBilling `Paginator`

* Clarify paginator comment wording

* Validate JSON response and include HTTP code

* Cast language params to bool and add JSON preview
2026-04-06 22:06:13 +01:00
c382a7a995 Code quality: type hints, method renames, null guards, and test fixes across Formbuilder, Page, Invoice, and Theme modules (#3380)
* Initial plan

* Apply code quality improvements: rename methods, add type hints, fix null checks, improve tests

Agent-Logs-Url: https://github.com/FOSSBilling/FOSSBilling/sessions/7815527d-3f30-486a-9f69-232031ba2d6e

Co-authored-by: admdly <2807620+admdly@users.noreply.github.com>

* Use `isValidFieldType` instead of `typeValidation`

* Allow rendered privacy policy HTML

Remove the Twig escape filter from the company privacy policy output so the HTML produced by the markdown filter is rendered. This change ensures markdown-generated markup displays correctly in the privacy policy card instead of being HTML-escaped.

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: admdly <2807620+admdly@users.noreply.github.com>
Co-authored-by: Adam Daley <admdly@users.noreply.github.com>
2026-03-29 08:49:49 +01:00
FOSSBilling BotandFOSSBilling Bot 41adc03d57 Apply PHP Code Styling & Quality Changes (#3375)
Co-authored-by: FOSSBilling Bot <fossbilling-bot>
2026-03-27 08:50:47 +00:00
Adam Daley 3d51718d83 Capitalise titles in templates (#3374)
Capitalize titles in Twig templates
2026-03-26 07:25:50 +00:00
FOSSBilling Bot 3847ebb216 Apply PHP Code Styling & Quality Changes (#3369) 2026-03-25 00:06:34 +00:00
65a028ef1e Normalize Massmailer filters and migrate to Doctrine entities (#3360)
* Normalize and validate Massmailer filters

* Migrate Massmailer to Doctrine entities

* Add strict typing to Massmailer API and Service

* Use DBAL/Doctrine for modules and add `ExtensionMeta`

* Fix PHPDoc `@return` type mismatch in Massmailer Admin API (#3361)

* Initial plan

* Fix PHPDoc @return type mismatch in Massmailer Admin API

Co-authored-by: admdly <2807620+admdly@users.noreply.github.com>
Agent-Logs-Url: https://github.com/FOSSBilling/FOSSBilling/sessions/bc7567ec-98df-4f54-83b9-06906daa43f1

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: admdly <2807620+admdly@users.noreply.github.com>

* Update src/modules/Redirect/Service.php

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

* Update tests-legacy/modules/Massmailer/ServiceTest.php

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

* Update src/modules/Notification/Service.php

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

* Fix TypeError in Massmailer `create()` when entity ID is null post-flush (#3362)

* Initial plan

* Throw exception when create() returns null ID instead of causing TypeError

Co-authored-by: admdly <2807620+admdly@users.noreply.github.com>
Agent-Logs-Url: https://github.com/FOSSBilling/FOSSBilling/sessions/a842fa3a-e1ff-40b8-b038-30b789ff3499

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: admdly <2807620+admdly@users.noreply.github.com>

* Fix test assertion for DBAL integer return type in Massmailer ServiceTest (#3364)

* Initial plan

* fix: update test assertion to expect int id from DBAL query

Co-authored-by: admdly <2807620+admdly@users.noreply.github.com>
Agent-Logs-Url: https://github.com/FOSSBilling/FOSSBilling/sessions/c18cfc23-4f38-4d1e-8468-03b332a6760d

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: admdly <2807620+admdly@users.noreply.github.com>
Co-authored-by: Adam Daley <admdly@users.noreply.github.com>

* Fix `TypeError` in Massmailer `copy()` and `create()` due to nullable ID return (#3363)

* Initial plan

* Fix nullable ID return type mismatch in Massmailer Admin API copy() and create()

Co-authored-by: admdly <2807620+admdly@users.noreply.github.com>
Agent-Logs-Url: https://github.com/FOSSBilling/FOSSBilling/sessions/b52c3722-adfe-4772-8bb4-628b1b56e989

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: admdly <2807620+admdly@users.noreply.github.com>
Co-authored-by: Adam Daley <admdly@users.noreply.github.com>

---------

Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com>
Co-authored-by: admdly <2807620+admdly@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2026-03-23 22:27:55 +00:00
Adam Daley 691c3f7aa7 Use templates/* directories for module templates (#3347)
* Use `templates/*` directories for module templates

* Update template globs and fix icon path
2026-03-17 21:28:15 +00:00
Adam DaleyandCopilot Autofix powered by AI d3ede6abc4 Fixes for 3 code quality findings in Formbuilder (#3336)
* Apply suggested fix to src/modules/Formbuilder/html_admin/mod_formbuilder_settings.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/Formbuilder/html_admin/mod_formbuilder_settings.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/Formbuilder/html_admin/mod_formbuilder_settings.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-03-17 12:04:22 +00:00
Adam Daley 9513e234c5 Use optional chaining for new-form element (#3335) 2026-03-17 04:58:13 +00:00
Adam Daley 85a49089ad Add URL field type and validation (#3298) 2026-03-09 04:26:39 +00:00
Adam Daley 75a45a4b13 Show field descriptions and adjust form layout (#3297) 2026-03-09 03:43:03 +00:00
FOSSBilling BotandFOSSBilling Bot 1f292eaa8a Apply PHP Code Styling & Quality Changes (#3257)
Co-authored-by: FOSSBilling Bot <fossbilling-bot>
2026-02-19 13:53:24 -08:00
Adam Daley e12fe8229f Improve type safety, auth checks and PHPStan fixes (#3250)
* Improve type safety, auth checks and PHPStan fixes

* Remove @phpstan-ignore annotations

* Improve type safety, auth checks and PHPStan fixes

* Remove @phpstan-ignore annotations

* Remove redundant @phpstan-ignore comment
2026-02-17 07:36:53 +00:00
Adam Daley 0f5ff8847f Improve code robustness and reliability (#3248)
* Harden code against null/undefined values

* Update dependency lockfiles

* Sanitize ticket input and use IDs in email list
2026-02-16 23:48:06 +00:00
Adam Daley 08a3919d96 Refactor Javascript and related API functions (#2725)
* chore: Remove jQuery dependencies and update build system

- Remove jQuery from theme dependencies
- Simplify build configuration
- Update documentation to reflect jQuery removal
- Apply PSR-12 code style formatting
- Replace jQuery with vanilla JS in ClientBalance adapter

* refactor: Complete JavaScript API rewrite with modern architecture

- Rewrite API.js with improved URL handling and CSRF management
- Add reusable utility functions in utils.js
- Remove deprecated jQuery-based bb object
- Update Tom Select integration

* feat: Add Twig API functions for declarative API interaction

- Add fb_api(), fb_api_form(), fb_api_link() Twig functions
- Add asset deduplication to prevent duplicate script/style loading

Note: Dashboard/Index module moved to separate refactor/index PR

* refactor: Integrate new API into theme layouts and core templates

- Update theme layouts to use new API functions
- Convert theme partials and macros
- Update core admin module templates (System, Theme, Wysiwyg, Staff)

* refactor: Update module templates to use new API functions

- Replace data-api-* attributes with fb_api_*() Twig functions
- Remove manual CSRF token handling
- Update all module templates for consistency

Note: Index module excluded (moved to refactor/index PR)

* Remove custom ignore rule from phpstan.neon

Deleted a specific ignore rule for ctype_alnum argument count in src/modules/Extension/Service.php, likely because it is no longer needed or the underlying issue has been resolved.
2026-01-14 19:10:24 +00:00
03c26e5972 Introduce RequiredParams attribute (#2965)
* Introduce RequiredParams attribute

* Use the new RequiredParams attribute instead

* Make sure we are always passing an array

* Fixed tests

* Fixed tests

* Fixed tests

* Fix validation attribute test failures

Added back manual parameter validation to API methods that use
RequiredParams attributes. The attribute validation only works when
methods are called through Api_Handler, but tests call methods directly.

Changes:
- Added checkRequiredParamsForArray calls to methods with RequiredParams
- Updated tests to include validators in DI containers
- Fixed HTTPS URL expectation in Invoice test
- Ensured all 1673 tests pass

This maintains both attribute-based validation (for Handler calls) and
inline validation (for direct calls and tests).

* Fix RequiredParams attribute validation in tests

- Made Api_Handler::validateRequiredParams() public to enable testing
- Added validateRequiredParams() helper method to BBTestCase for test validation
- Updated all failing tests to call validation before API methods
- Added RequiredParams attribute to Servicedomain update() method
- Fixed test expectation message to match actual error message
- All 1673 tests now pass successfully

This completes the RequiredParams attribute implementation by ensuring
tests properly validate required parameters through the attribute system
rather than relying on manual validation calls.

* Remove duplicate manual validation from API methods

Removed checkRequiredParamsForArray calls that were duplicating the
RequiredParams attribute validation. These manual calls are no longer
needed since the Api_Handler now processes the attributes automatically.

Files updated:
- Client/Api/Admin.php: Removed duplicate 'id' validation in update()
- Currency/Api/Admin.php: Removed duplicate 'code' validation in delete()
- Profile/Api/Admin.php: Removed duplicate password field validation in change_password()
- Staff/Api/Guest.php: Removed duplicate email/password validation in login()
- Support/Api/Admin.php: Removed duplicate 'id' validation in kb_category_* methods

All methods now rely solely on the RequiredParams attribute for validation.

* Introduce RequiredParams attribute

* Use the new RequiredParams attribute instead

* Make sure we are always passing an array

* Fixed tests

* Fixed tests

* Fixed tests

* Fix validation attribute test failures

Added back manual parameter validation to API methods that use
RequiredParams attributes. The attribute validation only works when
methods are called through Api_Handler, but tests call methods directly.

Changes:
- Added checkRequiredParamsForArray calls to methods with RequiredParams
- Updated tests to include validators in DI containers
- Fixed HTTPS URL expectation in Invoice test
- Ensured all 1673 tests pass

This maintains both attribute-based validation (for Handler calls) and
inline validation (for direct calls and tests).

* Fix RequiredParams attribute validation in tests

- Made Api_Handler::validateRequiredParams() public to enable testing
- Added validateRequiredParams() helper method to BBTestCase for test validation
- Updated all failing tests to call validation before API methods
- Added RequiredParams attribute to Servicedomain update() method
- Fixed test expectation message to match actual error message
- All 1673 tests now pass successfully

This completes the RequiredParams attribute implementation by ensuring
tests properly validate required parameters through the attribute system
rather than relying on manual validation calls.

* Remove duplicate manual validation from API methods

Removed checkRequiredParamsForArray calls that were duplicating the
RequiredParams attribute validation. These manual calls are no longer
needed since the Api_Handler now processes the attributes automatically.

Files updated:
- Client/Api/Admin.php: Removed duplicate 'id' validation in update()
- Currency/Api/Admin.php: Removed duplicate 'code' validation in delete()
- Profile/Api/Admin.php: Removed duplicate password field validation in change_password()
- Staff/Api/Guest.php: Removed duplicate email/password validation in login()
- Support/Api/Admin.php: Removed duplicate 'id' validation in kb_category_* methods

All methods now rely solely on the RequiredParams attribute for validation.

* Fix RequiredParams validation in tests

- Updated 10 tests to call validateRequiredParams() before API methods
- Fixed error message expectation in Client::update test
- Changed Staff login mock expectations from atLeastOnce to never
  (validation throws before validateAndSanitizeEmail is reached)
- Added missing validator to DI containers in Currency and Support tests
- Fixed http to https in Invoice callback URL test

All RequiredParams validation tests now properly test the attribute system.

* Fix kbHitView mock return type errors

The kbHitView method has a void return type, so mocks should not
specify a return value. Removed willReturn() calls from all kbHitView
mock setups.

Reduced errors from 70 to 64.

* Add location/ directory to gitignore

* Fix all void return type mock errors

Removed willReturn(null) from checkRequiredParamsForArray mocks and other
void methods. These methods have void return types and should not specify
return values in mocks.

Result: All 1673 tests now pass with 0 failures and 0 errors!
Only 30 PHPUnit deprecation warnings remain (not errors).

* chore: stabilize legacy tests after merge from main

- Fix PHPUnit 11 attribute compatibility issues (DataProvider, Group).
- Fix DI container issues in legacy tests by ensuring 'validator' and 'tools' are always available.
- Resolve 'IncompatibleReturnValueException' in mocks due to updated method return types (void, bool, int).
- Fix broken class/namespace references in mocks using 'getMockBuilder' and 'createMock'.
- Restore missing 'deleteLoginHistory' method in Staff Service.
- Remove obsolete Branding module legacy tests.

* chore: fully resolve legacy test failures and restore passing state

- Fixed 'testUninstall' in Extension module by allowing Filesystem injection.
- Restored missing 'deleteLoginHistory' in Staff Service.
- Updated all mocks for 'checkRequiredParamsForArray' to be optional (any()) as it's now handled by attributes.
- Corrected numerous assertions from assertIsArray/assertIsInt to assertTrue for methods whose return type changed to bool.
- Fixed relative class references and namespaces in several legacy tests.

* chore: eliminate all PHPUnit deprecations and resolve final test failures

- Replaced deprecated 'new ServiceTest()' manual instantiation in data providers with string identifiers.
- Updated 'onConsecutiveCalls' usage to use the newer 'willReturn' syntax for multiple values.
- Fixed numerous 'TypeError' and dynamic expectation call issues introduced during refactoring.
- Improved 'Email Service' by moving salt retrieval from static Config to DI container for better testability.
- Resolved all remaining legacy test failures and deprecations.

* Remove unused asset file

Deleted the file at location/Of/Assets/file as it is no longer needed.

* Restore Branding module with service, icon, and manifest

Introduces a new Branding module including the service class, SVG icon, and manifest file. This module allows voluntary display of FOSSBilling references and includes basic module permissions and uninstall functionality.

* Update .gitignore and add .gitkeep for cache directory

Modified .gitignore to properly ignore cache files while allowing the .gitkeep file to be tracked. Added src/data/cache/.gitkeep to ensure the cache directory is present in the repository.

* These were removed in #3026 and seem to be accidentally reintroduced.

* No need to use it here

* Also removed with #3026.

* Also removed with #3026.

* Update dependencies in composer.lock

Bump nette/utils from v4.1.0 to v4.1.1 and react/child-process from v0.6.6 to v0.6.7 in composer.lock to include latest bug fixes and improvements.

* Update service test mocks and improve test setup

Refactored Extension ServiceTest to properly mock getExtensionPath and filesystem exists, ensuring temp directories are created and cleaned up within the test. Updated Invoice ServiceTest to include 'toApiArray' in the list of mocked methods for relevant tests.

---------

Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: Adam Daley <admdly@users.noreply.github.com>
2025-12-24 01:54:13 +00:00
Belle Aerni bbf80a0dff Fix a handful of text strings (#2993)
* Fix a handful of text strings

* Missed a few

* Restored the number sign which has reason to be translated
2025-11-02 10:23:46 -08:00
renovate[bot]andBelle Aerni cd60dba2d8 chore(deps): update dependency league/csv to v9.27.0 (#2977)
* chore(deps): update dependency league/csv to v9.27.0

* Fixed the tests, also ran the cs fix script

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Belle Aerni <belleaerni@gmail.com>
2025-10-17 01:24:37 -07:00
Adam Daley a9b903c222 Codebase modernisation, configuration cleanup, and improved type safety (#2957)
* Refactor tests to replace depreciated functions

* Update Rector config and dependencies

* Rector: Add explicit string casting for stricter type safety

* Rector: Add return type hints to methods across codebase

* Rector: Increase dead code level and refactor invoice item logic

* Remove unnecessary `willReturn` from test mocks

Eliminate redundant `willReturn(null)` and similar calls from PHPUnit mock setups in legacy module tests, leaving only method expectations. Also update some test values to use floats for consistency.

* Refactor API controller and email adapter return values

* Update formatting and guidelines in `AGENTS.md`
2025-10-11 23:39:44 +01:00
Belle Aerni 996ff15a3e Partial revert of added strict types (#2881) 2025-08-29 15:06:49 -07:00
Adam DaleyandCopilot 315f9f3944 Refactor Filesystem and Path handling (#2836)
* Removed legacy files

* Refactor Filesystem and Path handling

* Removed `FOSSBilling\Tools` legacy functions

* Update live-tests to include file check for `php_error.log`

* Update Extension module tables to fix wrapping issue

* Apply suggestions from @Copilot

Co-Authored-By: Copilot <175728472+Copilot@users.noreply.github.com>

* Update Extension module icon URL handling

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-08-09 21:50:11 +01:00
b772526ae3 Replace outdated Twig features with recommended equivalents (#2780)
* Replace Twig `include` tag with function

* Replace Twig `attribute` function with dot operator

* Fix spelling issues in mod_order_manage.html.twig

---------

Co-authored-by: John P <64874788+j-a-pope@users.noreply.github.com>
Co-authored-by: Yağızhan <yagizhan49@protonmail.com>
2025-06-07 11:40:06 +03:00
Yağızhan 00b3b97f66 Make more messages translatable (#2778)
* Make static messages translatable

* Typo

* Second batch

* Make static messages translatable

* Typo

* Second batch

* Applying suggested fixes

* Applying suggested fixes

* Missed this one

* Make documentation section titles untranslatable

* Use double quotes instead of escaping single quotes
2025-06-07 11:34:24 +03:00
d2ad579466 Typos and some untranslatable text (#2773)
* Fix typos and add translatable strings 1

* Fix typos and add translatable strings 2

* Fix typos and add translatable strings 3

* correction

* Load theme settings HTML as Twig template

* Make huraga theme settings translatable

* Update CONTRIBUTING.md

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

* Update src/modules/Cookieconsent/html_admin/mod_cookieconsent_index.html.twig

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

* Update cspell.json

---------

Co-authored-by: Adam Daley <admdly@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-06-05 12:32:15 +01:00
Belle Aerni 368f8cd6ad Bump the year (#2581) 2025-01-23 15:11:53 -08:00
Belle Aerni 3449537c92 Fixed CS / Rector workflow and ran both (#2580) 2025-01-20 16:19:45 -08:00
FOSSBilling BotandFOSSBilling Bot 17d19c28ee Apply PHP Code Styling & Quality Changes (#2333)
Co-authored-by: FOSSBilling Bot <fossbilling-bot>
2024-07-04 13:46:38 -07:00
Belle Aerni 8ac5b00fe9 Misc fixes + product configuration page improvements (#2292)
* Fixed our Rector config. Closes #2272

* Much improved the product configuration page

Fixed a bug and significantly improved the visuals for that page

* Place the period text after the cost

Closes #2242

* Misc changes

* Slightly shrunk the addon buttons, updated cspell
2024-06-04 21:30:59 -07:00
Belle Aerni 303f4cfa2d Code styling & rector config improvements (#2254)
* Bumped the Rector deadcode level

* Added the instanceof setlist

* Increasded type coverage and updated tests config too

* Bumped type coverage & ran PHP-cs-fixer
2024-04-23 10:38:18 -07:00
Belle AerniandJohn @ S4 037acce702 Bulk fix of many grammar / phraseology mistakes (#2166)
* Bulk fix of many grammar / phraseology mistakes

* Small fixes after self-review

* Corrections

* Update mod_currency_settings.html.twig

* Update mod_currency_settings.html.twig

* Update mod_formbuilder_field.html.twig

---------

Co-authored-by: John @ S4 <64874788+John-S4@users.noreply.github.com>
2024-02-27 03:01:07 -08:00
Belle Aerni d771457efc Bump the year (#2167)
* Bump the year

* And fix the spelling
2024-02-25 02:45:38 -08:00
FOSSBilling BotandFOSSBilling Bot 0962197654 Apply PHP Code Styling & Quality Changes (#1994)
Co-authored-by: FOSSBilling Bot <fossbilling-bot>
2023-12-19 08:36:32 -08:00
Belle Aerni da4cd44590 Bugfixes (#1978)
* Fixed public tickets

* Resolved the most common reported errors
2023-12-15 23:26:33 +00:00