mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-12-24 04:01:27 +00:00
Compare commits
40 Commits
5.2.0-alph
...
5.2.0
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a6ce294131 | ||
|
|
34ceb69776 | ||
|
|
eed68b5d95 | ||
|
|
79374c11ee | ||
|
|
404f9df6d3 | ||
|
|
4b716e35b9 | ||
|
|
166fc7a3e2 | ||
|
|
06afbc7a0a | ||
|
|
49a98de63a | ||
|
|
5b572c0da2 | ||
|
|
59014b1a87 | ||
|
|
4aec1f06e0 | ||
|
|
136af9625a | ||
|
|
edac26f757 | ||
|
|
ac54dd05bf | ||
|
|
7948058364 | ||
|
|
f13a6f7bf9 | ||
|
|
e1a5d143c5 | ||
|
|
f98011cd0d | ||
|
|
e7c10dec5c | ||
|
|
ae2b28fdee | ||
|
|
8d3fc18ca6 | ||
|
|
61521cf478 | ||
|
|
06c5e4df2c | ||
|
|
9e4b7f8bb4 | ||
|
|
144bc29eb3 | ||
|
|
2c0d8b9cb3 | ||
|
|
511b1258ba | ||
|
|
8cfe0af502 | ||
|
|
54e3c7d729 | ||
|
|
628b493128 | ||
|
|
8c552b8fa8 | ||
|
|
c864d904b0 | ||
|
|
ecb61676ab | ||
|
|
ee5a4caaab | ||
|
|
84bdd47109 | ||
|
|
5445752588 | ||
|
|
bcfbdcf3f0 | ||
|
|
7e6cd77203 | ||
|
|
5e3d00ecde |
@@ -59,7 +59,7 @@ APP_LOG_LEVEL=notice
|
||||
# If you use Docker or similar, you can set these variables from a file by appending them with _FILE
|
||||
# Use "mysql" for MySQL and MariaDB. Use "sqlite" for SQLite.
|
||||
DB_CONNECTION=pgsql
|
||||
DB_HOST=firefly_iii_db
|
||||
DB_HOST=fireflyiiidb
|
||||
DB_PORT=5432
|
||||
DB_DATABASE=firefly
|
||||
DB_USERNAME=firefly
|
||||
|
||||
2
.github/ISSUE_TEMPLATE/Bug_report.md
vendored
2
.github/ISSUE_TEMPLATE/Bug_report.md
vendored
@@ -19,7 +19,7 @@ I am running Firefly III version x.x.x, and my problem is:
|
||||
<!-- Earn bonus points by checking the boxes -->
|
||||
|
||||
- [ ] Nobody reported this bug before
|
||||
- [ ] I have added a stack trace from my log files.
|
||||
- [ ] I have added a stack trace from my log files <!-- (see https://bit.ly/FF3-get-debug-info) -->
|
||||
- [ ] I have added a screenshot.
|
||||
- [ ] I was able to replicate it on the demo site https://demo.firefly-iii.org/
|
||||
<!-- - [ ] I donated money (this is a joke :wink:)-->
|
||||
|
||||
2
.github/ISSUE_TEMPLATE/Custom.md
vendored
2
.github/ISSUE_TEMPLATE/Custom.md
vendored
@@ -18,6 +18,6 @@ I am running Firefly III version x.x.x.
|
||||
|
||||
- [ ] I have read the FAQ at https://bit.ly/FF3-FAQ
|
||||
- [ ] I added a screenshot
|
||||
- [ ] I added log files (see https://bit.ly/FF3-get-logs)
|
||||
- [ ] I added log files <!-- (see https://bit.ly/FF3-get-debug-info) -->
|
||||
- [ ] I was able to replicate the issue on the demo site.
|
||||
<!-- - [ ] I donated money (this is a joke :wink:)-->
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
/**
|
||||
* CorrectOpeningBalanceCurrencies.php
|
||||
* Copyright (c) 2020 james@firefly-iii.org
|
||||
|
||||
@@ -47,7 +47,7 @@ class CreateLinkTypes extends Command
|
||||
/**
|
||||
* Execute the console command.
|
||||
*
|
||||
* @return mixed
|
||||
* @return int
|
||||
*/
|
||||
public function handle(): int
|
||||
{
|
||||
|
||||
@@ -50,7 +50,8 @@ class DeleteEmptyGroups extends Command
|
||||
* Execute the console command.
|
||||
*
|
||||
* @throws Exception;
|
||||
* @return mixed
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function handle(): int
|
||||
{
|
||||
|
||||
@@ -52,7 +52,7 @@ class EnableCurrencies extends Command
|
||||
/**
|
||||
* Execute the console command.
|
||||
*
|
||||
* @return mixed
|
||||
* @return int
|
||||
*/
|
||||
public function handle(): int
|
||||
{
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
/**
|
||||
* FixLongDescriptions.php
|
||||
* Copyright (c) 2020 james@firefly-iii.org
|
||||
@@ -65,7 +66,7 @@ class FixLongDescriptions extends Command
|
||||
$groups = TransactionGroup::get(['id', 'title']);
|
||||
/** @var TransactionGroup $group */
|
||||
foreach ($groups as $group) {
|
||||
if (strlen($group->title) > self::MAX_LENGTH) {
|
||||
if (strlen((string)$group->title) > self::MAX_LENGTH) {
|
||||
$group->title = substr($group->title, 0, self::MAX_LENGTH);
|
||||
$group->save();
|
||||
$this->line(sprintf('Truncated description of transaction group #%d', $group->id));
|
||||
|
||||
@@ -54,7 +54,7 @@ class FixPiggies extends Command
|
||||
/**
|
||||
* Execute the console command.
|
||||
*
|
||||
* @return mixed
|
||||
* @return int
|
||||
*/
|
||||
public function handle(): int
|
||||
{
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
/**
|
||||
* FixRecurringTransactions.php
|
||||
* Copyright (c) 2020 james@firefly-iii.org
|
||||
|
||||
@@ -48,7 +48,7 @@ class RemoveBills extends Command
|
||||
/**
|
||||
* Execute the console command.
|
||||
*
|
||||
* @return mixed
|
||||
* @return int
|
||||
*/
|
||||
public function handle(): int
|
||||
{
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -30,6 +30,7 @@ use FireflyIII\Exceptions\FireflyException;
|
||||
use FireflyIII\Models\Preference;
|
||||
use Illuminate\Console\Command;
|
||||
use Illuminate\Contracts\Encryption\DecryptException;
|
||||
use JsonException;
|
||||
use Log;
|
||||
|
||||
/**
|
||||
@@ -92,7 +93,11 @@ class DecryptDatabase extends Command
|
||||
// A separate routine for preferences:
|
||||
if ('preferences' === $table) {
|
||||
// try to json_decrypt the value.
|
||||
$value = json_decode($value, true, 512, JSON_THROW_ON_ERROR) ?? $value;
|
||||
try {
|
||||
$value = json_decode($value, true, 512, JSON_THROW_ON_ERROR) ?? $value;
|
||||
} catch(JsonException $e) {
|
||||
Log::error($e->getMessage());
|
||||
}
|
||||
Log::debug(sprintf('Decrypted field "%s" "%s" to "%s" in table "%s" (row #%d)', $field, $original, print_r($value, true), $table, $id));
|
||||
|
||||
/** @var Preference $object */
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
/**
|
||||
* ExportData.php
|
||||
* Copyright (c) 2020 james@firefly-iii.org
|
||||
@@ -238,11 +239,12 @@ class ExportData extends Command
|
||||
|
||||
/**
|
||||
* @throws FireflyException
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
private function getExportDirectory(): string
|
||||
{
|
||||
$directory = $this->option('export_directory');
|
||||
$directory = (string) $this->option('export_directory');
|
||||
if (null === $directory) {
|
||||
$directory = './';
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
/**
|
||||
* RestoreOAuthKeys.php
|
||||
* Copyright (c) 2020 james@firefly-iii.org
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
/**
|
||||
* MigrateRecurrenceMeta.php
|
||||
* Copyright (c) 2020 james@firefly-iii.org
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
/**
|
||||
* MigrateTagLocations.php
|
||||
* Copyright (c) 2020 james@firefly-iii.org
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
/**
|
||||
* DuplicateTransactionException.php
|
||||
* Copyright (c) 2019 james@firefly-iii.org
|
||||
|
||||
@@ -50,6 +50,7 @@ class GracefulNotFoundHandler extends ExceptionHandler
|
||||
* @param Request $request
|
||||
* @param Exception $exception
|
||||
*
|
||||
* @throws Exception
|
||||
* @return mixed
|
||||
*/
|
||||
public function render($request, Exception $exception)
|
||||
@@ -137,9 +138,10 @@ class GracefulNotFoundHandler extends ExceptionHandler
|
||||
* @param Request $request
|
||||
* @param Exception $exception
|
||||
*
|
||||
* @return \Illuminate\Http\Response|Response
|
||||
* @throws Exception
|
||||
* @return Redirector|Response
|
||||
*/
|
||||
private function handleAccount($request, Exception $exception)
|
||||
private function handleAccount(Request $request, Exception $exception)
|
||||
{
|
||||
Log::debug('404 page is probably a deleted account. Redirect to overview of account types.');
|
||||
/** @var User $user */
|
||||
@@ -160,6 +162,13 @@ class GracefulNotFoundHandler extends ExceptionHandler
|
||||
return redirect(route('accounts.index', [$shortType]));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Request $request
|
||||
* @param Exception $exception
|
||||
*
|
||||
* @throws Exception
|
||||
* @return RedirectResponse|Redirector|Response
|
||||
*/
|
||||
private function handleAttachment(Request $request, Exception $exception)
|
||||
{
|
||||
Log::debug('404 page is probably a deleted attachment. Redirect to parent object.');
|
||||
@@ -199,12 +208,13 @@ class GracefulNotFoundHandler extends ExceptionHandler
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $request
|
||||
* @param Request $request
|
||||
* @param Exception $exception
|
||||
*
|
||||
* @throws Exception
|
||||
* @return RedirectResponse|\Illuminate\Http\Response|Redirector|Response
|
||||
*/
|
||||
private function handleGroup($request, Exception $exception)
|
||||
private function handleGroup(Request $request, Exception $exception)
|
||||
{
|
||||
Log::debug('404 page is probably a deleted group. Redirect to overview of group types.');
|
||||
/** @var User $user */
|
||||
|
||||
@@ -116,8 +116,8 @@ class Handler extends ExceptionHandler
|
||||
* @param Exception $exception
|
||||
*
|
||||
* @throws Exception
|
||||
* @return mixed|void
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function report(Exception $exception)
|
||||
{
|
||||
|
||||
@@ -275,6 +275,9 @@ class TransactionJournalFactory
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
// TODO typeOverrule: the account validator may have another opinion on the transaction type.
|
||||
|
||||
/** create or get source and destination accounts */
|
||||
$sourceInfo = [
|
||||
'id' => (int) $row['source_id'],
|
||||
@@ -470,7 +473,7 @@ class TransactionJournalFactory
|
||||
// return user's default:
|
||||
return app('amount')->getDefaultCurrencyByUser($this->user);
|
||||
}
|
||||
$result = $preference ?? $currency;
|
||||
$result = ($preference ?? $currency) ?? app('amount')->getSystemCurrency();
|
||||
Log::debug(sprintf('Currency is now #%d (%s) because of account #%d (%s)', $result->id, $result->code, $account->id, $account->name));
|
||||
|
||||
return $result;
|
||||
@@ -599,7 +602,7 @@ class TransactionJournalFactory
|
||||
// validate source account.
|
||||
$sourceId = isset($data['source_id']) ? (int) $data['source_id'] : null;
|
||||
$sourceName = $data['source_name'] ?? null;
|
||||
$validSource = $this->accountValidator->validateSource($sourceId, $sourceName);
|
||||
$validSource = $this->accountValidator->validateSource($sourceId, $sourceName, null);
|
||||
|
||||
// do something with result:
|
||||
if (false === $validSource) {
|
||||
@@ -608,8 +611,8 @@ class TransactionJournalFactory
|
||||
Log::debug('Source seems valid.');
|
||||
// validate destination account
|
||||
$destinationId = isset($data['destination_id']) ? (int) $data['destination_id'] : null;
|
||||
$destinationName = $data['destination_name'] ?? null;
|
||||
$validDestination = $this->accountValidator->validateDestination($destinationId, $destinationName);
|
||||
$destinationName = (string)($data['destination_name'] ?? null);
|
||||
$validDestination = $this->accountValidator->validateDestination($destinationId, $destinationName, null);
|
||||
// do something with result:
|
||||
if (false === $validDestination) {
|
||||
throw new FireflyException(sprintf('Destination: %s', $this->accountValidator->destError)); // @codeCoverageIgnore
|
||||
|
||||
@@ -71,7 +71,7 @@ class DeleteController extends Controller
|
||||
*
|
||||
* @param Account $account
|
||||
*
|
||||
* @return Factory|View
|
||||
* @return Factory|RedirectResponse|Redirector|View
|
||||
*/
|
||||
public function delete(Account $account)
|
||||
{
|
||||
|
||||
@@ -81,8 +81,7 @@ class EditController extends Controller
|
||||
* @param Account $account
|
||||
* @param AccountRepositoryInterface $repository
|
||||
*
|
||||
* @return Factory|View
|
||||
*
|
||||
* @return Factory|RedirectResponse|Redirector|View
|
||||
*/
|
||||
public function edit(Request $request, Account $account, AccountRepositoryInterface $repository)
|
||||
{
|
||||
|
||||
@@ -216,7 +216,8 @@ class ReconcileController extends Controller
|
||||
* @param string $difference
|
||||
*
|
||||
* @throws DuplicateTransactionException
|
||||
* @return string
|
||||
*
|
||||
* @return RedirectResponse|Redirector|string
|
||||
*/
|
||||
private function createReconciliation(Account $account, Carbon $start, Carbon $end, string $difference)
|
||||
{
|
||||
|
||||
@@ -86,7 +86,8 @@ class ShowController extends Controller
|
||||
* @param Carbon|null $end
|
||||
*
|
||||
* @throws Exception
|
||||
* @return RedirectResponse|Redirector|View
|
||||
*
|
||||
* @return RedirectResponse|Redirector|\Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||
*/
|
||||
public function show(Request $request, Account $account, Carbon $start = null, Carbon $end = null)
|
||||
{
|
||||
@@ -158,7 +159,8 @@ class ShowController extends Controller
|
||||
* @param Account $account
|
||||
*
|
||||
* @throws Exception
|
||||
* @return RedirectResponse|Redirector|View
|
||||
*
|
||||
* @return RedirectResponse|Redirector|\Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||
*/
|
||||
public function showAll(Request $request, Account $account)
|
||||
{
|
||||
|
||||
@@ -90,7 +90,7 @@ class LinkController extends Controller
|
||||
* @param Request $request
|
||||
* @param LinkType $linkType
|
||||
*
|
||||
* @return RedirectResponse|Redirector|View
|
||||
* @return Factory|RedirectResponse|Redirector|\Illuminate\View\View
|
||||
*/
|
||||
public function delete(Request $request, LinkType $linkType)
|
||||
{
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
/**
|
||||
* TelemetryController.php
|
||||
* Copyright (c) 2020 thegrumpydictator@gmail.com
|
||||
@@ -55,7 +56,7 @@ class TelemetryController extends Controller
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
* @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
|
||||
*/
|
||||
public function deleteSubmitted()
|
||||
{
|
||||
@@ -67,7 +68,7 @@ class TelemetryController extends Controller
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
* @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
|
||||
*/
|
||||
public function deleteAll()
|
||||
{
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -57,10 +57,9 @@ class ForgotPasswordController extends Controller
|
||||
* Send a reset link to the given user.
|
||||
*
|
||||
* @param Request $request
|
||||
*
|
||||
* @param UserRepositoryInterface $repository
|
||||
*
|
||||
* @return RedirectResponse|JsonResponse
|
||||
* @return Factory|RedirectResponse|View
|
||||
*/
|
||||
public function sendResetLinkEmail(Request $request, UserRepositoryInterface $repository)
|
||||
{
|
||||
|
||||
@@ -68,7 +68,8 @@ class ResetPasswordController extends Controller
|
||||
* @param Request $request
|
||||
*
|
||||
* @throws \Illuminate\Validation\ValidationException
|
||||
* @return RedirectResponse|JsonResponse
|
||||
*
|
||||
* @return Factory|JsonResponse|RedirectResponse|View
|
||||
*/
|
||||
public function reset(Request $request)
|
||||
{
|
||||
|
||||
@@ -236,6 +236,7 @@ class IndexController extends Controller
|
||||
$repository->setBudgetOrder($budget, $index + 1);
|
||||
}
|
||||
}
|
||||
app('preferences')->mark();
|
||||
|
||||
return response()->json(['OK']);
|
||||
}
|
||||
|
||||
@@ -450,8 +450,6 @@ class TagReportController extends Controller
|
||||
$data = $this->generator->multiCurrencyPieChart($result);
|
||||
|
||||
return response()->json($data);
|
||||
|
||||
return response()->json($data);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
/**
|
||||
* TransactionController.php
|
||||
* Copyright (c) 2020 thegrumpydictator@gmail.com
|
||||
@@ -204,6 +205,7 @@ class TransactionController extends Controller
|
||||
$collector->setTypes([TransactionType::DEPOSIT]);
|
||||
break;
|
||||
case 'transfers':
|
||||
case 'transfer':
|
||||
$collector->setTypes([TransactionType::TRANSFER]);
|
||||
break;
|
||||
}
|
||||
@@ -270,6 +272,7 @@ class TransactionController extends Controller
|
||||
$collector->setTypes([TransactionType::DEPOSIT]);
|
||||
break;
|
||||
case 'transfers':
|
||||
case 'transfer':
|
||||
$collector->setTypes([TransactionType::TRANSFER]);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -75,7 +75,7 @@ class CurrencyController extends Controller
|
||||
*
|
||||
* @param Request $request
|
||||
*
|
||||
* @return RedirectResponse|Redirector|View
|
||||
* @return Factory|RedirectResponse|Redirector|\Illuminate\View\View
|
||||
*/
|
||||
public function create(Request $request)
|
||||
{
|
||||
@@ -128,7 +128,7 @@ class CurrencyController extends Controller
|
||||
* @param Request $request
|
||||
* @param TransactionCurrency $currency
|
||||
*
|
||||
* @return RedirectResponse|Redirector|View
|
||||
* @return Factory|RedirectResponse|Redirector|\Illuminate\View\View
|
||||
*/
|
||||
public function delete(Request $request, TransactionCurrency $currency)
|
||||
{
|
||||
@@ -266,7 +266,7 @@ class CurrencyController extends Controller
|
||||
* @param Request $request
|
||||
* @param TransactionCurrency $currency
|
||||
*
|
||||
* @return RedirectResponse|Redirector|View
|
||||
* @return Factory|RedirectResponse|Redirector|\Illuminate\View\View
|
||||
*/
|
||||
public function edit(Request $request, TransactionCurrency $currency)
|
||||
{
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
/**
|
||||
* IndexController.php
|
||||
* Copyright (c) 2019 james@firefly-iii.org
|
||||
|
||||
@@ -73,7 +73,7 @@ class PrerequisitesController extends Controller
|
||||
* @param string $importProvider
|
||||
* @param ImportJob $importJob
|
||||
*
|
||||
* @return Factory|View
|
||||
* @return Factory|RedirectResponse|Redirector|View
|
||||
*/
|
||||
public function index(string $importProvider, ImportJob $importJob = null)
|
||||
{
|
||||
|
||||
@@ -58,7 +58,7 @@ class NewUserController extends Controller
|
||||
/**
|
||||
* Form the user gets when he has no data in the system.
|
||||
*
|
||||
* @return RedirectResponse|Redirector|View
|
||||
* @return RedirectResponse|Redirector|\Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
/**
|
||||
* DataController.php
|
||||
* Copyright (c) 2019 james@firefly-iii.org
|
||||
|
||||
@@ -88,7 +88,7 @@ class ProfileController extends Controller
|
||||
*
|
||||
* @param Request $request
|
||||
*
|
||||
* @return Factory|View
|
||||
* @return Factory|RedirectResponse|Redirector|View
|
||||
*/
|
||||
public function changeEmail(Request $request)
|
||||
{
|
||||
@@ -114,7 +114,7 @@ class ProfileController extends Controller
|
||||
*
|
||||
* @param Request $request
|
||||
*
|
||||
* @return Factory|View
|
||||
* @return Factory|RedirectResponse|Redirector|View
|
||||
*/
|
||||
public function changePassword(Request $request)
|
||||
{
|
||||
|
||||
@@ -115,7 +115,7 @@ class InstallController extends Controller
|
||||
/**
|
||||
* Show index.
|
||||
*
|
||||
* @return RedirectResponse|Redirector
|
||||
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
|
||||
@@ -68,7 +68,7 @@ class BulkController extends Controller
|
||||
*
|
||||
* TODO user wont be able to tell if journal is part of split.
|
||||
*
|
||||
* @param Collection $journals
|
||||
* @param array $journals
|
||||
*
|
||||
* @return Factory|View
|
||||
*/
|
||||
|
||||
@@ -87,7 +87,8 @@ class ConvertController extends Controller
|
||||
* @param TransactionGroup $group
|
||||
*
|
||||
* @throws Exception
|
||||
* @return RedirectResponse|Redirector|View
|
||||
*
|
||||
* @return RedirectResponse|Redirector|\Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||
*/
|
||||
public function index(TransactionType $destinationType, TransactionGroup $group)
|
||||
{
|
||||
@@ -207,9 +208,9 @@ class ConvertController extends Controller
|
||||
$sourceId = '' === $sourceId || null === $sourceId ? null : (int) $sourceId;
|
||||
$sourceName = '' === $sourceName ? null : $sourceName;
|
||||
$destinationId = '' === $destinationId || null === $destinationId ? null : (int) $destinationId;
|
||||
$destinationName = '' === $destinationName ? null : $destinationName;
|
||||
$validSource = $validator->validateSource($sourceId, $sourceName);
|
||||
$validDestination = $validator->validateDestination($destinationId, $destinationName);
|
||||
$destinationName = (string)('' === $destinationName ? null : $destinationName);
|
||||
$validSource = $validator->validateSource($sourceId, $sourceName, null);
|
||||
$validDestination = $validator->validateDestination($destinationId, $destinationName, null);
|
||||
|
||||
if (false === $validSource) {
|
||||
throw new FireflyException(sprintf(trans('firefly.convert_invalid_source'), $journal->id));
|
||||
@@ -218,6 +219,8 @@ class ConvertController extends Controller
|
||||
throw new FireflyException(sprintf(trans('firefly.convert_invalid_destination'), $journal->id));
|
||||
}
|
||||
|
||||
// TODO typeOverrule: the account validator may have another opinion on the transaction type.
|
||||
|
||||
$update = [
|
||||
'source_id' => $sourceId,
|
||||
'source_name' => $sourceName,
|
||||
|
||||
@@ -63,7 +63,7 @@ class EditController extends Controller
|
||||
/**
|
||||
* @param TransactionGroup $transactionGroup
|
||||
*
|
||||
* @return Factory|View
|
||||
* @return Factory|View|\Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
|
||||
*/
|
||||
public function edit(TransactionGroup $transactionGroup)
|
||||
{
|
||||
|
||||
@@ -108,6 +108,7 @@ class ShowController extends Controller
|
||||
if (!Str::contains($transaction['notes'], $search)) {
|
||||
$groupArray['transactions'][$index]['notes'] = e($transaction['notes']);
|
||||
}
|
||||
$groupArray['transactions'][$index]['tags'] = $this->repository->getTagObjects($groupArray['transactions'][$index]['transaction_journal_id']);
|
||||
}
|
||||
|
||||
$events = $this->repository->getPiggyEvents($transactionGroup);
|
||||
|
||||
@@ -246,6 +246,8 @@ class RecurrenceFormRequest extends Request
|
||||
$sourceId = null;
|
||||
$destinationId = null;
|
||||
|
||||
// TODO typeOverrule: the account validator may have another opinion on the transaction type.
|
||||
|
||||
switch ($this->string('transaction_type')) {
|
||||
default:
|
||||
throw new FireflyException(sprintf('Cannot handle transaction type "%s"', $this->string('transaction_type'))); // @codeCoverageIgnore
|
||||
@@ -265,7 +267,7 @@ class RecurrenceFormRequest extends Request
|
||||
|
||||
|
||||
// validate source account.
|
||||
$validSource = $accountValidator->validateSource($sourceId, null);
|
||||
$validSource = $accountValidator->validateSource($sourceId, null, null);
|
||||
|
||||
// do something with result:
|
||||
if (false === $validSource) {
|
||||
@@ -277,7 +279,7 @@ class RecurrenceFormRequest extends Request
|
||||
}
|
||||
|
||||
// validate destination account
|
||||
$validDestination = $accountValidator->validateDestination($destinationId, null);
|
||||
$validDestination = $accountValidator->validateDestination($destinationId, null, null);
|
||||
// do something with result:
|
||||
if (false === $validDestination) {
|
||||
$message = (string) trans('validation.generic_invalid_destination');
|
||||
|
||||
@@ -41,8 +41,7 @@ class BankDebitCredit implements ConverterInterface
|
||||
*
|
||||
* @param $value
|
||||
*
|
||||
* @return mixed
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function convert($value): int
|
||||
{
|
||||
|
||||
@@ -112,9 +112,10 @@ class IngDescription implements SpecificInterface
|
||||
protected function moveValutadatumDescription(): void
|
||||
{
|
||||
$matches = [];
|
||||
preg_match('/Valutadatum: ([0-9-]+)/', $this->row[8], $matches);
|
||||
$this->row[9] = date("Ymd", strtotime($matches[1]));
|
||||
$this->row[8] = preg_replace('/Valutadatum: [0-9-]+/', '', $this->row[8]);
|
||||
if (preg_match('/Valutadatum: ([0-9-]+)/', $this->row[8], $matches)) {
|
||||
$this->row[9] = date("Ymd", strtotime($matches[1]));
|
||||
$this->row[8] = preg_replace('/Valutadatum: [0-9-]+/', '', $this->row[8]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -140,11 +141,7 @@ class IngDescription implements SpecificInterface
|
||||
*/
|
||||
protected function removeNameIngDescription(): void
|
||||
{
|
||||
$matches = [];
|
||||
if (preg_match('/Valutadatum: ([0-9-]+)/', $this->row[8], $matches)) {
|
||||
$this->row[9] = date("Ymd", strtotime($matches[1]));
|
||||
$this->row[8] = preg_replace('/Valutadatum: [0-9-]+/', '', $this->row[8]);
|
||||
}
|
||||
$this->row[8] = preg_replace('/Naam:.*?([a-zA-Z\/]+:)/', '$1', $this->row[8]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -153,16 +150,23 @@ class IngDescription implements SpecificInterface
|
||||
private function MoveSavingsAccount(): void
|
||||
{
|
||||
$matches = [];
|
||||
if ('' === (string) $this->row[3]) {
|
||||
if (preg_match('/(Naar|Van) (.*rekening) ([0-9]+)/', $this->row[8], $matches)) {
|
||||
$matches[3] = sprintf("%010d", $matches[3]);
|
||||
$this->row[1] = $matches[2]; // Savings account name
|
||||
$this->row[3] = $matches[3]; // Savings account number
|
||||
$this->row[8] = preg_replace('/(Naar|Van) (.*rekening) ([0-9]+)/', '', $this->row[8]); // Remove the savings account content from description
|
||||
} elseif (preg_match('/(Naar|Van) (.*rekening) ([0-9]+)/', $this->row[1], $matches)) {
|
||||
$matches[3] = sprintf("%010d", $matches[3]);
|
||||
$this->row[1] = $matches[2]; // Savings account name
|
||||
$this->row[3] = $matches[3]; // Savings account number
|
||||
|
||||
if (preg_match('/(Naar|Van) (.*rekening) ([A-Za-z0-9]+)/', $this->row[8], $matches)) { // Search for saving acount at 'Mededelingen' column
|
||||
$this->row[1] = $this->row[1] . ' ' . $matches[2] . ' ' . $matches[3]; // Current name + Saving acount name + Acount number
|
||||
if ('' === (string) $this->row[3]) { // if Saving account number does not yet exists
|
||||
$this->row[3] = $matches[3]; // Copy savings account number
|
||||
}
|
||||
$this->row[8] = preg_replace('/(Naar|Van) (.*rekening) ([A-Za-z0-9]+)/', '', $this->row[8]); // Remove the savings account content from description
|
||||
} elseif (preg_match('/(Naar|Van) (.*rekening) ([A-Za-z0-9]+)/', $this->row[1], $matches)) { // Search for saving acount at 'Naam / Omschrijving' column
|
||||
$this->row[1] = $matches[2] . ' ' . $matches[3]; // Saving acount name + Acount number
|
||||
if ('' === (string) $this->row[3]) { // if Saving account number does not yet exists
|
||||
$this->row[3] = $matches[3]; // Copy savings account number
|
||||
}
|
||||
}
|
||||
|
||||
if ('' !== (string)$this->row[3]) { // if Saving account number exists
|
||||
if (! preg_match('/[A-Za-z]/', $this->row[3])) { // if Saving account number has no characters
|
||||
$this->row[3] = sprintf("%010d", $this->row[3]); // Make the number 10 digits
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -85,6 +85,21 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||
* @method static Builder|Account withTrashed()
|
||||
* @method static Builder|Account withoutTrashed()
|
||||
* @mixin Eloquent
|
||||
* @property-read int|null $account_meta_count
|
||||
* @property-read \Illuminate\Database\Eloquent\Collection|Attachment[] $attachments
|
||||
* @property-read int|null $attachments_count
|
||||
* @property-read string $account_number
|
||||
* @property-read \Illuminate\Database\Eloquent\Collection|Location[] $locations
|
||||
* @property-read int|null $locations_count
|
||||
* @property-read int|null $notes_count
|
||||
* @property-read int|null $piggy_banks_count
|
||||
* @property-read int|null $transactions_count
|
||||
* @property \Illuminate\Support\Carbon|null $created_at
|
||||
* @property \Illuminate\Support\Carbon|null $updated_at
|
||||
* @property int $account_type_id
|
||||
* @property bool $encrypted
|
||||
* @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\AccountMeta[] $accountMeta
|
||||
* @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\PiggyBank[] $piggyBanks
|
||||
*/
|
||||
class Account extends Model
|
||||
{
|
||||
|
||||
@@ -32,11 +32,11 @@ use Illuminate\Support\Carbon;
|
||||
/**
|
||||
* Class AccountType.
|
||||
*
|
||||
* @property string $type
|
||||
* @property string $type
|
||||
* @method whereType(string $type)
|
||||
* @property int $id
|
||||
* @property Carbon|null $created_at
|
||||
* @property Carbon|null $updated_at
|
||||
* @property int $id
|
||||
* @property Carbon|null $created_at
|
||||
* @property Carbon|null $updated_at
|
||||
* @property-read Collection|Account[] $accounts
|
||||
* @method static Builder|AccountType newModelQuery()
|
||||
* @method static Builder|AccountType newQuery()
|
||||
@@ -45,6 +45,7 @@ use Illuminate\Support\Carbon;
|
||||
* @method static Builder|AccountType whereId($value)
|
||||
* @method static Builder|AccountType whereUpdatedAt($value)
|
||||
* @mixin Eloquent
|
||||
* @property-read int|null $accounts_count
|
||||
*/
|
||||
class AccountType extends Model
|
||||
{
|
||||
|
||||
@@ -78,6 +78,7 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||
* @method static Builder|Attachment withTrashed()
|
||||
* @method static Builder|Attachment withoutTrashed()
|
||||
* @mixin Eloquent
|
||||
* @property-read int|null $notes_count
|
||||
*/
|
||||
class Attachment extends Model
|
||||
{
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
/**
|
||||
* AutoBudget.php
|
||||
* Copyright (c) 2020 thegrumpydictator@gmail.com
|
||||
@@ -21,12 +22,45 @@
|
||||
|
||||
namespace FireflyIII\Models;
|
||||
|
||||
use Eloquent;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use Illuminate\Database\Query\Builder;
|
||||
use Illuminate\Support\Carbon;
|
||||
|
||||
/**
|
||||
* Class AutoBudget
|
||||
*
|
||||
* @property int $id
|
||||
* @property Carbon|null $created_at
|
||||
* @property Carbon|null $updated_at
|
||||
* @property Carbon|null $deleted_at
|
||||
* @property int $budget_id
|
||||
* @property int $transaction_currency_id
|
||||
* @property int $auto_budget_type
|
||||
* @property float $amount
|
||||
* @property string $period
|
||||
* @property-read Budget $budget
|
||||
* @property-read TransactionCurrency $transactionCurrency
|
||||
* @method static bool|null forceDelete()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|AutoBudget newModelQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|AutoBudget newQuery()
|
||||
* @method static Builder|AutoBudget onlyTrashed()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|AutoBudget query()
|
||||
* @method static bool|null restore()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|AutoBudget whereAmount($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|AutoBudget whereAutoBudgetType($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|AutoBudget whereBudgetId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|AutoBudget whereCreatedAt($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|AutoBudget whereDeletedAt($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|AutoBudget whereId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|AutoBudget wherePeriod($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|AutoBudget whereTransactionCurrencyId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|AutoBudget whereUpdatedAt($value)
|
||||
* @method static Builder|AutoBudget withTrashed()
|
||||
* @method static Builder|AutoBudget withoutTrashed()
|
||||
* @mixin Eloquent
|
||||
*/
|
||||
class AutoBudget extends Model
|
||||
{
|
||||
|
||||
@@ -86,6 +86,11 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||
* @method static Builder|Bill withTrashed()
|
||||
* @method static Builder|Bill withoutTrashed()
|
||||
* @mixin Eloquent
|
||||
* @property-read int|null $attachments_count
|
||||
* @property-read int|null $notes_count
|
||||
* @property-read int|null $transaction_journals_count
|
||||
* @property bool $name_encrypted
|
||||
* @property bool $match_encrypted
|
||||
*/
|
||||
class Bill extends Model
|
||||
{
|
||||
|
||||
@@ -70,6 +70,13 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||
* @method static Builder|Budget withTrashed()
|
||||
* @method static Builder|Budget withoutTrashed()
|
||||
* @mixin Eloquent
|
||||
* @property-read \Illuminate\Database\Eloquent\Collection|Attachment[] $attachments
|
||||
* @property-read int|null $attachments_count
|
||||
* @property-read \Illuminate\Database\Eloquent\Collection|AutoBudget[] $autoBudgets
|
||||
* @property-read int|null $auto_budgets_count
|
||||
* @property-read int|null $budgetlimits_count
|
||||
* @property-read int|null $transaction_journals_count
|
||||
* @property-read int|null $transactions_count
|
||||
*/
|
||||
class Budget extends Model
|
||||
{
|
||||
|
||||
@@ -66,6 +66,11 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||
* @method static Builder|Category withTrashed()
|
||||
* @method static Builder|Category withoutTrashed()
|
||||
* @mixin Eloquent
|
||||
* @property-read Collection|Attachment[] $attachments
|
||||
* @property-read int|null $attachments_count
|
||||
* @property-read int|null $transaction_journals_count
|
||||
* @property-read int|null $transactions_count
|
||||
* @property bool $encrypted
|
||||
*/
|
||||
class Category extends Model
|
||||
{
|
||||
|
||||
@@ -35,14 +35,14 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||
/**
|
||||
* Class ImportJob.
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
* @deprecated
|
||||
* @property array $transactions
|
||||
* @property array $configuration
|
||||
* @property User $user
|
||||
* @property int $user_id
|
||||
* @property string $status
|
||||
* @property string $stage
|
||||
* @codeCoverageIgnore
|
||||
* @deprecated
|
||||
* @property array $transactions
|
||||
* @property array $configuration
|
||||
* @property User $user
|
||||
* @property int $user_id
|
||||
* @property string $status
|
||||
* @property string $stage
|
||||
* @property string $key
|
||||
* @property string $provider
|
||||
* @property string $file_type
|
||||
@@ -72,6 +72,9 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||
* @method static Builder|ImportJob whereUpdatedAt($value)
|
||||
* @method static Builder|ImportJob whereUserId($value)
|
||||
* @mixin Eloquent
|
||||
* @property-read int|null $attachments_count
|
||||
* @property int $id
|
||||
* @property array|null $extended_status
|
||||
*/
|
||||
class ImportJob extends Model
|
||||
{
|
||||
|
||||
@@ -62,6 +62,7 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||
* @method static Builder|LinkType withTrashed()
|
||||
* @method static Builder|LinkType withoutTrashed()
|
||||
* @mixin Eloquent
|
||||
* @property-read int|null $transaction_journal_links_count
|
||||
*/
|
||||
class LinkType extends Model
|
||||
{
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
/**
|
||||
* Location.php
|
||||
* Copyright (c) 2019 james@firefly-iii.org
|
||||
@@ -22,12 +23,42 @@
|
||||
namespace FireflyIII\Models;
|
||||
|
||||
|
||||
use Eloquent;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\Collection;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\MorphMany;
|
||||
use Illuminate\Database\Eloquent\Relations\MorphTo;
|
||||
use Illuminate\Support\Carbon;
|
||||
|
||||
/**
|
||||
* Class Location
|
||||
*
|
||||
* @property int $id
|
||||
* @property Carbon|null $created_at
|
||||
* @property Carbon|null $updated_at
|
||||
* @property Carbon|null $deleted_at
|
||||
* @property int $locatable_id
|
||||
* @property string $locatable_type
|
||||
* @property float|null $latitude
|
||||
* @property float|null $longitude
|
||||
* @property int|null $zoom_level
|
||||
* @property-read Collection|Account[] $accounts
|
||||
* @property-read int|null $accounts_count
|
||||
* @property-read Model|Eloquent $locatable
|
||||
* @method static Builder|Location newModelQuery()
|
||||
* @method static Builder|Location newQuery()
|
||||
* @method static Builder|Location query()
|
||||
* @method static Builder|Location whereCreatedAt($value)
|
||||
* @method static Builder|Location whereDeletedAt($value)
|
||||
* @method static Builder|Location whereId($value)
|
||||
* @method static Builder|Location whereLatitude($value)
|
||||
* @method static Builder|Location whereLocatableId($value)
|
||||
* @method static Builder|Location whereLocatableType($value)
|
||||
* @method static Builder|Location whereLongitude($value)
|
||||
* @method static Builder|Location whereUpdatedAt($value)
|
||||
* @method static Builder|Location whereZoomLevel($value)
|
||||
* @mixin Eloquent
|
||||
*/
|
||||
class Location extends Model
|
||||
{
|
||||
|
||||
@@ -73,6 +73,12 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||
* @method static Builder|PiggyBank withTrashed()
|
||||
* @method static Builder|PiggyBank withoutTrashed()
|
||||
* @mixin Eloquent
|
||||
* @property-read Collection|Attachment[] $attachments
|
||||
* @property-read int|null $attachments_count
|
||||
* @property-read int|null $notes_count
|
||||
* @property-read int|null $piggy_bank_events_count
|
||||
* @property-read int|null $piggy_bank_repetitions_count
|
||||
* @property bool $encrypted
|
||||
*/
|
||||
class PiggyBank extends Model
|
||||
{
|
||||
|
||||
@@ -51,6 +51,10 @@ use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
* @method static Builder|PiggyBankEvent whereTransactionJournalId($value)
|
||||
* @method static Builder|PiggyBankEvent whereUpdatedAt($value)
|
||||
* @mixin Eloquent
|
||||
* @property \Illuminate\Support\Carbon|null $created_at
|
||||
* @property \Illuminate\Support\Carbon|null $updated_at
|
||||
* @property \Illuminate\Support\Carbon $date
|
||||
* @property-read \FireflyIII\Models\TransactionJournal|null $transactionJournal
|
||||
*/
|
||||
class PiggyBankEvent extends Model
|
||||
{
|
||||
|
||||
@@ -50,6 +50,7 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||
* @method static Builder|Preference whereUpdatedAt($value)
|
||||
* @method static Builder|Preference whereUserId($value)
|
||||
* @mixin Eloquent
|
||||
* @property-read \FireflyIII\User $user
|
||||
*/
|
||||
class Preference extends Model
|
||||
{
|
||||
|
||||
@@ -87,6 +87,10 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||
* @method static Builder|Recurrence withTrashed()
|
||||
* @method static Builder|Recurrence withoutTrashed()
|
||||
* @mixin Eloquent
|
||||
* @property-read int|null $notes_count
|
||||
* @property-read int|null $recurrence_meta_count
|
||||
* @property-read int|null $recurrence_repetitions_count
|
||||
* @property-read int|null $recurrence_transactions_count
|
||||
*/
|
||||
class Recurrence extends Model
|
||||
{
|
||||
|
||||
@@ -75,6 +75,8 @@ use Illuminate\Support\Collection;
|
||||
* @method static Builder|RecurrenceTransaction withTrashed()
|
||||
* @method static Builder|RecurrenceTransaction withoutTrashed()
|
||||
* @mixin Eloquent
|
||||
* @property-read int|null $recurrence_transaction_meta_count
|
||||
* @property int $transaction_currency_id
|
||||
*/
|
||||
class RecurrenceTransaction extends Model
|
||||
{
|
||||
|
||||
@@ -50,6 +50,7 @@ use Illuminate\Support\Carbon;
|
||||
* @method static Builder|Role whereName($value)
|
||||
* @method static Builder|Role whereUpdatedAt($value)
|
||||
* @mixin Eloquent
|
||||
* @property-read int|null $users_count
|
||||
*/
|
||||
class Role extends Model
|
||||
{
|
||||
|
||||
@@ -73,6 +73,8 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||
* @method static Builder|Rule withTrashed()
|
||||
* @method static Builder|Rule withoutTrashed()
|
||||
* @mixin Eloquent
|
||||
* @property-read int|null $rule_actions_count
|
||||
* @property-read int|null $rule_triggers_count
|
||||
*/
|
||||
class Rule extends Model
|
||||
{
|
||||
|
||||
@@ -67,6 +67,9 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||
* @method static Builder|RuleGroup withoutTrashed()
|
||||
* @property bool $stop_processing
|
||||
* @mixin Eloquent
|
||||
* @property-read int|null $rules_count
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|RuleGroup whereStopProcessing($value)
|
||||
* @property string|null $description
|
||||
*/
|
||||
class RuleGroup extends Model
|
||||
{
|
||||
|
||||
@@ -73,6 +73,18 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||
* @method static Builder|Tag withTrashed()
|
||||
* @method static Builder|Tag withoutTrashed()
|
||||
* @mixin Eloquent
|
||||
* @property-read \Illuminate\Database\Eloquent\Collection|Attachment[] $attachments
|
||||
* @property-read int|null $attachments_count
|
||||
* @property-read \Illuminate\Database\Eloquent\Collection|Location[] $locations
|
||||
* @property-read int|null $locations_count
|
||||
* @property-read int|null $transaction_journals_count
|
||||
* @property \Illuminate\Support\Carbon|null $created_at
|
||||
* @property \Illuminate\Support\Carbon|null $updated_at
|
||||
* @property string $tagMode
|
||||
* @property string|null $description
|
||||
* @property float|null $latitude
|
||||
* @property float|null $longitude
|
||||
* @property int|null $zoomLevel
|
||||
*/
|
||||
class Tag extends Model
|
||||
{
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
/**
|
||||
* Telemetry.php
|
||||
* Copyright (c) 2020 thegrumpydictator@gmail.com
|
||||
@@ -22,10 +23,36 @@
|
||||
namespace FireflyIII\Models;
|
||||
|
||||
|
||||
use Eloquent;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Support\Carbon;
|
||||
|
||||
/**
|
||||
* Class Telemetry
|
||||
*
|
||||
* @property int $id
|
||||
* @property Carbon|null $created_at
|
||||
* @property Carbon|null $updated_at
|
||||
* @property Carbon|null $submitted
|
||||
* @property int|null $user_id
|
||||
* @property string $installation_id
|
||||
* @property string $type
|
||||
* @property string $key
|
||||
* @property array $value
|
||||
* @method static Builder|Telemetry newModelQuery()
|
||||
* @method static Builder|Telemetry newQuery()
|
||||
* @method static Builder|Telemetry query()
|
||||
* @method static Builder|Telemetry whereCreatedAt($value)
|
||||
* @method static Builder|Telemetry whereId($value)
|
||||
* @method static Builder|Telemetry whereInstallationId($value)
|
||||
* @method static Builder|Telemetry whereKey($value)
|
||||
* @method static Builder|Telemetry whereSubmitted($value)
|
||||
* @method static Builder|Telemetry whereType($value)
|
||||
* @method static Builder|Telemetry whereUpdatedAt($value)
|
||||
* @method static Builder|Telemetry whereUserId($value)
|
||||
* @method static Builder|Telemetry whereValue($value)
|
||||
* @mixin Eloquent
|
||||
*/
|
||||
class Telemetry extends Model
|
||||
{
|
||||
|
||||
@@ -130,6 +130,11 @@ use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
* @method static \Illuminate\Database\Query\Builder|Transaction withTrashed()
|
||||
* @method static \Illuminate\Database\Query\Builder|Transaction withoutTrashed()
|
||||
* @mixin Eloquent
|
||||
* @property-read int|null $budgets_count
|
||||
* @property-read int|null $categories_count
|
||||
* @property \Illuminate\Support\Carbon|null $created_at
|
||||
* @property \Illuminate\Support\Carbon|null $updated_at
|
||||
* @property bool $reconciled
|
||||
*/
|
||||
class Transaction extends Model
|
||||
{
|
||||
|
||||
@@ -64,6 +64,10 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||
* @method static Builder|TransactionCurrency withTrashed()
|
||||
* @method static Builder|TransactionCurrency withoutTrashed()
|
||||
* @mixin Eloquent
|
||||
* @property-read int|null $budget_limits_count
|
||||
* @property-read int|null $transaction_journals_count
|
||||
* @property-read int|null $transactions_count
|
||||
* @property string $name
|
||||
*/
|
||||
class TransactionCurrency extends Model
|
||||
{
|
||||
|
||||
@@ -60,11 +60,12 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||
* @method static Builder|TransactionGroup withTrashed()
|
||||
* @method static Builder|TransactionGroup withoutTrashed()
|
||||
* @mixin Eloquent
|
||||
* @property string amount
|
||||
* @property string foreign_amount
|
||||
* @property int transaction_group_id
|
||||
* @property int transaction_journal_id
|
||||
* @property string transaction_group_title
|
||||
* @property string amount
|
||||
* @property string foreign_amount
|
||||
* @property int transaction_group_id
|
||||
* @property int transaction_journal_id
|
||||
* @property string transaction_group_title
|
||||
* @property-read int|null $transaction_journals_count
|
||||
*/
|
||||
class TransactionGroup extends Model
|
||||
{
|
||||
|
||||
@@ -109,6 +109,30 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||
* @method static \Illuminate\Database\Query\Builder|TransactionJournal withTrashed()
|
||||
* @method static \Illuminate\Database\Query\Builder|TransactionJournal withoutTrashed()
|
||||
* @mixin Eloquent
|
||||
* @property-read int|null $attachments_count
|
||||
* @property-read int|null $budgets_count
|
||||
* @property-read int|null $categories_count
|
||||
* @property-read \Illuminate\Database\Eloquent\Collection|TransactionJournalLink[] $destJournalLinks
|
||||
* @property-read int|null $dest_journal_links_count
|
||||
* @property-read int|null $notes_count
|
||||
* @property-read int|null $piggy_bank_events_count
|
||||
* @property-read int|null $source_journal_links_count
|
||||
* @property-read int|null $tags_count
|
||||
* @property-read int|null $transaction_journal_meta_count
|
||||
* @property-read int|null $transactions_count
|
||||
* @method static EloquentBuilder|TransactionJournal whereTransactionGroupId($value)
|
||||
* @property int $user_id
|
||||
* @property int|null $transaction_group_id
|
||||
* @property int|null $transaction_currency_id
|
||||
* @property \Illuminate\Support\Carbon|null $interest_date
|
||||
* @property \Illuminate\Support\Carbon|null $book_date
|
||||
* @property \Illuminate\Support\Carbon|null $process_date
|
||||
* @property int $order
|
||||
* @property bool $encrypted
|
||||
* @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\Budget[] $budgets
|
||||
* @property-read \FireflyIII\Models\TransactionGroup|null $transactionGroup
|
||||
* @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\TransactionJournalMeta[] $transactionJournalMeta
|
||||
* @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\Transaction[] $transactions
|
||||
*/
|
||||
class TransactionJournal extends Model
|
||||
{
|
||||
|
||||
@@ -56,6 +56,7 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||
* @method static Builder|TransactionJournalLink whereSourceId($value)
|
||||
* @method static Builder|TransactionJournalLink whereUpdatedAt($value)
|
||||
* @mixin Eloquent
|
||||
* @property-read int|null $notes_count
|
||||
*/
|
||||
class TransactionJournalLink extends Model
|
||||
{
|
||||
|
||||
@@ -54,6 +54,7 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||
* @method static Builder|TransactionType withTrashed()
|
||||
* @method static Builder|TransactionType withoutTrashed()
|
||||
* @mixin Eloquent
|
||||
* @property-read int|null $transaction_journals_count
|
||||
*/
|
||||
class TransactionType extends Model
|
||||
{
|
||||
|
||||
@@ -189,7 +189,7 @@ class BudgetRepository implements BudgetRepositoryInterface
|
||||
{
|
||||
/** @var Collection $set */
|
||||
$set = $this->user->budgets()->where('active', 1)
|
||||
->orderBy('order', 'ASC')
|
||||
->orderBy('order', 'DESC')
|
||||
->orderBy('name', 'ASC')
|
||||
->get();
|
||||
|
||||
|
||||
@@ -267,6 +267,7 @@ class CategoryRepository implements CategoryRepositoryInterface
|
||||
{
|
||||
/** @var CategoryUpdateService $service */
|
||||
$service = app(CategoryUpdateService::class);
|
||||
$service->setUser($this->user);
|
||||
|
||||
return $service->update($category, $data);
|
||||
}
|
||||
|
||||
@@ -320,7 +320,7 @@ class CurrencyRepository implements CurrencyRepositoryInterface
|
||||
* @param int|null $currencyId
|
||||
* @param string|null $currencyCode
|
||||
*
|
||||
* @return TransactionCurrency|null
|
||||
* @return TransactionCurrency
|
||||
*/
|
||||
public function findCurrency(?int $currencyId, ?string $currencyCode): TransactionCurrency
|
||||
{
|
||||
|
||||
@@ -156,7 +156,7 @@ interface CurrencyRepositoryInterface
|
||||
* @param int|null $currencyId
|
||||
* @param string|null $currencyCode
|
||||
*
|
||||
* @return TransactionCurrency|null
|
||||
* @return TransactionCurrency
|
||||
*/
|
||||
public function findCurrency(?int $currencyId, ?string $currencyCode): TransactionCurrency;
|
||||
|
||||
|
||||
@@ -118,7 +118,7 @@ interface TagRepositoryInterface
|
||||
/**
|
||||
* @param int|null $year
|
||||
*
|
||||
* @return Collection
|
||||
* @return array
|
||||
*/
|
||||
public function getTagsInYear(?int $year): array;
|
||||
|
||||
|
||||
@@ -45,6 +45,7 @@ use FireflyIII\Services\Internal\Update\GroupUpdateService;
|
||||
use FireflyIII\Support\NullArrayObject;
|
||||
use FireflyIII\User;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Support\Collection;
|
||||
use Log;
|
||||
|
||||
/**
|
||||
@@ -468,4 +469,15 @@ class TransactionGroupRepository implements TransactionGroupRepositoryInterface
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function getTagObjects(int $journalId): Collection
|
||||
{
|
||||
/** @var TransactionJournal $journal */
|
||||
$journal = $this->user->transactionJournals()->find($journalId);
|
||||
|
||||
return $journal->tags()->get();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,6 +28,7 @@ use FireflyIII\Exceptions\FireflyException;
|
||||
use FireflyIII\Models\TransactionGroup;
|
||||
use FireflyIII\Support\NullArrayObject;
|
||||
use FireflyIII\User;
|
||||
use Illuminate\Support\Collection;
|
||||
|
||||
/**
|
||||
* Interface TransactionGroupRepositoryInterface
|
||||
@@ -122,6 +123,15 @@ interface TransactionGroupRepositoryInterface
|
||||
*/
|
||||
public function getTags(int $journalId): array;
|
||||
|
||||
/**
|
||||
* Get the tags for a journal (by ID) as Tag objects.
|
||||
*
|
||||
* @param int $journalId
|
||||
*
|
||||
* @return Collection
|
||||
*/
|
||||
public function getTagObjects(int $journalId): Collection;
|
||||
|
||||
/**
|
||||
* Set the user.
|
||||
*
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
/**
|
||||
* IsTransferAccount.php
|
||||
* Copyright (c) 2019 james@firefly-iii.org
|
||||
@@ -35,7 +36,7 @@ class IsTransferAccount implements Rule
|
||||
/**
|
||||
* Get the validation error message.
|
||||
*
|
||||
* @return string|array
|
||||
* @return string
|
||||
*/
|
||||
public function message(): string
|
||||
{
|
||||
@@ -58,14 +59,14 @@ class IsTransferAccount implements Rule
|
||||
$validator->setTransactionType(TransactionType::TRANSFER);
|
||||
$validator->setUser(auth()->user());
|
||||
|
||||
$validAccount = $validator->validateSource(null, (string)$value);
|
||||
$validAccount = $validator->validateSource(null, (string)$value, null);
|
||||
if (true === $validAccount) {
|
||||
Log::debug('Found account based on name. Return true.');
|
||||
|
||||
// found by name, use repos to return.
|
||||
return true;
|
||||
}
|
||||
$validAccount = $validator->validateSource((int)$value, null);
|
||||
$validAccount = $validator->validateSource((int)$value, null, null);
|
||||
Log::debug(sprintf('Search by id (%d), result is %s.', (int)$value, var_export($validAccount, true)));
|
||||
|
||||
return !(false === $validAccount);
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
/**
|
||||
* LessThanPiggyTarget.php
|
||||
* Copyright (c) 2019 james@firefly-iii.org
|
||||
|
||||
@@ -128,7 +128,7 @@ class FixerIOv2 implements ExchangeRateInterface
|
||||
/**
|
||||
* @param User $user
|
||||
*
|
||||
* @return mixed|void
|
||||
* @return void
|
||||
*/
|
||||
public function setUser(User $user)
|
||||
{
|
||||
|
||||
@@ -117,7 +117,7 @@ class RatesApiIOv1 implements ExchangeRateInterface
|
||||
/**
|
||||
* @param User $user
|
||||
*
|
||||
* @return mixed|void
|
||||
* @return void
|
||||
*/
|
||||
public function setUser(User $user)
|
||||
{
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
/**
|
||||
* UpdateRequest.php
|
||||
* Copyright (c) 2019 james@firefly-iii.org
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
/**
|
||||
* UpdateRequestInterface.php
|
||||
* Copyright (c) 2019 james@firefly-iii.org
|
||||
|
||||
@@ -367,13 +367,13 @@ trait JournalServiceTrait
|
||||
if (null !== $data['bic']) {
|
||||
/** @var AccountMetaFactory $metaFactory */
|
||||
$metaFactory = app(AccountMetaFactory::class);
|
||||
$metaFactory->create(['account_id' => $result->id, 'name' => 'BIC', 'data' => $data['bic']]);
|
||||
$metaFactory->create(['account_id' => $account->id, 'name' => 'BIC', 'data' => $data['bic']]);
|
||||
}
|
||||
// store account number
|
||||
if (null !== $data['number']) {
|
||||
/** @var AccountMetaFactory $metaFactory */
|
||||
$metaFactory = app(AccountMetaFactory::class);
|
||||
$metaFactory->create(['account_id' => $result->id, 'name' => 'account_number', 'data' => $data['bic']]);
|
||||
$metaFactory->create(['account_id' => $account->id, 'name' => 'account_number', 'data' => $data['bic']]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
/**
|
||||
* LocationServiceTrait.php
|
||||
* Copyright (c) 2019 james@firefly-iii.org
|
||||
|
||||
@@ -98,14 +98,16 @@ trait RecurringTransactionTrait
|
||||
$validator = app(AccountValidator::class);
|
||||
$validator->setUser($recurrence->user);
|
||||
$validator->setTransactionType($recurrence->transactionType->type);
|
||||
if (!$validator->validateSource($source->id, null)) {
|
||||
if (!$validator->validateSource($source->id, null, null)) {
|
||||
throw new FireflyException(sprintf('Source invalid: %s', $validator->sourceError)); // @codeCoverageIgnore
|
||||
}
|
||||
|
||||
if (!$validator->validateDestination($destination->id, null)) {
|
||||
if (!$validator->validateDestination($destination->id, null, null)) {
|
||||
throw new FireflyException(sprintf('Destination invalid: %s', $validator->destError)); // @codeCoverageIgnore
|
||||
}
|
||||
|
||||
// TODO typeOverrule: the account validator may have another opinion on the transaction type.
|
||||
|
||||
$transaction = new RecurrenceTransaction(
|
||||
[
|
||||
'recurrence_id' => $recurrence->id,
|
||||
|
||||
@@ -35,6 +35,9 @@ use Log;
|
||||
*/
|
||||
class CategoryUpdateService
|
||||
{
|
||||
private $user;
|
||||
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*/
|
||||
@@ -43,6 +46,9 @@ class CategoryUpdateService
|
||||
if ('testing' === config('app.env')) {
|
||||
Log::warning(sprintf('%s should not be instantiated in the TEST environment!', get_class($this)));
|
||||
}
|
||||
if(auth()->check()) {
|
||||
$this->user = auth()->user();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -106,4 +112,12 @@ class CategoryUpdateService
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $user
|
||||
*/
|
||||
public function setUser($user): void
|
||||
{
|
||||
$this->user = $user;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -359,9 +359,11 @@ class JournalUpdateService
|
||||
$validator->source = $this->getValidSourceAccount();
|
||||
|
||||
|
||||
$result = $validator->validateDestination($destId, $destName);
|
||||
$result = $validator->validateDestination($destId, $destName, null);
|
||||
Log::debug(sprintf('hasValidDestinationAccount(%d, "%s") will return %s', $destId, $destName, var_export($result, true)));
|
||||
|
||||
// TODO typeOverrule: the account validator may have another opinion on the transaction type.
|
||||
|
||||
// validate submitted info:
|
||||
return $result;
|
||||
}
|
||||
@@ -391,9 +393,11 @@ class JournalUpdateService
|
||||
$validator->setTransactionType($expectedType);
|
||||
$validator->setUser($this->transactionJournal->user);
|
||||
|
||||
$result = $validator->validateSource($sourceId, $sourceName);
|
||||
$result = $validator->validateSource($sourceId, $sourceName, null);
|
||||
Log::debug(sprintf('hasValidSourceAccount(%d, "%s") will return %s', $sourceId, $sourceName, var_export($result, true)));
|
||||
|
||||
// TODO typeOverrule: the account validator may have another opinion on the transaction type.
|
||||
|
||||
// validate submitted info:
|
||||
return $result;
|
||||
}
|
||||
|
||||
@@ -25,11 +25,9 @@ namespace FireflyIII\Support;
|
||||
use Crypt;
|
||||
use FireflyIII\Models\TransactionCurrency;
|
||||
use FireflyIII\User;
|
||||
use Illuminate\Contracts\Auth\Authenticatable;
|
||||
use Illuminate\Contracts\Encryption\DecryptException;
|
||||
use Illuminate\Support\Collection;
|
||||
use Log;
|
||||
use Preferences as Prefs;
|
||||
|
||||
/**
|
||||
* Class Amount.
|
||||
@@ -204,7 +202,7 @@ class Amount
|
||||
if ($cache->has()) {
|
||||
return $cache->get(); // @codeCoverageIgnore
|
||||
}
|
||||
$currencyPreference = Prefs::get('currencyPreference', config('firefly.default_currency', 'EUR'));
|
||||
$currencyPreference = app('preferences')->get('currencyPreference', config('firefly.default_currency', 'EUR'));
|
||||
|
||||
$currency = TransactionCurrency::where('code', $currencyPreference->data)->first();
|
||||
if ($currency) {
|
||||
@@ -230,7 +228,7 @@ class Amount
|
||||
if ($cache->has()) {
|
||||
return $cache->get(); // @codeCoverageIgnore
|
||||
}
|
||||
$currencyPreference = Prefs::get('currencyPreference', config('firefly.default_currency', 'EUR'));
|
||||
$currencyPreference = app('preferences')->get('currencyPreference', config('firefly.default_currency', 'EUR'));
|
||||
$currency = TransactionCurrency::where('code', $currencyPreference->data)->first();
|
||||
|
||||
$cache->store($currency->symbol);
|
||||
@@ -253,7 +251,19 @@ class Amount
|
||||
}
|
||||
|
||||
/**
|
||||
* @param User|Authenticatable $user
|
||||
* @return \FireflyIII\Models\TransactionCurrency
|
||||
*/
|
||||
public function getSystemCurrency(): TransactionCurrency
|
||||
{
|
||||
if ('testing' === config('app.env')) {
|
||||
Log::warning(sprintf('%s should NOT be called in the TEST environment!', __METHOD__));
|
||||
}
|
||||
|
||||
return TransactionCurrency::where('code', 'EUR')->first();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param User $user
|
||||
*
|
||||
* @return \FireflyIII\Models\TransactionCurrency
|
||||
*/
|
||||
@@ -268,17 +278,18 @@ class Amount
|
||||
if ($cache->has()) {
|
||||
return $cache->get(); // @codeCoverageIgnore
|
||||
}
|
||||
$currencyPreference = Prefs::getForUser($user, 'currencyPreference', config('firefly.default_currency', 'EUR'));
|
||||
$currencyPreference = app('preferences')->getForUser($user, 'currencyPreference', config('firefly.default_currency', 'EUR'));
|
||||
$currencyPrefStr = $currencyPreference ? $currencyPreference->data : 'EUR';
|
||||
|
||||
// at this point the currency preference could be encrypted, if coming from an old version.
|
||||
Log::debug('Going to try to decrypt users currency preference.');
|
||||
$currencyCode = $this->tryDecrypt((string)$currencyPreference->data);
|
||||
$currencyCode = $this->tryDecrypt((string) $currencyPrefStr);
|
||||
|
||||
// could still be json encoded:
|
||||
if (strlen($currencyCode) > 3) {
|
||||
$currencyCode = json_decode($currencyCode, true) ?? 'EUR';
|
||||
$currencyCode = json_decode($currencyCode, true, 512, JSON_THROW_ON_ERROR) ?? 'EUR';
|
||||
}
|
||||
|
||||
/** @var TransactionCurrency $currency */
|
||||
$currency = TransactionCurrency::where('code', $currencyCode)->first();
|
||||
if (null === $currency) {
|
||||
// get EUR
|
||||
|
||||
@@ -96,7 +96,8 @@ class ImportProvider implements BinderInterface
|
||||
* @param string $value
|
||||
* @param Route $route
|
||||
*
|
||||
* @return Carbon
|
||||
* @return string
|
||||
*
|
||||
* @throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException
|
||||
*/
|
||||
public static function routeBinder(string $value, Route $route): string
|
||||
|
||||
@@ -36,7 +36,8 @@ class JournalList implements BinderInterface
|
||||
* @param string $value
|
||||
* @param Route $route
|
||||
*
|
||||
* @return mixed
|
||||
* @return array
|
||||
*
|
||||
* @throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException
|
||||
*/
|
||||
public static function routeBinder(string $value, Route $route): array
|
||||
|
||||
@@ -50,6 +50,7 @@ class CacheProperties
|
||||
|
||||
/**
|
||||
* @param $property
|
||||
* @param Collection|\Carbon\Carbon|\FireflyIII\Models\Category|array|int|string $property
|
||||
*/
|
||||
public function addProperty($property): void
|
||||
{
|
||||
@@ -87,6 +88,7 @@ class CacheProperties
|
||||
|
||||
/**
|
||||
* @param $data
|
||||
* @param (array|mixed)[]|Collection|\Carbon\Carbon|string $data
|
||||
*/
|
||||
public function store($data): void
|
||||
{
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
/**
|
||||
* AutoBudgetCronjob.php
|
||||
* Copyright (c) 2020 thegrumpydictator@gmail.com
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
/**
|
||||
* ExportDataGenerator.php
|
||||
* Copyright (c) 2019 james@firefly-iii.org
|
||||
@@ -659,7 +660,7 @@ class ExportDataGenerator
|
||||
$collector = app(GroupCollectorInterface::class);
|
||||
$collector->setUser($this->user);
|
||||
$collector->setRange($this->start, $this->end)->withAccountInformation()->withCategoryInformation()->withBillInformation()
|
||||
->withBudgetInformation();
|
||||
->withBudgetInformation()->withTagInformation();
|
||||
$journals = $collector->getExtractedJournals();
|
||||
|
||||
$records = [];
|
||||
@@ -689,8 +690,9 @@ class ExportDataGenerator
|
||||
$journal['category_name'],
|
||||
$journal['budget_name'],
|
||||
$journal['bill_name'],
|
||||
implode(',', $journal['tags']),
|
||||
$this->mergeTags($journal['tags']),
|
||||
];
|
||||
|
||||
}
|
||||
|
||||
//load the CSV document from a string
|
||||
@@ -705,4 +707,22 @@ class ExportDataGenerator
|
||||
return $csv->getContent(); //returns the CSV document as a string
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $tags
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
private function mergeTags(array $tags): string
|
||||
{
|
||||
if (0 === count($tags)) {
|
||||
return '';
|
||||
}
|
||||
$smol = [];
|
||||
foreach ($tags as $tag) {
|
||||
$smol[] = $tag['name'];
|
||||
}
|
||||
|
||||
return implode(',', $smol);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -136,7 +136,8 @@ class FireflyConfig
|
||||
|
||||
/**
|
||||
* @param string $name
|
||||
* @param $value
|
||||
* @param $value
|
||||
* @param int|string|true $value
|
||||
*
|
||||
* @return Configuration
|
||||
*/
|
||||
|
||||
@@ -159,7 +159,7 @@ trait FormSupport
|
||||
* @param $name
|
||||
* @param $options
|
||||
*
|
||||
* @return mixed
|
||||
* @return string
|
||||
*/
|
||||
protected function label(string $name, array $options = null): string
|
||||
{
|
||||
|
||||
@@ -70,8 +70,11 @@ trait ModelInformation
|
||||
}
|
||||
|
||||
/**
|
||||
* @codeCoverageIgnore
|
||||
* @return array
|
||||
* @codeCoverageIgnore
|
||||
*
|
||||
* @return string[]
|
||||
*
|
||||
* @psalm-return array<int|null, string>
|
||||
*/
|
||||
protected function getLiabilityTypes(): array
|
||||
{
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user