mirror of
				https://github.com/firefly-iii/firefly-iii.git
				synced 2025-11-04 05:15:39 +00:00 
			
		
		
		
	Some minor code cleanup.
This commit is contained in:
		@@ -14,8 +14,8 @@ use FireflyIII\Helpers\Collection\Balance;
 | 
			
		||||
use FireflyIII\Helpers\Collection\BalanceEntry;
 | 
			
		||||
use FireflyIII\Helpers\Collection\BalanceHeader;
 | 
			
		||||
use FireflyIII\Helpers\Collection\BalanceLine;
 | 
			
		||||
use FireflyIII\Models\Budget;
 | 
			
		||||
use FireflyIII\Models\Budget as BudgetModel;
 | 
			
		||||
use FireflyIII\Models\Budget;
 | 
			
		||||
use FireflyIII\Models\Tag;
 | 
			
		||||
use FireflyIII\Models\TransactionJournal;
 | 
			
		||||
use FireflyIII\Repositories\Budget\BudgetRepositoryInterface;
 | 
			
		||||
@@ -41,11 +41,10 @@ class BalanceReportHelper implements BalanceReportHelperInterface
 | 
			
		||||
     *
 | 
			
		||||
     * @codeCoverageIgnore
 | 
			
		||||
     *
 | 
			
		||||
     * @param ReportQueryInterface      $query
 | 
			
		||||
     * @param BudgetRepositoryInterface $budgetRepository
 | 
			
		||||
     * @param TagRepositoryInterface    $tagRepository
 | 
			
		||||
     */
 | 
			
		||||
    public function __construct(ReportQueryInterface $query, BudgetRepositoryInterface $budgetRepository, TagRepositoryInterface $tagRepository)
 | 
			
		||||
    public function __construct(BudgetRepositoryInterface $budgetRepository, TagRepositoryInterface $tagRepository)
 | 
			
		||||
    {
 | 
			
		||||
        $this->budgetRepository = $budgetRepository;
 | 
			
		||||
        $this->tagRepository    = $tagRepository;
 | 
			
		||||
 
 | 
			
		||||
@@ -344,7 +344,7 @@ class CategoryController extends Controller
 | 
			
		||||
            $row        = [clone $start];
 | 
			
		||||
            $currentSet = $set->filter( // get possibly relevant entries from the big $set
 | 
			
		||||
                function (Category $category) use ($start) {
 | 
			
		||||
                    return $category->dateFormatted == $start->format("Y-m");
 | 
			
		||||
                    return $category->dateFormatted == $start->format('Y-m');
 | 
			
		||||
                }
 | 
			
		||||
            );
 | 
			
		||||
            /** @var Category $category */
 | 
			
		||||
@@ -410,7 +410,7 @@ class CategoryController extends Controller
 | 
			
		||||
            $row        = [clone $start];
 | 
			
		||||
            $currentSet = $set->filter(// get possibly relevant entries from the big $set
 | 
			
		||||
                function (Category $category) use ($start) {
 | 
			
		||||
                    return $category->dateFormatted == $start->format("Y-m");
 | 
			
		||||
                    return $category->dateFormatted == $start->format('Y-m');
 | 
			
		||||
                }
 | 
			
		||||
            );
 | 
			
		||||
            /** @var Category $category */
 | 
			
		||||
 
 | 
			
		||||
@@ -32,20 +32,23 @@ class PreferencesController extends Controller
 | 
			
		||||
     */
 | 
			
		||||
    public function index(ARI $repository)
 | 
			
		||||
    {
 | 
			
		||||
        $accounts          = $repository->getAccounts(['Default account', 'Asset account']);
 | 
			
		||||
        $viewRangePref     = Preferences::get('viewRange', '1M');
 | 
			
		||||
        $viewRange         = $viewRangePref->data;
 | 
			
		||||
        $frontPageAccounts = Preferences::get('frontPageAccounts', []);
 | 
			
		||||
        $budgetMax         = Preferences::get('budgetMaximum', 1000);
 | 
			
		||||
        $language          = Preferences::get('language', env('DEFAULT_LANGUAGE', 'en_US'))->data;
 | 
			
		||||
        $budgetMaximum     = $budgetMax->data;
 | 
			
		||||
        $customFiscalYear  = Preferences::get('customFiscalYear', 0)->data;
 | 
			
		||||
        $fiscalYearStartStr  = Preferences::get('fiscalYearStart', '01-01')->data;
 | 
			
		||||
        $fiscalYearStart   = date('Y') . '-' . $fiscalYearStartStr;
 | 
			
		||||
        $accounts           = $repository->getAccounts(['Default account', 'Asset account']);
 | 
			
		||||
        $viewRangePref      = Preferences::get('viewRange', '1M');
 | 
			
		||||
        $viewRange          = $viewRangePref->data;
 | 
			
		||||
        $frontPageAccounts  = Preferences::get('frontPageAccounts', []);
 | 
			
		||||
        $budgetMax          = Preferences::get('budgetMaximum', 1000);
 | 
			
		||||
        $language           = Preferences::get('language', env('DEFAULT_LANGUAGE', 'en_US'))->data;
 | 
			
		||||
        $budgetMaximum      = $budgetMax->data;
 | 
			
		||||
        $customFiscalYear   = Preferences::get('customFiscalYear', 0)->data;
 | 
			
		||||
        $fiscalYearStartStr = Preferences::get('fiscalYearStart', '01-01')->data;
 | 
			
		||||
        $fiscalYearStart    = date('Y') . '-' . $fiscalYearStartStr;
 | 
			
		||||
 | 
			
		||||
        $showIncomplete = env('SHOW_INCOMPLETE_TRANSLATIONS', 'false') == 'true';
 | 
			
		||||
 | 
			
		||||
        return view('preferences.index', compact('budgetMaximum', 'language', 'accounts', 'frontPageAccounts', 'viewRange', 'customFiscalYear', 'fiscalYearStart', 'showIncomplete'));
 | 
			
		||||
        return view(
 | 
			
		||||
            'preferences.index',
 | 
			
		||||
            compact('budgetMaximum', 'language', 'accounts', 'frontPageAccounts', 'viewRange', 'customFiscalYear', 'fiscalYearStart', 'showIncomplete')
 | 
			
		||||
        );
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
@@ -74,7 +77,7 @@ class PreferencesController extends Controller
 | 
			
		||||
        Preferences::set('budgetMaximum', $budgetMaximum);
 | 
			
		||||
 | 
			
		||||
        // custom fiscal year
 | 
			
		||||
        $customFiscalYear = (int) Input::get('customFiscalYear');
 | 
			
		||||
        $customFiscalYear = (int)Input::get('customFiscalYear');
 | 
			
		||||
        Preferences::set('customFiscalYear', $customFiscalYear);
 | 
			
		||||
        $fiscalYearStart = date('m-d', strtotime(Input::get('fiscalYearStart')));
 | 
			
		||||
        Preferences::set('fiscalYearStart', $fiscalYearStart);
 | 
			
		||||
 
 | 
			
		||||
@@ -56,12 +56,12 @@ class ReportController extends Controller
 | 
			
		||||
        $expenseTopLength = 8;
 | 
			
		||||
 | 
			
		||||
        // get report stuff!
 | 
			
		||||
        $accountReport = $this->accountHelper->getAccountReport($start, $end, $accounts); // done (+2)
 | 
			
		||||
        $incomes       = $this->helper->getIncomeReport($start, $end, $accounts); // done (+3)
 | 
			
		||||
        $expenses      = $this->helper->getExpenseReport($start, $end, $accounts); // done (+1)
 | 
			
		||||
        $budgets       = $this->budgetHelper->getBudgetReport($start, $end, $accounts); // done (+5)
 | 
			
		||||
        $categories    = $this->helper->getCategoryReport($start, $end, $accounts); // done (+1) (20)
 | 
			
		||||
        $balance       = $this->balanceHelper->getBalanceReport($start, $end, $accounts); // +566
 | 
			
		||||
        $accountReport = $this->accountHelper->getAccountReport($start, $end, $accounts);
 | 
			
		||||
        $incomes       = $this->helper->getIncomeReport($start, $end, $accounts);
 | 
			
		||||
        $expenses      = $this->helper->getExpenseReport($start, $end, $accounts);
 | 
			
		||||
        $budgets       = $this->budgetHelper->getBudgetReport($start, $end, $accounts);
 | 
			
		||||
        $categories    = $this->helper->getCategoryReport($start, $end, $accounts);
 | 
			
		||||
        $balance       = $this->balanceHelper->getBalanceReport($start, $end, $accounts);
 | 
			
		||||
        $bills         = $this->helper->getBillReport($start, $end, $accounts);
 | 
			
		||||
 | 
			
		||||
        // and some id's, joined:
 | 
			
		||||
@@ -99,9 +99,9 @@ class ReportController extends Controller
 | 
			
		||||
        // list of users stuff:
 | 
			
		||||
        $budgets       = app('FireflyIII\Repositories\Budget\BudgetRepositoryInterface')->getActiveBudgets();
 | 
			
		||||
        $categories    = app('FireflyIII\Repositories\Category\CategoryRepositoryInterface')->listCategories();
 | 
			
		||||
        $accountReport = $this->accountHelper->getAccountReport($start, $end, $accounts); // done (+2)
 | 
			
		||||
        $incomes       = $this->helper->getIncomeReport($start, $end, $accounts); // done (+3)
 | 
			
		||||
        $expenses      = $this->helper->getExpenseReport($start, $end, $accounts); // done (+1)
 | 
			
		||||
        $accountReport = $this->accountHelper->getAccountReport($start, $end, $accounts);
 | 
			
		||||
        $incomes       = $this->helper->getIncomeReport($start, $end, $accounts);
 | 
			
		||||
        $expenses      = $this->helper->getExpenseReport($start, $end, $accounts);
 | 
			
		||||
 | 
			
		||||
        // and some id's, joined:
 | 
			
		||||
        $accountIds = [];
 | 
			
		||||
 
 | 
			
		||||
@@ -446,19 +446,21 @@ class RuleController extends Controller
 | 
			
		||||
    {
 | 
			
		||||
        $newIndex = 0;
 | 
			
		||||
        $actions  = [];
 | 
			
		||||
        foreach (Input::old('rule-action') as $index => $entry) {
 | 
			
		||||
            $count     = ($newIndex + 1);
 | 
			
		||||
            $checked   = isset(Input::old('rule-action-stop')[$index]) ? true : false;
 | 
			
		||||
            $actions[] = view(
 | 
			
		||||
                'rules.partials.action',
 | 
			
		||||
                [
 | 
			
		||||
                    'oldTrigger' => $entry,
 | 
			
		||||
                    'oldValue'   => Input::old('rule-action-value')[$index],
 | 
			
		||||
                    'oldChecked' => $checked,
 | 
			
		||||
                    'count'      => $count,
 | 
			
		||||
                ]
 | 
			
		||||
            )->render();
 | 
			
		||||
            $newIndex++;
 | 
			
		||||
        if (is_array(Input::old('rule-action'))) {
 | 
			
		||||
            foreach (Input::old('rule-action') as $index => $entry) {
 | 
			
		||||
                $count     = ($newIndex + 1);
 | 
			
		||||
                $checked   = isset(Input::old('rule-action-stop')[$index]) ? true : false;
 | 
			
		||||
                $actions[] = view(
 | 
			
		||||
                    'rules.partials.action',
 | 
			
		||||
                    [
 | 
			
		||||
                        'oldTrigger' => $entry,
 | 
			
		||||
                        'oldValue'   => Input::old('rule-action-value')[$index],
 | 
			
		||||
                        'oldChecked' => $checked,
 | 
			
		||||
                        'count'      => $count,
 | 
			
		||||
                    ]
 | 
			
		||||
                )->render();
 | 
			
		||||
                $newIndex++;
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        return $actions;
 | 
			
		||||
@@ -471,19 +473,21 @@ class RuleController extends Controller
 | 
			
		||||
    {
 | 
			
		||||
        $newIndex = 0;
 | 
			
		||||
        $triggers = [];
 | 
			
		||||
        foreach (Input::old('rule-trigger') as $index => $entry) {
 | 
			
		||||
            $count      = ($newIndex + 1);
 | 
			
		||||
            $oldChecked = isset(Input::old('rule-trigger-stop')[$index]) ? true : false;
 | 
			
		||||
            $triggers[] = view(
 | 
			
		||||
                'rules.partials.trigger',
 | 
			
		||||
                [
 | 
			
		||||
                    'oldTrigger' => $entry,
 | 
			
		||||
                    'oldValue'   => Input::old('rule-trigger-value')[$index],
 | 
			
		||||
                    'oldChecked' => $oldChecked,
 | 
			
		||||
                    'count'      => $count,
 | 
			
		||||
                ]
 | 
			
		||||
            )->render();
 | 
			
		||||
            $newIndex++;
 | 
			
		||||
        if (is_array(Input::old('rule-trigger'))) {
 | 
			
		||||
            foreach (Input::old('rule-trigger') as $index => $entry) {
 | 
			
		||||
                $count      = ($newIndex + 1);
 | 
			
		||||
                $oldChecked = isset(Input::old('rule-trigger-stop')[$index]) ? true : false;
 | 
			
		||||
                $triggers[] = view(
 | 
			
		||||
                    'rules.partials.trigger',
 | 
			
		||||
                    [
 | 
			
		||||
                        'oldTrigger' => $entry,
 | 
			
		||||
                        'oldValue'   => Input::old('rule-trigger-value')[$index],
 | 
			
		||||
                        'oldChecked' => $oldChecked,
 | 
			
		||||
                        'count'      => $count,
 | 
			
		||||
                    ]
 | 
			
		||||
                )->render();
 | 
			
		||||
                $newIndex++;
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        return $triggers;
 | 
			
		||||
 
 | 
			
		||||
@@ -40,8 +40,6 @@ class Binder
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        return $next($request);
 | 
			
		||||
 | 
			
		||||
        //return $next($request);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
 
 | 
			
		||||
@@ -21,7 +21,6 @@ Route::group(
 | 
			
		||||
    Route::post('/password/reset', 'Auth\PasswordController@reset');
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    //Route::get('/home', 'HomeController@index');
 | 
			
		||||
}
 | 
			
		||||
);
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -77,7 +77,7 @@ class Amount
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        if ($journal->isTransfer() && $coloured) {
 | 
			
		||||
            $txt = '<span class="text-info">' . $this->formatAnything($journal->transactionCurrency, $journal->amount_positive, false) . '</span>';;
 | 
			
		||||
            $txt = '<span class="text-info">' . $this->formatAnything($journal->transactionCurrency, $journal->amount_positive, false) . '</span>';
 | 
			
		||||
            $cache->store($txt);
 | 
			
		||||
 | 
			
		||||
            return $txt;
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user