Commit Graph
5740 Commits
Author SHA1 Message Date
renovate[bot] b6b3b01021 chore(deps): update fossbilling/.workflows digest to 11c3d3b 2026-01-06 01:55:25 +00:00
renovate[bot] d73e80cc23 chore(deps): pin dependencies (#3133)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2026-01-05 08:59:00 +00:00
renovate[bot] 74e2e5f097 chore(deps): update phpmyadmin:5 docker digest to 5ef9945 2026-01-02 01:09:56 +00:00
renovate[bot] 5d193cbbed chore(deps): update phpmyadmin:5 docker digest to 11f81b9 2025-12-31 06:26:00 +00:00
renovate[bot] 3cc1362742 chore(deps): update php:8.5-apache docker digest to 6e5cfae 2025-12-31 00:45:40 +00:00
8dc2d0f39b Migrate asset build system from Webpack Encore to esbuild (#3126)
* Migrate asset build system from Webpack Encore to esbuild

Replaces Symfony Webpack Encore with esbuild for frontend asset compilation. Updates documentation, removes related dependencies and config files, and adds esbuild configuration for themes. This modernizes the build process for improved speed and maintainability.

* Remove redundant comments and spinner from build scripts

Cleaned up code by removing unnecessary comments and the spinner utility from esbuild scripts in admin_default and huraga themes. Also simplified logic in API handler, currency entity, currency service, and profile client validator by removing redundant comments and streamlining null/empty checks.

* Add new terms to cspell custom dictionary

Added 'Spriter', 'spriter', 'dataurl', and 'tomselect' to the cspell custom words list to prevent false spelling errors for these terms.

* Potential fix for code scanning alert no. 422: Shell command built from environment values

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>

* Potential 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>

* Potential 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>

* Potential 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>

* Refactor theme build to use custom SASS and PostCSS pipeline

Replaces direct SCSS imports in JS with a custom esbuild pipeline for both admin_default and huraga themes. Adds SASS and PostCSS (autoprefixer) processing via esbuild plugins, improves tilde (~) import resolution, and ensures CSS is post-processed and source maps are handled. This change modernizes and unifies the asset build process, making it more maintainable and extensible.

* Update sass import and flag-icons path in themes

Changed sass import to use namespace import in both admin_default and huraga esbuild.mjs files for consistency. Set $flag-icons-path in huraga _flags.scss to ensure correct path resolution for flag-icons assets.

* Refactor theme CSS build to use vendor bundles

Introduces separate vendor.css files for both admin_default and huraga themes, consolidating third-party CSS imports. Updates esbuild scripts to build and include these vendor bundles, removes tilde (~) importers, and adjusts SCSS to use CSS variables instead of direct SCSS variable imports. Twig templates are updated to load the new vendor.css files, and Huraga's theme variables are migrated to CSS custom properties for better maintainability.

* Update `package-lock.json` with new CKEditor 5 packages

Added and updated multiple @ckeditor/ckeditor5-* packages to version 47.3.0 and related dependencies. This change likely prepares the project for enhanced or new CKEditor 5 features and plugins.

* Refactor theme build scripts and add shared utils

Introduces a new `@fossbilling/frontend-build-utils` package with shared helpers and esbuild plugins for theme builds. Refactors admin_default and huraga esbuild scripts to use these utilities, improving maintainability and reducing code duplication. Removes unused `sprite.js` and updates asset handling. Updates workspace configuration in `package.json` and `package-lock.json`.

* Refactor theme asset build paths and add svg sprite helper

Migrates theme asset outputs to 'assets/build' directories for both admin_default and huraga themes, updating all references and build scripts accordingly. Adds a Twig function for inlining SVG sprites. Updates SQL defaults and patcher for new asset paths. Removes direct jQuery imports from theme JS entrypoints and uses an esbuild inject shim for global jQuery. Also includes minor CSS and manifest adjustments.

* Potential 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 PurgeCSS plugin and integrate with theme builds

Introduced a new PurgeCSS plugin in frontend-build-utils to remove unused CSS from bundled files. Updated package.json and package-lock.json to include PurgeCSS and its dependencies. Integrated the plugin into the esbuild scripts for admin_default and huraga themes to enable CSS purging in production builds.

* Set NODE_ENV=production for frontend build

Ensures the frontend assets are built with production optimizations by explicitly setting NODE_ENV=production during the build step in the release workflow.

* Fix static analysis warning in module directory scan

Updated the type check in the module directory scan to use a null coalescing operator, improving compatibility with static analysis tools like PHPStan.

* Update PHPStan baseline for ctype_alnum argument count

Added a new baseline entry to ignore an argument count warning for ctype_alnum in src/modules/Extension/Service.php.

---------

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>
2025-12-30 09:40:04 +00:00
Adam Daley 660c141210 Remove Dashboard module and related references (#3129)
Deleted the Dashboard module, including its controller, template, icon, and manifest. Removed 'dashboard' from SentryHelper and Extension Service references to reflect the module's removal.
2025-12-30 09:07:08 +00:00
renovate[bot]andAdam Daley 2ae6d2ad42 chore(deps): update dependency phpunit/phpunit to v12 (#3128)
* chore(deps): update dependency phpunit/phpunit to v12

* Update PHPUnit and related dependencies

Upgraded PHPUnit and several related packages (such as php-code-coverage, php-file-iterator, php-invoker, php-text-template, php-timer, and various sebastian/* libraries) to their latest major versions, requiring PHP >=8.3. This ensures compatibility with the latest testing tools and brings in new features, improvements, and security updates.

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Adam Daley <admdly@users.noreply.github.com>
2025-12-30 08:41:18 +00:00
a6a1f16816 fix: variable domain pricing list issue (#3117)
* fix: variable domain pricing list issue

* Update src/modules/Servicedomain/html_client/mod_servicedomain_order_form.html.twig

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

---------

Co-authored-by: Adam Daley <admdly@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-12-30 08:25:27 +00:00
Adam Daley 21da5bb1ea Update API endpoints to fossbilling.net domain (#3122)
Changed API URLs in Update.php from fossbilling.org to fossbilling.net to reflect the updated endpoint locations for version and changelog retrieval.
2025-12-30 08:19:03 +00:00
Adam Daley 136480860b Raise minimum PHP version requirement to 8.3 (#3125)
* Raise minimum PHP version requirement to 8.3

Update all documentation, configuration, Composer requirements, and CI workflows to require PHP 8.3 or higher. Remove `symfony/polyfill-php83` and add `symfony/polyfill-php85`. Adjust installer and requirements checks accordingly.

* Update PHP version and dependencies

Remove PHP 8.5 from CI and workflows, standardizing on PHP 8.3 and 8.4. Update Composer dependencies in composer.json to latest compatible versions for both required and dev packages.
2025-12-30 08:13:04 +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
renovate[bot] 13a5e9a158 chore(deps): update dependency bootstrap to v5.3.8 (#3127)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-12-30 01:28:49 +00:00
renovate[bot] 53855f9f69 chore(deps): lock file maintenance 2025-12-29 00:33:36 +00:00
Adam Daley 38a2d4f8fe Remove opcache extension installation from Dockerfile (#3124)
The steps to configure and install the opcache PHP extension have been removed from the Dockerfile. This may be due to opcache being enabled by default or no longer required for the build.
2025-12-27 23:47:26 +00:00
Adam Daley 407b43505d Add 'Servicemembership' to cspell dictionary (#3123)
Updated cspell.json to include 'Servicemembership' in the list of recognized words to prevent false spelling errors.
2025-12-27 22:53:27 +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
8e4e6bd07a Add Validation for birthday, gender and document type parameters in profile update (#2992)
* Add Validation

* update test

* add migration

* Update src/library/FOSSBilling/UpdatePatcher.php

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

* Update src/modules/Profile/ClientValidator.php

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

* Update src/modules/Profile/ClientValidator.php

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

* update

* Update src/modules/Profile/ClientValidator.php

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

* Update `last_patch` setting value to 46

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

---------

Co-authored-by: blackholered <blackholered@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: enigmaticious <enigmaticious@users.noreply.github.com>
Co-authored-by: Adam Daley <admdly@users.noreply.github.com>
2025-12-27 22:34:04 +00:00
renovate[bot] c944fa09fd chore(deps): update dependency php-debugbar/php-debugbar to v2.2.6 2025-12-27 01:52:38 +00:00
renovate[bot] e4362ac667 chore(deps): update dependency rector/rector to v2.3.0 (#3121)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-12-26 17:29:17 +00:00
Yağızhan Burak YakarandAdam Daley 977bf4a255 Reworked Box_Mod into FOSSBilling\Module (#2754)
* Reworked Box_Mod into FOSSBilling\Module

* Tests

* Tests

* Tests

* Remove legacy integration tests

* Replace `Box_Mod` with `FOSSBilling\Module` in `ServiceTest`

Updated the `ServiceTest` to instantiate `FOSSBilling\Module` instead of `Box_Mod` when mocking modules. This aligns the test with the current module class implementation.

* Fix test class name and resolve merge conflicts in tests

Renamed ModuleTest to FOSSBilling_ModuleTest for consistency. Cleaned up ServiceTest by resolving merge conflicts, updating mock class references, and consolidating deactivate tests for module and hook extensions.

---------

Co-authored-by: Adam Daley <admdly@users.noreply.github.com>
2025-12-24 03:53:09 +00:00
renovate[bot] 7eb40c8754 chore(deps): update php docker tag to v8.5 (#3050)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-12-24 03:18:20 +00:00
Yağızhan Burak YakarandAdam Daley f23f1e1bca Add order and product information variables to invoice emails and PDFs (#3065)
* Added order and product information to invoice emails

* Also expose product type

* Consistency

* Update src/modules/Invoice/Service.php

* Fix misplaced order info block in invoice service

Moved the block that adds order information for email templates to the correct location within the Service class. This ensures order data is properly populated in the result array.

---------

Co-authored-by: Adam Daley <admdly@users.noreply.github.com>
2025-12-24 02:46:13 +00:00
b41aad26ce Migrated the Currency module to Doctrine (#2963)
* Migrated the Currency module to Doctrine

* Caching and other improvements

* Types, error handling and other improvements

* Don't return false but throw an exception

* Types

* Refactor currency model usage to new Currency entity

* Remove Fastnetmon submodule

Deleted the Fastnetmon submodule from src/modules. This change may be part of a cleanup or migration away from using Fastnetmon as a submodule.

* Refactor currency API admin get test

* Fix failing Currency-related tests after Doctrine migration

Updated test files to work with the new Doctrine-based Currency implementation.

* Refactor currency retrieval to use repository

* Refactor Currency database handling in several services and tests

* Replace anonymous class mocks with standard PHPUnit mocks in Invoice tests (#3037)

* Refactor currency retrieval and currency service

* Apply suggestions from code review

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

* Confirm updateCurrencyRates() method signature alignment (#3034)

* Add null check for currency in Cart::toApiArray to prevent fatal error (#3035)

* Initial plan

* Add null check for currency in toApiArray method

Co-authored-by: admdly <2807620+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>

* Initial plan

* Replace anonymous class mocks with standard PHPUnit mocks for consistency

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

---------

Co-authored-by: Adam Daley <admdly@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com>
Co-authored-by: admdly <2807620+admdly@users.noreply.github.com>

* Fix incorrect getRateByCode call in Order service (#3039)

* Initial plan

* Fix getRateByCode call and add null check with proper exception

Co-authored-by: admdly <2807620+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>

* Fix silent failure in Currency::getBaseCurrencyRate when currency not found (#3040)

* Initial plan

* Throw exception when currency not found in getBaseCurrencyRate

Co-authored-by: admdly <2807620+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>

* Use FOSSBilling\Exception for currency conversion rate failures (#3041)

Use FOSSBilling\Exception for conversion rate fetch failures

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

* Remove problematic reflection usage in Cart service tests (#3042)

Remove problematic reflection usage in Cart test

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

* Update tests-legacy/modules/Cart/Api/GuestTest.php

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

* Update src/modules/Currency/Service.php

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

* Update src/modules/Currency/Entity/Currency.php

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

* Use FOSSBilling\Exception for null currency check in Cart service (#3058)

* Initial plan

* Use FOSSBilling\Exception for null currency check in Cart service

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

* Use consistent error message for default currency not found

Co-authored-by: admdly <2807620+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>

* Remove silent fallback in CurrencyRepository::findDefault() (#3057)

* Add logging for default currency fallback behavior

- Log warning when no default currency is found and falling back to ID 1
- Log critical error when neither default currency nor ID 1 exists
- Clarify return type documentation
- Cache result even if null to avoid repeated warnings

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

* Remove silent fallback to currency ID 1 in findDefault()

Instead of silently falling back to currency ID 1 when no default
is found, the method now returns null and lets callers handle it.

This addresses the feedback about the silent fallback hiding
configuration issues. All existing callers already properly handle
null by throwing exceptions, so this change makes the error
visible rather than hidden.

Benefits:
- No silent failures hiding misconfiguration
- Cleaner separation of concerns (repositories for data access only)
- Better adherence to Doctrine repository pattern
- All callers already handle null appropriately

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

* Remove redundant documentation in findDefault()

Simplified @return annotation to avoid redundancy with the description.

Co-authored-by: admdly <2807620+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>

* Fix Currency entity getId() to handle uninitialized state (#3059)

Make Currency::getId() return nullable int to prevent runtime errors

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

* Remove static cache from CurrencyRepository to fix long-running process issues (#3061)

* Initial plan

* Remove static cache from CurrencyRepository to fix long-running process issues

Co-authored-by: admdly <2807620+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>

* Fix inconsistent null handling in CurrencyRepository::getRateByCode callers (#3062)

* Fix null handling in Invoice/Service.php getRateByCode call

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

* Fix Invoice test to mock getRateByCode with valid return value

Co-authored-by: admdly <2807620+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>

* Refactor Qwen `settings.json` structure and update version

* Verify null handling consistency in CurrencyRepository::getRateByCode (#3073)

Initial plan

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

* Update src/modules/Order/Service.php

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

* Update src/modules/Currency/Service.php

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

* Update src/modules/Currency/Repository/CurrencyRepository.php

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

* Update src/modules/Currency/Service.php

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

* Update src/modules/Currency/Service.php

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

* Improve return type annotation for Currency Admin API get_pairs method (#3075)

* Initial plan

* Improve return type annotation for get_pairs method in Currency Admin API

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

* Fix return type description to accurately reflect the return format

Co-authored-by: admdly <2807620+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>

* Fix nullable type inconsistency in Currency entity setCode/getCode methods (#3074)

* Initial plan

* Fix nullable type in Currency entity setCode and getCode methods

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

* Fix PHPUnit test failures by updating mock return values for getCode

Co-authored-by: admdly <2807620+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>

* Restore deleted Cart API Guest tests for Doctrine Currency migration (#3076)

* Initial plan

* Restore deleted Cart API Guest tests and update for Doctrine Currency migration

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

* Fix testAddItemSingle mock to return boolean instead of cart object

Co-authored-by: admdly <2807620+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>

* Refactor currency handling in `Cart` and `Invoice` services

Updated `Cart` and `Invoice` services to consistently use `CurrencyRepository` for retrieving currency entities and default currency. Improved error handling for missing currencies and updated related tests to mock new repository methods. Also fixed minor typos and improved code clarity in tests.

* Refactor currency handling in `Cart` Service

Replaced direct property access of currency code and conversion rate with getter methods in `Cart` Service. This improves encapsulation and consistency when handling currency-related operations.

* Update src/modules/Cart/Service.php

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

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

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

* Update src/modules/Currency/Service.php

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

* Update src/modules/Currency/Entity/Currency.php

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

* Fix exception signature and type hint in `Currency` service

Updated the exception thrown in `validateCurrencyForma`t to include a null second parameter for compatibility. Also added a return type to the closure in `Cart` `ServiceTest` for better type safety.

* Refactor currency selection logic in `Cart` Service

Improves clarity by separating client currency retrieval and default currency fallback. Ensures that the default currency is only checked and exception thrown if both client and default currencies are unavailable.

* Add precision handling and caching for Currency conversionRate property (#3082)

* Add documentation and caching for conversionRate precision handling

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

* Use sprintf for float-to-string conversion to avoid scientific notation

Co-authored-by: admdly <2807620+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>

* Fix Doctrine identity map caching issue when changing default currency (#3081)

* Fix Doctrine identity map caching issue in setAsDefault method

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

* Store currency code before clearing identity map to avoid detached entity access

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

* Fix PHPUnit test for setAsDefault method by mocking findOneByCode and clear

Co-authored-by: admdly <2807620+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>

* Refactor currency test mocks for static data providers

Replaces direct mock object creation in static data providers with string flags or placeholders, enabling proper mock instantiation within test methods. Updates test signatures and logic to handle these flags, improving test maintainability and compatibility with PHPUnit static context constraints.

---------

Co-authored-by: Adam Daley <admdly@users.noreply.github.com>
Co-authored-by: Claude <noreply@anthropic.com>
Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: admdly <2807620+admdly@users.noreply.github.com>
2025-12-24 02:28:57 +00:00
renovate[bot] 28947b010d fix(deps): update dependency stripe/stripe-php to v19 (#3033)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-12-24 02:00:57 +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
renovate[bot] d64918effd chore(deps): update php:8.4-apache docker digest to fdf06fd 2025-12-24 01:22:42 +00:00
Adam Daley b79cd4c610 Improve test isolation by using temp directories and files (#3120)
* Improve test isolation by using temp directories and files

Updated legacy ServiceTest classes for Extension, System, and Theme modules to use temporary directories and files for better test isolation and cleanup. This prevents side effects on the filesystem and ensures tests do not interfere with existing data or configuration.

* Improve test isolation by using temp directories and files

Updated legacy ServiceTest classes for Extension, System, and Theme modules to use temporary directories and files for better test isolation and cleanup. This prevents side effects on the filesystem and ensures tests do not interfere with existing data or configuration.
2025-12-24 01:21:10 +00:00
renovate[bot] 15db59c7a7 chore(deps): update dependency bootstrap to v5.3.8 (#3119)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-12-24 00:53:04 +00:00
8f0ac09d2f Create a new onEveryEvent event (#2918)
* Create a new onEveryEvent event

* Pass more data with onAfterClientSignUp, not just the ID

* Pass more details with invoice events

* Revert this one as passing $new would actually pass the new refund invoice with a different ID.

* Fixed tests

* Update src/library/Box/EventDispatcher.php

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

---------

Co-authored-by: Adam Daley <admdly@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-12-24 00:42:29 +00:00
Adam DaleyandYağızhan Burak Yakar 5ef7d5a07b Update central alerts API endpoint URL (#3109)
Changed the central alerts API URL from fossbilling.org to api.fossbilling.net to use the new endpoint.

Co-authored-by: Yağızhan Burak Yakar <yagizhan49@protonmail.com>
2025-12-23 18:05:02 +03:00
renovate[bot] 7a3fc34091 chore(deps): update dependency sass-embedded to v1.97.1 2025-12-23 10:50:34 +00:00
renovate[bot] 833d9959e4 chore(deps): update dependency sass to v1.97.1 2025-12-23 06:09:53 +00:00
renovate[bot] 3a644d1a49 chore(deps): update phpmyadmin:5 docker digest to 0266600 2025-12-23 02:36:46 +00:00
renovate[bot] 5b216a4adc chore(deps): lock file maintenance 2025-12-22 10:55:59 +00:00
renovate[bot] 1ee68ba542 chore(deps): update dependency webpack to v5.104.1 2025-12-22 05:28:04 +00:00
renovate[bot] 0c4ce3f2bb chore(deps): update dependency php-debugbar/php-debugbar to v2.2.5 2025-12-22 01:56:15 +00:00
renovate[bot] eb668eef7b chore(deps): update dependency sass-embedded to v1.97.0 (#3114)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-12-21 06:41:14 +00:00
renovate[bot] 99f367400d chore(deps): update dependency webpack to v5.104.0 (#3115)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-12-21 01:41:18 +00:00
renovate[bot] f235089208 chore(deps): update dependency sass to v1.97.0 (#3113)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-12-21 01:33:47 +00:00
renovate[bot] be7013847f chore(deps): update dependency doctrine/orm to v3.6.0 (#3112)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-12-21 01:24:59 +00:00
renovate[bot] a7b254c6a5 chore(deps): update dependency esbuild to v0.27.2 2025-12-20 04:26:28 +00:00
renovate[bot] 916d29d41d chore(deps): update php:8.4-apache docker digest to ad0dd03 2025-12-20 01:55:05 +00:00
renovate[bot] f7a2a49b37 chore(deps): update dependency mattketmo/email-checker to v2.5.0 (#3111)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2025-12-19 06:46:36 +00:00
renovate[bot] e34185a008 chore(deps): update phpmyadmin:5 docker digest to 92928ad 2025-12-19 02:34:53 +00:00
renovate[bot] 0744a75d2d chore(deps): update dependency bootstrap to v5.3.8 (#3110) 2025-12-18 22:58:41 +00:00
renovate[bot] 908a94e535 chore(deps): update dependency friendsofphp/php-cs-fixer to v3.92.3 2025-12-18 15:13:52 +00:00
renovate[bot] 8e37094dbf chore(deps): update dependency twig/twig to v3.22.2 2025-12-18 10:17:01 +00:00
renovate[bot] 007bf2178c chore(deps): update dependency autoprefixer to v10.4.23 2025-12-18 05:45:53 +00:00
renovate[bot] 35bf1d3d72 chore(deps): update github/codeql-action digest to 5d4e8d1 2025-12-18 02:11:50 +00:00