Take page size into account.

This commit is contained in:
James Cole
2016-04-21 09:00:32 +02:00
parent e293d69798
commit 98c057c516
4 changed files with 27 additions and 12 deletions

View File

@@ -194,7 +194,9 @@ class BudgetController extends Controller
/** @var Carbon $end */
$end = session('end', Carbon::now()->endOfMonth());
$list = $repository->getWithoutBudget($start, $end);
$page = intval(Input::get('page')) == 0 ? 1 : intval(Input::get('page'));
$pageSize = Preferences::get('transactionPageSize', 50)->data;
$list = $repository->getWithoutBudget($start, $end, $page, $pageSize);
$subTitle = trans(
'firefly.without_budget_between',
['start' => $start->formatLocalized($this->monthAndDayFormat), 'end' => $end->formatLocalized($this->monthAndDayFormat)]
@@ -235,18 +237,21 @@ class BudgetController extends Controller
throw new FireflyException('This budget limit is not part of this budget.');
}
$journals = $repository->getJournals($budget, $repetition, 50);
$pageSize = Preferences::get('transactionPageSize', 50)->data;
$journals = $repository->getJournals($budget, $repetition, $pageSize);
if (is_null($repetition->id)) {
$start = $repository->firstActivity($budget);
$end = new Carbon;
$set = $budget->limitrepetitions()->orderBy('startdate', 'DESC')->get();
$subTitle = e($budget->name);
$journals->setPath('/budgets/show/' . $budget->id);
} else {
$start = $repetition->startdate;
$end = $repetition->enddate;
$set = new Collection([$repetition]);
$subTitle = trans('firefly.budget_in_month', ['name' => $budget->name, 'month' => $repetition->startdate->formatLocalized($this->monthFormat)]);
$journals->setPath('/budgets/show/' . $budget->id . '/' . $repetition->id);
}
$spentArray = $repository->spentPerDay($budget, $start, $end);
@@ -258,7 +263,6 @@ class BudgetController extends Controller
$limits->push($entry);
}
$journals->setPath('/budgets/show/' . $budget->id);
return view('budgets.show', compact('limits', 'budget', 'repetition', 'journals', 'subTitle'));
}