mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-09-21 19:47:48 +00:00
Some extensions to budgets.
This commit is contained in:
@@ -160,6 +160,16 @@ class BudgetController extends Controller
|
||||
$periodEnd = $end->formatLocalized($this->monthAndDayFormat);
|
||||
$accounts = $accountRepository->getAccounts(['Default account', 'Asset account', 'Cash account']);
|
||||
|
||||
/**
|
||||
* Warn user if necessary
|
||||
*/
|
||||
$range = Preferences::get('viewRange', '1M')->data;
|
||||
$repeatFreq = Config::get('firefly.range_to_repeat_freq.' . $range);
|
||||
$userWarning = '';
|
||||
if (session('is_custom_range', false) === true) {
|
||||
$userWarning = strval(trans('firefly.warn_range_' . $repeatFreq));
|
||||
}
|
||||
|
||||
/**
|
||||
* Do some cleanup:
|
||||
*/
|
||||
@@ -187,7 +197,7 @@ class BudgetController extends Controller
|
||||
'budgetMaximum', 'periodStart', 'periodEnd',
|
||||
'period', 'range', 'budgetIncomeTotal',
|
||||
'defaultCurrency', 'inactive', 'budgets',
|
||||
'spent', 'budgeted'
|
||||
'spent', 'budgeted', 'userWarning'
|
||||
)
|
||||
);
|
||||
}
|
||||
|
@@ -9,6 +9,7 @@ use FireflyIII\Models\Tag;
|
||||
use FireflyIII\Repositories\Account\AccountRepositoryInterface as ARI;
|
||||
use FireflyIII\Repositories\Tag\TagRepositoryInterface;
|
||||
use Input;
|
||||
use Log;
|
||||
use Preferences;
|
||||
use Route;
|
||||
use Session;
|
||||
@@ -33,8 +34,17 @@ class HomeController extends Controller
|
||||
public function dateRange()
|
||||
{
|
||||
|
||||
$start = new Carbon(Input::get('start'));
|
||||
$end = new Carbon(Input::get('end'));
|
||||
$start = new Carbon(Input::get('start'));
|
||||
$end = new Carbon(Input::get('end'));
|
||||
$label = Input::get('label');
|
||||
|
||||
// check if the label is "everything" or "Custom range" which will betray
|
||||
// a possible problem with the budgets.
|
||||
if ($label === strval(trans('firefly.everything')) || $label === strval(trans('firefly.customRange'))) {
|
||||
Session::put('is_custom_range', true);
|
||||
} else {
|
||||
Session::put('is_custom_range', false);
|
||||
}
|
||||
|
||||
$diff = $start->diffInDays($end);
|
||||
|
||||
|
Reference in New Issue
Block a user