Skip to content

Firefly III: a personal finances manager

Make sure ff does not create accounts when balance is said to be 0.

James Cole7852b8a78522
diff --git a/app/Http/Controllers/NewUserController.php b/app/Http/Controllers/NewUserController.php
index 870b8ac966..3adfdc2973 100644
--- a/app/Http/Controllers/NewUserController.php
+++ b/app/Http/Controllers/NewUserController.php
@@ -78,14 +78,16 @@ class NewUserController extends Controller
$this->createAssetAccount($request, $repository);
// create savings account
- if (strlen($request->get('savings_balance')) > 0) {
+ $savingBalance = strval($request->get('savings_balance')) === '' ? '0' : strval($request->get('savings_balance'));
+ if (bccomp($savingBalance, '0') !== 0) {
$this->createSavingsAccount($request, $repository);
$count++;
}
// create credit card.
- if (strlen($request->get('credit_card_limit')) > 0) {
+ $limit = strval($request->get('credit_card_limit')) === '' ? '0' : strval($request->get('credit_card_limit'));
+ if (bccomp($limit, '0') !== 0) {
$this->storeCreditCard($request, $repository);
$count++;
}