🤖 Auto commit for release 'develop' on 2026-03-13

This commit is contained in:
JC5
2026-03-13 03:55:47 +01:00
parent bc23bc0173
commit 63c49f740f
262 changed files with 904 additions and 940 deletions
@@ -80,16 +80,16 @@ final class AccountController extends Controller
public function accounts(AutocompleteApiRequest $request): JsonResponse
{
// Log::debug('Before All.');
['types' => $types, 'query' => $query, 'date' => $date, 'limit' => $limit] = $request->attributes->all();
['types' => $types, 'query' => $query, 'date' => $date, 'limit' => $limit] = $request->attributes->all();
$date ??= today(config('app.timezone'));
// set date to end-of-day for account balance. so it is at $date 23:59:59
$date->endOfDay();
$return = [];
$result = $this->repository->searchAccount((string) $query, $types, $limit);
$allBalances = Steam::accountsBalancesOptimized($result, $date, $this->primaryCurrency, $this->convertToPrimary);
$return = [];
$result = $this->repository->searchAccount((string) $query, $types, $limit);
$allBalances = Steam::accountsBalancesOptimized($result, $date, $this->primaryCurrency, $this->convertToPrimary);
/** @var Account $account */
foreach ($result as $account) {
@@ -63,7 +63,7 @@ final class BillController extends Controller
public function bills(AutocompleteApiRequest $request): JsonResponse
{
$result = $this->repository->searchBill($request->attributes->get('query'), $request->attributes->get('limit'));
$filtered = $result->map(static fn (Bill $item): array => ['id' => (string) $item->id, 'name' => $item->name, 'active' => $item->active]);
$filtered = $result->map(static fn (Bill $item): array => ['id' => (string) $item->id, 'name' => $item->name, 'active' => $item->active]);
return response()->api($filtered->toArray());
}
@@ -63,7 +63,7 @@ final class BudgetController extends Controller
public function budgets(AutocompleteApiRequest $request): JsonResponse
{
$result = $this->repository->searchBudget($request->attributes->get('query'), $request->attributes->get('limit'));
$filtered = $result->map(static fn (Budget $item): array => ['id' => (string) $item->id, 'name' => $item->name, 'active' => $item->active]);
$filtered = $result->map(static fn (Budget $item): array => ['id' => (string) $item->id, 'name' => $item->name, 'active' => $item->active]);
return response()->api($filtered->toArray());
}
@@ -63,7 +63,7 @@ final class CategoryController extends Controller
public function categories(AutocompleteApiRequest $request): JsonResponse
{
$result = $this->repository->searchCategory($request->attributes->get('query'), $request->attributes->get('limit'));
$filtered = $result->map(static fn (Category $item): array => ['id' => (string) $item->id, 'name' => $item->name]);
$filtered = $result->map(static fn (Category $item): array => ['id' => (string) $item->id, 'name' => $item->name]);
return response()->api($filtered->toArray());
}
@@ -67,7 +67,7 @@ final class ObjectGroupController extends Controller
/** @var ObjectGroup $objectGroup */
foreach ($result as $objectGroup) {
$return[] = ['id' => (string) $objectGroup->id, 'name' => $objectGroup->title, 'title' => $objectGroup->title];
$return[] = ['id' => (string) $objectGroup->id, 'name' => $objectGroup->title, 'title' => $objectGroup->title];
}
return response()->api($return);
@@ -63,7 +63,7 @@ final class TagController extends Controller
/** @var Tag $tag */
foreach ($result as $tag) {
$array[] = ['id' => (string) $tag->id, 'name' => $tag->tag, 'tag' => $tag->tag];
$array[] = ['id' => (string) $tag->id, 'name' => $tag->tag, 'tag' => $tag->tag];
}
return response()->api($array);
@@ -62,7 +62,7 @@ final class TransactionTypeController extends Controller
/** @var TransactionType $type */
foreach ($types as $type) {
// different key for consistency.
$array[] = ['id' => (string) $type->id, 'name' => $type->type, 'type' => $type->type];
$array[] = ['id' => (string) $type->id, 'name' => $type->type, 'type' => $type->type];
}
return response()->api($array);
@@ -220,7 +220,7 @@ final class BudgetController extends Controller
'end_date' => $row['end'],
'yAxisID' => 0,
'type' => 'bar',
'entries' => ['budgeted' => $row['budgeted'], 'spent' => $row['spent'], 'left' => $row['left'], 'overspent' => $row['overspent']],
'entries' => ['budgeted' => $row['budgeted'], 'spent' => $row['spent'], 'left' => $row['left'], 'overspent' => $row['overspent']],
'pc_entries' => [
'budgeted' => $row['pc_budgeted'],
'spent' => $row['pc_spent'],
@@ -153,8 +153,8 @@ final class CategoryController extends Controller
'end_date' => $end->toAtomString(),
'yAxisID' => 0,
'type' => 'bar',
'entries' => ['spent' => '0', 'earned' => '0'],
'pc_entries' => ['spent' => '0', 'earned' => '0'],
'entries' => ['spent' => '0', 'earned' => '0'],
'pc_entries' => ['spent' => '0', 'earned' => '0'],
];
// add monies
@@ -70,21 +70,21 @@ final class ListController extends Controller
public function attachments(PaginationRequest $request, Account $account): JsonResponse
{
$manager = $this->getManager();
['limit' => $limit, 'offset' => $offset, 'page' => $page] = $request->attributes->all();
$collection = $this->repository->getAttachments($account);
$manager = $this->getManager();
['limit' => $limit, 'offset' => $offset, 'page' => $page] = $request->attributes->all();
$collection = $this->repository->getAttachments($account);
$count = $collection->count();
$attachments = $collection->slice($offset, $limit);
$count = $collection->count();
$attachments = $collection->slice($offset, $limit);
// make paginator:
$paginator = new LengthAwarePaginator($attachments, $count, $limit, $page);
$paginator = new LengthAwarePaginator($attachments, $count, $limit, $page);
$paginator->setPath(route('api.v1.accounts.attachments', [$account->id]).$this->buildParams());
/** @var AttachmentTransformer $transformer */
$transformer = app(AttachmentTransformer::class);
$transformer = app(AttachmentTransformer::class);
$resource = new FractalCollection($attachments, $transformer, 'attachments');
$resource = new FractalCollection($attachments, $transformer, 'attachments');
$resource->setPaginator(new IlluminatePaginatorAdapter($paginator));
return response()->json($manager->createData($resource)->toArray())->header('Content-Type', self::CONTENT_TYPE);
@@ -93,31 +93,31 @@ final class ListController extends Controller
public function piggyBanks(PaginationRequest $request, Account $account): JsonResponse
{
// create some objects:
$manager = $this->getManager();
$manager = $this->getManager();
['limit' => $limit, 'offset' => $offset, 'page' => $page] = $request->attributes->all();
['limit' => $limit, 'offset' => $offset, 'page' => $page] = $request->attributes->all();
// get list of piggy banks. Count it and split it.
$collection = $this->repository->getPiggyBanks($account);
$count = $collection->count();
$piggyBanks = $collection->slice($offset, $limit);
$collection = $this->repository->getPiggyBanks($account);
$count = $collection->count();
$piggyBanks = $collection->slice($offset, $limit);
// enrich
/** @var User $admin */
$admin = auth()->user();
$enrichment = new PiggyBankEnrichment();
$admin = auth()->user();
$enrichment = new PiggyBankEnrichment();
$enrichment->setUser($admin);
$piggyBanks = $enrichment->enrich($piggyBanks);
$piggyBanks = $enrichment->enrich($piggyBanks);
// make paginator:
$paginator = new LengthAwarePaginator($piggyBanks, $count, $limit, $page);
$paginator = new LengthAwarePaginator($piggyBanks, $count, $limit, $page);
$paginator->setPath(route('api.v1.accounts.piggy-banks', [$account->id]).$this->buildParams());
/** @var PiggyBankTransformer $transformer */
$transformer = app(PiggyBankTransformer::class);
$transformer = app(PiggyBankTransformer::class);
// $transformer->setParameters($this->parameters);
$resource = new FractalCollection($piggyBanks, $transformer, 'piggy-banks');
$resource = new FractalCollection($piggyBanks, $transformer, 'piggy-banks');
$resource->setPaginator(new IlluminatePaginatorAdapter($paginator));
return response()->json($manager->createData($resource)->toArray())->header('Content-Type', self::CONTENT_TYPE);
@@ -128,16 +128,16 @@ final class ListController extends Controller
*/
public function transactions(PaginationDateRangeRequest $request, Account $account): JsonResponse
{
['limit' => $limit, 'page' => $page, 'start' => $start, 'end' => $end, 'type' => $type] = $request->attributes->all();
$types = $this->mapTransactionTypes($type ?? 'default');
$manager = $this->getManager();
['limit' => $limit, 'page' => $page, 'start' => $start, 'end' => $end, 'type' => $type] = $request->attributes->all();
$types = $this->mapTransactionTypes($type ?? 'default');
$manager = $this->getManager();
/** @var User $admin */
$admin = auth()->user();
$admin = auth()->user();
// use new group collector:
/** @var GroupCollectorInterface $collector */
$collector = app(GroupCollectorInterface::class);
$collector = app(GroupCollectorInterface::class);
$collector->setUser($admin)->setAccounts(new Collection()->push($account))->withAPIInformation()->setLimit($limit)->setPage($page)->setTypes($types);
if (null !== $start) {
$collector->setStart($start);
@@ -146,18 +146,18 @@ final class ListController extends Controller
$collector->setEnd($end);
}
$paginator = $collector->getPaginatedGroups();
$paginator = $collector->getPaginatedGroups();
$paginator->setPath(route('api.v1.accounts.transactions', [$account->id]).$this->buildParams());
// enrich
$enrichment = new TransactionGroupEnrichment();
$enrichment = new TransactionGroupEnrichment();
$enrichment->setUser($admin);
$transactions = $enrichment->enrich($paginator->getCollection());
$transactions = $enrichment->enrich($paginator->getCollection());
/** @var TransactionGroupTransformer $transformer */
$transformer = app(TransactionGroupTransformer::class);
$transformer = app(TransactionGroupTransformer::class);
$resource = new FractalCollection($transactions, $transformer, 'transactions');
$resource = new FractalCollection($transactions, $transformer, 'transactions');
$resource->setPaginator(new IlluminatePaginatorAdapter($paginator));
return response()->json($manager->createData($resource)->toArray())->header('Content-Type', self::CONTENT_TYPE);
@@ -124,22 +124,22 @@ final class ShowController extends Controller
// get list of accounts. Count it and split it.
$this->repository->resetAccountOrder();
$account->refresh();
$manager = $this->getManager();
['start' => $start, 'end' => $end, 'date' => $date] = $request->attributes->all();
$manager = $this->getManager();
['start' => $start, 'end' => $end, 'date' => $date] = $request->attributes->all();
// enrich
/** @var User $admin */
$admin = auth()->user();
$enrichment = new AccountEnrichment();
$admin = auth()->user();
$enrichment = new AccountEnrichment();
$enrichment->setDate($date);
$enrichment->setStart($start);
$enrichment->setEnd($end);
$enrichment->setUser($admin);
$account = $enrichment->enrichSingle($account);
$account = $enrichment->enrichSingle($account);
/** @var AccountTransformer $transformer */
$transformer = app(AccountTransformer::class);
$resource = new Item($account, $transformer, self::RESOURCE_KEY);
$transformer = app(AccountTransformer::class);
$resource = new Item($account, $transformer, self::RESOURCE_KEY);
return response()->json($manager->createData($resource)->toArray())->header('Content-Type', self::CONTENT_TYPE);
}
@@ -121,7 +121,7 @@ final class ShowController extends Controller
*/
public function index(PaginationRequest $request): JsonResponse
{
['limit' => $limit, 'offset' => $offset, 'page' => $page] = $request->attributes->all();
['limit' => $limit, 'offset' => $offset, 'page' => $page] = $request->attributes->all();
if (true === auth()->user()->hasRole('demo')) {
Log::channel('audit')->warning(sprintf('Demo user tries to access attachment API in %s', __METHOD__));
@@ -129,21 +129,21 @@ final class ShowController extends Controller
throw new NotFoundHttpException();
}
$manager = $this->getManager();
$manager = $this->getManager();
// get list of attachments. Count it and split it.
$collection = $this->repository->get();
$count = $collection->count();
$attachments = $collection->slice($offset, $limit);
$collection = $this->repository->get();
$count = $collection->count();
$attachments = $collection->slice($offset, $limit);
// make paginator:
$paginator = new LengthAwarePaginator($attachments, $count, $limit, $page);
$paginator = new LengthAwarePaginator($attachments, $count, $limit, $page);
$paginator->setPath(route('api.v1.attachments.index').$this->buildParams());
/** @var AttachmentTransformer $transformer */
$transformer = app(AttachmentTransformer::class);
$transformer = app(AttachmentTransformer::class);
$resource = new FractalCollection($attachments, $transformer, 'attachments');
$resource = new FractalCollection($attachments, $transformer, 'attachments');
$resource->setPaginator(new IlluminatePaginatorAdapter($paginator));
return response()->json($manager->createData($resource)->toArray())->header('Content-Type', self::CONTENT_TYPE);
@@ -68,29 +68,29 @@ final class ShowController extends Controller
*/
public function index(PaginationDateRangeRequest $request): JsonResponse
{
$manager = $this->getManager();
['limit' => $limit, 'offset' => $offset, 'page' => $page, 'start' => $start, 'end' => $end] = $request->attributes->all();
$manager = $this->getManager();
['limit' => $limit, 'offset' => $offset, 'page' => $page, 'start' => $start, 'end' => $end] = $request->attributes->all();
// get list of available budgets. Count it and split it.
$collection = $this->abRepository->getAvailableBudgetsByDate($start, $end);
$count = $collection->count();
$availableBudgets = $collection->slice($offset, $limit);
$collection = $this->abRepository->getAvailableBudgetsByDate($start, $end);
$count = $collection->count();
$availableBudgets = $collection->slice($offset, $limit);
// enrich
/** @var User $admin */
$admin = auth()->user();
$enrichment = new AvailableBudgetEnrichment();
$admin = auth()->user();
$enrichment = new AvailableBudgetEnrichment();
$enrichment->setUser($admin);
$availableBudgets = $enrichment->enrich($availableBudgets);
$availableBudgets = $enrichment->enrich($availableBudgets);
// make paginator:
$paginator = new LengthAwarePaginator($availableBudgets, $count, $limit, $page);
$paginator = new LengthAwarePaginator($availableBudgets, $count, $limit, $page);
$paginator->setPath(route('api.v1.available-budgets.index').$this->buildParams());
/** @var AvailableBudgetTransformer $transformer */
$transformer = app(AvailableBudgetTransformer::class);
$transformer = app(AvailableBudgetTransformer::class);
$resource = new FractalCollection($availableBudgets, $transformer, 'available_budgets');
$resource = new FractalCollection($availableBudgets, $transformer, 'available_budgets');
$resource->setPaginator(new IlluminatePaginatorAdapter($paginator));
return response()->json($manager->createData($resource)->toArray())->header('Content-Type', self::CONTENT_TYPE);
@@ -72,21 +72,21 @@ final class ListController extends Controller
*/
public function attachments(PaginationRequest $request, Bill $bill): JsonResponse
{
['limit' => $limit, 'offset' => $offset, 'page' => $page] = $request->attributes->all();
$manager = $this->getManager();
$collection = $this->repository->getAttachments($bill);
['limit' => $limit, 'offset' => $offset, 'page' => $page] = $request->attributes->all();
$manager = $this->getManager();
$collection = $this->repository->getAttachments($bill);
$count = $collection->count();
$attachments = $collection->slice($offset, $limit);
$count = $collection->count();
$attachments = $collection->slice($offset, $limit);
// make paginator:
$paginator = new LengthAwarePaginator($attachments, $count, $limit, $page);
$paginator = new LengthAwarePaginator($attachments, $count, $limit, $page);
$paginator->setPath(route('api.v1.bills.attachments', [$bill->id]).$this->buildParams());
/** @var AttachmentTransformer $transformer */
$transformer = app(AttachmentTransformer::class);
$transformer = app(AttachmentTransformer::class);
$resource = new FractalCollection($attachments, $transformer, 'attachments');
$resource = new FractalCollection($attachments, $transformer, 'attachments');
$resource->setPaginator(new IlluminatePaginatorAdapter($paginator));
return response()->json($manager->createData($resource)->toArray())->header('Content-Type', self::CONTENT_TYPE);
@@ -100,20 +100,20 @@ final class ListController extends Controller
*/
public function rules(PaginationRequest $request, Bill $bill): JsonResponse
{
['limit' => $limit, 'offset' => $offset, 'page' => $page] = $request->attributes->all();
['limit' => $limit, 'offset' => $offset, 'page' => $page] = $request->attributes->all();
$manager = $this->getManager();
$collection = $this->repository->getRulesForBill($bill);
$count = $collection->count();
$rules = $collection->slice($offset, $limit);
$manager = $this->getManager();
$collection = $this->repository->getRulesForBill($bill);
$count = $collection->count();
$rules = $collection->slice($offset, $limit);
// make paginator:
$paginator = new LengthAwarePaginator($rules, $count, $limit, $page);
$paginator = new LengthAwarePaginator($rules, $count, $limit, $page);
$paginator->setPath(route('api.v1.bills.rules', [$bill->id]).$this->buildParams());
/** @var RuleTransformer $transformer */
$transformer = app(RuleTransformer::class);
$resource = new FractalCollection($rules, $transformer, 'rules');
$transformer = app(RuleTransformer::class);
$resource = new FractalCollection($rules, $transformer, 'rules');
$resource->setPaginator(new IlluminatePaginatorAdapter($paginator));
return response()->json($manager->createData($resource)->toArray())->header('Content-Type', self::CONTENT_TYPE);
@@ -127,16 +127,16 @@ final class ListController extends Controller
*/
public function transactions(PaginationDateRangeRequest $request, Bill $bill): JsonResponse
{
['limit' => $limit, 'page' => $page, 'types' => $types, 'start' => $start, 'end' => $end] = $request->attributes->all();
['limit' => $limit, 'page' => $page, 'types' => $types, 'start' => $start, 'end' => $end] = $request->attributes->all();
$manager = $this->getManager();
$manager = $this->getManager();
/** @var User $admin */
$admin = auth()->user();
$admin = auth()->user();
// use new group collector:
/** @var GroupCollectorInterface $collector */
$collector = app(GroupCollectorInterface::class);
$collector = app(GroupCollectorInterface::class);
$collector
->setUser($admin)
// include source + destination account name and type.
@@ -159,18 +159,18 @@ final class ListController extends Controller
}
// get paginator.
$paginator = $collector->getPaginatedGroups();
$paginator = $collector->getPaginatedGroups();
$paginator->setPath(route('api.v1.bills.transactions', [$bill->id]).$this->buildParams());
// enrich
$enrichment = new TransactionGroupEnrichment();
$enrichment = new TransactionGroupEnrichment();
$enrichment->setUser($admin);
$transactions = $enrichment->enrich($paginator->getCollection());
$transactions = $enrichment->enrich($paginator->getCollection());
/** @var TransactionGroupTransformer $transformer */
$transformer = app(TransactionGroupTransformer::class);
$transformer = app(TransactionGroupTransformer::class);
$resource = new FractalCollection($transactions, $transformer, 'transactions');
$resource = new FractalCollection($transactions, $transformer, 'transactions');
$resource->setPaginator(new IlluminatePaginatorAdapter($paginator));
return response()->json($manager->createData($resource)->toArray())->header('Content-Type', self::CONTENT_TYPE);
@@ -67,28 +67,28 @@ final class ShowController extends Controller
*/
public function index(PaginationDateRangeRequest $request): JsonResponse
{
['limit' => $limit, 'offset' => $offset, 'start' => $start, 'end' => $end, 'page' => $page] = $request->attributes->all();
['limit' => $limit, 'offset' => $offset, 'start' => $start, 'end' => $end, 'page' => $page] = $request->attributes->all();
$this->repository->correctOrder();
$bills = $this->repository->getBills();
$manager = $this->getManager();
$count = $bills->count();
$bills = $bills->slice($offset, $limit);
$paginator = new LengthAwarePaginator($bills, $count, $limit, $page);
$bills = $this->repository->getBills();
$manager = $this->getManager();
$count = $bills->count();
$bills = $bills->slice($offset, $limit);
$paginator = new LengthAwarePaginator($bills, $count, $limit, $page);
// enrich
/** @var User $admin */
$admin = auth()->user();
$enrichment = new SubscriptionEnrichment();
$admin = auth()->user();
$enrichment = new SubscriptionEnrichment();
$enrichment->setUser($admin);
$enrichment->setStart($start);
$enrichment->setEnd($end);
$bills = $enrichment->enrich($bills);
$bills = $enrichment->enrich($bills);
/** @var BillTransformer $transformer */
$transformer = app(BillTransformer::class);
$transformer = app(BillTransformer::class);
$resource = new FractalCollection($bills, $transformer, 'bills');
$resource = new FractalCollection($bills, $transformer, 'bills');
$resource->setPaginator(new IlluminatePaginatorAdapter($paginator));
return response()->json($manager->createData($resource)->toArray())->header('Content-Type', self::CONTENT_TYPE);
@@ -102,23 +102,23 @@ final class ShowController extends Controller
*/
public function show(DateRangeRequest $request, Bill $bill): JsonResponse
{
['start' => $start, 'end' => $end] = $request->attributes->all();
['start' => $start, 'end' => $end] = $request->attributes->all();
$manager = $this->getManager();
$manager = $this->getManager();
// enrich
/** @var User $admin */
$admin = auth()->user();
$enrichment = new SubscriptionEnrichment();
$admin = auth()->user();
$enrichment = new SubscriptionEnrichment();
$enrichment->setUser($admin);
$enrichment->setStart($start);
$enrichment->setEnd($end);
$bill = $enrichment->enrichSingle($bill);
$bill = $enrichment->enrichSingle($bill);
/** @var BillTransformer $transformer */
$transformer = app(BillTransformer::class);
$transformer = app(BillTransformer::class);
$resource = new Item($bill, $transformer, 'bills');
$resource = new Item($bill, $transformer, 'bills');
return response()->json($manager->createData($resource)->toArray())->header('Content-Type', self::CONTENT_TYPE);
}
@@ -78,15 +78,15 @@ final class TriggerController extends Controller
// overrule the rule(s) if necessary.
if (array_key_exists('start', $parameters) && null !== $parameters['start']) {
// add a range:
$ruleEngine->addOperator(['type' => 'date_after', 'value' => $parameters['start']->format('Y-m-d')]);
$ruleEngine->addOperator(['type' => 'date_after', 'value' => $parameters['start']->format('Y-m-d')]);
}
if (array_key_exists('end', $parameters) && null !== $parameters['end']) {
// add a range:
$ruleEngine->addOperator(['type' => 'date_before', 'value' => $parameters['end']->format('Y-m-d')]);
$ruleEngine->addOperator(['type' => 'date_before', 'value' => $parameters['end']->format('Y-m-d')]);
}
if (array_key_exists('accounts', $parameters) && '' !== $parameters['accounts']) {
$ruleEngine->addOperator(['type' => 'account_id', 'value' => implode(',', $parameters['accounts'])]);
$ruleEngine->addOperator(['type' => 'account_id', 'value' => implode(',', $parameters['accounts'])]);
}
// file the rule(s)
@@ -132,15 +132,15 @@ final class TriggerController extends Controller
// overrule the rule(s) if necessary.
if (array_key_exists('start', $parameters) && null !== $parameters['start']) {
// add a range:
$ruleEngine->addOperator(['type' => 'date_after', 'value' => $parameters['start']->format('Y-m-d')]);
$ruleEngine->addOperator(['type' => 'date_after', 'value' => $parameters['start']->format('Y-m-d')]);
}
if (array_key_exists('end', $parameters) && null !== $parameters['end']) {
// add a range:
$ruleEngine->addOperator(['type' => 'date_before', 'value' => $parameters['end']->format('Y-m-d')]);
$ruleEngine->addOperator(['type' => 'date_before', 'value' => $parameters['end']->format('Y-m-d')]);
}
if (array_key_exists('accounts', $parameters) && is_array($parameters['accounts']) && count($parameters['accounts']) > 0) {
$ruleEngine->addOperator(['type' => 'account_id', 'value' => implode(',', $parameters['accounts'])]);
$ruleEngine->addOperator(['type' => 'account_id', 'value' => implode(',', $parameters['accounts'])]);
}
// fire the rule(s)
@@ -85,15 +85,15 @@ final class TriggerController extends Controller
// overrule the rule(s) if necessary.
if (array_key_exists('start', $parameters) && null !== $parameters['start']) {
// add a range:
$ruleEngine->addOperator(['type' => 'date_after', 'value' => $parameters['start']->format('Y-m-d')]);
$ruleEngine->addOperator(['type' => 'date_after', 'value' => $parameters['start']->format('Y-m-d')]);
}
if (array_key_exists('end', $parameters) && null !== $parameters['end']) {
// add a range:
$ruleEngine->addOperator(['type' => 'date_before', 'value' => $parameters['end']->format('Y-m-d')]);
$ruleEngine->addOperator(['type' => 'date_before', 'value' => $parameters['end']->format('Y-m-d')]);
}
if (array_key_exists('accounts', $parameters) && '' !== $parameters['accounts']) {
$ruleEngine->addOperator(['type' => 'account_id', 'value' => implode(',', $parameters['accounts'])]);
$ruleEngine->addOperator(['type' => 'account_id', 'value' => implode(',', $parameters['accounts'])]);
}
// file the rule(s)
@@ -146,15 +146,15 @@ final class TriggerController extends Controller
// overrule the rule(s) if necessary.
if (array_key_exists('start', $parameters) && null !== $parameters['start']) {
// add a range:
$ruleEngine->addOperator(['type' => 'date_after', 'value' => $parameters['start']->format('Y-m-d')]);
$ruleEngine->addOperator(['type' => 'date_after', 'value' => $parameters['start']->format('Y-m-d')]);
}
if (array_key_exists('end', $parameters) && null !== $parameters['end']) {
// add a range:
$ruleEngine->addOperator(['type' => 'date_before', 'value' => $parameters['end']->format('Y-m-d')]);
$ruleEngine->addOperator(['type' => 'date_before', 'value' => $parameters['end']->format('Y-m-d')]);
}
if (array_key_exists('accounts', $parameters) && is_array($parameters['accounts']) && count($parameters['accounts']) > 0) {
$ruleEngine->addOperator(['type' => 'account_id', 'value' => implode(',', $parameters['accounts'])]);
$ruleEngine->addOperator(['type' => 'account_id', 'value' => implode(',', $parameters['accounts'])]);
}
// file the rule(s)
@@ -52,12 +52,12 @@ final class IndexController extends Controller
public function index(PaginationRequest $request): JsonResponse
{
$administrations = $this->repository->get();
['page' => $page, 'limit' => $limit, 'offset' => $offset] = $request->attributes->all();
$count = $administrations->count();
$administrations = $administrations->slice($offset, $limit);
$paginator = new LengthAwarePaginator($administrations, $count, $limit, $page);
$transformer = new UserGroupTransformer();
$administrations = $this->repository->get();
['page' => $page, 'limit' => $limit, 'offset' => $offset] = $request->attributes->all();
$count = $administrations->count();
$administrations = $administrations->slice($offset, $limit);
$paginator = new LengthAwarePaginator($administrations, $count, $limit, $page);
$transformer = new UserGroupTransformer();
return response()->json($this->jsonApiList(self::RESOURCE_KEY, $paginator, $transformer))->header('Content-Type', self::CONTENT_TYPE);
}
@@ -89,20 +89,20 @@ final class BasicController extends Controller
public function basic(BasicRequest $request): JsonResponse
{
// parameters for boxes:
['start' => $start, 'end' => $end, 'code' => $code] = $request->attributes->all();
['start' => $start, 'end' => $end, 'code' => $code] = $request->attributes->all();
// balance information:
$balanceData = $this->getBalanceInformation($start, $end);
$billData = $this->getSubscriptionInformation($start, $end);
$spentData = $this->getLeftToSpendInfo($start, $end);
$netWorthData = $this->getNetWorthInfo($end);
$balanceData = $this->getBalanceInformation($start, $end);
$billData = $this->getSubscriptionInformation($start, $end);
$spentData = $this->getLeftToSpendInfo($start, $end);
$netWorthData = $this->getNetWorthInfo($end);
// $balanceData = [];
// $billData = [];
// $spentData = [];
// $netWorthData = [];
$total = array_merge($balanceData, $billData, $spentData, $netWorthData);
$total = array_merge($balanceData, $billData, $spentData, $netWorthData);
// give new keys
$return = [];
$return = [];
foreach ($total as $entry) {
if ('' === $code || $code === $entry['currency_code']) {
$return[$entry['key']] = $entry;
@@ -54,7 +54,7 @@ class AutocompleteRequest extends FormRequest
$date = $this->getCarbonDate('date') ?? today(config('app.timezone'));
return ['types' => $array, 'query' => $this->convertString('query'), 'date' => $date->endOfDay()];
return ['types' => $array, 'query' => $this->convertString('query'), 'date' => $date->endOfDay()];
}
public function rules(): array
@@ -43,7 +43,7 @@ class MoveTransactionsRequest extends FormRequest
public function getAll(): array
{
return ['original_account' => $this->convertInteger('original_account'), 'destination_account' => $this->convertInteger('destination_account')];
return ['original_account' => $this->convertInteger('original_account'), 'destination_account' => $this->convertInteger('destination_account')];
}
/**
+1 -1
View File
@@ -56,6 +56,6 @@ class DestroyRequest extends FormRequest
.',accounts,asset_accounts,expense_accounts,revenue_accounts,liabilities,transactions,withdrawals,deposits,transfers'
.',not_assets_liabilities';
return ['objects' => sprintf('required|max:255|min:1|string|in:%s', $valid), 'unused' => 'in:true,false'];
return ['objects' => sprintf('required|max:255|min:1|string|in:%s', $valid), 'unused' => 'in:true,false'];
}
}
@@ -72,6 +72,6 @@ class ExportRequest extends FormRequest
*/
public function rules(): array
{
return ['type' => 'in:csv', 'accounts' => 'min:1|max:32768', 'start' => 'date|before:end', 'end' => 'date|after:start'];
return ['type' => 'in:csv', 'accounts' => 'min:1|max:32768', 'start' => 'date|before:end', 'end' => 'date|after:start'];
}
}
+2 -2
View File
@@ -47,7 +47,7 @@ class SameDateRequest extends FormRequest
*/
public function getAll(): array
{
return ['start' => $this->getCarbonDate('start'), 'end' => $this->getCarbonDate('end')];
return ['start' => $this->getCarbonDate('start'), 'end' => $this->getCarbonDate('end')];
}
/**
@@ -55,6 +55,6 @@ class SameDateRequest extends FormRequest
*/
public function rules(): array
{
return ['start' => 'required|date', 'end' => 'required|date|after_or_equal:start'];
return ['start' => 'required|date', 'end' => 'required|date|after_or_equal:start'];
}
}
@@ -58,7 +58,7 @@ class GenericRequest extends FormRequest
*/
public function getAll(): array
{
return ['start' => $this->getCarbonDate('start'), 'end' => $this->getCarbonDate('end')];
return ['start' => $this->getCarbonDate('start'), 'end' => $this->getCarbonDate('end')];
}
public function getAssetAccounts(): Collection
@@ -169,7 +169,7 @@ class GenericRequest extends FormRequest
$this->bills = new Collection();
$this->tags = new Collection();
return ['start' => 'required|date', 'end' => 'required|date|after_or_equal:start'];
return ['start' => 'required|date', 'end' => 'required|date|after_or_equal:start'];
}
private function parseAccounts(): void
@@ -45,7 +45,7 @@ class AccountTypeApiRequest extends ApiRequest
}
$type = $this->convertString('type', 'all');
$this->attributes->add(['type' => $type, 'types' => $this->mapAccountTypes($type)]);
$this->attributes->add(['type' => $type, 'types' => $this->mapAccountTypes($type)]);
});
}
}
@@ -67,7 +67,7 @@ class UpdateRequest extends FormRequest
];
$allData = $this->getAllData($fields);
if (array_key_exists('auto_budget_type', $allData)) {
$types = ['none' => 0, 'reset' => 1, 'rollover' => 2, 'adjusted' => 3];
$types = ['none' => 0, 'reset' => 1, 'rollover' => 2, 'adjusted' => 3];
$allData['auto_budget_type'] = $types[$allData['auto_budget_type']] ?? 0;
}
@@ -43,7 +43,7 @@ class StoreRequest extends FormRequest
*/
public function getAll(): array
{
return ['name' => $this->convertString('name'), 'notes' => $this->stringWithNewlines('notes')];
return ['name' => $this->convertString('name'), 'notes' => $this->stringWithNewlines('notes')];
}
/**
@@ -44,7 +44,7 @@ class UpdateRequest extends FormRequest
*/
public function getAll(): array
{
$fields = ['name' => ['name', 'convertString'], 'notes' => ['notes', 'stringWithNewlines']];
$fields = ['name' => ['name', 'convertString'], 'notes' => ['notes', 'stringWithNewlines']];
return $this->getAllData($fields);
}
@@ -44,7 +44,7 @@ class StoreByDateRequest extends FormRequest
*/
public function getAll(): array
{
return ['from' => $this->get('from'), 'rates' => $this->get('rates', [])];
return ['from' => $this->get('from'), 'rates' => $this->get('rates', [])];
}
public function getFromCurrency(): TransactionCurrency
@@ -59,7 +59,7 @@ class StoreByDateRequest extends FormRequest
*/
public function rules(): array
{
return ['from' => 'required|exists:transaction_currencies,code', 'rates' => 'required|array', 'rates.*' => 'required|numeric|min:0.0000000001'];
return ['from' => 'required|exists:transaction_currencies,code', 'rates' => 'required|array', 'rates.*' => 'required|numeric|min:0.0000000001'];
}
public function withValidator(Validator $validator): void
@@ -69,7 +69,7 @@ class StoreRequest extends FormRequest
];
$recurrence = $this->getAllData($fields);
return ['recurrence' => $recurrence, 'transactions' => $this->getTransactionData(), 'repetitions' => $this->getRepetitionData()];
return ['recurrence' => $recurrence, 'transactions' => $this->getTransactionData(), 'repetitions' => $this->getRepetitionData()];
}
/**
@@ -41,7 +41,7 @@ class TestRequest extends FormRequest
public function getTestParameters(): array
{
return ['page' => $this->getPage(), 'start' => $this->getDate('start'), 'end' => $this->getDate('end'), 'accounts' => $this->getAccounts()];
return ['page' => $this->getPage(), 'start' => $this->getDate('start'), 'end' => $this->getDate('end'), 'accounts' => $this->getAccounts()];
}
public function rules(): array
@@ -41,7 +41,7 @@ class TriggerRequest extends FormRequest
public function getTriggerParameters(): array
{
return ['start' => $this->getDate('start'), 'end' => $this->getDate('end'), 'accounts' => $this->getAccounts()];
return ['start' => $this->getDate('start'), 'end' => $this->getDate('end'), 'accounts' => $this->getAccounts()];
}
public function rules(): array
@@ -41,7 +41,7 @@ class TestRequest extends FormRequest
public function getTestParameters(): array
{
return ['start' => $this->getDate('start'), 'end' => $this->getDate('end'), 'accounts' => $this->getAccounts()];
return ['start' => $this->getDate('start'), 'end' => $this->getDate('end'), 'accounts' => $this->getAccounts()];
}
public function rules(): array
@@ -41,12 +41,12 @@ class TriggerRequest extends FormRequest
public function getTriggerParameters(): array
{
return ['start' => $this->getDate('start'), 'end' => $this->getDate('end'), 'accounts' => $this->getAccounts()];
return ['start' => $this->getDate('start'), 'end' => $this->getDate('end'), 'accounts' => $this->getAccounts()];
}
public function rules(): array
{
return ['start' => 'date|after:1970-01-02|before:2038-01-17', 'end' => 'date|after_or_equal:start|after:1970-01-02|before:2038-01-17'];
return ['start' => 'date|after:1970-01-02|before:2038-01-17', 'end' => 'date|after_or_equal:start|after:1970-01-02|before:2038-01-17'];
}
private function getAccounts(): array
@@ -48,7 +48,7 @@ class UpdateRequest extends FormRequest
public function getAll(): array
{
// This is the way.
$fields = ['tag' => ['tag', 'convertString'], 'date' => ['date', 'date'], 'description' => ['description', 'convertString']];
$fields = ['tag' => ['tag', 'convertString'], 'date' => ['date', 'date'], 'description' => ['description', 'convertString']];
$data = $this->getAllData($fields);
return $this->appendLocationData($data, null);
@@ -43,7 +43,7 @@ class StoreRequest extends FormRequest
*/
public function getAll(): array
{
return ['name' => $this->convertString('name'), 'outward' => $this->convertString('outward'), 'inward' => $this->convertString('inward')];
return ['name' => $this->convertString('name'), 'outward' => $this->convertString('outward'), 'inward' => $this->convertString('inward')];
}
/**
@@ -45,7 +45,7 @@ class UpdateRequest extends FormRequest
*/
public function getAll(): array
{
return ['name' => $this->convertString('name'), 'outward' => $this->convertString('outward'), 'inward' => $this->convertString('inward')];
return ['name' => $this->convertString('name'), 'outward' => $this->convertString('outward'), 'inward' => $this->convertString('inward')];
}
/**
@@ -47,7 +47,7 @@ class CreateRequest extends FormRequest
public function getData(): array
{
$fields = ['title' => ['title', 'convertString'], 'active' => ['active', 'boolean'], 'url' => ['url', 'convertString']];
$fields = ['title' => ['title', 'convertString'], 'active' => ['active', 'boolean'], 'url' => ['url', 'convertString']];
$triggers = $this->get('triggers', []);
$responses = $this->get('responses', []);
$deliveries = $this->get('deliveries', []);
@@ -47,7 +47,7 @@ class UpdateRequest extends FormRequest
public function getData(): array
{
$fields = ['title' => ['title', 'convertString'], 'active' => ['active', 'boolean'], 'url' => ['url', 'convertString']];
$fields = ['title' => ['title', 'convertString'], 'active' => ['active', 'boolean'], 'url' => ['url', 'convertString']];
$triggers = $this->get('triggers', []);
$responses = $this->get('responses', []);
+2 -2
View File
@@ -48,7 +48,7 @@ class CronRequest extends FormRequest
*/
public function getAll(): array
{
$data = ['force' => false, 'date' => today(config('app.timezone'))];
$data = ['force' => false, 'date' => today(config('app.timezone'))];
if ($this->has('force')) {
$data['force'] = $this->boolean('force');
}
@@ -68,6 +68,6 @@ class CronRequest extends FormRequest
*/
public function rules(): array
{
return ['force' => 'in:true,false', 'date' => 'nullable|date|after:1970-01-02|before:2038-01-17'];
return ['force' => 'in:true,false', 'date' => 'nullable|date|after:1970-01-02|before:2038-01-17'];
}
}
@@ -66,7 +66,7 @@ class CreatesGroupMemberships extends Command
->first()
;
if (null === $membership) {
GroupMembership::create(['user_id' => $user->id, 'user_role_id' => $userRole->id, 'user_group_id' => $userGroup->id]);
GroupMembership::create(['user_id' => $user->id, 'user_role_id' => $userRole->id, 'user_group_id' => $userGroup->id]);
}
if (null === $user->user_group_id) {
$user->user_group_id = $userGroup->id;
@@ -54,7 +54,7 @@ class CreatesDatabase extends Command
}
// try to set up a raw connection:
$exists = false;
$dsn = sprintf('mysql:host=%s;port=%d;charset=utf8mb4',config('database.connections.mysql.host'), config('database.connections.mysql.port'));
$dsn = sprintf('mysql:host=%s;port=%d;charset=utf8mb4', config('database.connections.mysql.host'), config('database.connections.mysql.port'));
if ('' !== (string) config('database.connections.mysql.unix_socket')) {
$dsn = sprintf('mysql:unix_socket=%s;charset=utf8mb4', config('database.connections.mysql.unix_socket'));
@@ -56,7 +56,7 @@ class CreatesFirstUser extends Command
return 1;
}
$data = ['blocked' => false, 'blocked_code' => null, 'email' => $this->argument('email'), 'role' => 'owner'];
$data = ['blocked' => false, 'blocked_code' => null, 'email' => $this->argument('email'), 'role' => 'owner'];
$password = Str::random(24);
$user = $this->repository->store($data);
$user->password = Hash::make($password);
@@ -78,7 +78,7 @@ class ForcesMigrations extends Command
sleep(2);
Schema::dropIfExists('migrations');
$this->friendlyLine('Re-run all migrations...');
Artisan::call('migrate', ['--seed' => true, '--force' => true]);
Artisan::call('migrate', ['--seed' => true, '--force' => true]);
sleep(2);
$this->friendlyLine('');
$this->friendlyWarning('There is a good chance you just saw a lot of error messages.');
+3 -3
View File
@@ -121,11 +121,11 @@ class ApplyRules extends Command
$filterAccountList[] = $account->id;
}
$list = implode(',', $filterAccountList);
$ruleEngine->addOperator(['type' => 'account_id', 'value' => $list]);
$ruleEngine->addOperator(['type' => 'account_id', 'value' => $list]);
// add the date as a filter:
$ruleEngine->addOperator(['type' => 'date_after', 'value' => $this->startDate->format('Y-m-d')]);
$ruleEngine->addOperator(['type' => 'date_before', 'value' => $this->endDate->format('Y-m-d')]);
$ruleEngine->addOperator(['type' => 'date_after', 'value' => $this->startDate->format('Y-m-d')]);
$ruleEngine->addOperator(['type' => 'date_before', 'value' => $this->endDate->format('Y-m-d')]);
// start running rules.
$this->friendlyLine(sprintf('Will apply %d rule(s) to your transaction(s).', $count));
@@ -84,7 +84,7 @@ class ChecksForUpdates extends Command
}
// if running develop, slightly different message.
if (str_contains($version, 'develop')) {
$this->friendlyInfo(trans('firefly.update_current_dev_older', ['version' => $version, 'new_version' => $info->getNewVersion()]));
$this->friendlyInfo(trans('firefly.update_current_dev_older', ['version' => $version, 'new_version' => $info->getNewVersion()]));
return Command::SUCCESS;
}
@@ -35,7 +35,7 @@ trait VerifiesDatabaseConnectionTrait
{
$loops = 30;
$loop = 0;
$queries = ['pgsql' => 'SELECT * FROM pg_catalog.pg_tables;', 'sqlite' => 'SELECT name FROM sqlite_schema;', 'mysql' => 'SHOW TABLES;'];
$queries = ['pgsql' => 'SELECT * FROM pg_catalog.pg_tables;', 'sqlite' => 'SELECT name FROM sqlite_schema;', 'mysql' => 'SHOW TABLES;'];
$default = config('database.default');
if (!array_key_exists($default, $queries)) {
$this->friendlyWarning(sprintf('Cannot validate database connection for "%s"', $default));
@@ -107,7 +107,7 @@ class UpgradesAccountCurrencies extends Command
// both 0? set to default currency:
if (0 === $accountCurrency && 0 === $obCurrency) {
AccountMeta::where('account_id', $account->id)->where('name', 'currency_id')->forceDelete();
AccountMeta::create(['account_id' => $account->id, 'name' => 'currency_id', 'data' => $currency->id]);
AccountMeta::create(['account_id' => $account->id, 'name' => 'currency_id', 'data' => $currency->id]);
$this->friendlyInfo(sprintf('Account #%d ("%s") now has a currency setting (%s).', $account->id, $account->name, $currency->code));
++$this->count;
@@ -116,7 +116,7 @@ class UpgradesAccountCurrencies extends Command
// account is set to 0, opening balance is not?
if (0 === $accountCurrency && $obCurrency > 0) {
AccountMeta::create(['account_id' => $account->id, 'name' => 'currency_id', 'data' => $obCurrency]);
AccountMeta::create(['account_id' => $account->id, 'name' => 'currency_id', 'data' => $obCurrency]);
$this->friendlyInfo(sprintf('Account #%d ("%s") now has a currency setting (#%d).', $account->id, $account->name, $obCurrency));
++$this->count;
@@ -113,17 +113,17 @@ class UpgradesBillsToRules extends Command
'title' => (string) trans('firefly.rule_for_bill_title', ['name' => $bill->name], $languageString),
'description' => (string) trans('firefly.rule_for_bill_description', ['name' => $bill->name], $languageString),
'trigger' => 'store-journal',
'triggers' => [['type' => 'description_contains', 'value' => $match]],
'actions' => [['type' => 'link_to_bill', 'value' => $bill->name]],
'triggers' => [['type' => 'description_contains', 'value' => $match]],
'actions' => [['type' => 'link_to_bill', 'value' => $bill->name]],
];
// two triggers or one, depends on bill content:
if ($bill->amount_max === $bill->amount_min) {
$newRule['triggers'][] = ['type' => 'amount_exactly', 'value' => $bill->amount_min];
$newRule['triggers'][] = ['type' => 'amount_exactly', 'value' => $bill->amount_min];
}
if ($bill->amount_max !== $bill->amount_min) {
$newRule['triggers'][] = ['type' => 'amount_less', 'value' => $bill->amount_max];
$newRule['triggers'][] = ['type' => 'amount_more', 'value' => $bill->amount_min];
$newRule['triggers'][] = ['type' => 'amount_less', 'value' => $bill->amount_max];
$newRule['triggers'][] = ['type' => 'amount_more', 'value' => $bill->amount_min];
}
$this->ruleRepository->store($newRule);
@@ -95,7 +95,7 @@ class UpgradesDatabase extends Command
private function callInitialCommands(): void
{
$this->call('firefly-iii:verify-database-connection');
$this->call('migrate', ['--seed' => true, '--force' => true, '--no-interaction' => true]);
$this->call('migrate', ['--seed' => true, '--force' => true, '--no-interaction' => true]);
$this->call('upgrade:600-pgsql-sequences');
$this->call('upgrade:480-decrypt-all');
}
@@ -94,7 +94,7 @@ class UpgradesRecurrenceMetaData extends Command
$value = json_encode($array, JSON_THROW_ON_ERROR);
}
RecurrenceTransactionMeta::create(['rt_id' => $firstTransaction->id, 'name' => $meta->name, 'value' => $value]);
RecurrenceTransactionMeta::create(['rt_id' => $firstTransaction->id, 'name' => $meta->name, 'value' => $value]);
$meta->forceDelete();
return 1;
+9 -9
View File
@@ -117,40 +117,40 @@ class Handler extends ExceptionHandler
// JSON error:
Log::debug('Return JSON not found error.');
return response()->json(['message' => 'Resource not found', 'exception' => 'NotFoundHttpException'], 404);
return response()->json(['message' => 'Resource not found', 'exception' => 'NotFoundHttpException'], 404);
}
if ($e instanceof AuthorizationException && $expectsJson) {
// somehow Laravel handler does not catch this:
Log::debug('Return JSON unauthorized error.');
return response()->json(['message' => $e->getMessage(), 'exception' => 'AuthorizationException'], 401);
return response()->json(['message' => $e->getMessage(), 'exception' => 'AuthorizationException'], 401);
}
if ($e instanceof AuthenticationException && $expectsJson) {
// somehow Laravel handler does not catch this:
Log::debug('Return JSON unauthenticated error.');
return response()->json(['message' => $e->getMessage(), 'exception' => 'AuthenticationException'], 401);
return response()->json(['message' => $e->getMessage(), 'exception' => 'AuthenticationException'], 401);
}
if ($e instanceof OAuthServerException && $expectsJson) {
Log::debug('Return JSON OAuthServerException.');
// somehow Laravel handler does not catch this:
return response()->json(['message' => $e->getMessage(), 'exception' => 'OAuthServerException'], 401);
return response()->json(['message' => $e->getMessage(), 'exception' => 'OAuthServerException'], 401);
}
if ($e instanceof BadRequestHttpException) {
Log::debug('Return JSON BadRequestHttpException.');
return response()->json(['message' => $e->getMessage(), 'exception' => 'HttpException'], 400);
return response()->json(['message' => $e->getMessage(), 'exception' => 'HttpException'], 400);
}
if ($e instanceof BadHttpHeaderException) {
// is always API exception.
Log::debug('Return JSON BadHttpHeaderException.');
return response()->json(['message' => $e->getMessage(), 'exception' => 'BadHttpHeaderException'], $e->statusCode);
return response()->json(['message' => $e->getMessage(), 'exception' => 'BadHttpHeaderException'], $e->statusCode);
}
if (($e instanceof ValidationException || $e instanceof NumberFormatException) && $expectsJson) {
$errorCode = 422;
@@ -197,14 +197,14 @@ class Handler extends ExceptionHandler
Log::debug('Return Firefly III database exception view.');
$isDebug = config('app.debug');
return response()->view('errors.DatabaseException', ['exception' => $e, 'debug' => $isDebug], 500);
return response()->view('errors.DatabaseException', ['exception' => $e, 'debug' => $isDebug], 500);
}
if ($e instanceof FireflyException || $e instanceof ErrorException || $e instanceof OAuthServerException) {
Log::debug('Return Firefly III error view.');
$isDebug = config('app.debug');
return response()->view('errors.FireflyException', ['exception' => $e, 'debug' => $isDebug], 500);
return response()->view('errors.FireflyException', ['exception' => $e, 'debug' => $isDebug], 500);
}
Log::debug(sprintf('Error "%s" has no Firefly III treatment, parent will handle.', $e::class));
@@ -228,7 +228,7 @@ class Handler extends ExceptionHandler
return;
}
$userData = ['id' => 0, 'email' => 'unknown@example.com'];
$userData = ['id' => 0, 'email' => 'unknown@example.com'];
if (auth()->check()) {
$userData['id'] = auth()->user()->id;
$userData['email'] = auth()->user()->email;
+1 -1
View File
@@ -53,7 +53,7 @@ class AccountMetaFactory
}
// if $data has field and $entry is null, create new one:
if (null === $entry) {
return $this->create(['account_id' => $account->id, 'name' => $field, 'data' => $value]);
return $this->create(['account_id' => $account->id, 'name' => $field, 'data' => $value]);
}
// if $data has field and $entry is not null, update $entry:
+1 -1
View File
@@ -75,7 +75,7 @@ class CategoryFactory
}
try {
return Category::create(['user_id' => $this->user->id, 'user_group_id' => $this->user->user_group_id, 'name' => $categoryName]);
return Category::create(['user_id' => $this->user->id, 'user_group_id' => $this->user->user_group_id, 'name' => $categoryName]);
} catch (QueryException $e) {
Log::error($e->getMessage());
Log::error($e->getTraceAsString());
+1 -1
View File
@@ -188,7 +188,7 @@ class TransactionJournalFactory
protected function storeMeta(TransactionJournal $journal, array $data, string $field): void
{
$set = ['journal' => $journal, 'name' => $field, 'data' => (string) ($data[$field] ?? '')];
$set = ['journal' => $journal, 'name' => $field, 'data' => (string) ($data[$field] ?? '')];
if (array_key_exists($field, $data) && $data[$field] instanceof Carbon) {
$data[$field]->setTimezone(config('app.timezone'));
Log::debug(sprintf('%s Date: %s (%s)', $field, $data[$field], $data[$field]->timezone->getName()));
@@ -39,7 +39,7 @@ class ChartJsGenerator implements GeneratorInterface
*/
public function multiCurrencyPieChart(array $data): array
{
$chartData = ['datasets' => [0 => []], 'labels' => []];
$chartData = ['datasets' => [0 => []], 'labels' => []];
$amounts = array_column($data, 'amount');
$next = next($amounts);
@@ -117,7 +117,7 @@ class ChartJsGenerator implements GeneratorInterface
unset($first, $labels);
foreach ($data as $set) {
$currentSet = ['label' => $set['label'] ?? '(no label)', 'type' => $set['type'] ?? 'line', 'data' => array_values($set['entries'])];
$currentSet = ['label' => $set['label'] ?? '(no label)', 'type' => $set['type'] ?? 'line', 'data' => array_values($set['entries'])];
if (array_key_exists('yAxisID', $set)) {
$currentSet['yAxisID'] = $set['yAxisID'];
}
@@ -143,7 +143,7 @@ class ChartJsGenerator implements GeneratorInterface
*/
public function pieChart(array $data): array
{
$chartData = ['datasets' => [0 => []], 'labels' => []];
$chartData = ['datasets' => [0 => []], 'labels' => []];
// sort by value, keep keys.
// different sort when values are positive and when they're negative.
@@ -178,7 +178,7 @@ class ChartJsGenerator implements GeneratorInterface
return [
'count' => 1,
'labels' => array_keys($data), // take ALL labels from the first set.
'datasets' => [['label' => $setLabel, 'data' => array_values($data)]],
'datasets' => [['label' => $setLabel, 'data' => array_values($data)]],
];
}
}
@@ -55,7 +55,7 @@ class MonthReportGenerator implements ReportGeneratorInterface
$budgetIds = implode(',', $this->budgets->pluck('id')->toArray());
try {
$result = view('reports.budget.month', ['accountIds' => $accountIds, 'budgetIds' => $budgetIds])
$result = view('reports.budget.month', ['accountIds' => $accountIds, 'budgetIds' => $budgetIds])
->with('start', $this->start)
->with('end', $this->end)
->with('budgets', $this->budgets)
@@ -58,7 +58,7 @@ class MonthReportGenerator implements ReportGeneratorInterface
// render!
try {
return view('reports.category.month', ['accountIds' => $accountIds, 'categoryIds' => $categoryIds, 'reportType' => $reportType])
return view('reports.category.month', ['accountIds' => $accountIds, 'categoryIds' => $categoryIds, 'reportType' => $reportType])
->with('start', $this->start)
->with('end', $this->end)
->with('categories', $this->categories)
@@ -63,7 +63,7 @@ class MonthReportGenerator implements ReportGeneratorInterface
// render!
try {
$result = view('reports.tag.month', ['accountIds' => $accountIds, 'reportType' => $reportType, 'tagIds' => $tagIds])
$result = view('reports.tag.month', ['accountIds' => $accountIds, 'reportType' => $reportType, 'tagIds' => $tagIds])
->with('start', $this->start)
->with('end', $this->end)
->with('tags', $this->tags)
@@ -34,11 +34,8 @@ use FireflyIII\Support\Http\Controllers\ModelInformation;
use Illuminate\Contracts\View\Factory;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
use Illuminate\Routing\Redirector;
use Illuminate\Support\Facades\Log;
use Illuminate\View\View;
use Psr\Container\ContainerExceptionInterface;
use Psr\Container\NotFoundExceptionInterface;
/**
* Class CreateController
@@ -87,7 +84,7 @@ final class CreateController extends Controller
'zoom_level' => $hasOldInput ? old('location_zoom_level') : config('firefly.default_location.zoom_level'),
'has_location' => $hasOldInput && 'true' === old('location_has_location'),
]];
$liabilityDirections = ['debit' => trans('firefly.liability_direction_debit'), 'credit' => trans('firefly.liability_direction_credit')];
$liabilityDirections = ['debit' => trans('firefly.liability_direction_debit'), 'credit' => trans('firefly.liability_direction_credit')];
// interest calculation periods:
$interestPeriods = [];
@@ -80,7 +80,7 @@ final class DeleteController extends Controller
// put previous url in session
$this->rememberPreviousUrl('accounts.delete.url');
return view('accounts.delete', ['account' => $account, 'subTitle' => $subTitle, 'accountList' => $accountList, 'objectType' => $objectType]);
return view('accounts.delete', ['account' => $account, 'subTitle' => $subTitle, 'accountList' => $accountList, 'objectType' => $objectType]);
}
/**
@@ -103,7 +103,7 @@ final class EditController extends Controller
'has_location' => $hasLocation || 'true' === old('location_has_location'),
]];
$liabilityDirections = ['debit' => trans('firefly.liability_direction_debit'), 'credit' => trans('firefly.liability_direction_credit')];
$liabilityDirections = ['debit' => trans('firefly.liability_direction_debit'), 'credit' => trans('firefly.liability_direction_credit')];
// interest calculation periods:
$interestPeriods = [];
@@ -121,7 +121,7 @@ final class ShowController extends Controller
$currency = $accountCurrency ?? $this->primaryCurrency;
$fStart = $start->isoFormat($this->monthAndDayFormat);
$fEnd = $end->isoFormat($this->monthAndDayFormat);
$subTitle = (string) trans('firefly.journals_in_period_for_account', ['name' => $account->name, 'start' => $fStart, 'end' => $fEnd]);
$subTitle = (string) trans('firefly.journals_in_period_for_account', ['name' => $account->name, 'start' => $fStart, 'end' => $fEnd]);
$chartUrl = route('chart.account.period', [$account->id, $start->format('Y-m-d'), $end->format('Y-m-d')]);
$firstTransaction = $this->repository->oldestJournalDate($account) ?? $start;
@@ -65,6 +65,6 @@ final class HomeController extends Controller
$email = $pref->data;
}
return view('settings.index', ['title' => $title, 'mainTitleIcon' => $mainTitleIcon, 'email' => $email]);
return view('settings.index', ['title' => $title, 'mainTitleIcon' => $mainTitleIcon, 'email' => $email]);
}
}
@@ -77,7 +77,7 @@ final class LinkController extends Controller
$this->rememberPreviousUrl('link-types.create.url');
}
return view('settings.link.create', ['subTitle' => $subTitle, 'subTitleIcon' => $subTitleIcon]);
return view('settings.link.create', ['subTitle' => $subTitle, 'subTitleIcon' => $subTitleIcon]);
}
/**
@@ -110,7 +110,7 @@ final class LinkController extends Controller
// put previous url in session
$this->rememberPreviousUrl('link-types.delete.url');
return view('settings.link.delete', ['linkType' => $linkType, 'subTitle' => $subTitle, 'moveTo' => $moveTo, 'count' => $count]);
return view('settings.link.delete', ['linkType' => $linkType, 'subTitle' => $subTitle, 'moveTo' => $moveTo, 'count' => $count]);
}
/**
@@ -152,7 +152,7 @@ final class LinkController extends Controller
}
$request->session()->forget('link-types.edit.fromUpdate');
return view('settings.link.edit', ['subTitle' => $subTitle, 'subTitleIcon' => $subTitleIcon, 'linkType' => $linkType]);
return view('settings.link.edit', ['subTitle' => $subTitle, 'subTitleIcon' => $subTitleIcon, 'linkType' => $linkType]);
}
/**
@@ -171,7 +171,7 @@ final class LinkController extends Controller
$linkType->journalCount = $this->repository->countJournals($linkType);
});
return view('settings.link.index', ['subTitle' => $subTitle, 'subTitleIcon' => $subTitleIcon, 'linkTypes' => $linkTypes]);
return view('settings.link.index', ['subTitle' => $subTitle, 'subTitleIcon' => $subTitleIcon, 'linkTypes' => $linkTypes]);
}
/**
@@ -237,7 +237,7 @@ final class LinkController extends Controller
return redirect(route('settings.links.index'));
}
$data = ['name' => $request->convertString('name'), 'inward' => $request->convertString('inward'), 'outward' => $request->convertString('outward')];
$data = ['name' => $request->convertString('name'), 'inward' => $request->convertString('inward'), 'outward' => $request->convertString('outward')];
$this->repository->update($linkType, $data);
Log::channel('audit')->info(sprintf('User update link type #%d.', $linkType->id), $data);
@@ -31,7 +31,6 @@ use FireflyIII\Support\Facades\FireflyConfig;
use Illuminate\Contracts\View\Factory;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
use Illuminate\Routing\Redirector;
use Illuminate\View\View;
/**
@@ -123,7 +122,7 @@ final class UpdateController extends Controller
if ($release->isNewVersionAvailable()) {
// if running develop, slightly different message.
if (str_contains(config('firefly.version'), 'develop')) {
$message = trans('firefly.update_current_dev_older', ['version' => config('firefly.version'), 'new_version' => $release->getNewVersion()]);
$message = trans('firefly.update_current_dev_older', ['version' => config('firefly.version'), 'new_version' => $release->getNewVersion()]);
}
if (!str_contains(config('firefly.version'), 'develop')) {
$message = trans('firefly.update_new_version_alert', [
@@ -79,7 +79,7 @@ final class UserController extends Controller
$subTitle = (string) trans('firefly.delete_user', ['email' => $user->email]);
return view('settings.users.delete', ['user' => $user, 'subTitle' => $subTitle]);
return view('settings.users.delete', ['user' => $user, 'subTitle' => $subTitle]);
}
public function deleteInvite(InvitedUser $invitedUser): JsonResponse
@@ -32,7 +32,6 @@ use Illuminate\Contracts\View\Factory;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
use Illuminate\Http\Response as LaravelResponse;
use Illuminate\Routing\Redirector;
use Illuminate\View\View;
/**
@@ -71,7 +70,7 @@ final class AttachmentController extends Controller
// put previous url in session
$this->rememberPreviousUrl('attachments.delete.url');
return view('attachments.delete', ['attachment' => $attachment, 'subTitle' => $subTitle]);
return view('attachments.delete', ['attachment' => $attachment, 'subTitle' => $subTitle]);
}
/**
@@ -141,7 +140,7 @@ final class AttachmentController extends Controller
$preFilled = ['notes' => $this->repository->getNoteText($attachment)];
$request->session()->flash('preFilled', $preFilled);
return view('attachments.edit', ['attachment' => $attachment, 'subTitleIcon' => $subTitleIcon, 'subTitle' => $subTitle]);
return view('attachments.edit', ['attachment' => $attachment, 'subTitleIcon' => $subTitleIcon, 'subTitle' => $subTitle]);
}
/**
@@ -130,7 +130,7 @@ final class ForgotPasswordController extends Controller
$allowRegistration = false;
}
return view('auth.passwords.email')->with(['allowRegistration' => $allowRegistration, 'pageTitle' => $pageTitle]);
return view('auth.passwords.email')->with(['allowRegistration' => $allowRegistration, 'pageTitle' => $pageTitle]);
}
/**
@@ -36,7 +36,6 @@ use Illuminate\Contracts\View\Factory;
use Illuminate\Foundation\Auth\RegistersUsers;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
use Illuminate\Routing\Redirector;
use Illuminate\Support\Facades\Log;
use Illuminate\View\View;
use Psr\Container\ContainerExceptionInterface;
@@ -135,7 +134,7 @@ final class RegisterController extends Controller
$email = $request->old('email');
return view('auth.register', ['isDemoSite' => $isDemoSite, 'email' => $email, 'pageTitle' => $pageTitle, 'inviteCode' => $inviteCode]);
return view('auth.register', ['isDemoSite' => $isDemoSite, 'email' => $email, 'pageTitle' => $pageTitle, 'inviteCode' => $inviteCode]);
}
/**
@@ -161,7 +160,7 @@ final class RegisterController extends Controller
$email = $request?->old('email');
return view('auth.register', ['isDemoSite' => $isDemoSite, 'email' => $email, 'pageTitle' => $pageTitle]);
return view('auth.register', ['isDemoSite' => $isDemoSite, 'email' => $email, 'pageTitle' => $pageTitle]);
}
/**
@@ -85,7 +85,7 @@ final class ResetPasswordController extends Controller
return view('errors.error', ['message' => $message]);
}
$rules = ['token' => 'required', 'email' => 'required|email', 'password' => 'required|confirmed|min:16|secure_password'];
$rules = ['token' => 'required', 'email' => 'required|email', 'password' => 'required|confirmed|min:16|secure_password'];
$this->validate($request, $rules, $this->validationErrorMessages());
@@ -35,7 +35,6 @@ use Illuminate\Contracts\View\Factory;
use Illuminate\Contracts\View\View;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
use Illuminate\Routing\Redirector;
use Illuminate\Support\Facades\Log;
use PragmaRX\Google2FALaravel\Support\Authenticator;
use Psr\Container\ContainerExceptionInterface;
@@ -56,7 +55,7 @@ final class TwoFactorController extends Controller
$siteOwner = config('firefly.site_owner');
$title = (string) trans('firefly.two_factor_forgot_title');
return view('auth.lost-two-factor', ['user' => $user, 'siteOwner' => $siteOwner, 'title' => $title]);
return view('auth.lost-two-factor', ['user' => $user, 'siteOwner' => $siteOwner, 'title' => $title]);
}
/**
@@ -81,7 +81,7 @@ final class CreateController extends Controller
}
$request->session()->forget('bills.create.fromStore');
return view('bills.create', ['periods' => $periods, 'subTitle' => $subTitle]);
return view('bills.create', ['periods' => $periods, 'subTitle' => $subTitle]);
}
/**
@@ -31,7 +31,6 @@ use FireflyIII\Support\Facades\Preferences;
use Illuminate\Contracts\View\Factory;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
use Illuminate\Routing\Redirector;
use Illuminate\View\View;
/**
@@ -70,7 +69,7 @@ final class DeleteController extends Controller
$this->rememberPreviousUrl('bills.delete.url');
$subTitle = (string) trans('firefly.delete_bill', ['name' => $bill->name]);
return view('bills.delete', ['bill' => $bill, 'subTitle' => $subTitle]);
return view('bills.delete', ['bill' => $bill, 'subTitle' => $subTitle]);
}
/**
+1 -1
View File
@@ -102,7 +102,7 @@ final class EditController extends Controller
$request->session()->flash('preFilled', $preFilled);
$request->session()->forget('bills.edit.fromUpdate');
return view('bills.edit', ['subTitle' => $subTitle, 'periods' => $periods, 'rules' => $rules, 'bill' => $bill, 'preFilled' => $preFilled]);
return view('bills.edit', ['subTitle' => $subTitle, 'periods' => $periods, 'rules' => $rules, 'bill' => $bill, 'preFilled' => $preFilled]);
}
/**
@@ -113,7 +113,7 @@ final class IndexController extends Controller
$rules = $this->repository->getRulesForBills($collection);
// make bill groups:
$bills = [0 => ['object_group_id' => 0, 'object_group_title' => (string) trans('firefly.default_group_title_name'), 'bills' => []]]; // the index is the order, not the ID.
$bills = [0 => ['object_group_id' => 0, 'object_group_title' => (string) trans('firefly.default_group_title_name'), 'bills' => []]]; // the index is the order, not the ID.
/** @var Bill $bill */
foreach ($collection as $bill) {
@@ -144,7 +144,7 @@ final class IndexController extends Controller
$totals = $this->getTotals($sums);
$today = now()->startOfDay();
return view('bills.index', ['bills' => $bills, 'sums' => $sums, 'total' => $total, 'totals' => $totals, 'today' => $today]);
return view('bills.index', ['bills' => $bills, 'sums' => $sums, 'total' => $total, 'totals' => $totals, 'today' => $today]);
}
/**
@@ -172,7 +172,7 @@ final class IndexController extends Controller
Log::debug(sprintf('Amount per period for bill #%d "%s"', $bill['id'], $bill['name']));
Log::debug(sprintf('Average is %s', $avg));
// calculate amount per year:
$multiplies = ['yearly' => '1', 'half-year' => '2', 'quarterly' => '4', 'monthly' => '12', 'weekly' => '52.17', 'daily' => '365.24'];
$multiplies = ['yearly' => '1', 'half-year' => '2', 'quarterly' => '4', 'monthly' => '12', 'weekly' => '52.17', 'daily' => '365.24'];
$yearAmount = bcmul($avg, bcdiv($multiplies[$bill['repeat_freq']], (string) ($bill['skip'] + 1)));
Log::debug(sprintf('Amount per year is %s (%s * %s / %s)', $yearAmount, $avg, $multiplies[$bill['repeat_freq']], (string) ($bill['skip'] + 1)));
@@ -39,7 +39,6 @@ use FireflyIII\User;
use Illuminate\Contracts\View\Factory;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
use Illuminate\Routing\Redirector;
use Illuminate\Support\Collection;
use Illuminate\View\View;
use League\Fractal\Manager;
@@ -42,7 +42,6 @@ use Illuminate\Contracts\View\Factory;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
use Illuminate\Routing\Redirector;
use Illuminate\Support\Collection;
use Illuminate\Support\Facades\Log;
use Illuminate\View\View;
@@ -100,7 +99,7 @@ final class BudgetLimitController extends Controller
return true;
});
return view('budgets.budget-limits.create', ['start' => $start, 'end' => $end, 'currencies' => $currencies, 'budget' => $budget]);
return view('budgets.budget-limits.create', ['start' => $start, 'end' => $end, 'currencies' => $currencies, 'budget' => $budget]);
}
public function delete(BudgetLimit $budgetLimit): RedirectResponse
@@ -118,7 +117,7 @@ final class BudgetLimitController extends Controller
{
$notes = $this->blRepository->getNoteText($budgetLimit);
return view('budgets.budget-limits.edit', ['budgetLimit' => $budgetLimit, 'notes' => $notes]);
return view('budgets.budget-limits.edit', ['budgetLimit' => $budgetLimit, 'notes' => $notes]);
}
/**
@@ -128,7 +127,7 @@ final class BudgetLimitController extends Controller
{
$notes = $this->blRepository->getNoteText($budgetLimit);
return view('budgets.budget-limits.show', ['budgetLimit' => $budgetLimit, 'notes' => $notes]);
return view('budgets.budget-limits.show', ['budgetLimit' => $budgetLimit, 'notes' => $notes]);
}
/**
@@ -259,7 +258,7 @@ final class BudgetLimitController extends Controller
$notes = substr($notes, 0, 32768);
}
$limit = $this->blRepository->update($budgetLimit, ['amount' => $amount, 'notes' => $notes]);
$limit = $this->blRepository->update($budgetLimit, ['amount' => $amount, 'notes' => $notes]);
Preferences::mark();
$array = $limit->toArray();
@@ -100,7 +100,7 @@ final class CreateController extends Controller
$request->session()->forget('budgets.create.fromStore');
$subTitle = (string) trans('firefly.create_new_budget');
return view('budgets.create', ['subTitle' => $subTitle, 'autoBudgetTypes' => $autoBudgetTypes, 'autoBudgetPeriods' => $autoBudgetPeriods]);
return view('budgets.create', ['subTitle' => $subTitle, 'autoBudgetTypes' => $autoBudgetTypes, 'autoBudgetPeriods' => $autoBudgetPeriods]);
}
/**
@@ -31,7 +31,6 @@ use FireflyIII\Support\Facades\Preferences;
use Illuminate\Contracts\View\Factory;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
use Illuminate\Routing\Redirector;
use Illuminate\View\View;
/**
@@ -70,7 +69,7 @@ final class DeleteController extends Controller
// put previous url in session
$this->rememberPreviousUrl('budgets.delete.url');
return view('budgets.delete', ['budget' => $budget, 'subTitle' => $subTitle]);
return view('budgets.delete', ['budget' => $budget, 'subTitle' => $subTitle]);
}
/**
@@ -300,7 +300,7 @@ final class IndexController extends Controller
private function getSums(array $budgets): array
{
$sums = ['budgeted' => [], 'spent' => [], 'left' => []];
$sums = ['budgeted' => [], 'spent' => [], 'left' => []];
/** @var array $budget */
foreach ($budgets as $budget) {
@@ -113,7 +113,7 @@ final class ShowController extends Controller
$groups = $collector->getPaginatedGroups();
$groups->setPath(route('budgets.no-budget'));
return view('budgets.no-budget', ['groups' => $groups, 'subTitle' => $subTitle, 'periods' => $periods, 'start' => $start, 'end' => $end]);
return view('budgets.no-budget', ['groups' => $groups, 'subTitle' => $subTitle, 'periods' => $periods, 'start' => $start, 'end' => $end]);
}
/**
@@ -147,7 +147,7 @@ final class ShowController extends Controller
$groups = $collector->getPaginatedGroups();
$groups->setPath(route('budgets.no-budget-all'));
return view('budgets.no-budget', ['groups' => $groups, 'subTitle' => $subTitle, 'start' => $start, 'end' => $end]);
return view('budgets.no-budget', ['groups' => $groups, 'subTitle' => $subTitle, 'start' => $start, 'end' => $end]);
}
/**
@@ -33,7 +33,6 @@ use FireflyIII\Support\Facades\Preferences;
use Illuminate\Contracts\View\Factory;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
use Illuminate\Routing\Redirector;
use Illuminate\Support\Facades\Log;
use Illuminate\View\View;
@@ -31,7 +31,6 @@ use FireflyIII\Support\Facades\Preferences;
use Illuminate\Contracts\View\Factory;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
use Illuminate\Routing\Redirector;
use Illuminate\View\View;
/**
@@ -33,7 +33,6 @@ use FireflyIII\Support\Facades\Preferences;
use Illuminate\Contracts\View\Factory;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
use Illuminate\Routing\Redirector;
use Illuminate\Support\Facades\Log;
use Illuminate\View\View;
@@ -79,7 +78,7 @@ final class EditController extends Controller
$preFilled = ['notes' => $request->old('notes') ?? $this->repository->getNoteText($category)];
return view('categories.edit', ['category' => $category, 'subTitle' => $subTitle, 'preFilled' => $preFilled]);
return view('categories.edit', ['category' => $category, 'subTitle' => $subTitle, 'preFilled' => $preFilled]);
}
/**
@@ -271,8 +271,8 @@ final class AccountController extends Controller
foreach ($result as $row) {
$budgetId = $row['budget_id'];
$name = $names[$budgetId];
$label = (string) trans('firefly.name_in_currency', ['name' => $name, 'currency' => $row['currency_name']]);
$chartData[$label] = ['amount' => $row['total'], 'currency_symbol' => $row['currency_symbol'], 'currency_code' => $row['currency_code']];
$label = (string) trans('firefly.name_in_currency', ['name' => $name, 'currency' => $row['currency_name']]);
$chartData[$label] = ['amount' => $row['total'], 'currency_symbol' => $row['currency_symbol'], 'currency_code' => $row['currency_code']];
}
$data = $this->generator->multiCurrencyPieChart($chartData);
@@ -354,8 +354,8 @@ final class AccountController extends Controller
foreach ($result as $row) {
$categoryId = $row['category_id'];
$name = $names[$categoryId] ?? '(unknown)';
$label = (string) trans('firefly.name_in_currency', ['name' => $name, 'currency' => $row['currency_name']]);
$chartData[$label] = ['amount' => $row['total'], 'currency_symbol' => $row['currency_symbol'], 'currency_code' => $row['currency_code']];
$label = (string) trans('firefly.name_in_currency', ['name' => $name, 'currency' => $row['currency_name']]);
$chartData[$label] = ['amount' => $row['total'], 'currency_symbol' => $row['currency_symbol'], 'currency_code' => $row['currency_code']];
}
$data = $this->generator->multiCurrencyPieChart($chartData);
@@ -465,8 +465,8 @@ final class AccountController extends Controller
foreach ($result as $row) {
$categoryId = $row['category_id'];
$name = $names[$categoryId] ?? '(unknown)';
$label = (string) trans('firefly.name_in_currency', ['name' => $name, 'currency' => $row['currency_name']]);
$chartData[$label] = ['amount' => $row['total'], 'currency_symbol' => $row['currency_symbol'], 'currency_code' => $row['currency_code']];
$label = (string) trans('firefly.name_in_currency', ['name' => $name, 'currency' => $row['currency_name']]);
$chartData[$label] = ['amount' => $row['total'], 'currency_symbol' => $row['currency_symbol'], 'currency_code' => $row['currency_code']];
}
$data = $this->generator->multiCurrencyPieChart($chartData);
$cache->store($data);
@@ -74,7 +74,7 @@ final class BillController extends Controller
foreach ($paid as $info) {
$amount = $info['sum'];
$label = (string) trans('firefly.paid_in_currency', ['currency' => $info['name']]);
$chartData[$label] = ['amount' => $amount, 'currency_symbol' => $info['symbol'], 'currency_code' => $info['code']];
$chartData[$label] = ['amount' => $amount, 'currency_symbol' => $info['symbol'], 'currency_code' => $info['code']];
}
/**
@@ -83,7 +83,7 @@ final class BillController extends Controller
foreach ($unpaid as $info) {
$amount = $info['sum'];
$label = (string) trans('firefly.unpaid_in_currency', ['currency' => $info['name']]);
$chartData[$label] = ['amount' => $amount, 'currency_symbol' => $info['symbol'], 'currency_code' => $info['code']];
$chartData[$label] = ['amount' => $amount, 'currency_symbol' => $info['symbol'], 'currency_code' => $info['code']];
}
$data = $this->generator->multiCurrencyPieChart($chartData);
@@ -257,7 +257,7 @@ final class BudgetController extends Controller
$amount = $journal['foreign_amount'];
}
$result[$key] ??= ['amount' => '0', 'currency_symbol' => $symbol, 'currency_code' => $code, 'currency_name' => $name];
$result[$key] ??= ['amount' => '0', 'currency_symbol' => $symbol, 'currency_code' => $code, 'currency_name' => $name];
$result[$key]['amount'] = bcadd((string) $amount, $result[$key]['amount']);
}
@@ -341,7 +341,7 @@ final class BudgetController extends Controller
$amount = $journal['foreign_amount'];
}
$result[$key] ??= ['amount' => '0', 'currency_symbol' => $symbol, 'currency_code' => $code, 'currency_name' => $name];
$result[$key] ??= ['amount' => '0', 'currency_symbol' => $symbol, 'currency_code' => $code, 'currency_name' => $name];
$result[$key]['amount'] = bcadd((string) $amount, $result[$key]['amount']);
}
@@ -427,7 +427,7 @@ final class BudgetController extends Controller
$amount = $journal['foreign_amount'];
}
$result[$key] ??= ['amount' => '0', 'currency_symbol' => $symbol, 'currency_code' => $code, 'currency_name' => $name];
$result[$key] ??= ['amount' => '0', 'currency_symbol' => $symbol, 'currency_code' => $code, 'currency_name' => $name];
$result[$key]['amount'] = bcadd((string) $amount, $result[$key]['amount']);
}
@@ -193,7 +193,7 @@ final class ReportController extends Controller
'currency_name' => $currencyName,
'currency_decimal_places' => $currencyDecimalPlaces,
];
$data[$currencyId][$period] ??= ['period' => $period, 'spent' => '0', 'earned' => '0'];
$data[$currencyId][$period] ??= ['period' => $period, 'spent' => '0', 'earned' => '0'];
// in our outgoing?
$key = 'spent';
+2 -3
View File
@@ -43,7 +43,6 @@ use FireflyIII\User;
use Illuminate\Contracts\View\Factory;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
use Illuminate\Routing\Redirector;
use Illuminate\Support\Facades\Artisan;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Log;
@@ -164,7 +163,7 @@ final class DebugController extends Controller
$logContent = 'Truncated from this point <----|'.substr($logContent, -16384);
}
return view('debug', ['table' => $table, 'now' => $now, 'logContent' => $logContent]);
return view('debug', ['table' => $table, 'now' => $now, 'logContent' => $logContent]);
}
public function routes(Request $request): never
@@ -285,7 +284,7 @@ final class DebugController extends Controller
$app = $this->getAppInfo();
$user = $this->getUserInfo();
return (string) view('partials.debug-table', ['system' => $system, 'docker' => $docker, 'app' => $app, 'user' => $user]);
return (string) view('partials.debug-table', ['system' => $system, 'docker' => $docker, 'app' => $app, 'user' => $user]);
}
private function getAppInfo(): array
@@ -58,6 +58,6 @@ final class IndexController extends Controller
public function rates(TransactionCurrency $from, TransactionCurrency $to): View
{
return view('exchange-rates.rates', ['from' => $from, 'to' => $to]);
return view('exchange-rates.rates', ['from' => $from, 'to' => $to]);
}
}
+3 -4
View File
@@ -91,7 +91,7 @@ final class HomeController extends Controller
$label = $request->get('label');
$isCustomRange = false;
Log::debug('dateRange: Received dateRange', ['start' => $stringStart, 'end' => $stringEnd, 'label' => $request->get('label')]);
Log::debug('dateRange: Received dateRange', ['start' => $stringStart, 'end' => $stringEnd, 'label' => $request->get('label')]);
// check if the label is "everything" or "Custom range" which will betray
// a possible problem with the budgets.
if ($label === (string) trans('firefly.everything') || $label === (string) trans('firefly.customRange')) {
@@ -122,7 +122,6 @@ final class HomeController extends Controller
*/
public function index(AccountRepositoryInterface $repository): mixed
{
$types = config('firefly.accountTypesByIdentifier.asset');
$count = $repository->count($types);
Log::channel('audit')->info('User visits homepage.');
@@ -174,7 +173,7 @@ final class HomeController extends Controller
$collector = app(GroupCollectorInterface::class);
$collector->setAccounts(new Collection()->push($account))->withAccountInformation()->setRange($start, $end)->setLimit(10)->setPage(1);
$set = $collector->getExtractedJournals();
$transactions[] = ['transactions' => $set, 'account' => $account];
$transactions[] = ['transactions' => $set, 'account' => $account];
}
/** @var User $user */
@@ -205,6 +204,6 @@ final class HomeController extends Controller
$user = auth()->user();
event(new SystemRequestedVersionCheck($user));
return view('index', ['subTitle' => $subTitle, 'start' => $start, 'end' => $end, 'pageTitle' => $pageTitle]);
return view('index', ['subTitle' => $subTitle, 'start' => $start, 'end' => $end, 'pageTitle' => $pageTitle]);
}
}
@@ -66,7 +66,7 @@ final class JavascriptController extends Controller
$accountId = $account->id;
$currency = (int) $repository->getMetaValue($account, 'currency_id');
$currency = 0 === $currency ? $this->primaryCurrency->id : $currency;
$entry = ['preferredCurrency' => $currency, 'name' => $account->name];
$entry = ['preferredCurrency' => $currency, 'name' => $account->name];
$data['accounts'][$accountId] = $entry;
}
@@ -84,7 +84,7 @@ final class JavascriptController extends Controller
/** @var TransactionCurrency $currency */
foreach ($currencies as $currency) {
$currencyId = $currency->id;
$entry = ['name' => $currency->name, 'code' => $currency->code, 'symbol' => $currency->symbol];
$entry = ['name' => $currency->name, 'code' => $currency->code, 'symbol' => $currency->symbol];
$data['currencies'][$currencyId] = $entry;
}
@@ -139,7 +139,7 @@ final class JavascriptController extends Controller
/** @var Carbon $end */
$end = clone session('end', today(config('app.timezone'))->endOfMonth());
$data = ['start' => $start->format('Y-m-d'), 'end' => $end->format('Y-m-d')];
$data = ['start' => $start->format('Y-m-d'), 'end' => $end->format('Y-m-d')];
return response()->view('v2.javascript.variables', $data)->header('Content-Type', 'text/javascript');
}
+1 -1
View File
@@ -130,7 +130,7 @@ final class BoxController extends Controller
$expenses[$this->primaryCurrency->id] = Amount::formatAnything($this->primaryCurrency, '0', false);
}
$response = ['incomes' => $incomes, 'expenses' => $expenses, 'sums' => $sums, 'size' => count($sums), 'preferred' => $currency->id];
$response = ['incomes' => $incomes, 'expenses' => $expenses, 'sums' => $sums, 'size' => count($sums), 'preferred' => $currency->id];
$cache->store($response);
return response()->json($response);
@@ -157,7 +157,7 @@ final class ReconcileController extends Controller
throw new FireflyException($view, 0, $e);
}
$return = ['post_url' => $route, 'html' => $view];
$return = ['post_url' => $route, 'html' => $view];
return response()->json($return);
}
@@ -244,7 +244,7 @@ final class ReconcileController extends Controller
throw new FireflyException($html, 0, $e);
}
return response()->json(['html' => $html, 'startBalance' => $startBalance, 'endBalance' => $endBalance]);
return response()->json(['html' => $html, 'startBalance' => $startBalance, 'endBalance' => $endBalance]);
}
private function processJournal(Account $account, TransactionCurrency $currency, array $journal, string $amount): string
@@ -181,7 +181,7 @@ final class RecurrenceController extends Controller
$yearly = sprintf('yearly,%s', $date->format('Y-m-d'));
$yearlyDate = $date->isoFormat((string) trans('config.month_and_day_no_year_js', [], $locale));
$result = [
'daily' => ['label' => (string) trans('firefly.recurring_daily'), 'selected' => str_starts_with($preSelected, 'daily')],
'daily' => ['label' => (string) trans('firefly.recurring_daily'), 'selected' => str_starts_with($preSelected, 'daily')],
$weekly => [
'label' => (string) trans('firefly.recurring_weekly', ['weekday' => $dayOfWeek]),
'selected' => str_starts_with($preSelected, 'weekly'),
@@ -191,7 +191,7 @@ final class RecurrenceController extends Controller
'selected' => str_starts_with($preSelected, 'monthly'),
],
$ndom => [
'label' => (string) trans('firefly.recurring_ndom', ['weekday' => $dayOfWeek, 'dayOfMonth' => $date->weekOfMonth]),
'label' => (string) trans('firefly.recurring_ndom', ['weekday' => $dayOfWeek, 'dayOfMonth' => $date->weekOfMonth]),
'selected' => str_starts_with($preSelected, 'ndom'),
],
$yearly => [
+2 -2
View File
@@ -51,7 +51,7 @@ final class RuleController extends Controller
}
try {
$view = view('rules.partials.action', ['actions' => $actions, 'count' => $count])->render();
$view = view('rules.partials.action', ['actions' => $actions, 'count' => $count])->render();
} catch (Throwable $e) {
Log::error(sprintf('Cannot render rules.partials.action: %s', $e->getMessage()));
Log::error($e->getTraceAsString());
@@ -81,7 +81,7 @@ final class RuleController extends Controller
asort($triggers);
try {
$view = view('rules.partials.trigger', ['triggers' => $triggers, 'count' => $count])->render();
$view = view('rules.partials.trigger', ['triggers' => $triggers, 'count' => $count])->render();
} catch (Throwable $e) {
Log::error(sprintf('Cannot render rules.partials.trigger: %s', $e->getMessage()));
Log::error($e->getTraceAsString());
@@ -67,7 +67,7 @@ final class DeleteController extends Controller
// put previous url in session
$this->rememberPreviousUrl('object-groups.delete.url');
return view('object-groups.delete', ['objectGroup' => $objectGroup, 'subTitle' => $subTitle, 'piggyBanks' => $piggyBanks]);
return view('object-groups.delete', ['objectGroup' => $objectGroup, 'subTitle' => $subTitle, 'piggyBanks' => $piggyBanks]);
}
/**
@@ -32,7 +32,6 @@ use FireflyIII\Support\Facades\Preferences;
use Illuminate\Contracts\View\Factory;
use Illuminate\Contracts\View\View;
use Illuminate\Http\RedirectResponse;
use Illuminate\Routing\Redirector;
/**
* Class EditController
@@ -71,7 +70,7 @@ final class EditController extends Controller
}
session()->forget('object-groups.edit.fromUpdate');
return view('object-groups.edit', ['subTitle' => $subTitle, 'subTitleIcon' => $subTitleIcon, 'objectGroup' => $objectGroup]);
return view('object-groups.edit', ['subTitle' => $subTitle, 'subTitleIcon' => $subTitleIcon, 'objectGroup' => $objectGroup]);
}
/**

Some files were not shown because too many files have changed in this diff Show More