Commit Graph
81 Commits
Author SHA1 Message Date
Samuel Apraku 76935bac0a Fix transactions search query (#2010)
* Fix transactions search query

* Fix test
2023-12-26 15:34:15 -08:00
Belle Aerni 59027a10f4 Add a configurable cron API guest endpoint (#1909)
* Add a configurable cron API guest endpoint

* PHPDoc changes

* Fix the test, added a last run check
2023-12-02 18:44:13 -08:00
Belle Aerni e39fad02b6 Fix tests (#1912) 2023-12-01 21:12:58 -08:00
Belle Aerni be36d68f61 Restructure the redirect after login functionality (#1897)
* Restructure the login after redirect functionality

* Initialize the session in the start of the app

* Fix the test

* That 100% needs to come after the fallback patcher
2023-11-29 08:45:55 +02:00
FOSSBilling BotandFOSSBilling Bot f136352b31 Apply PHP Code Styling & Quality Changes (#1865)
Co-authored-by: FOSSBilling Bot <fossbilling-bot>
2023-11-25 02:55:31 +00:00
Belle Aerni 5c7718bf89 Prevent duplicated email logs in DB (#1866)
* Prevent duplicated email logs in DB

Also fixed installer the massmailer module

* Fix the test
2023-11-24 22:42:12 +00:00
Belle Aerni 5bd3ff7751 Begin reworking permission management (#1545)
* Begin reworking permission management

* Tests

* This.. tested functionality that didn't exist in the app

* Fixes

* Added permission checks for the system module

* Implemented extension settings permission

The "extension" settings page will now check for permission before allowing a staff member to even visit the settings page for a client.

FOSSBilling will also check for permission before saving a new config so the API can't be used to bypass this limitation.

I also removed a test as it was checking a function which only ever had one possible return value, no point in updating it to work with this PR

* This should fix the test

* I got a little mixed up with that, but this should work

* Fixed the tests

* Implemented give all & revoke all buttons

* Implemented more, enhancements, & bugfix

* Rename function

* Fix tests

* Optimize, address comment

* Now let's make the tests happy again

* Deduplicate code, cleanup a bit

* Bugfix

* Added selectbox support to the front-end

* Quick bugfix

* Fix issue PHPStan detected

* Bug fix

* Improved page layout & styling

* Implemented more checks

* Fix the tests

* Update error.html.twig

* Cleanup

* Fix the tests

* Updated the design to be more space efficient

* Don't list module access when always given

* Updated the exception type

* setMethod -> onlyMethods

* I donno how that got goofed up

* Fix the test, email module should always be accessible

* Removed the broken test

It's.. not really checking anything anyways. Just that the `extension` module is in a hardcoded array.
2023-11-21 16:18:53 -08:00
Belle Aerni 64edea94c4 Cache extension configs (#1848)
* Cache extension configs

* Adjusted the tests

* Use ArrayAdapter
2023-11-19 01:24:36 +01:00
Belle Aerni add20b6281 Resolve reported errors (#1836)
* Resolve reported errors

* Update ServicePayGatewayTest.php
2023-11-14 19:25:17 +01:00
Belle Aerni 7c36b25763 Remove the generate EU VAT rates button (#1826)
* Remove the generate EU VAT rates button

* Update AdminTest.php
2023-11-14 10:07:56 +01:00
Belle Aerni 50043e6211 Run Rector against our tests (#1761)
* Update rector config to include tests

* Run Rector against the tests

* Delete test-results

* Update .gitignore

* Correctly set the PHP min to 8.1, split the configs

* Corrected PHPDoc

* Deleted tests we can't really get to pass

PHPunit is hard-coded to fail when a class has a return type of `never`, which is the correct return type of our redirect function (and rightfully so).

No way to disable the exception as far as we can tell
2023-11-11 18:41:09 +00:00
Adam Daley 276df9a58e Update PHPUnit to version 10 (#1798)
* Update PHPUnit to version 10

Update composer and CI version of PHPUnit to 10, and migrate XML config to updated schema.

* Update tests for PHPUnit 10

Update tests to replace depreciated functions in PHPUnit 10. Also, remove risky tests which don't assert anything.
2023-11-09 10:43:30 +01:00
Belle Aerni a64b5e6821 Improve email queue behavior (#1789)
* Improve email queue behavior

* Also ensure it works from oldest -> newest

* Update the tests to reflect the changes

* Whoops
2023-11-08 06:49:56 +00:00
Adam Daley 230b10f6ea Replace direct config references with constants (#1768)
* Fix PATH_DATA constant to use config

Update `PATH_DATA` constant to use the `path_data` config option.

* Replace direct config references with constants

Replace direct references to `config.php` file and specific config options in favour of global constants, where available.

* Drop BB prefix on global constants

Rename global constants to drop `BB_` prefix, where appropriate.
2023-11-06 07:55:23 +00:00
Adam DaleyandBelle Aerni b35b2efc52 Merge Kb and Support modules (#1180)
* Merge Kb and Support modules

Merge the Kb and Support modules as they contain related functionality.

* General improvements to Support module UI

Update Support module copy and navigation to be more consistent, and other general improvements.

* This was missed.. and now it's not 😉

---------

Co-authored-by: Belle Aerni <belleaerni@gmail.com>
2023-11-06 04:10:09 +00:00
Belle Aerni 602b537996 Opt-in error reporting via Sentry.io (#1732)
* Began implementing Sentry.io support

* Added to the installer

* Added the ID to the bug report template and UI

* Hook it into our error handler, added the ability to filter by error code

* Attempting to add the DSN via GH actions

* Spelling and making PHPstan happy

* Skip exceptions for various incomplete configurations

Also brings in some of the category suggestions made by @Anuril in #195

* Update tests to account for changes

* Added & renamed exception classes

* Fix tests

* Change a bunch of items to be InformationExceptions

* Use a lighter HTTP client, fixed API error reporting

* I guess that's not needed now?

Arighty then

* Improvements, additional info added

* Update SentryHelper.php

* Improved error logging, added instance ID to error page

Also made it so that errors are correctly sent to Sentry rather than exclusively exceptions

* Make the tests happy

* Added the link, improved wording

Also removed the "performance" part of the reporting as it needs to be added to the front-end and I'm not currently implementing that

* Began implementing UI alerts and info

* Added the ability to toggle, fixed tests, use path constants

* Added some useful info & links to the page

* These should be InformationException

* Fix the automated Sentry DSN entry

* Fix the install number text

* Minor cleanup, converted more to InformationException

* Replaced some direct config references with constants

We have the BB_DEBUG constant to indicate if we have debug mode enabled or not, so we shouldn't be directly referencing it in the config file unless we actually need to do so.

Using the constant means there's less locations to update the reference if the config structure is changed

* Bugfix

* Consistency & fixed a PHPDoc

* Corrections

* We actually do want exceptions thrown here

* Change how we get the instance ID

* Stability improvements

Having support for translatable error pages was proving to be problematic, so I had to remove it.

I also had to update the exception class to handle cases where the trans function wasn't setup yet (needed for the /run-patcher page if an error occurs)

* Missed this change on git

* Also fix the variable names...

* Re-added new deps after rebase

* This should also accept "Error" types

* Added more info to the bug report and removed a dug line

* This wasn't supposed to get renamed

* Updated some missed references to Box_Exception
2023-10-28 18:40:39 -07:00
Belle Aerni e0b84e58a7 Fix and improve cron messages in the admin panel (#1666)
* Fix and improve cron messages in the admin panel

* Add a note that the message is cached for 15 min
2023-10-02 03:32:03 -07:00
Belle Aerni b8d3d35ad2 Significantly improve translation management (#1661)
* Started work on locale disable / enable functionality

* Implemented enable / disable functionality

* Implemented completion bar

* Update the preview workflow to use locale releases

* Fix typos, correct workflow

* Use the latest translation release

* Fix tests

* Fixed typo, removed crappy instructions

* fkn spelling
2023-09-30 22:19:15 +03:00
f2f9701359 Mark as paid now adds funds if the Payment Provider is "Custom". (#1487)
* When you press the "Mark as paid" Button on the invoice, you can now enter a transaction id.
If the Payment gateway of the Invoice is "Custom" and it's enabled, the transaction ID will be used to add transactions that add funds in the amount of the invoice to the customer. Then, it will be marked as paid, just like with any other payment provider.

* Added processTransaction method to the Custom Payment Gateway.
* Fixed tests by removing unnecessary tests for Payment Adapters that don't have the processTransaction method.


---------

Co-authored-by: Christoph Schläpfer <chris+github@cleverly.ch>
Co-authored-by: Belle Aerni <belleaerni@gmail.com>
Co-authored-by: Jaap Marcus <9754650+jaapmarcus@users.noreply.github.com>
2023-09-28 13:14:06 +02:00
Belle Aerni 1881ff7bfb Bump PHPStan analysis level (#1641)
* Bump PHPStan to level 2
2023-09-28 09:06:58 +02:00
Christoph Schläpfer 95cdf9d329 Replaced Bank Clearing Code with BIC / SWIFT Code 2023-09-27 22:10:54 +02:00
Christoph Schläpfer a36695365d Made invoice to be checked against client as well. 2023-09-27 11:23:07 +02:00
Christoph Schläpfer 5cab8a3d8f Added option to configure if the bank information should be displayed on the bottom of every page 2023-09-27 11:14:50 +02:00
Christoph Schläpfer 0c5320b7db Fixed Test 2023-09-27 10:42:24 +02:00
YağızhanandBelle Aerni dbcf9a3ad4 Rewritten bin/prepare & +FOSSBilling_Environment (#1622)
* Rewritten bin/prepare & +FOSSBilling_Environment

* -redundancy

* - unnecessary bits

* nothing much

* Fix inverted logic, use new function in missed location

---------

Co-authored-by: Belle Aerni <belleaerni@gmail.com>
2023-09-22 18:19:02 -07:00
3ee7f29689 Reworked Password-Reset flow (#1627)
* Reworked Password-Reset flow
- No more Passwords sent via E-Mail
- Correct redirects.

* Fixed spelling & last redirect

* Small fixes and updated tests for pw-reset-flow

* Fixed tests for pw-reset-flow

* Fixed tests for the Password reset flow

* Fixed typos, resolved Feedback

* Renamed event before password reset

* Renamed event after password reset

* Tweak a few comments, send the reset email instantly

---------

Co-authored-by: Christoph Schläpfer <c.schlaepfer@datact.ch>
Co-authored-by: Belle Aerni <belleaerni@gmail.com>
2023-09-22 18:15:18 -07:00
Christoph SchlaepferandChristoph Schläpfer 4dd38a0479 Removed random static key in email setVars & getVars (#1629)
* Removed random static key in email setVars & getVars

* Added config mock to Tests, fixed feedback

* Added config mock to Tests, fixed feedback

---------

Co-authored-by: Christoph Schläpfer <c.schlaepfer@datact.ch>
2023-09-22 15:43:36 -07:00
Belle Aerni 3d7132321a Prune the filesystem cache during cron (#1596)
* Prune the filesystem cache during cron

* Something something fix the tests

* Move it to the system module
2023-09-20 00:08:47 +02:00
RonandBelle Aerni 756fab9308 #1342 Fix Email Queue (#1592)
* #1342 fix processing emails from queue

* #1342 fix code style

* #1342 temp fix email send test

* Remove the commented out code as it's not needed

---------

Co-authored-by: Belle Aerni <belleaerni@gmail.com>
2023-09-14 08:27:34 -07:00
Belle Aerni df0c300d23 Remove payment gateways we can't really maintain (#1535)
* Remove payment gateways we can't really maintain

I've moved these to their own separate repos so others can easily contribute to them if needed, however since we can't (and don't plan to) maintain these, it's best to remove them from the main repo and no longer ship them with every installation.
The only known-working one is TwoCheckout which I'll get added to the extension directory

* Fix the tests
2023-08-14 11:03:12 +02:00
Belle AerniandJaap Marcus d2a18581c4 Fix / change invoice incrementation logic (#1474)
* Fix invoice incrementation logic

Co-Authored-By: Jaap Marcus <9754650+jaapmarcus@users.noreply.github.com>

* Oh I hate these tests

* Remove duplicated semicolon

---------

Co-authored-by: Jaap Marcus <9754650+jaapmarcus@users.noreply.github.com>
2023-08-12 02:19:01 +01:00
Christoph SchlaepferandBelle Aerni 7a38450458 Make system version & company info visibility through the guest API configurable (#1504)
* Add feature to hide public FOSSBilling version and Company information

* Cleaned up

* Added Test cases for Version & Company information

* Fixed Authorization Mock

* Fixed Tests so isAdminLoggedIn is false when testing Public Access

* Cleaned up

* Implemented Suggested code and fixed tests.

* Removed manual Version for API.js string and replaced with twig filter "script_tag"

* Added Twig filter for Version and replaced guest.system_version

* Added Message to Admin Settings

* Now let's do all of that, but better

- A filter is the wrong way to get the system version to the front end
- The wording in the admin panel for these settings didn't correctly describe what they did and they had poor grammar
- The version check should be returning a string, not an array & the code can be significantly cleaned up.
- Inverting the behavior of these toggles means that existing installations will continue to have the same behavior as before without us forcibly changing it. Otherwise, we need to introduce a DB patch to add the new values with them being on to match what was the old behavior.
- For new installations, we can pretty safely turn these options off to give a bit more privacy / security and allow them to be turned back on if wanted.
- New installations can keep the current behavior. We will highlight that this feature is added & if it's something the administrator wants, they can adjust the settings for themselves

* Cursed spelling *angry hand movements*

* That should have never been an array to being with

---------

Co-authored-by: Belle Aerni <belleaerni@gmail.com>
2023-08-02 19:40:43 +02:00
Christoph SchlaepferandAnuril e466b0a425 Prevent deletion of Servers, Hosting Plans and TLDs that have active Products. (#1492)
* Started to rework deletion checks so no unintended database issues can arise.

We should really start working with referential integrity, otherwise this will become unmanageable soon.

That would also require things like Taxes be referred to by their IDs, not their names.

https://github.com/FOSSBilling/FOSSBilling/blob/ad94a9f3255801817f393cda36bc0a38796e1eb9/src/install/sql/structure.sql#L575

https://github.com/FOSSBilling/FOSSBilling/blob/ad94a9f3255801817f393cda36bc0a38796e1eb9/src/install/sql/structure.sql#L1365

* Fixed the tests for the _delete functions

* Started to rework deletion checks so no unintended database issues can arise.

We should really start working with referential integrity, otherwise this will become unmanageable soon.

That would also require things like Taxes be referred to by their IDs, not their names.

https://github.com/FOSSBilling/FOSSBilling/blob/ad94a9f3255801817f393cda36bc0a38796e1eb9/src/install/sql/structure.sql#L575

https://github.com/FOSSBilling/FOSSBilling/blob/ad94a9f3255801817f393cda36bc0a38796e1eb9/src/install/sql/structure.sql#L1365

* Fixed the tests for the _delete functions

* Fixed tests

* Fixed tests

* Fixed tests

* Fixed tests

* Fixed testhp_delete tests

* Add words to ignorelist

* Add words to ignorelist

* Fixed count placeholder & cleaned up code

---------

Co-authored-by: Anuril <ta@TAPC01.localdomain>
2023-07-30 20:38:53 +02:00
9e4e3023fa Fixed Password Reset handling (#1365)
* Fixed Passwort Reset handling so the message is the same whether the E-Mail address exists or not.

* Fixed spelling & Test

* Fixed Typo

* Improved Staff PW Reset handling and removed both Exceptions to return true

* Improved grammar & wording

---------

Co-authored-by: Christoph Schläpfer <c.schlaepfer@datact.ch>
Co-authored-by: Anuril <ta@TAPC01.localdomain>
Co-authored-by: Belle Aerni <belleaerni@gmail.com>
2023-07-30 06:58:11 -07:00
Belle Aerni dfcabdd80b Remove the "remember me" checkbox (#1471)
The functionality for this isn't actually implemented and it doesn't work
2023-07-26 08:14:28 -07:00
Belle Aerni 20c23b051e Invalidate existing sessions during PW reset (#1435) 2023-07-20 13:23:44 +01:00
Belle Aerni c83f80cc2d Fix / improve flawed email confirmation system (#1451)
* Fix / improve flawed email confirmation system

* Don't check email confirmation during login

This will prevent them from being able to change it if they had a typo and is not needed now that it's checked on page-load

* Removed the unneeded test
2023-07-18 13:04:39 +02:00
Belle Aerni ee623529ca Minor improvements to cron (#1436)
* Minor improvements to cron

* I swear these tests are high sometimes

Seriously. Why did this check pass before?

* Update Service.php

* Update ServiceTest.php
2023-07-14 17:03:22 +03:00
Belle AerniandJohn @ S4 20e38a162f Exception messages cleanup (#1376)
* Misc exception messages improvements

* Cleanup / improve server manager exceptions

* Tests :)

* Some registrar exception cleanup

* Clean up payment gateway exceptions

* Some other misc improvements

* Update Resellerclub.php

* Fix typo in Namecheap error message

---------

Co-authored-by: John @ S4 <64874788+John-S4@users.noreply.github.com>
2023-07-03 14:54:23 -07:00
Belle Aerni 3dccf978ad Fix some malformed search statements (#1400)
* Fix some malformed search statements

* Fix these stupidly written tests
2023-07-02 22:55:56 +03:00
Jaap MarcusandBelle Aerni 2ddb7438ee Limit "LIMIT" to numbers only + Disable upload theme (#1392)
* Prevent non numeric values being used in limits

Potential abuse for Sql injection
Only allow integers to be used


Adjust exception

* Disable upload assets via Theme pages

File upload was removed in an earlier PR

* Make sure the test run fine

* Fix the tests

* Use limit instead of per_page

* And another fix

---------

Co-authored-by: Belle Aerni <belleaerni@gmail.com>
2023-06-30 22:51:50 +02:00
Belle Aerni 3752db5096 Beef up invoice & ticket hash generation (#1309)
* Beef up invoice & ticket hash generation

* Update test for the new length
2023-06-22 09:51:27 +03:00
Belle Aerni ef0200c45a Fix disabling client signups / email changing (#1347)
* Fix disabling client signups / email changing

* Right - I needed to invert these params for the tests
2023-06-20 05:31:00 -07:00
Belle Aerni b9c35a1747 Replace Box_Session and improve session handling (#1332)
* Replace Box_Session and improve session handling

* Improve weights, capitalize class name correctly

* Make the tests pass, update the SQL structure

* Tweak to the fingerprint class, fix more tests

* Regenerate session IDs when logging in

* Improve readability

* Update ServiceTest.php

* Tweak weights and added Huntr badge to the readme

* Improve readability, add PHPDocs, and updated weight

* Update SECURITY.md
2023-06-19 04:14:29 -07:00
Belle Aerni a02b1b32fe Re-check promo code validity during checkout (#1316)
* Re-check promo code validity during checkout

* Add tools mock to the failing test

* Properly resolve issue with the tests
2023-06-12 06:30:45 +02:00
Belle Aerni b95f92554e Fix logical error in Servicedownloadable module (#1311)
* Fix logical error in Servicedownloadable module

* Fix the tests now
2023-06-12 06:28:36 +02: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
Adam Daley 8708d9d895 Fix error with PHPUnit tests (#1217)
Fix error with PHPUnit tests introduced by changes to `FOSSBilling\Validate` class.
2023-05-08 14:06:09 -07:00
Adam Daley e54569d2cd Introduce namespaces and strict typing for FOSSBilling library classes (#1206) 2023-05-04 01:02:06 +01:00
YağızhanandAdam Daley 4928ebf932 Implemented Monolog (#1155)
* Implemented Monolog

* Doesn't need to look for BB_DEBUG. It won't be logged on prod anyway.

* Doesn't need to be an array

* -Box_LogStream

* Reverted squash

* Fixed a duplicate

* Type hinting

* This got lost in a merge commit

* Kind of distracted today. Good thing squash and merge exists.

* Cleaning

* Rebased composer.json & lockfile

* Enabled the check again

---------

Co-authored-by: Adam Daley <admdly@users.noreply.github.com>
2023-05-02 09:32:40 +01:00