mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-12-23 19:51:24 +00:00
Compare commits
114 Commits
5.2.0-beta
...
5.2.5
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7f8ed7abb6 | ||
|
|
c593936b32 | ||
|
|
c54204ede9 | ||
|
|
d9132bbee3 | ||
|
|
c1be98762e | ||
|
|
c2733e2a8f | ||
|
|
722cf9b4fe | ||
|
|
01e31e73e0 | ||
|
|
dba7d05296 | ||
|
|
a8709a4a45 | ||
|
|
49b1435cba | ||
|
|
6a25b41952 | ||
|
|
c561f99de6 | ||
|
|
9d9053d828 | ||
|
|
c3c9a2f3c0 | ||
|
|
28465142e9 | ||
|
|
5473a618c9 | ||
|
|
ac1a8d8053 | ||
|
|
15ae9203b6 | ||
|
|
9dfc2ae20b | ||
|
|
230de7cbdd | ||
|
|
feaa003a52 | ||
|
|
295d01dc16 | ||
|
|
cbf1fde45e | ||
|
|
6cc47287d3 | ||
|
|
4bbe728376 | ||
|
|
427a90ec85 | ||
|
|
55ddb26dac | ||
|
|
891777f079 | ||
|
|
1655286b67 | ||
|
|
dd81636bf2 | ||
|
|
56a43a707d | ||
|
|
c2f92c6e45 | ||
|
|
61bd2dc840 | ||
|
|
f6a675f2e2 | ||
|
|
85b43055a7 | ||
|
|
e63f7bcc70 | ||
|
|
384dd37430 | ||
|
|
c6b336171c | ||
|
|
d2f4399a1a | ||
|
|
02d1bc093c | ||
|
|
420e493987 | ||
|
|
0a15479bff | ||
|
|
a9b76a3679 | ||
|
|
d1a3cd9044 | ||
|
|
81735d59f8 | ||
|
|
1d8da7f9f0 | ||
|
|
c5f0684030 | ||
|
|
25867adcb9 | ||
|
|
d55694cd68 | ||
|
|
05f069d61e | ||
|
|
5f6e7ad138 | ||
|
|
61bc38921e | ||
|
|
94c660545d | ||
|
|
4d3907948d | ||
|
|
e6442dd8af | ||
|
|
7905e0bd70 | ||
|
|
f4b1da352d | ||
|
|
0d33348941 | ||
|
|
c7c875e95f | ||
|
|
19d24b3e2a | ||
|
|
8fed6b6657 | ||
|
|
b5eafa1910 | ||
|
|
c15501937f | ||
|
|
4c743bd5b0 | ||
|
|
44289cbd95 | ||
|
|
b2f1642cfe | ||
|
|
341ef0220c | ||
|
|
9df88115bc | ||
|
|
c7273edb5e | ||
|
|
c398aa2b69 | ||
|
|
aa786eaaf3 | ||
|
|
e58a5e12d6 | ||
|
|
12b3575c5c | ||
|
|
3ca186dc8f | ||
|
|
1535f596f6 | ||
|
|
2cc326caa1 | ||
|
|
43436ae942 | ||
|
|
fbfd8475de | ||
|
|
405752f353 | ||
|
|
2af98b259a | ||
|
|
015242a666 | ||
|
|
54933fda2e | ||
|
|
852d057a47 | ||
|
|
1778f0b4f3 | ||
|
|
6daf083b3f | ||
|
|
4a7d9b130a | ||
|
|
4163efba55 | ||
|
|
db5847b49b | ||
|
|
6829003f5e | ||
|
|
047927718e | ||
|
|
91deb22a3f | ||
|
|
1629ca0739 | ||
|
|
8b87204f10 | ||
|
|
f920d90e3d | ||
|
|
1cb91282af | ||
|
|
a6ce294131 | ||
|
|
34ceb69776 | ||
|
|
eed68b5d95 | ||
|
|
79374c11ee | ||
|
|
404f9df6d3 | ||
|
|
4b716e35b9 | ||
|
|
166fc7a3e2 | ||
|
|
06afbc7a0a | ||
|
|
49a98de63a | ||
|
|
5b572c0da2 | ||
|
|
59014b1a87 | ||
|
|
4aec1f06e0 | ||
|
|
136af9625a | ||
|
|
edac26f757 | ||
|
|
ac54dd05bf | ||
|
|
7948058364 | ||
|
|
f13a6f7bf9 | ||
|
|
e1a5d143c5 |
20
.env.example
20
.env.example
@@ -22,15 +22,15 @@ APP_KEY=SomeRandomStringOf32CharsExactly
|
||||
# If text is still in English, remember that not everything may have been translated.
|
||||
DEFAULT_LANGUAGE=en_US
|
||||
|
||||
# The locale defines how numbers are formatted.
|
||||
# by default this value is the same as whatever the language is.
|
||||
DEFAULT_LOCALE=equal
|
||||
|
||||
# Change this value to your preferred time zone.
|
||||
# Example: Europe/Amsterdam
|
||||
# For a list of supported time zones, see https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
|
||||
TZ=Europe/Amsterdam
|
||||
|
||||
# This variable must match your installation's external address but keep in mind that
|
||||
# it's only used on the command line as a fallback value.
|
||||
APP_URL=http://localhost
|
||||
|
||||
# TRUSTED_PROXIES is a useful variable when using Docker and/or a reverse proxy.
|
||||
# Set it to ** and reverse proxies work just fine.
|
||||
TRUSTED_PROXIES=
|
||||
@@ -270,3 +270,15 @@ IS_SANDSTORM=false
|
||||
IS_DOCKER=false
|
||||
IS_HEROKU=false
|
||||
BUNQ_USE_SANDBOX=false
|
||||
|
||||
#
|
||||
# If you have trouble configuring your Firefly III installation, DON'T BOTHER setting this variable.
|
||||
# It won't work. It doesn't do ANYTHING. Don't believe the lies you read online. I'm not joking.
|
||||
# This configuration value WILL NOT HELP.
|
||||
#
|
||||
# This variable is ONLY used in some of the emails Firefly III sends around. Nowhere else.
|
||||
# So when configuring anything WEB related this variable doesn't do anything. Nothing
|
||||
#
|
||||
# If you're stuck I understand you get desperate but look SOMEWHERE ELSE.
|
||||
#
|
||||
APP_URL=http://localhost
|
||||
|
||||
12
.github/ISSUE_TEMPLATE/Bug_report.md
vendored
12
.github/ISSUE_TEMPLATE/Bug_report.md
vendored
@@ -16,10 +16,10 @@ I am running Firefly III version x.x.x, and my problem is:
|
||||
<!-- Please add extra info here, such as OS, browser, and the output from the /debug page of your Firefly III installation (click the version at the bottom). -->
|
||||
|
||||
**Bonus points**
|
||||
<!-- Earn bonus points by checking the boxes -->
|
||||
<!-- Before you submit, verify the following please: -->
|
||||
|
||||
- [ ] Nobody reported this bug before
|
||||
- [ ] 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:)-->
|
||||
- I searched and nobody reported this bug before
|
||||
- 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 ;)-->
|
||||
|
||||
10
.github/ISSUE_TEMPLATE/Custom.md
vendored
10
.github/ISSUE_TEMPLATE/Custom.md
vendored
@@ -16,8 +16,8 @@ I am running Firefly III version x.x.x.
|
||||
|
||||
<!-- Complete the following checklist for bonus points -->
|
||||
|
||||
- [ ] 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-debug-info) -->
|
||||
- [ ] I was able to replicate the issue on the demo site.
|
||||
<!-- - [ ] I donated money (this is a joke :wink:)-->
|
||||
- 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-debug-info) -->
|
||||
- I was able to replicate the issue on the demo site.
|
||||
<!-- - I donated money (this is a joke :wink:)-->
|
||||
|
||||
1
.gitignore
vendored
1
.gitignore
vendored
@@ -1,4 +1,5 @@
|
||||
/node_modules
|
||||
/frontend/node_modules
|
||||
/public/hot
|
||||
/public/storage
|
||||
/storage/*.key
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
/**
|
||||
* CorrectOpeningBalanceCurrencies.php
|
||||
* Copyright (c) 2020 james@firefly-iii.org
|
||||
|
||||
@@ -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));
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
/**
|
||||
* FixRecurringTransactions.php
|
||||
* Copyright (c) 2020 james@firefly-iii.org
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
/**
|
||||
* ExportData.php
|
||||
* Copyright (c) 2020 james@firefly-iii.org
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -98,7 +98,7 @@ class AccountFactory
|
||||
'user_id' => $this->user->id,
|
||||
'account_type_id' => $type->id,
|
||||
'name' => $data['name'],
|
||||
'virtual_balance' => $data['virtual_balance'] ?? '0',
|
||||
'virtual_balance' => $data['virtual_balance'] ?? null,
|
||||
'active' => true === $data['active'],
|
||||
'iban' => $data['iban'],
|
||||
];
|
||||
@@ -109,12 +109,12 @@ class AccountFactory
|
||||
|
||||
// remove virtual balance when not an asset account or a liability
|
||||
if (!in_array($type->type, $this->canHaveVirtual, true)) {
|
||||
$databaseData['virtual_balance'] = '0';
|
||||
$databaseData['virtual_balance'] = null;
|
||||
}
|
||||
|
||||
// fix virtual balance when it's empty
|
||||
if ('' === $databaseData['virtual_balance']) {
|
||||
$databaseData['virtual_balance'] = '0';
|
||||
if ('' === (string)$databaseData['virtual_balance']) {
|
||||
$databaseData['virtual_balance'] = null;
|
||||
}
|
||||
|
||||
$return = Account::create($databaseData);
|
||||
|
||||
@@ -280,25 +280,29 @@ class TransactionJournalFactory
|
||||
|
||||
/** create or get source and destination accounts */
|
||||
$sourceInfo = [
|
||||
'id' => (int) $row['source_id'],
|
||||
'name' => $row['source_name'],
|
||||
'iban' => $row['source_iban'],
|
||||
'number' => $row['source_number'],
|
||||
'bic' => $row['source_bic'],
|
||||
'id' => (int) $row['source_id'],
|
||||
'name' => $row['source_name'],
|
||||
'iban' => $row['source_iban'],
|
||||
'number' => $row['source_number'],
|
||||
'bic' => $row['source_bic'],
|
||||
'currency_id' => $currency->id,
|
||||
];
|
||||
|
||||
$destInfo = [
|
||||
'id' => (int) $row['destination_id'],
|
||||
'name' => $row['destination_name'],
|
||||
'iban' => $row['destination_iban'],
|
||||
'number' => $row['destination_number'],
|
||||
'bic' => $row['destination_bic'],
|
||||
'id' => (int) $row['destination_id'],
|
||||
'name' => $row['destination_name'],
|
||||
'iban' => $row['destination_iban'],
|
||||
'number' => $row['destination_number'],
|
||||
'bic' => $row['destination_bic'],
|
||||
'currency_id' => $currency->id,
|
||||
];
|
||||
Log::debug('Source info:', $sourceInfo);
|
||||
Log::debug('Destination info:', $destInfo);
|
||||
|
||||
$sourceAccount = $this->getAccount($type->type, 'source', $sourceInfo);
|
||||
Log::debug('Now calling getAccount for the source.');
|
||||
$sourceAccount = $this->getAccount($type->type, 'source', $sourceInfo);
|
||||
Log::debug('Now calling getAccount for the destination.');
|
||||
$destinationAccount = $this->getAccount($type->type, 'destination', $destInfo);
|
||||
Log::debug('Done with getAccount(2x)');
|
||||
$currency = $this->getCurrencyByAccount($type->type, $currency, $sourceAccount, $destinationAccount);
|
||||
$foreignCurrency = $this->compareCurrencies($currency, $foreignCurrency);
|
||||
$foreignCurrency = $this->getForeignByAccount($type->type, $foreignCurrency, $destinationAccount);
|
||||
@@ -468,6 +472,7 @@ class TransactionJournalFactory
|
||||
*/
|
||||
private function getCurrency(?TransactionCurrency $currency, Account $account): TransactionCurrency
|
||||
{
|
||||
Log::debug('Now in getCurrency()');
|
||||
$preference = $this->accountRepository->getAccountCurrency($account);
|
||||
if (null === $preference && null === $currency) {
|
||||
// return user's default:
|
||||
@@ -489,6 +494,7 @@ class TransactionJournalFactory
|
||||
*/
|
||||
private function getCurrencyByAccount(string $type, ?TransactionCurrency $currency, Account $source, Account $destination): TransactionCurrency
|
||||
{
|
||||
Log::debug('Now ingetCurrencyByAccount()');
|
||||
switch ($type) {
|
||||
default:
|
||||
case TransactionType::WITHDRAWAL:
|
||||
@@ -538,15 +544,15 @@ class TransactionJournalFactory
|
||||
$dataRow = $row->getArrayCopy();
|
||||
|
||||
unset($dataRow['import_hash_v2'], $dataRow['original_source']);
|
||||
$json = json_encode($dataRow);
|
||||
$json = json_encode($dataRow, JSON_THROW_ON_ERROR, 512);
|
||||
if (false === $json) {
|
||||
// @codeCoverageIgnoreStart
|
||||
$json = json_encode((string) microtime());
|
||||
$json = json_encode((string) microtime(), JSON_THROW_ON_ERROR, 512);
|
||||
Log::error(sprintf('Could not hash the original row! %s', json_last_error_msg()), $dataRow);
|
||||
// @codeCoverageIgnoreEnd
|
||||
}
|
||||
$hash = hash('sha256', $json);
|
||||
Log::debug(sprintf('The hash is: %s', $hash));
|
||||
Log::debug(sprintf('The hash is: %s', $hash), $dataRow);
|
||||
|
||||
return $hash;
|
||||
}
|
||||
@@ -601,7 +607,7 @@ class TransactionJournalFactory
|
||||
|
||||
// validate source account.
|
||||
$sourceId = isset($data['source_id']) ? (int) $data['source_id'] : null;
|
||||
$sourceName = $data['source_name'] ?? null;
|
||||
$sourceName = isset($data['source_name']) ? (string) $data['source_name'] : null;
|
||||
$validSource = $this->accountValidator->validateSource($sourceId, $sourceName, null);
|
||||
|
||||
// do something with result:
|
||||
@@ -611,7 +617,7 @@ class TransactionJournalFactory
|
||||
Log::debug('Source seems valid.');
|
||||
// validate destination account
|
||||
$destinationId = isset($data['destination_id']) ? (int) $data['destination_id'] : null;
|
||||
$destinationName = (string)($data['destination_name'] ?? null);
|
||||
$destinationName = isset($data['destination_name']) ? (string) $data['destination_name'] : null;
|
||||
$validDestination = $this->accountValidator->validateDestination($destinationId, $destinationName, null);
|
||||
// do something with result:
|
||||
if (false === $validDestination) {
|
||||
|
||||
@@ -154,14 +154,14 @@ class MonthReportGenerator implements ReportGeneratorInterface
|
||||
$journals[$index]['invoice_date'] = $journalRepository->getMetaDateById($journal['transaction_journal_id'], 'invoice_date');
|
||||
|
||||
}
|
||||
|
||||
$locale = app('steam')->getLocale();
|
||||
$return = [
|
||||
'journals' => $journals,
|
||||
'currency' => $currency,
|
||||
'exists' => count($journals) > 0,
|
||||
'end' => $this->end->formatLocalized((string) trans('config.month_and_day')),
|
||||
'end' => $this->end->formatLocalized((string) trans('config.month_and_day', [], $locale)),
|
||||
'endBalance' => app('steam')->balance($account, $this->end),
|
||||
'dayBefore' => $date->formatLocalized((string) trans('config.month_and_day')),
|
||||
'dayBefore' => $date->formatLocalized((string) trans('config.month_and_day', [], $locale)),
|
||||
'dayBeforeBalance' => $dayBeforeBalance,
|
||||
];
|
||||
|
||||
|
||||
@@ -165,7 +165,8 @@ class UserEventHandler
|
||||
$user = $event->user;
|
||||
$ipAddress = $event->ipAddress;
|
||||
$token = app('preferences')->getForUser($user, 'email_change_undo_token', 'invalid');
|
||||
$uri = route('profile.undo-email-change', [$token->data, hash('sha256', $oldEmail)]);
|
||||
$hashed = hash('sha256', sprintf('%s%s', (string) config('app.key'), $oldEmail));
|
||||
$uri = route('profile.undo-email-change', [$token->data,$hashed]);
|
||||
try {
|
||||
Mail::to($oldEmail)->send(new UndoEmailChangeMail($newEmail, $oldEmail, $uri, $ipAddress));
|
||||
// @codeCoverageIgnoreStart
|
||||
|
||||
@@ -91,8 +91,9 @@ trait TimeCollection
|
||||
if ($end < $start) {
|
||||
[$start, $end] = [$end, $start];
|
||||
}
|
||||
$startStr = $start->format('Y-m-d H:i:s');
|
||||
$endStr = $end->format('Y-m-d H:i:s');
|
||||
// always got to end of day / start of day for ranges.
|
||||
$startStr = $start->format('Y-m-d 00:00:00');
|
||||
$endStr = $end->format('Y-m-d 23:59:59');
|
||||
|
||||
$this->query->where('transaction_journals.date', '>=', $startStr);
|
||||
$this->query->where('transaction_journals.date', '<=', $endStr);
|
||||
@@ -117,4 +118,4 @@ trait TimeCollection
|
||||
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
/**
|
||||
* TelemetryController.php
|
||||
* Copyright (c) 2020 thegrumpydictator@gmail.com
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -59,7 +59,7 @@ class AvailableBudgetController extends Controller
|
||||
$this->middleware(
|
||||
function ($request, $next) {
|
||||
app('view')->share('title', (string) trans('firefly.budgets'));
|
||||
app('view')->share('mainTitleIcon', 'fa-tasks');
|
||||
app('view')->share('mainTitleIcon', 'fa-pie-chart');
|
||||
$this->abRepository = app(AvailableBudgetRepositoryInterface::class);
|
||||
$this->currencyRepos = app(CurrencyRepositoryInterface::class);
|
||||
|
||||
|
||||
@@ -70,7 +70,7 @@ class BudgetLimitController extends Controller
|
||||
$this->middleware(
|
||||
function ($request, $next) {
|
||||
app('view')->share('title', (string) trans('firefly.budgets'));
|
||||
app('view')->share('mainTitleIcon', 'fa-tasks');
|
||||
app('view')->share('mainTitleIcon', 'fa-pie-chart');
|
||||
$this->repository = app(BudgetRepositoryInterface::class);
|
||||
$this->opsRepository = app(OperationsRepositoryInterface::class);
|
||||
$this->blRepository = app(BudgetLimitRepositoryInterface::class);
|
||||
|
||||
@@ -58,7 +58,7 @@ class CreateController extends Controller
|
||||
$this->middleware(
|
||||
function ($request, $next) {
|
||||
app('view')->share('title', (string) trans('firefly.budgets'));
|
||||
app('view')->share('mainTitleIcon', 'fa-tasks');
|
||||
app('view')->share('mainTitleIcon', 'fa-pie-chart');
|
||||
$this->repository = app(BudgetRepositoryInterface::class);
|
||||
$this->attachments = app(AttachmentHelperInterface::class);
|
||||
|
||||
|
||||
@@ -54,7 +54,7 @@ class DeleteController extends Controller
|
||||
$this->middleware(
|
||||
function ($request, $next) {
|
||||
app('view')->share('title', (string) trans('firefly.budgets'));
|
||||
app('view')->share('mainTitleIcon', 'fa-tasks');
|
||||
app('view')->share('mainTitleIcon', 'fa-pie-chart');
|
||||
$this->repository = app(BudgetRepositoryInterface::class);
|
||||
|
||||
return $next($request);
|
||||
|
||||
@@ -59,7 +59,7 @@ class EditController extends Controller
|
||||
$this->middleware(
|
||||
function ($request, $next) {
|
||||
app('view')->share('title', (string) trans('firefly.budgets'));
|
||||
app('view')->share('mainTitleIcon', 'fa-tasks');
|
||||
app('view')->share('mainTitleIcon', 'fa-pie-chart');
|
||||
$this->repository = app(BudgetRepositoryInterface::class);
|
||||
$this->attachments = app(AttachmentHelperInterface::class);
|
||||
|
||||
|
||||
@@ -72,7 +72,7 @@ class IndexController extends Controller
|
||||
$this->middleware(
|
||||
function ($request, $next) {
|
||||
app('view')->share('title', (string) trans('firefly.budgets'));
|
||||
app('view')->share('mainTitleIcon', 'fa-tasks');
|
||||
app('view')->share('mainTitleIcon', 'fa-pie-chart');
|
||||
$this->repository = app(BudgetRepositoryInterface::class);
|
||||
$this->opsRepository = app(OperationsRepositoryInterface::class);
|
||||
$this->abRepository = app(AvailableBudgetRepositoryInterface::class);
|
||||
@@ -86,7 +86,6 @@ class IndexController extends Controller
|
||||
}
|
||||
|
||||
/**
|
||||
* TODO the "budgeted" progress bar doesn't update.
|
||||
* Show all budgets.
|
||||
*
|
||||
* @param Request $request
|
||||
@@ -106,7 +105,6 @@ class IndexController extends Controller
|
||||
$budgeted = '0';
|
||||
$spent = '0';
|
||||
|
||||
|
||||
// new period stuff:
|
||||
$periodTitle = app('navigation')->periodShow($start, $range);
|
||||
$prevLoop = $this->getPreviousPeriods($start, $range);
|
||||
|
||||
@@ -64,7 +64,7 @@ class ShowController extends Controller
|
||||
$this->middleware(
|
||||
function ($request, $next) {
|
||||
app('view')->share('title', (string) trans('firefly.budgets'));
|
||||
app('view')->share('mainTitleIcon', 'fa-tasks');
|
||||
app('view')->share('mainTitleIcon', 'fa-pie-chart');
|
||||
$this->journalRepos = app(JournalRepositoryInterface::class);
|
||||
$this->repository = app(BudgetRepositoryInterface::class);
|
||||
|
||||
|
||||
@@ -57,7 +57,7 @@ class CreateController extends Controller
|
||||
$this->middleware(
|
||||
function ($request, $next) {
|
||||
app('view')->share('title', (string) trans('firefly.categories'));
|
||||
app('view')->share('mainTitleIcon', 'fa-bar-chart');
|
||||
app('view')->share('mainTitleIcon', 'fa-bookmark');
|
||||
$this->repository = app(CategoryRepositoryInterface::class);
|
||||
$this->attachments = app(AttachmentHelperInterface::class);
|
||||
|
||||
|
||||
@@ -53,7 +53,7 @@ class DeleteController extends Controller
|
||||
$this->middleware(
|
||||
function ($request, $next) {
|
||||
app('view')->share('title', (string) trans('firefly.categories'));
|
||||
app('view')->share('mainTitleIcon', 'fa-bar-chart');
|
||||
app('view')->share('mainTitleIcon', 'fa-bookmark');
|
||||
$this->repository = app(CategoryRepositoryInterface::class);
|
||||
|
||||
return $next($request);
|
||||
|
||||
@@ -59,7 +59,7 @@ class EditController extends Controller
|
||||
$this->middleware(
|
||||
function ($request, $next) {
|
||||
app('view')->share('title', (string) trans('firefly.categories'));
|
||||
app('view')->share('mainTitleIcon', 'fa-bar-chart');
|
||||
app('view')->share('mainTitleIcon', 'fa-bookmark');
|
||||
$this->repository = app(CategoryRepositoryInterface::class);
|
||||
$this->attachments = app(AttachmentHelperInterface::class);
|
||||
|
||||
|
||||
@@ -53,7 +53,7 @@ class IndexController extends Controller
|
||||
$this->middleware(
|
||||
function ($request, $next) {
|
||||
app('view')->share('title', (string) trans('firefly.categories'));
|
||||
app('view')->share('mainTitleIcon', 'fa-bar-chart');
|
||||
app('view')->share('mainTitleIcon', 'fa-bookmark');
|
||||
$this->repository = app(CategoryRepositoryInterface::class);
|
||||
|
||||
return $next($request);
|
||||
|
||||
@@ -59,7 +59,7 @@ class NoCategoryController extends Controller
|
||||
$this->middleware(
|
||||
function ($request, $next) {
|
||||
app('view')->share('title', (string) trans('firefly.categories'));
|
||||
app('view')->share('mainTitleIcon', 'fa-bar-chart');
|
||||
app('view')->share('mainTitleIcon', 'fa-bookmark');
|
||||
$this->journalRepos = app(JournalRepositoryInterface::class);
|
||||
|
||||
return $next($request);
|
||||
|
||||
@@ -58,7 +58,7 @@ class ShowController extends Controller
|
||||
$this->middleware(
|
||||
function ($request, $next) {
|
||||
app('view')->share('title', (string) trans('firefly.categories'));
|
||||
app('view')->share('mainTitleIcon', 'fa-bar-chart');
|
||||
app('view')->share('mainTitleIcon', 'fa-bookmark');
|
||||
$this->repository = app(CategoryRepositoryInterface::class);
|
||||
|
||||
return $next($request);
|
||||
@@ -84,7 +84,7 @@ class ShowController extends Controller
|
||||
$start = $start ?? session('start', Carbon::now()->startOfMonth());
|
||||
/** @var Carbon $end */
|
||||
$end = $end ?? session('end', Carbon::now()->endOfMonth());
|
||||
$subTitleIcon = 'fa-bar-chart';
|
||||
$subTitleIcon = 'fa-bookmark';
|
||||
$page = (int) $request->get('page');
|
||||
$attachments = $this->repository->getAttachments($category);
|
||||
$pageSize = (int) app('preferences')->get('listPageSize', 50)->data;
|
||||
@@ -122,7 +122,7 @@ class ShowController extends Controller
|
||||
public function showAll(Request $request, Category $category)
|
||||
{
|
||||
// default values:
|
||||
$subTitleIcon = 'fa-bar-chart';
|
||||
$subTitleIcon = 'fa-bookmark';
|
||||
$page = (int) $request->get('page');
|
||||
$pageSize = (int) app('preferences')->get('listPageSize', 50)->data;
|
||||
$start = null;
|
||||
|
||||
@@ -432,9 +432,15 @@ class AccountController extends Controller
|
||||
$cache->addProperty($end);
|
||||
$cache->addProperty($account->id);
|
||||
if ($cache->has()) {
|
||||
return response()->json($cache->get()); // @codeCoverageIgnore
|
||||
return response()->json($cache->get()); // @codeCoverageIgnore
|
||||
}
|
||||
$currencies = $this->accountRepository->getUsedCurrencies($account);
|
||||
|
||||
// if the account is not expense or revenue, just use the account's default currency.
|
||||
if (!in_array($account->accountType->type, [AccountType::REVENUE, AccountType::EXPENSE], true)) {
|
||||
$currencies = [$this->accountRepository->getAccountCurrency($account) ?? app('amount')->getDefaultCurrency()];
|
||||
}
|
||||
|
||||
/** @var TransactionCurrency $currency */
|
||||
foreach ($currencies as $currency) {
|
||||
$chartData[] = $this->periodByCurrency($start, $end, $account, $currency);
|
||||
@@ -565,6 +571,7 @@ class AccountController extends Controller
|
||||
*/
|
||||
private function periodByCurrency(Carbon $start, Carbon $end, Account $account, TransactionCurrency $currency): array
|
||||
{
|
||||
$locale = app('steam')->getLocale();
|
||||
$step = $this->calculateStep($start, $end);
|
||||
$result = [
|
||||
'label' => sprintf('%s (%s)', $account->name, $currency->symbol),
|
||||
@@ -576,7 +583,7 @@ class AccountController extends Controller
|
||||
switch ($step) {
|
||||
case '1D':
|
||||
// per day the entire period, balance for every day.
|
||||
$format = (string) trans('config.month_and_day');
|
||||
$format = (string) trans('config.month_and_day', [], $locale);
|
||||
$range = app('steam')->balanceInRange($account, $start, $end, $currency);
|
||||
$previous = array_values($range)[0];
|
||||
while ($end >= $current) {
|
||||
|
||||
@@ -111,6 +111,7 @@ class BillController extends Controller
|
||||
if ($cache->has()) {
|
||||
return response()->json($cache->get()); // @codeCoverageIgnore
|
||||
}
|
||||
$locale = app('steam')->getLocale();
|
||||
|
||||
/** @var GroupCollectorInterface $collector */
|
||||
$collector = app(GroupCollectorInterface::class);
|
||||
@@ -131,7 +132,7 @@ class BillController extends Controller
|
||||
];
|
||||
|
||||
foreach ($journals as $journal) {
|
||||
$date = $journal['date']->formatLocalized((string) trans('config.month_and_day'));
|
||||
$date = $journal['date']->formatLocalized((string) trans('config.month_and_day', [], $locale));
|
||||
$chartData[0]['entries'][$date] = $bill->amount_min; // minimum amount of bill
|
||||
$chartData[1]['entries'][$date] = $bill->amount_max; // maximum amount of bill
|
||||
|
||||
|
||||
@@ -179,14 +179,14 @@ class BudgetController extends Controller
|
||||
if ($cache->has()) {
|
||||
return response()->json($cache->get()); // @codeCoverageIgnore
|
||||
}
|
||||
|
||||
$locale = app('steam')->getLocale();
|
||||
$entries = [];
|
||||
$amount = $budgetLimit->amount;
|
||||
$budgetCollection = new Collection([$budget]);
|
||||
while ($start <= $end) {
|
||||
$spent = $this->opsRepository->spentInPeriod($budgetCollection, new Collection, $start, $start);
|
||||
$amount = bcadd($amount, $spent);
|
||||
$format = $start->formatLocalized((string)trans('config.month_and_day'));
|
||||
$format = $start->formatLocalized((string)trans('config.month_and_day', [], $locale));
|
||||
$entries[$format] = $amount;
|
||||
|
||||
$start->addDay();
|
||||
|
||||
@@ -76,6 +76,7 @@ class PiggyBankController extends Controller
|
||||
}
|
||||
$set = $repository->getEvents($piggyBank);
|
||||
$set = $set->reverse();
|
||||
$locale =app('steam')->getLocale();
|
||||
|
||||
// get first event or start date of piggy bank or today
|
||||
$startDate = $piggyBank->start_date ?? new Carbon;
|
||||
@@ -99,7 +100,7 @@ class PiggyBankController extends Controller
|
||||
}
|
||||
);
|
||||
$currentSum = $filtered->sum('amount');
|
||||
$label = $oldest->formatLocalized((string) trans('config.month_and_day'));
|
||||
$label = $oldest->formatLocalized((string) trans('config.month_and_day', [], $locale));
|
||||
$chartData[$label] = $currentSum;
|
||||
$oldest = app('navigation')->addPeriod($oldest, $step, 0);
|
||||
}
|
||||
@@ -110,7 +111,7 @@ class PiggyBankController extends Controller
|
||||
}
|
||||
);
|
||||
$finalSum = $finalFiltered->sum('amount');
|
||||
$finalLabel = $today->formatLocalized((string) trans('config.month_and_day'));
|
||||
$finalLabel = $today->formatLocalized((string) trans('config.month_and_day', [], $locale));
|
||||
$chartData[$finalLabel] = $finalSum;
|
||||
|
||||
$data = $this->generator->singleSet($piggyBank->name, $chartData);
|
||||
|
||||
@@ -79,6 +79,7 @@ class ReportController extends Controller
|
||||
if ($cache->has()) {
|
||||
return response()->json($cache->get()); // @codeCoverageIgnore
|
||||
}
|
||||
$locale = app('steam')->getLocale();
|
||||
$current = clone $start;
|
||||
$chartData = [];
|
||||
/** @var NetWorthInterface $helper */
|
||||
@@ -110,7 +111,7 @@ class ReportController extends Controller
|
||||
/** @var array $netWorthItem */
|
||||
foreach ($result as $netWorthItem) {
|
||||
$currencyId = $netWorthItem['currency']->id;
|
||||
$label = $current->formatLocalized((string) trans('config.month_and_day'));
|
||||
$label = $current->formatLocalized((string) trans('config.month_and_day', [], $locale));
|
||||
if (!isset($chartData[$currencyId])) {
|
||||
$chartData[$currencyId] = [
|
||||
'label' => 'Net worth in ' . $netWorthItem['currency']->name,
|
||||
|
||||
@@ -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
|
||||
@@ -137,6 +138,7 @@ class TransactionController extends Controller
|
||||
$collector->setTypes([TransactionType::DEPOSIT]);
|
||||
break;
|
||||
case 'transfers':
|
||||
case 'transfer':
|
||||
$collector->setTypes([TransactionType::TRANSFER]);
|
||||
break;
|
||||
}
|
||||
@@ -204,6 +206,7 @@ class TransactionController extends Controller
|
||||
$collector->setTypes([TransactionType::DEPOSIT]);
|
||||
break;
|
||||
case 'transfers':
|
||||
case 'transfer':
|
||||
$collector->setTypes([TransactionType::TRANSFER]);
|
||||
break;
|
||||
}
|
||||
@@ -270,6 +273,7 @@ class TransactionController extends Controller
|
||||
$collector->setTypes([TransactionType::DEPOSIT]);
|
||||
break;
|
||||
case 'transfers':
|
||||
case 'transfer':
|
||||
$collector->setTypes([TransactionType::TRANSFER]);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -85,17 +85,20 @@ class Controller extends BaseController
|
||||
|
||||
$this->middleware(
|
||||
function ($request, $next) {
|
||||
$locale = app('steam')->getLocale();
|
||||
// translations for specific strings:
|
||||
$this->monthFormat = (string) trans('config.month');
|
||||
$this->monthAndDayFormat = (string) trans('config.month_and_day');
|
||||
$this->dateTimeFormat = (string) trans('config.date_time');
|
||||
$this->monthFormat = (string) trans('config.month', [], $locale);
|
||||
$this->monthAndDayFormat = (string) trans('config.month_and_day', [], $locale);
|
||||
$this->dateTimeFormat = (string) trans('config.date_time', [], $locale);
|
||||
|
||||
// get shown-intro-preference:
|
||||
if (auth()->check()) {
|
||||
$language = $this->getLanguage();
|
||||
$language = app('steam')->getLanguage();
|
||||
$locale = app('steam')->getLocale();
|
||||
$page = $this->getPageName();
|
||||
$shownDemo = $this->hasSeenDemo();
|
||||
app('view')->share('language', $language);
|
||||
app('view')->share('locale', $locale);
|
||||
app('view')->share('shownDemo', $shownDemo);
|
||||
app('view')->share('current_route_name', $page);
|
||||
app('view')->share('original_route_name', Route::currentRouteName());
|
||||
|
||||
@@ -126,7 +126,6 @@ class DebugController extends Controller
|
||||
$phpOs = str_replace($search, $replace, PHP_OS);
|
||||
$interface = PHP_SAPI;
|
||||
$now = Carbon::now()->format('Y-m-d H:i:s e');
|
||||
$extensions = implode(', ', get_loaded_extensions());
|
||||
$drivers = implode(', ', DB::availableDrivers());
|
||||
$currentDriver = DB::getDriverName();
|
||||
$userAgent = $request->header('user-agent');
|
||||
@@ -143,7 +142,7 @@ class DebugController extends Controller
|
||||
// set languages, see what happens:
|
||||
$original = setlocale(LC_ALL, 0);
|
||||
$localeAttempts = [];
|
||||
$parts = explode(',', (string) trans('config.locale'));
|
||||
$parts = app('steam')->getLocaleArray(app('steam')->getLocale());
|
||||
foreach ($parts as $code) {
|
||||
$code = trim($code);
|
||||
$localeAttempts[$code] = var_export(setlocale(LC_ALL, $code), true);
|
||||
@@ -178,7 +177,6 @@ class DebugController extends Controller
|
||||
'debug',
|
||||
compact(
|
||||
'phpVersion',
|
||||
'extensions',
|
||||
'localeAttempts',
|
||||
'appEnv',
|
||||
'appDebug',
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
/**
|
||||
* IndexController.php
|
||||
* Copyright (c) 2019 james@firefly-iii.org
|
||||
|
||||
@@ -126,7 +126,7 @@ class JavascriptController extends Controller
|
||||
/** @noinspection NullPointerExceptionInspection */
|
||||
$lang = $pref->data;
|
||||
$dateRange = $this->getDateRangeConfig();
|
||||
$uid = substr(hash('sha256', auth()->user()->id . auth()->user()->email), 0, 12);
|
||||
$uid = substr(hash('sha256', sprintf('%s-%s-%s', (string) config('app.key'), auth()->user()->id, auth()->user()->email)), 0, 12);
|
||||
|
||||
$data = [
|
||||
'currencyCode' => $currency->code,
|
||||
|
||||
@@ -263,7 +263,7 @@ class BoxController extends Controller
|
||||
*/
|
||||
public function netWorth(): JsonResponse
|
||||
{
|
||||
$date = Carbon::now()->startOfDay();
|
||||
$date = Carbon::now()->endOfDay();
|
||||
|
||||
// start and end in the future? use $end
|
||||
if ($this->notInSessionRange($date)) {
|
||||
|
||||
@@ -63,7 +63,7 @@ class BudgetController extends Controller
|
||||
$this->middleware(
|
||||
function ($request, $next) {
|
||||
app('view')->share('title', (string) trans('firefly.budgets'));
|
||||
app('view')->share('mainTitleIcon', 'fa-tasks');
|
||||
app('view')->share('mainTitleIcon', 'fa-pie-chart');
|
||||
$this->repository = app(BudgetRepositoryInterface::class);
|
||||
$this->opsRepository = app(OperationsRepositoryInterface::class);
|
||||
$this->abRepository = app(AvailableBudgetRepositoryInterface::class);
|
||||
|
||||
@@ -151,6 +151,7 @@ class RecurrenceController extends Controller
|
||||
$today = Carbon::now()->startOfDay();
|
||||
$date = Carbon::createFromFormat('Y-m-d', $string)->startOfDay();
|
||||
$preSelected = (string) $request->get('pre_select');
|
||||
$locale = app('steam')->getLocale();
|
||||
|
||||
Log::debug(sprintf('date = %s, today = %s. date > today? %s', $date->toAtomString(), $today->toAtomString(), var_export($date > $today, true)));
|
||||
Log::debug(sprintf('past = true? %s', var_export('true' === (string) $request->get('past'), true)));
|
||||
@@ -163,7 +164,7 @@ class RecurrenceController extends Controller
|
||||
$dayOfWeek = (string) trans(sprintf('config.dow_%s', $date->dayOfWeekIso));
|
||||
$ndom = sprintf('ndom,%s,%s', $date->weekOfMonth, $date->dayOfWeekIso);
|
||||
$yearly = sprintf('yearly,%s', $date->format('Y-m-d'));
|
||||
$yearlyDate = $date->formatLocalized((string) trans('config.month_and_day_no_year'));
|
||||
$yearlyDate = $date->formatLocalized((string) trans('config.month_and_day_no_year', [], $locale));
|
||||
$result = [
|
||||
'daily' => ['label' => (string) trans('firefly.recurring_daily'), 'selected' => 0 === strpos($preSelected, 'daily')],
|
||||
$weekly => ['label' => (string) trans('firefly.recurring_weekly', ['weekday' => $dayOfWeek]),
|
||||
|
||||
@@ -23,6 +23,7 @@ declare(strict_types=1);
|
||||
namespace FireflyIII\Http\Controllers;
|
||||
|
||||
use FireflyIII\Http\Requests\NewUserFormRequest;
|
||||
use FireflyIII\Models\AccountType;
|
||||
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
|
||||
use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface;
|
||||
use FireflyIII\Support\Http\Controllers\CreateStuff;
|
||||
@@ -110,6 +111,12 @@ class NewUserController extends Controller
|
||||
|
||||
// store currency preference:
|
||||
app('preferences')->set('currencyPreference', $currency->code);
|
||||
|
||||
// store frontpage preferences:
|
||||
$accounts = $this->repository->getAccountsByType([AccountType::ASSET])->pluck('id')->toArray();
|
||||
app('preferences')->set('frontPageAccounts', $accounts);
|
||||
|
||||
// mark.
|
||||
app('preferences')->mark();
|
||||
|
||||
// set default optional fields:
|
||||
|
||||
@@ -71,7 +71,7 @@ class PiggyBankController extends Controller
|
||||
$this->middleware(
|
||||
function ($request, $next) {
|
||||
app('view')->share('title', (string) trans('firefly.piggyBanks'));
|
||||
app('view')->share('mainTitleIcon', 'fa-sort-amount-asc');
|
||||
app('view')->share('mainTitleIcon', 'fa-bullseye');
|
||||
|
||||
$this->attachments = app(AttachmentHelperInterface::class);
|
||||
$this->piggyRepos = app(PiggyBankRepositoryInterface::class);
|
||||
|
||||
@@ -31,6 +31,7 @@ use Illuminate\Http\RedirectResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Routing\Redirector;
|
||||
use Illuminate\View\View;
|
||||
use JsonException;
|
||||
|
||||
/**
|
||||
* Class PreferencesController.
|
||||
@@ -90,8 +91,9 @@ class PreferencesController extends Controller
|
||||
|
||||
$viewRange = $viewRangePref->data;
|
||||
$frontPageAccounts = app('preferences')->get('frontPageAccounts', $accountIds);
|
||||
$language = app('preferences')->get('language', config('firefly.default_language', 'en_US'))->data;
|
||||
$language = app('steam')->getLanguage();
|
||||
$languages = config('firefly.languages');
|
||||
$locale = app('preferences')->get('locale', config('firefly.default_locale', 'equal'))->data;
|
||||
$listPageSize = app('preferences')->get('listPageSize', 50)->data;
|
||||
$customFiscalYear = app('preferences')->get('customFiscalYear', 0)->data;
|
||||
$fiscalYearStartStr = app('preferences')->get('fiscalYearStart', '01-01')->data;
|
||||
@@ -100,6 +102,15 @@ class PreferencesController extends Controller
|
||||
|
||||
ksort($languages);
|
||||
|
||||
// list of locales also has "equal" which makes it equal to whatever the language is.
|
||||
|
||||
try {
|
||||
$locales = json_decode(file_get_contents(resource_path(sprintf('lang/%s/locales.json', $language))), true, 512, JSON_THROW_ON_ERROR);
|
||||
} catch (JsonException $e) {
|
||||
Log::error($e->getMessage());
|
||||
$locales = [];
|
||||
}
|
||||
$locales = ['equal' => (string) trans('firefly.equal_to_language')] + $locales;
|
||||
// an important fallback is that the frontPageAccount array gets refilled automatically
|
||||
// when it turns up empty.
|
||||
if (0 === count($frontPageAccounts->data)) {
|
||||
@@ -113,6 +124,8 @@ class PreferencesController extends Controller
|
||||
'groupedAccounts',
|
||||
'frontPageAccounts',
|
||||
'languages',
|
||||
'locales',
|
||||
'locale',
|
||||
'tjOptionalFields',
|
||||
'viewRange',
|
||||
'customFiscalYear',
|
||||
@@ -172,6 +185,11 @@ class PreferencesController extends Controller
|
||||
session()->flash('info', 'All translations are supplied by volunteers. There might be errors and mistakes. I appreciate your feedback.');
|
||||
}
|
||||
|
||||
// same for locale:
|
||||
/** @var Preference $currentLocale */
|
||||
$locale = $request->get('locale');
|
||||
app('preferences')->set('locale', $locale);
|
||||
|
||||
// optional fields for transactions:
|
||||
$setOptions = $request->get('tj');
|
||||
$optionalTj = [
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
/**
|
||||
* DataController.php
|
||||
* Copyright (c) 2019 james@firefly-iii.org
|
||||
|
||||
@@ -555,7 +555,7 @@ class ProfileController extends Controller
|
||||
/** @var string $match */
|
||||
$match = null;
|
||||
foreach ($set as $entry) {
|
||||
$hashed = hash('sha256', $entry->data);
|
||||
$hashed = hash('sha256', sprintf('%s%s', (string) config('app.key'), $entry->data));
|
||||
if ($hashed === $hash) {
|
||||
$match = $entry->data;
|
||||
break;
|
||||
|
||||
@@ -110,8 +110,13 @@ class IndexController extends Controller
|
||||
$array['first_date'] = new Carbon($array['first_date']);
|
||||
$array['repeat_until'] = null === $array['repeat_until'] ? null : new Carbon($array['repeat_until']);
|
||||
$array['latest_date'] = null === $array['latest_date'] ? null : new Carbon($array['latest_date']);
|
||||
$array['occurrences'] = array_slice($this->recurring->getOccurrencesInRange($recurrence->recurrenceRepetitions->first(), $today, $year), 0, 1);
|
||||
$recurring[] = $array;
|
||||
$array['occurrences'] = [];
|
||||
|
||||
if (0 !== $recurrence->recurrenceRepetitions->count()) {
|
||||
$array['ocurrences'] = array_slice($this->recurring->getOccurrencesInRange($recurrence->recurrenceRepetitions->first(), $today, $year), 0, 1);
|
||||
}
|
||||
|
||||
$recurring[] = $array;
|
||||
}
|
||||
$paginator = new LengthAwarePaginator($recurring, $total, $pageSize, $page);
|
||||
$paginator->setPath(route('recurring.index'));
|
||||
|
||||
@@ -301,7 +301,6 @@ class BudgetController extends Controller
|
||||
$report[$budgetId]['currencies'][$currencyId]['sum_pct'] = $pct;
|
||||
}
|
||||
}
|
||||
|
||||
return view('reports.budget.partials.budgets', compact('sums', 'report'));
|
||||
}
|
||||
|
||||
@@ -317,6 +316,7 @@ class BudgetController extends Controller
|
||||
*/
|
||||
public function general(Collection $accounts, Carbon $start, Carbon $end)
|
||||
{
|
||||
|
||||
$report = [
|
||||
'budgets' => [],
|
||||
'sums' => [],
|
||||
@@ -488,6 +488,7 @@ class BudgetController extends Controller
|
||||
foreach ($expenses as $currency) {
|
||||
foreach ($currency['budgets'] as $budget) {
|
||||
$count = 0;
|
||||
$total = '0';
|
||||
foreach ($budget['transaction_journals'] as $journal) {
|
||||
$count++;
|
||||
$key = sprintf('%d-%d', $budget['id'], $currency['currency_id']);
|
||||
@@ -506,7 +507,7 @@ class BudgetController extends Controller
|
||||
$report[$key]['entries'][$dateKey] = $report[$key] ['entries'][$dateKey] ?? '0';
|
||||
$report[$key]['entries'][$dateKey] = bcadd($journal['amount'], $report[$key] ['entries'][$dateKey]);
|
||||
$report[$key]['sum'] = bcadd($report[$key] ['sum'], $journal['amount']);
|
||||
$report[$key]['avg'] = bcdiv($report[$key]['sum'], (string) $count);
|
||||
$report[$key]['avg'] = bcdiv($report[$key]['sum'], (string) count($periods));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -64,7 +64,7 @@ class ReportController extends Controller
|
||||
$this->middleware(
|
||||
function ($request, $next) {
|
||||
app('view')->share('title', (string) trans('firefly.reports'));
|
||||
app('view')->share('mainTitleIcon', 'fa-line-chart');
|
||||
app('view')->share('mainTitleIcon', 'fa-bar-chart');
|
||||
app('view')->share('subTitleIcon', 'fa-calendar');
|
||||
$this->helper = app(ReportHelperInterface::class);
|
||||
$this->repository = app(BudgetRepositoryInterface::class);
|
||||
|
||||
@@ -41,6 +41,7 @@ class CronController
|
||||
{
|
||||
$results = [];
|
||||
$results[] = $this->runRecurring();
|
||||
$results[] = $this->runAutoBudget();
|
||||
|
||||
return implode("<br>\n", $results);
|
||||
}
|
||||
|
||||
@@ -60,7 +60,7 @@ class TagController extends Controller
|
||||
$this->middleware(
|
||||
function ($request, $next) {
|
||||
app('view')->share('title', (string) trans('firefly.tags'));
|
||||
app('view')->share('mainTitleIcon', 'fa-tags');
|
||||
app('view')->share('mainTitleIcon', 'fa-tag');
|
||||
|
||||
$this->attachments = app(AttachmentHelperInterface::class);
|
||||
$this->repository = app(TagRepositoryInterface::class);
|
||||
|
||||
@@ -56,7 +56,7 @@ class BulkController extends Controller
|
||||
function ($request, $next) {
|
||||
$this->repository = app(JournalRepositoryInterface::class);
|
||||
app('view')->share('title', (string) trans('firefly.transactions'));
|
||||
app('view')->share('mainTitleIcon', 'fa-repeat');
|
||||
app('view')->share('mainTitleIcon', 'fa-exchange');
|
||||
|
||||
return $next($request);
|
||||
}
|
||||
|
||||
@@ -206,9 +206,9 @@ class ConvertController extends Controller
|
||||
|
||||
// double check its not an empty string.
|
||||
$sourceId = '' === $sourceId || null === $sourceId ? null : (int) $sourceId;
|
||||
$sourceName = '' === $sourceName ? null : $sourceName;
|
||||
$sourceName = '' === $sourceName ? null : (string) $sourceName;
|
||||
$destinationId = '' === $destinationId || null === $destinationId ? null : (int) $destinationId;
|
||||
$destinationName = (string)('' === $destinationName ? null : $destinationName);
|
||||
$destinationName = '' === $destinationName ? null : (string) $destinationName;
|
||||
$validSource = $validator->validateSource($sourceId, $sourceName, null);
|
||||
$validDestination = $validator->validateDestination($destinationId, $destinationName, null);
|
||||
|
||||
|
||||
@@ -49,7 +49,7 @@ class CreateController extends Controller
|
||||
$this->middleware(
|
||||
static function ($request, $next) {
|
||||
app('view')->share('title', (string) trans('firefly.transactions'));
|
||||
app('view')->share('mainTitleIcon', 'fa-repeat');
|
||||
app('view')->share('mainTitleIcon', 'fa-exchange');
|
||||
|
||||
return $next($request);
|
||||
}
|
||||
|
||||
@@ -56,7 +56,7 @@ class DeleteController extends Controller
|
||||
$this->middleware(
|
||||
function ($request, $next) {
|
||||
app('view')->share('title', (string) trans('firefly.transactions'));
|
||||
app('view')->share('mainTitleIcon', 'fa-repeat');
|
||||
app('view')->share('mainTitleIcon', 'fa-exchange');
|
||||
|
||||
$this->repository = app(TransactionGroupRepositoryInterface::class);
|
||||
|
||||
|
||||
@@ -52,7 +52,7 @@ class EditController extends Controller
|
||||
static function ($request, $next) {
|
||||
|
||||
app('view')->share('title', (string) trans('firefly.transactions'));
|
||||
app('view')->share('mainTitleIcon', 'fa-repeat');
|
||||
app('view')->share('mainTitleIcon', 'fa-exchange');
|
||||
|
||||
return $next($request);
|
||||
}
|
||||
|
||||
@@ -56,8 +56,8 @@ class IndexController extends Controller
|
||||
// translations:
|
||||
$this->middleware(
|
||||
function ($request, $next) {
|
||||
app('view')->share('mainTitleIcon', 'fa-credit-card');
|
||||
app('view')->share('title', (string) trans('firefly.accounts'));
|
||||
app('view')->share('mainTitleIcon', 'fa-exchange');
|
||||
app('view')->share('title', (string) trans('firefly.transactions'));
|
||||
|
||||
$this->repository = app(JournalRepositoryInterface::class);
|
||||
|
||||
@@ -88,7 +88,9 @@ class IndexController extends Controller
|
||||
$end = session('end');
|
||||
}
|
||||
if (null === $end) {
|
||||
$end = session('end'); // @codeCoverageIgnore
|
||||
// get last transaction ever?
|
||||
$last = $this->repository->getLast();
|
||||
$end = $last ? $last->date : session('end');
|
||||
}
|
||||
|
||||
[$start, $end] = $end < $start ? [$end, $start] : [$start, $end];
|
||||
@@ -134,14 +136,15 @@ class IndexController extends Controller
|
||||
$repository = app(JournalRepositoryInterface::class);
|
||||
|
||||
|
||||
$subTitleIcon = config('firefly.transactionIconsByWhat.' . $objectType);
|
||||
$types = config('firefly.transactionTypesByWhat.' . $objectType);
|
||||
$subTitleIcon = config('firefly.transactionIconsByType.' . $objectType);
|
||||
$types = config('firefly.transactionTypesByType.' . $objectType);
|
||||
$page = (int) $request->get('page');
|
||||
$pageSize = (int) app('preferences')->get('listPageSize', 50)->data;
|
||||
$path = route('transactions.index.all', [$objectType]);
|
||||
$first = $repository->firstNull();
|
||||
$start = null === $first ? new Carbon : $first->date;
|
||||
$end = new Carbon;
|
||||
$last = $this->repository->getLast();
|
||||
$end = $last ? $last->date : new Carbon;
|
||||
$subTitle = (string) trans('firefly.all_' . $objectType);
|
||||
|
||||
/** @var GroupCollectorInterface $collector */
|
||||
|
||||
@@ -57,7 +57,7 @@ class LinkController extends Controller
|
||||
$this->middleware(
|
||||
function ($request, $next) {
|
||||
app('view')->share('title', (string) trans('firefly.transactions'));
|
||||
app('view')->share('mainTitleIcon', 'fa-repeat');
|
||||
app('view')->share('mainTitleIcon', 'fa-exchange');
|
||||
|
||||
$this->journalRepository = app(JournalRepositoryInterface::class);
|
||||
$this->repository = app(LinkTypeRepositoryInterface::class);
|
||||
|
||||
@@ -62,7 +62,7 @@ class MassController extends Controller
|
||||
$this->middleware(
|
||||
function ($request, $next) {
|
||||
app('view')->share('title', (string) trans('firefly.transactions'));
|
||||
app('view')->share('mainTitleIcon', 'fa-repeat');
|
||||
app('view')->share('mainTitleIcon', 'fa-exchange');
|
||||
$this->repository = app(JournalRepositoryInterface::class);
|
||||
|
||||
return $next($request);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -26,6 +26,7 @@ use App;
|
||||
use Carbon\Carbon;
|
||||
use Closure;
|
||||
use FireflyIII\Repositories\Journal\JournalRepositoryInterface;
|
||||
use FireflyIII\Support\Http\Controllers\RequestInformation;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
/**
|
||||
@@ -33,6 +34,7 @@ use Illuminate\Http\Request;
|
||||
*/
|
||||
class Range
|
||||
{
|
||||
use RequestInformation;
|
||||
/**
|
||||
* Handle an incoming request.
|
||||
*
|
||||
@@ -72,16 +74,16 @@ class Range
|
||||
*/
|
||||
private function configureView(): void
|
||||
{
|
||||
$pref = app('preferences')->get('language', config('firefly.default_language', 'en_US'));
|
||||
/** @noinspection NullPointerExceptionInspection */
|
||||
$lang = $pref->data;
|
||||
App::setLocale($lang);
|
||||
Carbon::setLocale(substr($lang, 0, 2));
|
||||
$locale = explode(',', (string) trans('config.locale'));
|
||||
$locale = array_map('trim', $locale);
|
||||
// get locale preference:
|
||||
$language = app('steam')->getLanguage();
|
||||
$locale = app('steam')->getLocale();
|
||||
App::setLocale($language);
|
||||
Carbon::setLocale(substr($locale, 0, 2));
|
||||
|
||||
setlocale(LC_TIME, $locale);
|
||||
$moneyResult = setlocale(LC_MONETARY, $locale);
|
||||
$localeArray = app('steam')->getLocaleArray($locale);
|
||||
|
||||
setlocale(LC_TIME, $localeArray);
|
||||
$moneyResult = setlocale(LC_MONETARY, $localeArray);
|
||||
|
||||
// send error to view if could not set money format
|
||||
if (false === $moneyResult) {
|
||||
@@ -89,12 +91,12 @@ class Range
|
||||
}
|
||||
|
||||
// save some formats:
|
||||
$monthAndDayFormat = (string) trans('config.month_and_day');
|
||||
$dateTimeFormat = (string) trans('config.date_time');
|
||||
$monthAndDayFormat = (string) trans('config.month_and_day', [], $locale);
|
||||
$dateTimeFormat = (string) trans('config.date_time', [], $locale);
|
||||
$defaultCurrency = app('amount')->getDefaultCurrency();
|
||||
|
||||
// also format for moment JS:
|
||||
$madMomentJS = (string) trans('config.month_and_day_moment_js');
|
||||
$madMomentJS = (string) trans('config.month_and_day_moment_js', [], $locale);
|
||||
|
||||
app('view')->share('madMomentJS', $madMomentJS);
|
||||
app('view')->share('monthAndDayFormat', $monthAndDayFormat);
|
||||
|
||||
@@ -58,7 +58,7 @@ class SecureHeaders
|
||||
"base-uri 'self'",
|
||||
"font-src 'self' data:",
|
||||
"connect-src 'self'",
|
||||
sprintf("img-src 'self' data: https://api.tiles.mapbox.com %s", $trackingScriptSrc),
|
||||
sprintf("img-src 'self' data: https://a.tile.openstreetmap.org https://b.tile.openstreetmap.org https://c.tile.openstreetmap.org https://api.tiles.mapbox.com %s", $trackingScriptSrc),
|
||||
"manifest-src 'self'",
|
||||
];
|
||||
|
||||
|
||||
@@ -68,7 +68,7 @@ class BudgetFormStoreRequest extends Request
|
||||
'name' => 'required|between:1,100|uniqueObjectForUser:budgets,name',
|
||||
'active' => 'numeric|between:0,1',
|
||||
'auto_budget_type' => 'numeric|between:0,2',
|
||||
'auto_budget_currency_id' => 'required|exists:transaction_currencies,id',
|
||||
'auto_budget_currency_id' => 'exists:transaction_currencies,id',
|
||||
'auto_budget_amount' => 'min:0|max:1000000000',
|
||||
'auto_budget_period' => 'in:daily,weekly,monthly,quarterly,half_year,yearly',
|
||||
];
|
||||
|
||||
@@ -78,7 +78,7 @@ class BudgetFormUpdateRequest extends Request
|
||||
'name' => $nameRule,
|
||||
'active' => 'numeric|between:0,1',
|
||||
'auto_budget_option' => 'numeric|between:0,2',
|
||||
'auto_budget_currency_id' => 'required|exists:transaction_currencies,id',
|
||||
'auto_budget_currency_id' => 'exists:transaction_currencies,id',
|
||||
'auto_budget_amount' => 'min:0|max:1000000000',
|
||||
'auto_budget_period' => 'in:daily,weekly,monthly,quarterly,half_year,yearly',
|
||||
];
|
||||
|
||||
@@ -53,7 +53,7 @@ class PiggyBankFormRequest extends Request
|
||||
'account_id' => $this->integer('account_id'),
|
||||
'targetamount' => $this->string('targetamount'),
|
||||
'targetdate' => $this->date('targetdate'),
|
||||
'notes' => $this->string('notes'),
|
||||
'notes' => $this->nlString('notes'),
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
@@ -50,7 +50,7 @@ class ProfileFormRequest extends Request
|
||||
// fixed
|
||||
return [
|
||||
'current_password' => 'required',
|
||||
'new_password' => 'required|confirmed|secure_password',
|
||||
'new_password' => 'required|confirmed|secure_password|min:16',
|
||||
'new_password_confirmation' => 'required',
|
||||
];
|
||||
}
|
||||
|
||||
@@ -297,8 +297,9 @@ class Request extends FormRequest
|
||||
$latitudeKey = $this->getLocationKey($prefix, 'latitude');
|
||||
$zoomLevelKey = $this->getLocationKey($prefix, 'zoom_level');
|
||||
$hasLocationKey = $this->getLocationKey($prefix, 'has_location');
|
||||
$hasLocation = $this->boolean($hasLocationKey);
|
||||
|
||||
// for a POST (store, all fields must be present and accounted for:
|
||||
// for a POST (store), all fields must be present and accounted for:
|
||||
if (
|
||||
('POST' === $this->method() && $this->routeIs('*.store'))
|
||||
&& ($this->has($longitudeKey) && $this->has($latitudeKey) && $this->has($zoomLevelKey))
|
||||
@@ -322,12 +323,14 @@ class Request extends FormRequest
|
||||
$data['latitude'] = $this->nullableString($latitudeKey);
|
||||
$data['zoom_level'] = $this->nullableString($zoomLevelKey);
|
||||
}
|
||||
if (null === $data['longitude'] || null === $data['latitude'] || null === $data['zoom_level']) {
|
||||
Log::debug('One of the fields is NULL, wont save.');
|
||||
if (false === $hasLocation || null === $data['longitude'] || null === $data['latitude'] || null === $data['zoom_level']) {
|
||||
Log::debug('One of the fields is NULL or hasLocation is false, wont save.');
|
||||
$data['store_location'] = false;
|
||||
$data['update_location'] = false;
|
||||
$data['update_location'] = true; // update is always true, but the values are null:
|
||||
$data['longitude'] = null;
|
||||
$data['latitude'] = null;
|
||||
$data['zoom_level'] = null;
|
||||
}
|
||||
|
||||
Log::debug(sprintf('Returning longitude: "%s", latitude: "%s", zoom level: "%s"', $data['longitude'], $data['latitude'], $data['zoom_level']));
|
||||
|
||||
return $data;
|
||||
|
||||
@@ -252,7 +252,11 @@ class Account extends Model
|
||||
*/
|
||||
public function setVirtualBalanceAttribute($value): void
|
||||
{
|
||||
$this->attributes['virtual_balance'] = (string) $value;
|
||||
$value = (string)$value;
|
||||
if('' === $value) {
|
||||
$value = null;
|
||||
}
|
||||
$this->attributes['virtual_balance'] = $value;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -83,7 +83,7 @@ class AccountMeta extends Model
|
||||
*/
|
||||
public function getDataAttribute($value)
|
||||
{
|
||||
return json_decode($value);
|
||||
return json_decode($value, true, 512, JSON_THROW_ON_ERROR);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
/**
|
||||
* AutoBudget.php
|
||||
* Copyright (c) 2020 thegrumpydictator@gmail.com
|
||||
|
||||
@@ -89,6 +89,8 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||
* @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
|
||||
{
|
||||
|
||||
@@ -77,6 +77,10 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||
* @property-read int|null $budgetlimits_count
|
||||
* @property-read int|null $transaction_journals_count
|
||||
* @property-read int|null $transactions_count
|
||||
* @property \Illuminate\Support\Carbon|null $created_at
|
||||
* @property \Illuminate\Support\Carbon|null $updated_at
|
||||
* @property bool $encrypted
|
||||
* @property-read \Illuminate\Database\Eloquent\Collection|\FireflyIII\Models\BudgetLimit[] $budgetlimits
|
||||
*/
|
||||
class Budget extends Model
|
||||
{
|
||||
|
||||
@@ -70,6 +70,7 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||
* @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,8 +35,8 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||
/**
|
||||
* Class ImportJob.
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
* @deprecated
|
||||
* @codeCoverageIgnore
|
||||
* @deprecated
|
||||
* @property array $transactions
|
||||
* @property array $configuration
|
||||
* @property User $user
|
||||
@@ -73,6 +73,8 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||
* @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
|
||||
{
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
/**
|
||||
* Location.php
|
||||
* Copyright (c) 2019 james@firefly-iii.org
|
||||
|
||||
@@ -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
|
||||
{
|
||||
|
||||
@@ -76,6 +76,7 @@ use Illuminate\Support\Collection;
|
||||
* @method static Builder|RecurrenceTransaction withoutTrashed()
|
||||
* @mixin Eloquent
|
||||
* @property-read int|null $recurrence_transaction_meta_count
|
||||
* @property int $transaction_currency_id
|
||||
*/
|
||||
class RecurrenceTransaction extends Model
|
||||
{
|
||||
|
||||
@@ -69,6 +69,7 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||
* @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
|
||||
{
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
/**
|
||||
* Telemetry.php
|
||||
* Copyright (c) 2020 thegrumpydictator@gmail.com
|
||||
|
||||
@@ -132,6 +132,9 @@ use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
* @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
|
||||
{
|
||||
|
||||
@@ -67,6 +67,7 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||
* @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
|
||||
{
|
||||
|
||||
@@ -121,6 +121,18 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||
* @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
|
||||
{
|
||||
|
||||
@@ -48,7 +48,7 @@ use FireflyIII\Services\FireflyIIIOrg\Update\UpdateRequest;
|
||||
use FireflyIII\Services\FireflyIIIOrg\Update\UpdateRequestInterface;
|
||||
use FireflyIII\Services\IP\IpifyOrg;
|
||||
use FireflyIII\Services\IP\IPRetrievalInterface;
|
||||
use FireflyIII\Services\Password\PwndVerifierV3;
|
||||
use FireflyIII\Services\Password\PwndVerifierV2;
|
||||
use FireflyIII\Services\Password\Verifier;
|
||||
use FireflyIII\Support\Amount;
|
||||
use FireflyIII\Support\ExpandedForm;
|
||||
@@ -189,7 +189,7 @@ class FireflyServiceProvider extends ServiceProvider
|
||||
$this->app->bind(ExchangeRateInterface::class, $class);
|
||||
|
||||
// password verifier thing
|
||||
$this->app->bind(Verifier::class, PwndVerifierV3::class);
|
||||
$this->app->bind(Verifier::class, PwndVerifierV2::class);
|
||||
|
||||
// IP thing:
|
||||
$this->app->bind(IPRetrievalInterface::class, IpifyOrg::class);
|
||||
|
||||
@@ -79,6 +79,8 @@ class BudgetRepository implements BudgetRepositoryInterface
|
||||
$budget->order = $index + 1;
|
||||
$budget->save();
|
||||
}
|
||||
// other budgets, set to 0.
|
||||
$this->user->budgets()->where('active', 0)->update(['order' => 0]);
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -187,12 +189,12 @@ class BudgetRepository implements BudgetRepositoryInterface
|
||||
*/
|
||||
public function getActiveBudgets(): Collection
|
||||
{
|
||||
//throw new \RuntimeException;
|
||||
/** @var Collection $set */
|
||||
$set = $this->user->budgets()->where('active', 1)
|
||||
->orderBy('order', 'DESC')
|
||||
->orderBy('order', 'ASC')
|
||||
->orderBy('name', 'ASC')
|
||||
->get();
|
||||
|
||||
return $set;
|
||||
}
|
||||
|
||||
@@ -202,7 +204,7 @@ class BudgetRepository implements BudgetRepositoryInterface
|
||||
public function getBudgets(): Collection
|
||||
{
|
||||
/** @var Collection $set */
|
||||
$set = $this->user->budgets()->orderBy('order', 'DESC')
|
||||
$set = $this->user->budgets()->orderBy('order', 'ASC')
|
||||
->orderBy('name', 'ASC')->get();
|
||||
|
||||
return $set;
|
||||
@@ -227,7 +229,7 @@ class BudgetRepository implements BudgetRepositoryInterface
|
||||
{
|
||||
/** @var Collection $set */
|
||||
$set = $this->user->budgets()
|
||||
->orderBy('order', 'DESC')
|
||||
->orderBy('order', 'ASC')
|
||||
->orderBy('name', 'ASC')->where('active', 0)->get();
|
||||
|
||||
return $set;
|
||||
@@ -277,11 +279,13 @@ class BudgetRepository implements BudgetRepositoryInterface
|
||||
*/
|
||||
public function store(array $data): Budget
|
||||
{
|
||||
$order = $this->getMaxOrder();
|
||||
try {
|
||||
$newBudget = Budget::create(
|
||||
[
|
||||
'user_id' => $this->user->id,
|
||||
'name' => $data['name'],
|
||||
'order' => $order + 1,
|
||||
]
|
||||
);
|
||||
} catch (QueryException $e) {
|
||||
@@ -487,4 +491,9 @@ class BudgetRepository implements BudgetRepositoryInterface
|
||||
{
|
||||
return $budget->attachments()->get();
|
||||
}
|
||||
|
||||
public function getMaxOrder(): int
|
||||
{
|
||||
return (int)$this->user->budgets()->max('order');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -58,6 +58,11 @@ interface BudgetRepositoryInterface
|
||||
*/
|
||||
public function destroyAutoBudget(Budget $budget): void;
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getMaxOrder(): int;
|
||||
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
|
||||
@@ -267,6 +267,7 @@ class CategoryRepository implements CategoryRepositoryInterface
|
||||
{
|
||||
/** @var CategoryUpdateService $service */
|
||||
$service = app(CategoryUpdateService::class);
|
||||
$service->setUser($this->user);
|
||||
|
||||
return $service->update($category, $data);
|
||||
}
|
||||
|
||||
@@ -384,7 +384,7 @@ class ImportJobRepository implements ImportJobRepositoryInterface
|
||||
$attachment = new Attachment; // create Attachment object.
|
||||
$attachment->user()->associate($job->user);
|
||||
$attachment->attachable()->associate($job);
|
||||
$attachment->md5 = md5($content);
|
||||
$attachment->md5 = substr(hash('sha256', $content), 0, 32); // limit due to DB.
|
||||
$attachment->filename = $name;
|
||||
$attachment->mime = 'plain/txt';
|
||||
$attachment->size = strlen($content);
|
||||
|
||||
@@ -407,4 +407,19 @@ class JournalRepository implements JournalRepositoryInterface
|
||||
|
||||
return $transaction->account;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return TransactionJournal|null
|
||||
*/
|
||||
public function getLast(): ?TransactionJournal
|
||||
{
|
||||
/** @var TransactionJournal $entry */
|
||||
$entry = $this->user->transactionJournals()->orderBy('date', 'DESC')->first(['transaction_journals.*']);
|
||||
$result = null;
|
||||
if (null !== $entry) {
|
||||
$result = $entry;
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,6 +37,10 @@ use Illuminate\Support\Collection;
|
||||
*/
|
||||
interface JournalRepositoryInterface
|
||||
{
|
||||
/**
|
||||
* @return TransactionJournal|null
|
||||
*/
|
||||
public function getLast(): ?TransactionJournal;
|
||||
|
||||
/**
|
||||
* TODO maybe create JSON repository?
|
||||
@@ -44,6 +48,7 @@ interface JournalRepositoryInterface
|
||||
* Search in journal descriptions.
|
||||
*
|
||||
* @param string $search
|
||||
*
|
||||
* @return Collection
|
||||
*/
|
||||
public function searchJournalDescriptions(string $search): Collection;
|
||||
|
||||
@@ -142,6 +142,9 @@ trait ModifiesPiggyBanks
|
||||
*/
|
||||
public function createEvent(PiggyBank $piggyBank, string $amount): PiggyBankEvent
|
||||
{
|
||||
if (0 === bccomp('0', $amount)) {
|
||||
return new PiggyBankEvent;
|
||||
}
|
||||
/** @var PiggyBankEvent $event */
|
||||
$event = PiggyBankEvent::create(['date' => Carbon::now(), 'amount' => $amount, 'piggy_bank_id' => $piggyBank->id]);
|
||||
|
||||
@@ -219,11 +222,12 @@ trait ModifiesPiggyBanks
|
||||
if (1 === bccomp($amount, $max)) {
|
||||
$amount = $max;
|
||||
}
|
||||
$difference = bcsub($amount, $repetition->currentamount);
|
||||
$repetition->currentamount = $amount;
|
||||
$repetition->save();
|
||||
|
||||
// create event
|
||||
$this->createEvent($piggyBank, $amount);
|
||||
$this->createEvent($piggyBank, $difference);
|
||||
|
||||
return $piggyBank;
|
||||
}
|
||||
@@ -343,4 +347,4 @@ trait ModifiesPiggyBanks
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user