Commit Graph
17 Commits
Author SHA1 Message Date
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 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
renovate[bot]andAdam Daley 23641e1dde chore(deps): update streetsidesoftware/cspell-action digest to 24fa8d3 (#3134)
* chore(deps): update streetsidesoftware/cspell-action digest to 24fa8d3

* Update PHPStan config to ignore `ctype_alnum` argument count

Added a new ignore rule in `phpstan.neon` for the 'Function ctype_alnum invoked with 1 parameter, 0 required' message in src/modules/Extension/Service.php. Minor formatting change in `phpstan-baseline.neon`.

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Adam Daley <admdly@users.noreply.github.com>
2026-01-09 15:03:10 +00:00
f27d2e3646 Fix downloadable products (#2822)
* Fixed Downloadable product issue where the product config was overwritten if the settings were saved.

* Ran phpstan & cs-fixer

* Added pdate function to fix products where possible

* Fixed uploading new files when the config is broken.

* Added fix to updater

* Removed superfluous line

* Bump Last Patch Level to Fix Live Tests

* Clean up file download response headers and fix `json_decode` usage

* Handle null config in saveProductConfig and sendProductFile

* Apply suggestion from @Copilot

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

* Fix file upload path and improve error handling

* Refactor file update logic in Service class

Replaces inline update of the servicedownloadable record with a call to updateProductFile, improving code organization and maintainability.

* Update `last_patch` setting to version 48

Incremented the 'last_patch' value in the settings table from 47 to 48 to reflect the latest patch version.

* Improve downloadable product filename recovery in patch

Enhanced patch 48 in UpdatePatcher to more robustly recover missing filenames for downloadable products by checking both order configs and service_downloadable records, updating all related data sources, and cleaning up orphaned records. Added detailed statistics logging for the recovery process. Also removed an obsolete PHPStan ignore rule for polyfilled ctype functions.

* Add required param validation to config_save method

Introduced explicit required parameter validation for the 'id' field in the config_save method of the Admin API. This ensures that a missing product ID is caught early with a clear error message.

* Refactor file handling and patch logic for downloadable products

Simplifies and streamlines the patch logic for recovering lost filenames in downloadable products, removing verbose statistics and redundant comments. Refactors file upload error handling in Servicedownloadable Service to use a dedicated error message method and eliminates unnecessary try/catch blocks. Updates Admin API to use attribute-based required parameter validation for product file downloads.

* Update src/modules/Servicedownloadable/Service.php

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

* Apply suggestions from code review

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

* Refactor Servicedownloadable Admin API param validation

Removed redundant manual required param validation in Admin API methods in favor of attribute-based validation. Updated related tests to reflect this change and added more comprehensive tests for file sending scenarios. Also updated HTML form element IDs for clarity.

* Remove redundant test for missing product ID in config save

Deleted the testConfigSaveMissingId test from AdminTest.php as it is no longer needed. This streamlines the test suite by removing duplicate or unnecessary validation checks.

---------

Co-authored-by: Chris Schläpfer <c.schlaepfer@datact.ch>
Co-authored-by: Adam Daley <admdly@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-12-30 04:05:30 +00:00
01612b9146 Dropped Paidsupport and Servicemembership (#3066)
* Dropped the "Paidsupport" module

* Patch to migrate existing orders and products to "custom"

* Dropped the "Servicemembership" module

* Update src/library/FOSSBilling/UpdatePatcher.php

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

* Update src/library/FOSSBilling/UpdatePatcher.php

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

* Improve PHPStan compatibility and static analysis

Added a PHPStan ignore pattern for polyfilled ctype function parameter count errors. Updated Extension Service to explicitly check variable type before calling ctype_alnum, aiding static analysis tools like PHPStan.

* Remove polyfill-php72 and update dependencies

Removed 'symfony/polyfill-php72' from composer.json replace section. Updated composer.lock with new versions of league/csv, php-debugbar/php-debugbar, phpunit/php-code-coverage, and rector/rector.

* Update `last_patch` setting to version 47

Incremented the 'last_patch' value in the settings table from 46 to 47 to reflect the latest patch version.

---------

Co-authored-by: Adam Daley <admdly@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-12-27 22:42:37 +00:00
renovate[bot]andBelle Aerni 96fa36b3e3 chore(deps): update dependency rector/rector to v2 (#2545)
* chore(deps): update dependency rector/rector to v2

* Updated PHPStan and related deps

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Belle Aerni <belleaerni@gmail.com>
2024-12-17 12:20:41 -08:00
Belle Aerni 1881ff7bfb Bump PHPStan analysis level (#1641)
* Bump PHPStan to level 2
2023-09-28 09:06:58 +02:00
Belle Aerni 8c047bc0da Fix to allow analysis to run against the installer (#1633) 2023-09-25 22:02:57 +03:00
Adam Daley 0e5109a0a5 Refactor System Updater (#1252)
* Refactor System Updater

Refactor Box/Update to clean things up, merge related functionality, improve error checking, and move to FOSSBilling namespace.

Also refactor foss-update.php into core class, `UpdatePatcher`.

* Refactor file system actions to use Symfony Filesystem

Refactor file system actions to use Symfony Filesystem component, and declare all used resources at start of files rather than duplicating throughout.
2023-05-26 15:30:39 +01:00
Belle Aerni ba51391731 Fix currencylayer (#985)
* Fix currencylayer

* Fix PHPStan and from currencies other than USD

* Add back European Central Bank

* Use placeholders
2023-03-24 00:56:28 -07:00
Adam de0bed20ec Replace various HTTP client implementations with symfony/http-client (#861)
* Replace guzzlehttp/guzzle with symfony/http-client

Replace guzzlehttp/guzzle with symfony/http-client to standardise around one globally available HTTP client.

* Replace Box\Curl library and native cURL with symfony/http-client

Replace the Box\Curl library and native cURL with symfony/http-client to standardise around one well supported HTTP client, reduce unnecessary code, and improve compatibility.

* Remove obsolete functionality from Spamchecker module

Remove obsolete functions from Spamchecker module which depended upon cURL.
2023-03-15 11:11:28 +01:00
Belle Aerni 7ecaf786d5 Move RedBeanPHP to composer (#767)
* Move RedBeanPHP to composer

* Remove missed references to rb.php

* This *should* fix the tests

* Update DummyBean.php

* Remove payment adapter tests

They.. honestly didn't test much and are proving to cause issues when moving rb.php to composer
2023-02-05 08:43:37 -08:00
Belle Aerni 8f168f138b Translation work
Added plural translation functionality, fixed the usage of placeholders, and cleaned up the functions
2023-01-26 15:02:57 -08:00
Belle Aerni 429e9c671d Make PHPStan ignore the rector file 2023-01-12 00:50:13 -08:00
Belle Aerni 3011c8a4b0 Move PHPStan to it's own action & bump the scanning level (#629)
* Move PHPStan to it's own action

* Bump PHPStan to level 1

* This fix it?

* Update Box_MailTest.php

* And fix a typo in the action

* Update phpstan.yml

* Update phpstan.yml

* Test
2022-12-28 04:32:17 -08:00
Belle Aerni 7f99078664 Update phpstan.neon 2022-12-19 13:03:35 -08:00
Belle Aerni 1bb7dc2fd0 Introduce PHPStan 2022-12-19 12:54:12 -08:00