mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-16 01:06:46 +00:00
Simplified some code.
This commit is contained in:
@@ -127,16 +127,15 @@ class PiggyBankController extends Controller
|
||||
$accounts = ExpandedForm::makeSelectList($repository->getAccounts(['Default account', 'Asset account']));
|
||||
$subTitle = trans('firefly.update_piggy_title', ['name' => $piggyBank->name]);
|
||||
$subTitleIcon = 'fa-pencil';
|
||||
|
||||
$targetDate = null;
|
||||
/*
|
||||
* Flash some data to fill the form.
|
||||
*/
|
||||
if (is_null($piggyBank->targetdate) || $piggyBank->targetdate == '') {
|
||||
$targetDate = null;
|
||||
} else {
|
||||
if (!is_null($piggyBank->targetdate) || !$piggyBank->targetdate == '') {
|
||||
$targetDate = new Carbon($piggyBank->targetdate);
|
||||
$targetDate = $targetDate->format('Y-m-d');
|
||||
}
|
||||
|
||||
$preFilled = ['name' => $piggyBank->name,
|
||||
'account_id' => $piggyBank->account_id,
|
||||
'targetamount' => $piggyBank->targetamount,
|
||||
@@ -246,13 +245,13 @@ class PiggyBankController extends Controller
|
||||
'success', strval(trans('firefly.added_amount_to_piggy', ['amount' => Amount::format($amount, false), 'name' => e($piggyBank->name)]))
|
||||
);
|
||||
Preferences::mark();
|
||||
} else {
|
||||
Log::error('Cannot add ' . $amount . ' because max amount is ' . $maxAmount . ' (left on account is ' . $leftOnAccount . ')');
|
||||
Session::flash(
|
||||
'error', strval(trans('firefly.cannot_add_amount_piggy', ['amount' => Amount::format($amount, false), 'name' => e($piggyBank->name)]))
|
||||
);
|
||||
|
||||
return redirect(route('piggy-banks.index'));
|
||||
}
|
||||
|
||||
Log::error('Cannot add ' . $amount . ' because max amount is ' . $maxAmount . ' (left on account is ' . $leftOnAccount . ')');
|
||||
Session::flash('error', strval(trans('firefly.cannot_add_amount_piggy', ['amount' => Amount::format($amount, false), 'name' => e($piggyBank->name)])));
|
||||
|
||||
return redirect(route('piggy-banks.index'));
|
||||
}
|
||||
|
||||
@@ -280,12 +279,12 @@ class PiggyBankController extends Controller
|
||||
'success', strval(trans('firefly.removed_amount_from_piggy', ['amount' => Amount::format($amount, false), 'name' => e($piggyBank->name)]))
|
||||
);
|
||||
Preferences::mark();
|
||||
} else {
|
||||
Session::flash(
|
||||
'error', strval(trans('firefly.cannot_remove_from_piggy', ['amount' => Amount::format($amount, false), 'name' => e($piggyBank->name)]))
|
||||
);
|
||||
|
||||
return redirect(route('piggy-banks.index'));
|
||||
}
|
||||
|
||||
Session::flash('error', strval(trans('firefly.cannot_remove_from_piggy', ['amount' => Amount::format($amount, false), 'name' => e($piggyBank->name)])));
|
||||
|
||||
return redirect(route('piggy-banks.index'));
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user