Various code cleanup and fixed alignments.

This commit is contained in:
James Cole
2024-01-01 14:43:56 +01:00
parent 1368aafe5f
commit f963ac63f1
443 changed files with 3668 additions and 3672 deletions

View File

@@ -77,13 +77,13 @@ class ShowController extends Controller
*/
public function rescan(Request $request, Bill $bill)
{
$total = 0;
$total = 0;
if (false === $bill->active) {
$request->session()->flash('warning', (string)trans('firefly.cannot_scan_inactive_bill'));
return redirect(route('bills.show', [$bill->id]));
}
$set = $this->repository->getRulesForBill($bill);
$set = $this->repository->getRulesForBill($bill);
if (0 === $set->count()) {
$request->session()->flash('error', (string)trans('firefly.no_rules_for_bill'));
@@ -115,34 +115,34 @@ class ShowController extends Controller
public function show(Request $request, Bill $bill)
{
// add info about rules:
$rules = $this->repository->getRulesForBill($bill);
$subTitle = $bill->name;
$rules = $this->repository->getRulesForBill($bill);
$subTitle = $bill->name;
/** @var Carbon $start */
$start = session('start');
$start = session('start');
/** @var Carbon $end */
$end = session('end');
$year = $start->year;
$page = (int)$request->get('page');
$pageSize = (int)app('preferences')->get('listPageSize', 50)->data;
$yearAverage = $this->repository->getYearAverage($bill, $start);
$overallAverage = $this->repository->getOverallAverage($bill);
$manager = new Manager();
$end = session('end');
$year = $start->year;
$page = (int)$request->get('page');
$pageSize = (int)app('preferences')->get('listPageSize', 50)->data;
$yearAverage = $this->repository->getYearAverage($bill, $start);
$overallAverage = $this->repository->getOverallAverage($bill);
$manager = new Manager();
$manager->setSerializer(new DataArraySerializer());
$manager->parseIncludes(['attachments', 'notes']);
// add another period to end, could fix 8163
$range = app('navigation')->getViewRange(true);
$end = app('navigation')->addPeriod($end, $range);
$range = app('navigation')->getViewRange(true);
$end = app('navigation')->addPeriod($end, $range);
// Make a resource out of the data and
$parameters = new ParameterBag();
$parameters = new ParameterBag();
$parameters->set('start', $start);
$parameters->set('end', $end);
/** @var BillTransformer $transformer */
$transformer = app(BillTransformer::class);
$transformer = app(BillTransformer::class);
$transformer->setParameters($parameters);
$resource = new Item($bill, $transformer, 'bill');
@@ -150,16 +150,16 @@ class ShowController extends Controller
$object['data']['currency'] = $bill->transactionCurrency;
/** @var GroupCollectorInterface $collector */
$collector = app(GroupCollectorInterface::class);
$collector = app(GroupCollectorInterface::class);
$collector->setBill($bill)->setLimit($pageSize)->setPage($page)->withBudgetInformation()
->withCategoryInformation()->withAccountInformation()
;
$groups = $collector->getPaginatedGroups();
$groups = $collector->getPaginatedGroups();
$groups->setPath(route('bills.show', [$bill->id]));
// transform any attachments as well.
$collection = $this->repository->getAttachments($bill);
$attachments = new Collection();
$collection = $this->repository->getAttachments($bill);
$attachments = new Collection();
if ($collection->count() > 0) {
/** @var AttachmentTransformer $transformer */