Fix: Persist currency selection on installation validation failure (#2746)
- Move currency session storage before validation steps
- Prevents currency from resetting to USD when database connection or admin validation fails
- Ensures consistent behavior with other form fields
Fix: Prevent add funds invoices from being auto-paid with credits
When paying an add funds invoice via Stripe or PayPal, the payment was
processed successfully but the balance would show as /bin/zsh. This happened
because after adding funds to the client balance, the code would also try
to pay the invoice using credits, effectively canceling out the deposit.
The fix adds a check using the existing isInvoiceTypeDeposit() method to
skip the credit payment for deposit invoices, since funds were already
added directly.
FixesFOSSBilling/FOSSBilling#2988
Added additional Stripe charge statuses to the status mapping, ensuring more accurate transaction status handling for cases such as 'requires_action', 'requires_payment_method', 'requires_confirmation', 'requires_capture', 'processing', and 'canceled'.
* 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.
* Validate `gateway_id` in IPN and transaction creation
Added input validation for `gateway_id` in `ipn.php` to ensure it is a positive integer, returning a 400 error for invalid values. In ServiceTransaction, now checks if the provided `gateway_id` exists in the database and throws an exception if not, logging a warning for invalid gateway IDs.
* Add logger existence check in `ServiceTransaction`
Ensures that the logger is set before attempting to log a warning when an invalid `gateway_id` is encountered. Also removes an unnecessary `gateway_id` entry from test data in `ServiceTransactionTest`.
Wrapped `OR` conditions in SQL `WHERE` clauses with parentheses across multiple service classes to ensure correct logical grouping and prevent operator precedence issues during search queries.
* Initial plan
* Remove unused variables and fix test issues in Invoice ServiceTest
- Remove unused $itemInvoiceServiceMock variable from testGetDi()
- Remove duplicate test data for 'id' => 1 in dataForSearchQuery()
- Remove unused $itemInvoiceServiceMock and fix closure in testToApiArray()
- Remove duplicate setDi() call in testOnAfterAdminInvoiceReminderSent()
- Fix incorrect method call to onAfterAdminInvoiceReminderSent()
Co-authored-by: admdly <2807620+admdly@users.noreply.github.com>
* Fix test: handle both 'email' and 'Email' service names
The onAfterAdminInvoiceReminderSent method calls mod_service('Email')
with uppercase E, but the test closure was only checking for lowercase
'email'. Updated the closure to handle both cases.
Co-authored-by: admdly <2807620+admdly@users.noreply.github.com>
* Fix test: remove return value assertions for void method
The onAfterAdminInvoiceReminderSent method has a void return type,
so the test should not check for a return value. Removed the result
variable and assertions that were expecting a boolean return.
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>
* Apply security and code quality fixes to Invoice Service
- Rename ambiguous variable 'int' to 'search_numeric_id'
- Fix SQL injection in order IDs batch loading with parameterized queries
- Fix SQL injection in product IDs batch loading with parameterized queries
- Replace hard-coded 'unpaid' with Model_Invoice::STATUS_UNPAID constant
- Rename camelCase 'invoiceIdentifier' to snake_case 'invoice_identifier'
Co-authored-by: admdly <2807620+admdly@users.noreply.github.com>
* Improve readability of product lookup logic
Simplify nested ternary operator by extracting product ID lookup into a separate variable for better code readability.
Co-authored-by: admdly <2807620+admdly@users.noreply.github.com>
* Fix PHPUnit test for renamed parameter
Update test expectation to use 'search_numeric_id' instead of 'int' to match the code changes that renamed this parameter for better clarity.
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 Font Awesome from huraga theme and related modules
* Add `aria-hidden` to SVG icons for accessibility
Added the aria-hidden="true" attribute to SVG icons in order button and layout templates to improve accessibility for screen readers.
* Replace jQuery with vanilla JS in `PayPalEmail` adapter
Removes jQuery dependency for auto-redirect functionality by using
document.addEventListener('DOMContentLoaded', ...) instead of .ready()
* Apply suggestions from code review
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
---------
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* fix(deps): update dependency php-debugbar/php-debugbar to v3
* Add `php-debugbar/twig-bridge` and update dependencies
Added `php-debugbar/twig-bridge` to `composer.json` and updated several dependencies to their latest versions, including doctrine/collections, doctrine/orm, dompdf/php-svg-lib, monolog/monolog, php-debugbar/php-debugbar, pimple/pimple, prinsfrank/standards, sabberworm/php-css-parser, symfony/* packages, and others. These updates improve compatibility, security, and feature support.
---------
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Adam Daley <admdly@users.noreply.github.com>
* 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>
* 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>
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.
* 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>
* 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.