mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2026-03-07 08:21:21 +00:00
Compare commits
52 Commits
develop-20
...
develop-20
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ef5c35c04d | ||
|
|
4dfbdc644c | ||
|
|
a08f776ffa | ||
|
|
e246c1f4b7 | ||
|
|
f2d1e8e184 | ||
|
|
19d8f46f24 | ||
|
|
9ac991edd7 | ||
|
|
e85f06792b | ||
|
|
b66f95f1dc | ||
|
|
4d63146524 | ||
|
|
695f990236 | ||
|
|
e882530a69 | ||
|
|
993a2491e9 | ||
|
|
f6ea517b5d | ||
|
|
6f4143bb79 | ||
|
|
4a2c77c6b7 | ||
|
|
0e62f980b0 | ||
|
|
41533fd922 | ||
|
|
d6b5fbe341 | ||
|
|
1047e3290b | ||
|
|
8ac4c535b4 | ||
|
|
2c997d8d95 | ||
|
|
419382f9e0 | ||
|
|
12f19c6c34 | ||
|
|
705138aa27 | ||
|
|
36d20137b2 | ||
|
|
7f08a3f594 | ||
|
|
a897229958 | ||
|
|
1fa4632be5 | ||
|
|
221a00a23b | ||
|
|
09c3318408 | ||
|
|
25ba87babb | ||
|
|
d7e9a42f58 | ||
|
|
8fd6d99c11 | ||
|
|
463ae00ec2 | ||
|
|
969460d271 | ||
|
|
8ecfa4b619 | ||
|
|
55ae86ad62 | ||
|
|
5e68d948f3 | ||
|
|
77cae13b95 | ||
|
|
49d8a3c32e | ||
|
|
0ad4db8a71 | ||
|
|
ed9754c8d4 | ||
|
|
7315825475 | ||
|
|
eea23ed756 | ||
|
|
04875728b4 | ||
|
|
1fa51a92c6 | ||
|
|
f8687d4fc1 | ||
|
|
9b5cf09cc0 | ||
|
|
268377ad3a | ||
|
|
93500b8156 | ||
|
|
8a3fb50607 |
12
.ci/php-cs-fixer/composer.lock
generated
12
.ci/php-cs-fixer/composer.lock
generated
@@ -1264,16 +1264,16 @@
|
||||
},
|
||||
{
|
||||
"name": "symfony/console",
|
||||
"version": "v8.0.6",
|
||||
"version": "v8.0.7",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/console.git",
|
||||
"reference": "488285876e807a4777f074041d8bb508623419fa"
|
||||
"reference": "15ed9008a4ebe2d6a78e4937f74e0c13ef2e618a"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/console/zipball/488285876e807a4777f074041d8bb508623419fa",
|
||||
"reference": "488285876e807a4777f074041d8bb508623419fa",
|
||||
"url": "https://api.github.com/repos/symfony/console/zipball/15ed9008a4ebe2d6a78e4937f74e0c13ef2e618a",
|
||||
"reference": "15ed9008a4ebe2d6a78e4937f74e0c13ef2e618a",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -1330,7 +1330,7 @@
|
||||
"terminal"
|
||||
],
|
||||
"support": {
|
||||
"source": "https://github.com/symfony/console/tree/v8.0.6"
|
||||
"source": "https://github.com/symfony/console/tree/v8.0.7"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
@@ -1350,7 +1350,7 @@
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2026-02-25T16:59:43+00:00"
|
||||
"time": "2026-03-06T14:06:22+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/deprecation-contracts",
|
||||
|
||||
@@ -1,48 +1,51 @@
|
||||
parameters:
|
||||
ergebnis:
|
||||
noExtends:
|
||||
enabled: false
|
||||
final:
|
||||
enabled: false
|
||||
noParameterWithNullDefaultValue:
|
||||
enabled: false
|
||||
noParameterWithNullableTypeDeclaration:
|
||||
enabled: false
|
||||
noCompact:
|
||||
enabled: false
|
||||
noSwitch:
|
||||
enabled: false
|
||||
noNullableReturnTypeDeclaration:
|
||||
enabled: false
|
||||
finalInAbstractClass:
|
||||
enabled: false
|
||||
noConstructorParameterWithDefaultValue:
|
||||
enabled: false
|
||||
noNamedArgument:
|
||||
enabled: false
|
||||
noParameterWithContainerTypeDeclaration:
|
||||
enabled: false
|
||||
paths:
|
||||
- ../app
|
||||
- ../database
|
||||
- ../routes
|
||||
- ../config
|
||||
- ../bootstrap/app.php
|
||||
- ../bootstrap/providers.php
|
||||
universalObjectCratesClasses:
|
||||
- Illuminate\Database\Eloquent\Model
|
||||
reportUnmatchedIgnoredErrors: true
|
||||
ignoreErrors:
|
||||
# these are actually interesting but not right now:
|
||||
- identifier: notIdentical.alwaysTrue
|
||||
- identifier: method.notFound
|
||||
- identifier: nullsafe.neverNull
|
||||
- identifier: identical.alwaysFalse
|
||||
- identifier: if.condNotBoolean
|
||||
# - identifier: booleanNot.exprNotBoolean
|
||||
- identifier: method.nonObject
|
||||
- identifier: function.impossibleType
|
||||
- identifier: booleanNot.exprNotBoolean
|
||||
- identifier: ternary.condNotBoolean
|
||||
- identifier: booleanNot.alwaysFalse
|
||||
- identifier: booleanAnd.alwaysFalse
|
||||
- identifier: greater.alwaysTrue
|
||||
- identifier: function.alreadyNarrowedType
|
||||
- identifier: booleanNot.alwaysTrue
|
||||
- identifier: property.phpDocType
|
||||
- identifier: nullCoalesce.offset
|
||||
- identifier: nullCoalesce.variable
|
||||
- identifier: larastan.noUnnecessaryCollectionCall
|
||||
- identifier: varTag.differentVariable
|
||||
- identifier: identical.alwaysTrue
|
||||
- identifier: clone.nonObject
|
||||
- identifier: assign.propertyReadOnly
|
||||
- identifier: property.nonObject
|
||||
- identifier: varTag.nativeType
|
||||
- identifier: booleanAnd.leftAlwaysFalse
|
||||
- identifier: property.onlyWritten
|
||||
- identifier: parameter.phpDocType
|
||||
- identifier: property.dynamicName
|
||||
- identifier: property.unusedType
|
||||
- identifier: staticMethod.deprecated
|
||||
- identifier: greater.invalid
|
||||
- identifier: instanceof.alwaysTrue
|
||||
# ignore everything but things that BREAK
|
||||
- identifier: property.deprecated
|
||||
- identifier: method.deprecated
|
||||
@@ -54,7 +57,15 @@ parameters:
|
||||
- identifier: assign.propertyType
|
||||
- identifier: return.unusedType
|
||||
- identifier: return.phpDocType
|
||||
# all errors below I will never fix.
|
||||
# all errors below I will (probably) never fix.
|
||||
- identifier: method.notFound # way too many false positives
|
||||
- identifier: catch.neverThrown # plenty of errors that are thrown undocumented
|
||||
- identifier: staticMethod.dynamicName # dont care
|
||||
- identifier: arguments.count # one false positive
|
||||
- identifier: property.notFound # false positives
|
||||
- identifier: method.dynamicName # i dont care
|
||||
- identifier: staticMethod.dynamicCall # many false positives.
|
||||
- identifier: argument.templateType # no clue how to fix single occurrence.
|
||||
# - '#expects view-string\|null, string given#'
|
||||
# - '#expects view-string, string given#'
|
||||
# - "#Parameter \\#[1-2] \\$num[1-2] of function bc[a-z]+ expects numeric-string, [a-z\\-|&]+ given#"
|
||||
@@ -64,7 +75,7 @@ parameters:
|
||||
path: ../app/Console/Commands/System/CreatesDatabase.php
|
||||
- identifier: missingType.iterableValue # not interesting enough to fix.
|
||||
- identifier: varTag.type # needs a custom extension for every repository, not gonna happen.
|
||||
- '#Dynamic call to static method Illuminate#'
|
||||
# - '#Dynamic call to static method Illuminate#'
|
||||
# - '#Call to an undefined method Illuminate\\Database\\Eloquent\\Relations\\HasMany::before#' # is custom scope
|
||||
# - '#Call to an undefined method Illuminate\\Database\\Eloquent\\Relations\\HasMany::after#' # is custom scope
|
||||
# - '#Call to an undefined method Illuminate\\Database\\Eloquent\\Relations\\HasMany::withTrashed#' # is to allow soft delete
|
||||
|
||||
12
.github/workflows/release.yml
vendored
12
.github/workflows/release.yml
vendored
@@ -174,22 +174,24 @@ jobs:
|
||||
uses: nhedger/setup-mago@v1
|
||||
- name: Run CI
|
||||
run: |
|
||||
cp .env.example .env
|
||||
# install all packages etc.
|
||||
rm -rf vendor composer.lock
|
||||
composer update --no-scripts --no-plugins -q
|
||||
composer update --no-scripts -q
|
||||
|
||||
# format code.
|
||||
echo "Will now run Mago Format"
|
||||
mago format || true
|
||||
mago format
|
||||
sudo chown -R runner:docker resources/lang
|
||||
echo "Will now run PHPCS"
|
||||
.ci/phpcs.sh || true
|
||||
.ci/phpcs.sh
|
||||
|
||||
# lint and check
|
||||
echo "Will now run Mago Lint"
|
||||
mago lint || true
|
||||
mago lint
|
||||
echo "Will now run PHPstan"
|
||||
.ci/phpstan.sh || true
|
||||
.ci/phpstan.sh
|
||||
rm .env
|
||||
- name: Calculate variables
|
||||
run: |
|
||||
|
||||
|
||||
@@ -63,6 +63,8 @@ abstract class Controller extends BaseController
|
||||
use ValidatesRequests;
|
||||
use ValidatesUserGroupTrait;
|
||||
|
||||
protected array $acceptedRoles = [];
|
||||
|
||||
protected const string CONTENT_TYPE = 'application/vnd.api+json';
|
||||
protected const string JSON_CONTENT_TYPE = 'application/json';
|
||||
|
||||
@@ -222,11 +224,7 @@ abstract class Controller extends BaseController
|
||||
$value = min(max(1, $value), 2 ** 16);
|
||||
$bag->set($integer, $value);
|
||||
}
|
||||
if (
|
||||
null === $value
|
||||
&& 'limit' === $integer // @phpstan-ignore-line
|
||||
&& auth()->check()
|
||||
) {
|
||||
if (null === $value && 'limit' === $integer && auth()->check()) {
|
||||
// set default for user:
|
||||
/** @var User $user */
|
||||
$user = auth()->user();
|
||||
|
||||
@@ -256,7 +256,7 @@ final class ListController extends Controller
|
||||
$unfiltered = $recurringRepos->get();
|
||||
|
||||
// filter selection
|
||||
$collection = $unfiltered->filter(static function (Recurrence $recurrence) use ($currency): null|Recurrence { // @phpstan-ignore-line
|
||||
$collection = $unfiltered->filter(static function (Recurrence $recurrence) use ($currency): null|Recurrence {
|
||||
if (array_any(
|
||||
$recurrence->recurrenceTransactions,
|
||||
static fn ($transaction): bool => $transaction->transaction_currency_id === $currency->id || $transaction->foreign_currency_id === $currency->id
|
||||
@@ -306,7 +306,7 @@ final class ListController extends Controller
|
||||
$ruleRepos = app(RuleRepositoryInterface::class);
|
||||
$unfiltered = $ruleRepos->getAll();
|
||||
|
||||
$collection = $unfiltered->filter(static function (Rule $rule) use ($currency): null|Rule { // @phpstan-ignore-line
|
||||
$collection = $unfiltered->filter(static function (Rule $rule) use ($currency): null|Rule {
|
||||
if (array_any(
|
||||
$rule->ruleTriggers,
|
||||
static fn ($trigger): bool => 'currency_is' === $trigger->trigger_type && $currency->name === $trigger->trigger_value
|
||||
|
||||
@@ -68,7 +68,7 @@ final class TransactionController extends Controller
|
||||
$description = (string) $request->attributes->get('description');
|
||||
Log::debug(sprintf('Include deleted? %s', var_export($includeDeleted, true)));
|
||||
if ('' !== $externalId) {
|
||||
$count += $this->repository->countByMeta('external_identifier', $externalId, $includeDeleted);
|
||||
$count += $this->repository->countByMeta('external_id', $externalId, $includeDeleted);
|
||||
Log::debug(sprintf('Search for transactions with external_identifier "%s", count is now %d', $externalId, $count));
|
||||
}
|
||||
if ('' !== $internalRef) {
|
||||
|
||||
@@ -112,19 +112,6 @@ final class BasicController extends Controller
|
||||
return response()->json($return);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if date is outside session range.
|
||||
*/
|
||||
protected function notInDateRange(Carbon $date, Carbon $start, Carbon $end): bool
|
||||
{ // Validate a preference
|
||||
if ($start->greaterThanOrEqualTo($date) && $end->greaterThanOrEqualTo($date)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// start and end in the past? use $end
|
||||
return $start->lessThanOrEqualTo($date) && $end->lessThanOrEqualTo($date);
|
||||
}
|
||||
|
||||
private function getBalanceInformation(Carbon $start, Carbon $end): array
|
||||
{
|
||||
Log::debug('getBalanceInformation');
|
||||
|
||||
@@ -62,7 +62,7 @@ final class BatchController extends Controller
|
||||
}
|
||||
Log::debug(sprintf('Counted %d journals.', count($journals)));
|
||||
|
||||
/** @var TransactionJournal $first */
|
||||
/** @var null|TransactionJournal $first */
|
||||
$first = $journals->first();
|
||||
$group = $first?->transactionGroup;
|
||||
if (null === $group) {
|
||||
|
||||
@@ -34,7 +34,9 @@ abstract class AggregateFormRequest extends ApiRequest
|
||||
/**
|
||||
* @var ApiRequest[]
|
||||
*/
|
||||
protected array $requests = [];
|
||||
protected array $requests = [];
|
||||
|
||||
protected array $acceptedRoles = [];
|
||||
|
||||
#[Override]
|
||||
public function initialize(
|
||||
|
||||
@@ -38,7 +38,7 @@ class DateRangeRequest extends ApiRequest
|
||||
public function withValidator(Validator $validator): void
|
||||
{
|
||||
$validator->after(function (Validator $validator): void {
|
||||
if ($validator->failed()) {
|
||||
if (count($validator->failed()) > 0) {
|
||||
return;
|
||||
}
|
||||
$start = $this->getCarbonDate('start')?->startOfDay();
|
||||
|
||||
@@ -36,7 +36,7 @@ class DateRequest extends ApiRequest
|
||||
public function withValidator(Validator $validator): void
|
||||
{
|
||||
$validator->after(function (Validator $validator): void {
|
||||
if ($validator->failed()) {
|
||||
if (count($validator->failed()) > 0) {
|
||||
return;
|
||||
}
|
||||
$date = $this->getCarbonDate('date')?->endOfDay();
|
||||
|
||||
@@ -50,7 +50,7 @@ class ObjectTypeApiRequest extends ApiRequest
|
||||
|
||||
$this->objectType = $config['object_type'] ?? null;
|
||||
|
||||
if (!$this->objectType) {
|
||||
if (null === $this->objectType) {
|
||||
throw new RuntimeException('ObjectTypeApiRequest requires a object_type config');
|
||||
}
|
||||
}
|
||||
@@ -75,7 +75,7 @@ class ObjectTypeApiRequest extends ApiRequest
|
||||
public function withValidator(Validator $validator): void
|
||||
{
|
||||
$validator->after(function (Validator $validator): void {
|
||||
if ($validator->failed()) {
|
||||
if (count($validator->failed()) > 0) {
|
||||
return;
|
||||
}
|
||||
$type = $this->convertString('types', 'all');
|
||||
|
||||
@@ -42,7 +42,7 @@ class QueryRequest extends ApiRequest
|
||||
public function withValidator(Validator $validator): void
|
||||
{
|
||||
$validator->after(function (Validator $validator): void {
|
||||
if ($validator->failed()) {
|
||||
if (count($validator->failed()) > 0) {
|
||||
return;
|
||||
}
|
||||
$query = $this->convertString('query');
|
||||
|
||||
@@ -40,7 +40,7 @@ class AccountTypeApiRequest extends ApiRequest
|
||||
public function withValidator(Validator $validator): void
|
||||
{
|
||||
$validator->after(function (Validator $validator): void {
|
||||
if ($validator->failed()) {
|
||||
if (count($validator->failed()) > 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@ class AccountTypesApiRequest extends ApiRequest
|
||||
public function withValidator(Validator $validator): void
|
||||
{
|
||||
$validator->after(function (Validator $validator): void {
|
||||
if ($validator->failed()) {
|
||||
if (count($validator->failed()) > 0) {
|
||||
return;
|
||||
}
|
||||
$types = explode(',', $this->convertString('types', 'all'));
|
||||
|
||||
@@ -40,6 +40,8 @@ class Request extends FormRequest
|
||||
use ChecksLogin;
|
||||
use ConvertsDataTypes;
|
||||
|
||||
protected array $acceptedRoles = [];
|
||||
|
||||
/**
|
||||
* Get all data from the request.
|
||||
*/
|
||||
|
||||
@@ -26,6 +26,7 @@ namespace FireflyIII\Api\V1\Requests\Models\BudgetLimit;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use FireflyIII\Factory\TransactionCurrencyFactory;
|
||||
use FireflyIII\Models\Budget;
|
||||
use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface;
|
||||
use FireflyIII\Rules\IsBoolean;
|
||||
use FireflyIII\Rules\IsValidPositiveAmount;
|
||||
@@ -85,6 +86,7 @@ class StoreRequest extends FormRequest
|
||||
*/
|
||||
public function withValidator(Validator $validator): void
|
||||
{
|
||||
/** @var Budget $budget */
|
||||
$budget = $this->route()->parameter('budget');
|
||||
$validator->after(static function (Validator $validator) use ($budget): void {
|
||||
if (0 !== count($validator->failed())) {
|
||||
|
||||
@@ -61,7 +61,7 @@ class UpdateRequest extends FormRequest
|
||||
*/
|
||||
public function rules(): array
|
||||
{
|
||||
/** @var TransactionCurrency $currency */
|
||||
/** @var string|TransactionCurrency $currency */
|
||||
$currency = $this->route()->parameter('currency_code');
|
||||
if (is_string($currency)) {
|
||||
$currency = TransactionCurrency::whereCode($currency)->first();
|
||||
|
||||
@@ -27,6 +27,7 @@ namespace FireflyIII\Api\V1\Requests\Models\Webhook;
|
||||
use FireflyIII\Exceptions\FireflyException;
|
||||
use FireflyIII\Models\Webhook;
|
||||
use FireflyIII\Rules\IsBoolean;
|
||||
use FireflyIII\Rules\Webhook\IsValidWebhookUrl;
|
||||
use FireflyIII\Support\Facades\FireflyConfig;
|
||||
use FireflyIII\Support\Request\ChecksLogin;
|
||||
use FireflyIII\Support\Request\ConvertsDataTypes;
|
||||
@@ -83,7 +84,7 @@ class CreateRequest extends FormRequest
|
||||
'delivery' => 'prohibited',
|
||||
'deliveries' => 'required|array|min:1|max:1',
|
||||
'deliveries.*' => sprintf('required|in:%s', $deliveries),
|
||||
'url' => ['required', sprintf('url:%s', $validProtocols)],
|
||||
'url' => ['required', sprintf('url:%s', $validProtocols), new IsValidWebhookUrl()],
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,6 +27,7 @@ namespace FireflyIII\Api\V1\Requests\Models\Webhook;
|
||||
use FireflyIII\Exceptions\FireflyException;
|
||||
use FireflyIII\Models\Webhook;
|
||||
use FireflyIII\Rules\IsBoolean;
|
||||
use FireflyIII\Rules\Webhook\IsValidWebhookUrl;
|
||||
use FireflyIII\Support\Facades\FireflyConfig;
|
||||
use FireflyIII\Support\Request\ChecksLogin;
|
||||
use FireflyIII\Support\Request\ConvertsDataTypes;
|
||||
@@ -87,7 +88,7 @@ class UpdateRequest extends FormRequest
|
||||
'delivery' => 'prohibited',
|
||||
'deliveries' => 'required|array|min:1|max:1',
|
||||
'deliveries.*' => sprintf('required|in:%s', $deliveries),
|
||||
'url' => [sprintf('url:%s', $validProtocols), sprintf('uniqueExistingWebhook:%d', $webhook->id)],
|
||||
'url' => [sprintf('url:%s', $validProtocols), sprintf('uniqueExistingWebhook:%d', $webhook->id), new IsValidWebhookUrl()],
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,7 +41,7 @@ class PaginationRequest extends ApiRequest
|
||||
|
||||
$this->sortClass = $config['sort_class'] ?? null;
|
||||
|
||||
if (!$this->sortClass) {
|
||||
if (null === $this->sortClass) {
|
||||
throw new RuntimeException('PaginationRequest requires a sort_class config');
|
||||
}
|
||||
}
|
||||
@@ -58,7 +58,7 @@ class PaginationRequest extends ApiRequest
|
||||
public function withValidator(Validator $validator): void
|
||||
{
|
||||
$validator->after(function (Validator $validator): void {
|
||||
if ($validator->failed()) {
|
||||
if (count($validator->failed()) > 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -72,7 +72,7 @@ class PaginationRequest extends ApiRequest
|
||||
$page = $this->convertInteger('page');
|
||||
$page = min(max(1, $page), 2 ** 16);
|
||||
$offset = ($page - 1) * $limit;
|
||||
$sort = $this->sortClass ? $this->convertSortParameters('sort', $this->sortClass) : $this->get('sort');
|
||||
$sort = null !== $this->sortClass ? $this->convertSortParameters('sort', $this->sortClass) : $this->get('sort');
|
||||
$this->attributes->set('limit', $limit);
|
||||
$this->attributes->set('sort', $sort);
|
||||
$this->attributes->set('page', $page);
|
||||
|
||||
@@ -45,7 +45,7 @@ class CountRequest extends AggregateFormRequest
|
||||
public function withValidator(Validator $validator): void
|
||||
{
|
||||
$validator->after(function (Validator $validator): void {
|
||||
if ($validator->failed()) {
|
||||
if (count($validator->failed()) > 0) {
|
||||
return;
|
||||
}
|
||||
$this->attributes->set('include_deleted', $this->convertBoolean($this->input('include_deleted', 'false')));
|
||||
|
||||
@@ -37,7 +37,7 @@ class SearchQueryRequest extends ApiRequest
|
||||
public function withValidator(Validator $validator): void
|
||||
{
|
||||
$validator->after(function (Validator $validator): void {
|
||||
if ($validator->failed()) {
|
||||
if (count($validator->failed()) > 0) {
|
||||
return;
|
||||
}
|
||||
$query = $this->convertString('query');
|
||||
|
||||
@@ -83,10 +83,10 @@ class ConvertsDatesToUTC extends Command
|
||||
}
|
||||
$this->friendlyInfo(sprintf('Converting field "%s" of model "%s" to UTC.', $field, $shortModel));
|
||||
$items->each(static function ($item) use ($field, $timezoneField): void {
|
||||
$date = Carbon::parse($item->{$field}, $item->{$timezoneField}); // @phpstan-ignore-line
|
||||
$date = Carbon::parse($item->{$field}, $item->{$timezoneField});
|
||||
$date->setTimezone('UTC');
|
||||
$item->{$field} = $date->format('Y-m-d H:i:s'); // @phpstan-ignore-line
|
||||
$item->{$timezoneField} = 'UTC'; // @phpstan-ignore-line
|
||||
$item->{$field} = $date->format('Y-m-d H:i:s');
|
||||
$item->{$timezoneField} = 'UTC';
|
||||
$item->save();
|
||||
});
|
||||
}
|
||||
|
||||
@@ -57,24 +57,28 @@ class CorrectsIbans extends Command
|
||||
|
||||
/** @var Account $account */
|
||||
foreach ($accounts as $account) {
|
||||
$userId = $account->user_id;
|
||||
$userId = $account->user_id;
|
||||
$set[$userId] ??= [];
|
||||
$iban = (string) $account->iban;
|
||||
$iban = (string) $account->iban;
|
||||
if ('' === $iban) {
|
||||
continue;
|
||||
}
|
||||
$type = $account->accountType->type;
|
||||
$type = $account->accountType->type;
|
||||
if (in_array($type, [AccountTypeEnum::LOAN->value, AccountTypeEnum::DEBT->value, AccountTypeEnum::MORTGAGE->value], true)) {
|
||||
$type = 'liabilities';
|
||||
}
|
||||
// iban already in use! two exceptions exist:
|
||||
if (
|
||||
array_key_exists($iban, $set[$userId]) && (
|
||||
!AccountTypeEnum::EXPENSE->value === $set[$userId][$iban]
|
||||
&& AccountTypeEnum::REVENUE->value === $type
|
||||
&& !(AccountTypeEnum::REVENUE->value === $set[$userId][$iban] && AccountTypeEnum::EXPENSE->value === $type)
|
||||
)
|
||||
) {
|
||||
$showWarningAndCorrect = false;
|
||||
if (array_key_exists($iban, $set[$userId])) {
|
||||
// the type is a revenue account, and the existing IBAN is NOT an expense account.
|
||||
if (AccountTypeEnum::REVENUE->value === $type && AccountTypeEnum::EXPENSE->value !== $set[$userId][$iban]) {
|
||||
$showWarningAndCorrect = true;
|
||||
}
|
||||
// the type is an expense account, and the existing IBAN is NOT a revenue account
|
||||
if (AccountTypeEnum::EXPENSE->value === $type && AccountTypeEnum::REVENUE->value !== $set[$userId][$iban]) {
|
||||
$showWarningAndCorrect = true;
|
||||
}
|
||||
}
|
||||
if ($showWarningAndCorrect) {
|
||||
$this->friendlyWarning(sprintf(
|
||||
'IBAN "%s" is used more than once and will be removed from %s #%d ("%s")',
|
||||
$iban,
|
||||
|
||||
@@ -69,10 +69,6 @@ class CorrectsInvertedBudgetLimits extends Command
|
||||
$budgetLimit->saveQuietly();
|
||||
}
|
||||
|
||||
if ($set->count() > 0) {
|
||||
// FIXME here be a available budget event.
|
||||
}
|
||||
|
||||
if (1 === $set->count()) {
|
||||
$this->friendlyInfo('Corrected one budget limit to have the right start/end dates.');
|
||||
|
||||
|
||||
@@ -322,12 +322,7 @@ class CorrectsUnevenAmount extends Command
|
||||
foreach ($journals as $entry) {
|
||||
$sum = (string) $entry->the_sum;
|
||||
$sum = Steam::floatalize($sum);
|
||||
if (
|
||||
!is_numeric($sum)
|
||||
|| '' === $sum // @phpstan-ignore-line
|
||||
|| str_contains($sum, 'e')
|
||||
|| str_contains($sum, ',')
|
||||
) {
|
||||
if (!is_numeric($sum) || str_contains($sum, 'e') || str_contains($sum, ',')) {
|
||||
$message = sprintf('Journal #%d has an invalid sum ("%s"). No sure what to do.', $entry->transaction_journal_id, $entry->the_sum);
|
||||
$this->friendlyWarning($message);
|
||||
Log::warning($message);
|
||||
|
||||
@@ -57,7 +57,7 @@ class VerifySecurityAlerts extends Command
|
||||
$version = config('firefly.version');
|
||||
$disk = Storage::disk('resources');
|
||||
// Next line is ignored because it's a Laravel Facade.
|
||||
if (!$disk->has('alerts.json')) { // @phpstan-ignore-line
|
||||
if (!$disk->has('alerts.json')) {
|
||||
Log::debug('No alerts.json file present.');
|
||||
|
||||
return 0;
|
||||
|
||||
@@ -70,7 +70,7 @@ class Cron extends Command
|
||||
} catch (InvalidArgumentException $e) {
|
||||
$this->friendlyError(sprintf('"%s" is not a valid date', $this->option('date')));
|
||||
}
|
||||
$force = (bool) $this->option('force'); // @phpstan-ignore-line
|
||||
$force = (bool) $this->option('force');
|
||||
|
||||
// Fire exchange rates cron job.
|
||||
if (true === FireflyConfig::get('enable_external_rates', config('cer.download_enabled'))->data && ($doAll || $this->option('download-cer'))) {
|
||||
|
||||
@@ -68,7 +68,7 @@ class RemovesDatabaseDecryption extends Command
|
||||
* @var string $table
|
||||
* @var array $fields
|
||||
*/
|
||||
foreach ($tables as $table => $fields) { // @phpstan-ignore-line
|
||||
foreach ($tables as $table => $fields) {
|
||||
$this->decryptTable($table, $fields);
|
||||
}
|
||||
|
||||
@@ -127,7 +127,7 @@ class RemovesDatabaseDecryption extends Command
|
||||
}
|
||||
|
||||
// A separate routine for preferences table:
|
||||
if ('preferences' === $table && is_string($value)) {
|
||||
if ('preferences' === $table) {
|
||||
$this->decryptPreferencesRow($id, $value);
|
||||
|
||||
return;
|
||||
|
||||
@@ -101,8 +101,13 @@ class UpgradesLiabilitiesEight extends Command
|
||||
|
||||
private function hasBadOpening(Account $account): bool
|
||||
{
|
||||
/** @var TransactionType $openingBalanceType */
|
||||
$openingBalanceType = TransactionType::whereType(TransactionTypeEnum::OPENING_BALANCE->value)->first();
|
||||
|
||||
/** @var TransactionType $liabilityType */
|
||||
$liabilityType = TransactionType::whereType(TransactionTypeEnum::LIABILITY_CREDIT->value)->first();
|
||||
|
||||
/** @var null|TransactionJournal $openingJournal */
|
||||
$openingJournal = TransactionJournal::leftJoin('transactions', 'transactions.transaction_journal_id', '=', 'transaction_journals.id')
|
||||
->where('transactions.account_id', $account->id)
|
||||
->where('transaction_journals.transaction_type_id', $openingBalanceType->id)
|
||||
@@ -111,6 +116,8 @@ class UpgradesLiabilitiesEight extends Command
|
||||
if (null === $openingJournal) {
|
||||
return false;
|
||||
}
|
||||
|
||||
/** @var null|TransactionJournal $liabilityJournal */
|
||||
$liabilityJournal = TransactionJournal::leftJoin('transactions', 'transactions.transaction_journal_id', '=', 'transaction_journals.id')
|
||||
->where('transactions.account_id', $account->id)
|
||||
->where('transaction_journals.transaction_type_id', $liabilityType->id)
|
||||
@@ -120,7 +127,7 @@ class UpgradesLiabilitiesEight extends Command
|
||||
return false;
|
||||
}
|
||||
|
||||
return (bool) $openingJournal->date->isSameDay($liabilityJournal->date);
|
||||
return $openingJournal->date->isSameDay($liabilityJournal->date);
|
||||
}
|
||||
|
||||
private function isExecuted(): bool
|
||||
|
||||
@@ -27,6 +27,7 @@ namespace FireflyIII\Events\Model\BudgetLimit;
|
||||
use FireflyIII\Events\Event;
|
||||
use FireflyIII\Models\BudgetLimit;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
class CreatedBudgetLimit extends Event
|
||||
{
|
||||
@@ -35,5 +36,7 @@ class CreatedBudgetLimit extends Event
|
||||
public function __construct(
|
||||
public BudgetLimit $budgetLimit,
|
||||
public bool $createWebhookMessages
|
||||
) {}
|
||||
) {
|
||||
Log::debug(sprintf('CreatedNewBudgetLimit(#%d) Event', $budgetLimit->id));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,6 +29,7 @@ use FireflyIII\Events\Event;
|
||||
use FireflyIII\Models\Budget;
|
||||
use FireflyIII\User;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
class DestroyedBudgetLimit extends Event
|
||||
{
|
||||
@@ -40,5 +41,7 @@ class DestroyedBudgetLimit extends Event
|
||||
public Carbon $start,
|
||||
public Carbon $end,
|
||||
public bool $createWebhookMessages
|
||||
) {}
|
||||
) {
|
||||
Log::debug(sprintf('DestroyedBudgetLimit(#%d) Event', $budget->id));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,6 +27,7 @@ namespace FireflyIII\Events\Model\BudgetLimit;
|
||||
use FireflyIII\Events\Event;
|
||||
use FireflyIII\Models\BudgetLimit;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
class UpdatedBudgetLimit extends Event
|
||||
{
|
||||
@@ -35,5 +36,7 @@ class UpdatedBudgetLimit extends Event
|
||||
public function __construct(
|
||||
public BudgetLimit $budgetLimit,
|
||||
public bool $createWebhookMessages
|
||||
) {}
|
||||
) {
|
||||
Log::debug(sprintf('UpdatedBudgetLimit(#%d) Event', $budgetLimit->id));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ final class IntervalException extends Exception
|
||||
public array $availableIntervals = [];
|
||||
public Periodicity $periodicity = Periodicity::Monthly;
|
||||
|
||||
/** @var mixed */
|
||||
/** @var string */
|
||||
protected $message = 'The periodicity %s is unknown. Choose one of available periodicity: %s';
|
||||
|
||||
public function __construct(string $message = '', int $code = 0, ?Throwable $previous = null)
|
||||
|
||||
@@ -338,7 +338,7 @@ class TransactionJournalFactory
|
||||
'date_tz' => $carbon->format('e'),
|
||||
'order' => $order,
|
||||
'tag_count' => 0,
|
||||
'completed' => !$row['batch_submission'],
|
||||
'completed' => is_bool($row['batch_submission']) && !$row['batch_submission'],
|
||||
]);
|
||||
Log::debug(sprintf('Created new journal #%d: "%s"', $journal->id, $journal->description));
|
||||
|
||||
@@ -574,16 +574,11 @@ class TransactionJournalFactory
|
||||
return [$sourceAccount, $account];
|
||||
}
|
||||
|
||||
if (!$sourceAccount instanceof Account) { // @phpstan-ignore-line
|
||||
Log::debug('Source account is NULL, destination account is not.');
|
||||
$account = $this->accountRepository->getReconciliation($destinationAccount);
|
||||
Log::debug(sprintf('Will return account #%d ("%s") of type "%s"', $account->id, $account->name, $account->accountType->type));
|
||||
Log::debug('Source account is NULL, destination account is not.');
|
||||
$account = $this->accountRepository->getReconciliation($destinationAccount);
|
||||
Log::debug(sprintf('Will return account #%d ("%s") of type "%s"', $account->id, $account->name, $account->accountType->type));
|
||||
|
||||
return [$account, $destinationAccount];
|
||||
}
|
||||
Log::debug('Unused fallback'); // @phpstan-ignore-line
|
||||
|
||||
return [$sourceAccount, $destinationAccount];
|
||||
return [$account, $destinationAccount];
|
||||
}
|
||||
|
||||
private function storeLocation(TransactionJournal $journal, NullArrayObject $data): void
|
||||
|
||||
@@ -178,7 +178,7 @@ trait AccountCollection
|
||||
{
|
||||
if ($accounts->count() > 0) {
|
||||
$accountIds = $accounts->pluck('id')->toArray();
|
||||
$this->query->where(static function (EloquentBuilder $query) use ($accountIds): void { // @phpstan-ignore-line
|
||||
$this->query->where(static function (EloquentBuilder $query) use ($accountIds): void {
|
||||
$query->whereIn('source.account_id', $accountIds);
|
||||
$query->orWhereIn('destination.account_id', $accountIds);
|
||||
});
|
||||
@@ -196,7 +196,7 @@ trait AccountCollection
|
||||
{
|
||||
if ($accounts->count() > 0) {
|
||||
$accountIds = $accounts->pluck('id')->toArray();
|
||||
$this->query->where(static function (EloquentBuilder $query) use ($accountIds): void { // @phpstan-ignore-line
|
||||
$this->query->where(static function (EloquentBuilder $query) use ($accountIds): void {
|
||||
$query->whereIn('source.account_id', $accountIds);
|
||||
$query->whereIn('destination.account_id', $accountIds);
|
||||
});
|
||||
@@ -228,7 +228,7 @@ trait AccountCollection
|
||||
{
|
||||
if ($accounts->count() > 0) {
|
||||
$accountIds = $accounts->pluck('id')->toArray();
|
||||
$this->query->where(static function (EloquentBuilder $query) use ($accountIds): void { // @phpstan-ignore-line
|
||||
$this->query->where(static function (EloquentBuilder $query) use ($accountIds): void {
|
||||
$query->whereNotIn('source.account_id', $accountIds);
|
||||
$query->whereNotIn('destination.account_id', $accountIds);
|
||||
});
|
||||
@@ -261,7 +261,7 @@ trait AccountCollection
|
||||
{
|
||||
if ($accounts->count() > 0) {
|
||||
$accountIds = $accounts->pluck('id')->toArray();
|
||||
$this->query->where(static function (EloquentBuilder $q1) use ($accountIds): void { // @phpstan-ignore-line
|
||||
$this->query->where(static function (EloquentBuilder $q1) use ($accountIds): void {
|
||||
// sourceAccount is in the set, and destination is NOT.
|
||||
|
||||
$q1->where(static function (EloquentBuilder $q2) use ($accountIds): void {
|
||||
|
||||
@@ -38,7 +38,7 @@ trait AmountCollection
|
||||
*/
|
||||
public function amountIs(string $amount): GroupCollectorInterface
|
||||
{
|
||||
$this->query->where(static function (EloquentBuilder $q) use ($amount): void { // @phpstan-ignore-line
|
||||
$this->query->where(static function (EloquentBuilder $q) use ($amount): void {
|
||||
$q->where('source.amount', Steam::negative($amount));
|
||||
});
|
||||
|
||||
@@ -47,7 +47,7 @@ trait AmountCollection
|
||||
|
||||
public function amountIsNot(string $amount): GroupCollectorInterface
|
||||
{
|
||||
$this->query->where(static function (EloquentBuilder $q) use ($amount): void { // @phpstan-ignore-line
|
||||
$this->query->where(static function (EloquentBuilder $q) use ($amount): void {
|
||||
$q->where('source.amount', '!=', Steam::negative($amount));
|
||||
});
|
||||
|
||||
@@ -59,7 +59,7 @@ trait AmountCollection
|
||||
*/
|
||||
public function amountLess(string $amount): GroupCollectorInterface
|
||||
{
|
||||
$this->query->where(static function (EloquentBuilder $q) use ($amount): void { // @phpstan-ignore-line
|
||||
$this->query->where(static function (EloquentBuilder $q) use ($amount): void {
|
||||
$q->where('destination.amount', '<=', Steam::positive($amount));
|
||||
});
|
||||
|
||||
@@ -71,7 +71,7 @@ trait AmountCollection
|
||||
*/
|
||||
public function amountMore(string $amount): GroupCollectorInterface
|
||||
{
|
||||
$this->query->where(static function (EloquentBuilder $q) use ($amount): void { // @phpstan-ignore-line
|
||||
$this->query->where(static function (EloquentBuilder $q) use ($amount): void {
|
||||
$q->where('destination.amount', '>=', Steam::positive($amount));
|
||||
});
|
||||
|
||||
@@ -83,7 +83,7 @@ trait AmountCollection
|
||||
*/
|
||||
public function foreignAmountIs(string $amount): GroupCollectorInterface
|
||||
{
|
||||
$this->query->where(static function (EloquentBuilder $q) use ($amount): void { // @phpstan-ignore-line
|
||||
$this->query->where(static function (EloquentBuilder $q) use ($amount): void {
|
||||
$q->whereNotNull('source.foreign_amount');
|
||||
$q->where('source.foreign_amount', Steam::negative($amount));
|
||||
});
|
||||
@@ -96,7 +96,7 @@ trait AmountCollection
|
||||
*/
|
||||
public function foreignAmountIsNot(string $amount): GroupCollectorInterface
|
||||
{
|
||||
$this->query->where(static function (EloquentBuilder $q) use ($amount): void { // @phpstan-ignore-line
|
||||
$this->query->where(static function (EloquentBuilder $q) use ($amount): void {
|
||||
$q->whereNull('source.foreign_amount');
|
||||
$q->orWhere('source.foreign_amount', '!=', Steam::negative($amount));
|
||||
});
|
||||
@@ -109,7 +109,7 @@ trait AmountCollection
|
||||
*/
|
||||
public function foreignAmountLess(string $amount): GroupCollectorInterface
|
||||
{
|
||||
$this->query->where(static function (EloquentBuilder $q) use ($amount): void { // @phpstan-ignore-line
|
||||
$this->query->where(static function (EloquentBuilder $q) use ($amount): void {
|
||||
$q->whereNotNull('destination.foreign_amount');
|
||||
$q->where('destination.foreign_amount', '<=', Steam::positive($amount));
|
||||
});
|
||||
@@ -122,7 +122,7 @@ trait AmountCollection
|
||||
*/
|
||||
public function foreignAmountMore(string $amount): GroupCollectorInterface
|
||||
{
|
||||
$this->query->where(static function (EloquentBuilder $q) use ($amount): void { // @phpstan-ignore-line
|
||||
$this->query->where(static function (EloquentBuilder $q) use ($amount): void {
|
||||
$q->whereNotNull('destination.foreign_amount');
|
||||
$q->where('destination.foreign_amount', '>=', Steam::positive($amount));
|
||||
});
|
||||
|
||||
@@ -483,7 +483,7 @@ trait AttachmentCollection
|
||||
Log::debug('Add filter on no attachments.');
|
||||
$this->joinAttachmentTables();
|
||||
|
||||
$this->query->where(static function (EloquentBuilder $q1): void { // @phpstan-ignore-line
|
||||
$this->query->where(static function (EloquentBuilder $q1): void {
|
||||
$q1->whereNull('attachments.attachable_id')->orWhere(static function (EloquentBuilder $q2): void {
|
||||
$q2->whereNotNull('attachments.attachable_id')->whereNotNull('attachments.deleted_at');
|
||||
|
||||
@@ -517,7 +517,7 @@ trait AttachmentCollection
|
||||
$this->hasJoinedAttTables = true;
|
||||
$this->query
|
||||
->leftJoin('attachments', 'attachments.attachable_id', '=', 'transaction_journals.id')
|
||||
->where(static function (EloquentBuilder $q1): void { // @phpstan-ignore-line
|
||||
->where(static function (EloquentBuilder $q1): void {
|
||||
$q1->where('attachments.attachable_type', TransactionJournal::class);
|
||||
// $q1->where('attachments.uploaded', true);
|
||||
// $q1->whereNull('attachments.deleted_at');
|
||||
|
||||
@@ -46,7 +46,7 @@ trait MetaCollection
|
||||
public function excludeBills(Collection $bills): GroupCollectorInterface
|
||||
{
|
||||
$this->withBillInformation();
|
||||
$this->query->where(static function (EloquentBuilder $q1) use ($bills): void { // @phpstan-ignore-line
|
||||
$this->query->where(static function (EloquentBuilder $q1) use ($bills): void {
|
||||
$q1->whereNotIn('transaction_journals.bill_id', $bills->pluck('id')->toArray());
|
||||
$q1->orWhereNull('transaction_journals.bill_id');
|
||||
});
|
||||
@@ -61,7 +61,7 @@ trait MetaCollection
|
||||
{
|
||||
$this->withBudgetInformation();
|
||||
|
||||
$this->query->where(static function (EloquentBuilder $q2) use ($budget): void { // @phpstan-ignore-line
|
||||
$this->query->where(static function (EloquentBuilder $q2) use ($budget): void {
|
||||
$q2->where('budgets.id', '!=', $budget->id);
|
||||
$q2->orWhereNull('budgets.id');
|
||||
});
|
||||
@@ -73,7 +73,7 @@ trait MetaCollection
|
||||
{
|
||||
if ($budgets->count() > 0) {
|
||||
$this->withBudgetInformation();
|
||||
$this->query->where(static function (EloquentBuilder $q1) use ($budgets): void { // @phpstan-ignore-line
|
||||
$this->query->where(static function (EloquentBuilder $q1) use ($budgets): void {
|
||||
$q1->whereNotIn('budgets.id', $budgets->pluck('id')->toArray());
|
||||
$q1->orWhereNull('budgets.id');
|
||||
});
|
||||
@@ -86,7 +86,7 @@ trait MetaCollection
|
||||
{
|
||||
if ($categories->count() > 0) {
|
||||
$this->withCategoryInformation();
|
||||
$this->query->where(static function (EloquentBuilder $q1) use ($categories): void { // @phpstan-ignore-line
|
||||
$this->query->where(static function (EloquentBuilder $q1) use ($categories): void {
|
||||
$q1->whereNotIn('categories.id', $categories->pluck('id')->toArray());
|
||||
$q1->orWhereNull('categories.id');
|
||||
});
|
||||
@@ -102,7 +102,7 @@ trait MetaCollection
|
||||
{
|
||||
$this->withCategoryInformation();
|
||||
|
||||
$this->query->where(static function (EloquentBuilder $q2) use ($category): void { // @phpstan-ignore-line
|
||||
$this->query->where(static function (EloquentBuilder $q2) use ($category): void {
|
||||
$q2->where('categories.id', '!=', $category->id);
|
||||
$q2->orWhereNull('categories.id');
|
||||
});
|
||||
@@ -394,7 +394,7 @@ trait MetaCollection
|
||||
public function notesDoNotContain(string $value): GroupCollectorInterface
|
||||
{
|
||||
$this->withNotes();
|
||||
$this->query->where(static function (EloquentBuilder $q) use ($value): void { // @phpstan-ignore-line
|
||||
$this->query->where(static function (EloquentBuilder $q) use ($value): void {
|
||||
$q->whereNull('notes.text');
|
||||
$q->orWhereNotLike('notes.text', sprintf('%%%s%%', $value));
|
||||
});
|
||||
@@ -405,7 +405,7 @@ trait MetaCollection
|
||||
public function notesDontEndWith(string $value): GroupCollectorInterface
|
||||
{
|
||||
$this->withNotes();
|
||||
$this->query->where(static function (EloquentBuilder $q) use ($value): void { // @phpstan-ignore-line
|
||||
$this->query->where(static function (EloquentBuilder $q) use ($value): void {
|
||||
$q->whereNull('notes.text');
|
||||
$q->orWhereNotLike('notes.text', sprintf('%%%s', $value));
|
||||
});
|
||||
@@ -416,7 +416,7 @@ trait MetaCollection
|
||||
public function notesDontStartWith(string $value): GroupCollectorInterface
|
||||
{
|
||||
$this->withNotes();
|
||||
$this->query->where(static function (EloquentBuilder $q) use ($value): void { // @phpstan-ignore-line
|
||||
$this->query->where(static function (EloquentBuilder $q) use ($value): void {
|
||||
$q->whereNull('notes.text');
|
||||
$q->orWhereNotLike('notes.text', sprintf('%s%%', $value));
|
||||
});
|
||||
@@ -443,7 +443,7 @@ trait MetaCollection
|
||||
public function notesExactlyNot(string $value): GroupCollectorInterface
|
||||
{
|
||||
$this->withNotes();
|
||||
$this->query->where(static function (EloquentBuilder $q) use ($value): void { // @phpstan-ignore-line
|
||||
$this->query->where(static function (EloquentBuilder $q) use ($value): void {
|
||||
$q->whereNull('notes.text');
|
||||
$q->orWhere('notes.text', '!=', $value);
|
||||
});
|
||||
@@ -889,7 +889,7 @@ trait MetaCollection
|
||||
{
|
||||
$this->joinMetaDataTables();
|
||||
// TODO not sure if this will work properly.
|
||||
$this->query->where(static function (EloquentBuilder $q1): void { // @phpstan-ignore-line
|
||||
$this->query->where(static function (EloquentBuilder $q1): void {
|
||||
$q1->where(static function (EloquentBuilder $q2): void {
|
||||
$q2->where('journal_meta.name', '=', 'external_id');
|
||||
$q2->whereNull('journal_meta.data');
|
||||
@@ -910,7 +910,7 @@ trait MetaCollection
|
||||
{
|
||||
$this->joinMetaDataTables();
|
||||
// TODO not sure if this will work properly.
|
||||
$this->query->where(static function (EloquentBuilder $q1): void { // @phpstan-ignore-line
|
||||
$this->query->where(static function (EloquentBuilder $q1): void {
|
||||
$q1->where(static function (EloquentBuilder $q2): void {
|
||||
$q2->where('journal_meta.name', '=', 'external_url');
|
||||
$q2->whereNull('journal_meta.data');
|
||||
@@ -930,7 +930,7 @@ trait MetaCollection
|
||||
public function withoutNotes(): GroupCollectorInterface
|
||||
{
|
||||
$this->withNotes();
|
||||
$this->query->where(static function (EloquentBuilder $q): void { // @phpstan-ignore-line
|
||||
$this->query->where(static function (EloquentBuilder $q): void {
|
||||
$q->whereNull('notes.text');
|
||||
$q->orWhere('notes.text', '');
|
||||
});
|
||||
|
||||
@@ -314,7 +314,7 @@ class GroupCollector implements GroupCollectorInterface
|
||||
|
||||
public function excludeForeignCurrency(TransactionCurrency $currency): GroupCollectorInterface
|
||||
{
|
||||
$this->query->where(static function (EloquentBuilder $q2) use ($currency): void { // @phpstan-ignore-line
|
||||
$this->query->where(static function (EloquentBuilder $q2) use ($currency): void {
|
||||
$q2->where('source.foreign_currency_id', '!=', $currency->id);
|
||||
$q2->orWhereNull('source.foreign_currency_id');
|
||||
});
|
||||
@@ -698,7 +698,7 @@ class GroupCollector implements GroupCollectorInterface
|
||||
*/
|
||||
foreach ($this->sorting as $field => $direction) {
|
||||
$func = 'ASC' === $direction ? 'sortBy' : 'sortByDesc';
|
||||
$collection = $collection->{$func}(static function (array $product, int $key) use ($field) { // @phpstan-ignore-line
|
||||
$collection = $collection->{$func}(static function (array $product, int $key) use ($field) {
|
||||
// depends on $field:
|
||||
if ('description' === $field) {
|
||||
if (1 === count($product['transactions'])) {
|
||||
|
||||
@@ -275,7 +275,7 @@ final class LoginController extends Controller
|
||||
$request->session()->regenerate();
|
||||
$this->clearLoginAttempts($request);
|
||||
$response = $this->authenticated($request, $this->guard()->user());
|
||||
if ($response) {
|
||||
if (null !== $response) {
|
||||
return $response;
|
||||
}
|
||||
$path = Steam::getSafeUrl(session()->pull('url.intended', route('index')), route('index'));
|
||||
|
||||
@@ -176,7 +176,7 @@ final class RegisterController extends Controller
|
||||
/**
|
||||
* @throws FireflyException
|
||||
*/
|
||||
protected function allowedToRegister(): bool
|
||||
private function allowedToRegister(): bool
|
||||
{
|
||||
// is allowed to register?
|
||||
$allowRegistration = true;
|
||||
|
||||
@@ -135,7 +135,7 @@ final class ExpenseReportController extends Controller
|
||||
|
||||
while ($currentStart < $end) {
|
||||
$currentEnd = clone $currentStart;
|
||||
$currentEnd = $currentEnd->{$function}(); // @phpstan-ignore-line
|
||||
$currentEnd = $currentEnd->{$function}();
|
||||
|
||||
// get expenses grouped by opposing name:
|
||||
$expenses = $this->groupByName($this->getExpensesForOpposing($accounts, $all, $currentStart, $currentEnd));
|
||||
|
||||
@@ -102,7 +102,7 @@ abstract class Controller extends BaseController
|
||||
if ('true' === request()->get('force_default_layout') && 'v2' === config('view.layout')) {
|
||||
// config('view.layout','v1');
|
||||
Config::set('view.layout', 'v1');
|
||||
View::getFinder()->setPaths([realpath(base_path('resources/views'))]); // @phpstan-ignore-line
|
||||
View::getFinder()->setPaths([realpath(base_path('resources/views'))]);
|
||||
}
|
||||
|
||||
View::share('authGuard', $authGuard);
|
||||
|
||||
@@ -149,7 +149,7 @@ final class DebugController extends Controller
|
||||
// get latest log file:
|
||||
$logger = Log::driver();
|
||||
// PHPstan doesn't recognize the method because of its polymorphic nature.
|
||||
$handlers = $logger->getHandlers(); // @phpstan-ignore-line
|
||||
$handlers = $logger->getHandlers();
|
||||
$logContent = '';
|
||||
foreach ($handlers as $handler) {
|
||||
if ($handler instanceof RotatingFileHandler) {
|
||||
@@ -304,7 +304,7 @@ final class DebugController extends Controller
|
||||
|
||||
return [
|
||||
'debug' => var_export(config('app.debug'), true),
|
||||
'audit_log_channel' => envNonEmpty('AUDIT_LOG_CHANNEL', '(empty)'),
|
||||
'audit_log_channel' => implode(', ', config('logging.channels.audit.channels')),
|
||||
'default_language' => (string) config('firefly.default_language'),
|
||||
'default_locale' => (string) config('firefly.default_locale'),
|
||||
'remote_header' => 'remote_user_guard' === $userGuard ? config('auth.guard_header') : 'N/A',
|
||||
@@ -323,11 +323,11 @@ final class DebugController extends Controller
|
||||
private function getBuildInfo(): array
|
||||
{
|
||||
$return = [
|
||||
'is_docker' => env('IS_DOCKER', false), // @phpstan-ignore-line
|
||||
'is_docker' => config('firefly.is_docker'),
|
||||
'build' => '(unknown)',
|
||||
'build_date' => '(unknown)',
|
||||
'base_build' => '(unknown)',
|
||||
'base_build_date' => '(unknown)',
|
||||
'base_build' => config('firefly.base_image_build'),
|
||||
'base_build_date' => config('firefly.base_image_date'),
|
||||
];
|
||||
|
||||
try {
|
||||
@@ -348,12 +348,6 @@ final class DebugController extends Controller
|
||||
Log::debug('Could not check build date, but thats ok.');
|
||||
Log::warning($e->getMessage());
|
||||
}
|
||||
if ('' !== (string) env('BASE_IMAGE_BUILD')) { // @phpstan-ignore-line
|
||||
$return['base_build'] = env('BASE_IMAGE_BUILD'); // @phpstan-ignore-line
|
||||
}
|
||||
if ('' !== (string) env('BASE_IMAGE_DATE')) { // @phpstan-ignore-line
|
||||
$return['base_build_date'] = env('BASE_IMAGE_DATE'); // @phpstan-ignore-line
|
||||
}
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
||||
@@ -69,7 +69,7 @@ final class AmountController extends Controller
|
||||
public function add(PiggyBank $piggyBank): Factory|\Illuminate\Contracts\View\View
|
||||
{
|
||||
/** @var Carbon $date */
|
||||
$date = session('end', today(config('app.timezone')));
|
||||
$date = now(config('app.timezone'));
|
||||
$accounts = [];
|
||||
$total = '0';
|
||||
$totalSaved = $this->piggyRepos->getCurrentAmount($piggyBank);
|
||||
@@ -109,7 +109,7 @@ final class AmountController extends Controller
|
||||
public function addMobile(PiggyBank $piggyBank): Factory|\Illuminate\Contracts\View\View
|
||||
{
|
||||
/** @var Carbon $date */
|
||||
$date = session('end', today(config('app.timezone')));
|
||||
$date = now(config('app.timezone'));
|
||||
$accounts = [];
|
||||
$total = '0';
|
||||
$totalSaved = $this->piggyRepos->getCurrentAmount($piggyBank);
|
||||
@@ -143,7 +143,7 @@ final class AmountController extends Controller
|
||||
/** @var Account $account */
|
||||
foreach ($piggyBank->accounts as $account) {
|
||||
$amount = (string) ($amounts[$account->id] ?? '0');
|
||||
if ('' === $amount || 0 === bccomp($amount, '0')) {
|
||||
if ('' === $amount || !is_numeric($amount) || 0 === bccomp($amount, '0')) {
|
||||
continue;
|
||||
}
|
||||
if (-1 === bccomp($amount, '0')) {
|
||||
|
||||
@@ -81,16 +81,6 @@ final class IndexController extends Controller
|
||||
$this->piggyRepos->resetOrder();
|
||||
$collection = $this->piggyRepos->getPiggyBanks();
|
||||
|
||||
session('end', today(config('app.timezone'))->endOfMonth());
|
||||
|
||||
// transform piggies using the transformer:
|
||||
// $parameters = new ParameterBag();
|
||||
// $parameters->set('end', $end);
|
||||
|
||||
// /** @var AccountTransformer $accountTransformer */
|
||||
// $accountTransformer = app(AccountTransformer::class);
|
||||
// $accountTransformer->setParameters($parameters);
|
||||
|
||||
// data
|
||||
$piggyBanks = $this->groupPiggyBanks($collection);
|
||||
$accounts = $this->collectAccounts($collection);
|
||||
@@ -107,8 +97,8 @@ final class IndexController extends Controller
|
||||
*/
|
||||
public function setOrder(Request $request, PiggyBank $piggyBank): JsonResponse
|
||||
{
|
||||
$objectGroupTitle = (string) $request->get('objectGroupTitle');
|
||||
$newOrder = (int) $request->get('order');
|
||||
$objectGroupTitle = (string) $request->input('objectGroupTitle');
|
||||
$newOrder = (int) $request->input('order');
|
||||
$this->piggyRepos->setOrder($piggyBank, $newOrder);
|
||||
if ('' !== $objectGroupTitle) {
|
||||
$this->piggyRepos->setObjectGroup($piggyBank, $objectGroupTitle);
|
||||
@@ -122,21 +112,15 @@ final class IndexController extends Controller
|
||||
|
||||
private function collectAccounts(Collection $collection): array
|
||||
{
|
||||
/** @var Carbon $end */
|
||||
$end = session('end', today(config('app.timezone'))->endOfMonth());
|
||||
|
||||
// transform piggies using the transformer:
|
||||
$parameters = new ParameterBag();
|
||||
$parameters->set('end', $end);
|
||||
$now = Carbon::now();
|
||||
|
||||
/** @var AccountTransformer $accountTransformer */
|
||||
$accountTransformer = app(AccountTransformer::class);
|
||||
$accountTransformer->setParameters($parameters);
|
||||
|
||||
// enrich each account.
|
||||
$enrichment = new AccountEnrichment();
|
||||
$enrichment->setUser(auth()->user());
|
||||
$enrichment->setDate($end);
|
||||
$enrichment->setDate($now);
|
||||
$return = [];
|
||||
|
||||
/** @var PiggyBank $piggy */
|
||||
|
||||
@@ -86,7 +86,7 @@ final class PreferencesController extends Controller
|
||||
AccountTypeEnum::DEBT->value,
|
||||
AccountTypeEnum::MORTGAGE->value,
|
||||
]);
|
||||
$isDocker = env('IS_DOCKER', false); // @phpstan-ignore-line
|
||||
$isDocker = config('firefly.is_docker');
|
||||
$groupedAccounts = [];
|
||||
|
||||
/** @var Account $account */
|
||||
|
||||
@@ -42,6 +42,6 @@ final class CreateController extends Controller
|
||||
$mainTitleIcon = 'fa-book';
|
||||
Log::debug(sprintf('Now at %s', __METHOD__));
|
||||
|
||||
return view('administrations.create')->with(['title' => $title, 'subTitle' => $subTitle, 'mainTitleIcon' => $mainTitleIcon]); // @phpstan-ignore-line
|
||||
return view('administrations.create')->with(['title' => $title, 'subTitle' => $subTitle, 'mainTitleIcon' => $mainTitleIcon]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -67,7 +67,7 @@ class SecureHeaders
|
||||
];
|
||||
|
||||
// overrule in development mode
|
||||
if (true === env('IS_LOCAL_DEV')) { // @phpstan-ignore-line
|
||||
if (true === config('firefly.is_local_dev')) {
|
||||
$csp = [
|
||||
"default-src 'none'",
|
||||
"object-src 'none'",
|
||||
|
||||
@@ -134,7 +134,7 @@ class RecurrenceFormRequest extends FormRequest
|
||||
* @var int $index
|
||||
* @var array $transaction
|
||||
*/
|
||||
foreach ($return['transactions'] as $index => $transaction) { // @phpstan-ignore-line
|
||||
foreach ($return['transactions'] as $index => $transaction) {
|
||||
$categoryName = $transaction['category_name'] ?? null;
|
||||
if (null !== $categoryName) {
|
||||
$category = $factory->findOrCreate(null, $categoryName);
|
||||
|
||||
@@ -213,7 +213,7 @@ class CreateRecurringTransactions implements ShouldQueue
|
||||
/** @var RecurrenceTransaction $transaction */
|
||||
foreach ($transactions as $index => $transaction) {
|
||||
$single = [
|
||||
'type' => null === $transaction?->transactionType?->type
|
||||
'type' => null === $transaction->transactionType?->type
|
||||
? strtolower((string) $recurrence->transactionType->type)
|
||||
: strtolower($transaction->transactionType->type),
|
||||
'date' => $date,
|
||||
|
||||
@@ -41,8 +41,8 @@ class ProcessesBudgetLimits implements ShouldQueue
|
||||
{
|
||||
public function handle(CreatedBudgetLimit|DestroyedBudgetLimit|UpdatedBudgetLimit $event): void
|
||||
{
|
||||
Log::debug(sprintf('Now in handle for event %s', get_class($event)));
|
||||
if ($event instanceof DestroyedBudgetLimit && null !== $event->user) {
|
||||
Log::debug(sprintf('Now in ProcessesBudgetLimits::handle for event %s', get_class($event)));
|
||||
if ($event instanceof DestroyedBudgetLimit) {
|
||||
// need to recalculate all available budgets for this user.
|
||||
$calculator = new AvailableBudgetCalculator();
|
||||
$calculator->setUser($event->user);
|
||||
@@ -70,6 +70,7 @@ class ProcessesBudgetLimits implements ShouldQueue
|
||||
|
||||
// do webhooks:
|
||||
if ($event->createWebhookMessages) {
|
||||
Log::debug('Event says to create webhook messages');
|
||||
$this->createWebhookMessages($event->budgetLimit->budget->user, $event->budgetLimit->budget, WebhookTrigger::STORE_UPDATE_BUDGET_LIMIT);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -58,10 +58,10 @@ class SendsWebhookMessages implements ShouldQueue
|
||||
$message->save();
|
||||
Log::debug(sprintf('Send message #%d', $message->id));
|
||||
SendWebhookMessage::dispatch($message)->afterResponse();
|
||||
|
||||
continue;
|
||||
}
|
||||
if (false !== $message->sent) {
|
||||
Log::debug(sprintf('Skip message #%d', $message->id));
|
||||
}
|
||||
Log::debug(sprintf('Skip message #%d', $message->id));
|
||||
}
|
||||
|
||||
// clean up sent messages table:
|
||||
|
||||
@@ -23,6 +23,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace FireflyIII\Models;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use FireflyIII\Casts\SeparateTimezoneCaster;
|
||||
use FireflyIII\Handlers\Observer\BillObserver;
|
||||
use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
|
||||
@@ -38,6 +39,11 @@ use Illuminate\Database\Eloquent\Relations\MorphToMany;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||
|
||||
/**
|
||||
* @property Carbon $date
|
||||
* @property null|Carbon $end_date
|
||||
* @property null|Carbon $extension_date
|
||||
*/
|
||||
#[ObservedBy([BillObserver::class])]
|
||||
class Bill extends Model
|
||||
{
|
||||
|
||||
@@ -23,6 +23,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace FireflyIII\Models;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use FireflyIII\Casts\SeparateTimezoneCaster;
|
||||
use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
|
||||
use FireflyIII\Support\Models\ReturnsIntegerUserIdTrait;
|
||||
@@ -32,6 +33,9 @@ use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
/**
|
||||
* @property Carbon $date
|
||||
*/
|
||||
class CurrencyExchangeRate extends Model
|
||||
{
|
||||
use ReturnsIntegerIdTrait;
|
||||
|
||||
@@ -4,6 +4,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace FireflyIII\Models;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use FireflyIII\Casts\SeparateTimezoneCaster;
|
||||
use FireflyIII\Support\Models\ReturnsIntegerUserIdTrait;
|
||||
use Illuminate\Database\Eloquent\Casts\Attribute;
|
||||
@@ -11,6 +12,10 @@ use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\Relations\MorphTo;
|
||||
|
||||
/**
|
||||
* @property Carbon $start
|
||||
* @property Carbon $end
|
||||
*/
|
||||
class PeriodStatistic extends Model
|
||||
{
|
||||
use ReturnsIntegerUserIdTrait;
|
||||
|
||||
@@ -23,6 +23,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace FireflyIII\Models;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use FireflyIII\Handlers\Observer\PiggyBankObserver;
|
||||
use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
|
||||
use Illuminate\Database\Eloquent\Attributes\ObservedBy;
|
||||
@@ -36,6 +37,10 @@ use Illuminate\Database\Eloquent\Relations\MorphToMany;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||
|
||||
/**
|
||||
* @property null|Carbon $target_date
|
||||
* @property null|Carbon $start_date
|
||||
*/
|
||||
#[ObservedBy([PiggyBankObserver::class])]
|
||||
class PiggyBank extends Model
|
||||
{
|
||||
|
||||
@@ -23,6 +23,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace FireflyIII\Models;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use FireflyIII\Casts\SeparateTimezoneCaster;
|
||||
use FireflyIII\Handlers\Observer\PiggyBankEventObserver;
|
||||
use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
|
||||
@@ -31,6 +32,9 @@ use Illuminate\Database\Eloquent\Casts\Attribute;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
|
||||
/**
|
||||
* @property Carbon $date
|
||||
*/
|
||||
#[ObservedBy([PiggyBankEventObserver::class])]
|
||||
class PiggyBankEvent extends Model
|
||||
{
|
||||
|
||||
@@ -30,6 +30,9 @@ use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||
|
||||
/**
|
||||
* @property mixed $data
|
||||
*/
|
||||
class Preference extends Model
|
||||
{
|
||||
use ReturnsIntegerIdTrait;
|
||||
|
||||
@@ -40,8 +40,9 @@ use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||
|
||||
/**
|
||||
* @property Carbon $first_date
|
||||
* @property null|Carbon $first_date
|
||||
* @property null|Carbon $latest_date
|
||||
* @property null|Carbon $repeat_until
|
||||
*/
|
||||
#[ObservedBy([DeletedRecurrenceObserver::class])]
|
||||
class Recurrence extends Model
|
||||
|
||||
@@ -23,6 +23,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace FireflyIII\Models;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use FireflyIII\Casts\SeparateTimezoneCaster;
|
||||
use FireflyIII\Handlers\Observer\DeletedTagObserver;
|
||||
use FireflyIII\Support\Models\ReturnsIntegerIdTrait;
|
||||
@@ -36,6 +37,9 @@ use Illuminate\Database\Eloquent\Relations\MorphMany;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||
|
||||
/**
|
||||
* @property null|Carbon $date
|
||||
*/
|
||||
#[ObservedBy([DeletedTagObserver::class])]
|
||||
class Tag extends Model
|
||||
{
|
||||
|
||||
@@ -47,7 +47,8 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||
* @method EloquentBuilder|static after()
|
||||
* @method static EloquentBuilder|static query()
|
||||
*
|
||||
* @property TransactionGroup $transactionGroup
|
||||
* @property null|TransactionGroup $transactionGroup
|
||||
* @property Carbon $date
|
||||
*/
|
||||
#[ObservedBy([DeletedTransactionJournalObserver::class])]
|
||||
class TransactionJournal extends Model
|
||||
|
||||
@@ -46,7 +46,7 @@ class OwnerNotifiable
|
||||
if (method_exists($this, $method)) {
|
||||
Log::debug(sprintf('Redirect for settings to "%s".', $method));
|
||||
|
||||
return $this->{$method}($notification); // @phpstan-ignore-line
|
||||
return $this->{$method}($notification);
|
||||
}
|
||||
Log::debug(sprintf('No method "%s" found, return generic settings.', $method));
|
||||
|
||||
|
||||
@@ -63,7 +63,7 @@ class AccountServiceProvider extends ServiceProvider
|
||||
$repository = app(AccountRepository::class);
|
||||
|
||||
// phpstan thinks auth does not exist.
|
||||
if ($app->auth->check()) { // @phpstan-ignore-line
|
||||
if ($app->auth->check()) {
|
||||
$repository->setUser(auth()->user());
|
||||
}
|
||||
|
||||
@@ -75,7 +75,7 @@ class AccountServiceProvider extends ServiceProvider
|
||||
$repository = app(OperationsRepository::class);
|
||||
|
||||
// phpstan thinks auth does not exist.
|
||||
if ($app->auth->check()) { // @phpstan-ignore-line
|
||||
if ($app->auth->check()) {
|
||||
$repository->setUser(auth()->user());
|
||||
}
|
||||
|
||||
@@ -93,7 +93,7 @@ class AccountServiceProvider extends ServiceProvider
|
||||
$tasker = app(AccountTasker::class);
|
||||
|
||||
// phpstan thinks auth does not exist.
|
||||
if ($app->auth->check()) { // @phpstan-ignore-line
|
||||
if ($app->auth->check()) {
|
||||
$tasker->setUser(auth()->user());
|
||||
}
|
||||
|
||||
|
||||
@@ -57,7 +57,7 @@ class AdminServiceProvider extends ServiceProvider
|
||||
/** @var LinkTypeRepository $repository */
|
||||
$repository = app(LinkTypeRepository::class);
|
||||
// reference to auth is not understood by phpstan.
|
||||
if ($app->auth->check()) { // @phpstan-ignore-line
|
||||
if ($app->auth->check()) {
|
||||
$repository->setUser(auth()->user());
|
||||
}
|
||||
|
||||
|
||||
@@ -49,7 +49,7 @@ class AttachmentServiceProvider extends ServiceProvider
|
||||
/** @var AttachmentRepositoryInterface $repository */
|
||||
$repository = app(AttachmentRepository::class);
|
||||
// reference to auth is not understood by phpstan.
|
||||
if ($app->auth->check()) { // @phpstan-ignore-line
|
||||
if ($app->auth->check()) {
|
||||
$repository->setUser(auth()->user());
|
||||
}
|
||||
|
||||
|
||||
@@ -50,7 +50,7 @@ class BillServiceProvider extends ServiceProvider
|
||||
$repository = app(BillRepository::class);
|
||||
|
||||
// reference to auth is not understood by phpstan.
|
||||
if ($app->auth->check()) { // @phpstan-ignore-line
|
||||
if ($app->auth->check()) {
|
||||
$repository->setUser(auth()->user());
|
||||
}
|
||||
|
||||
|
||||
@@ -59,7 +59,7 @@ class BudgetServiceProvider extends ServiceProvider
|
||||
$this->app->bind(static function (Application $app): BudgetRepositoryInterface {
|
||||
/** @var BudgetRepositoryInterface $repository */
|
||||
$repository = app(BudgetRepository::class);
|
||||
if ($app->auth->check()) { // @phpstan-ignore-line
|
||||
if ($app->auth->check()) {
|
||||
$repository->setUser(auth()->user());
|
||||
}
|
||||
|
||||
@@ -70,7 +70,7 @@ class BudgetServiceProvider extends ServiceProvider
|
||||
$this->app->bind(static function (Application $app): AvailableBudgetRepositoryInterface {
|
||||
/** @var AvailableBudgetRepositoryInterface $repository */
|
||||
$repository = app(AvailableBudgetRepository::class);
|
||||
if ($app->auth->check()) { // @phpstan-ignore-line
|
||||
if ($app->auth->check()) {
|
||||
$repository->setUser(auth()->user());
|
||||
}
|
||||
|
||||
@@ -81,7 +81,7 @@ class BudgetServiceProvider extends ServiceProvider
|
||||
$this->app->bind(static function (Application $app): BudgetLimitRepositoryInterface {
|
||||
/** @var BudgetLimitRepositoryInterface $repository */
|
||||
$repository = app(BudgetLimitRepository::class);
|
||||
if ($app->auth->check()) { // @phpstan-ignore-line
|
||||
if ($app->auth->check()) {
|
||||
$repository->setUser(auth()->user());
|
||||
}
|
||||
|
||||
@@ -92,7 +92,7 @@ class BudgetServiceProvider extends ServiceProvider
|
||||
$this->app->bind(static function (Application $app): NoBudgetRepositoryInterface {
|
||||
/** @var NoBudgetRepositoryInterface $repository */
|
||||
$repository = app(NoBudgetRepository::class);
|
||||
if ($app->auth->check()) { // @phpstan-ignore-line
|
||||
if ($app->auth->check()) {
|
||||
$repository->setUser(auth()->user());
|
||||
}
|
||||
|
||||
@@ -103,7 +103,7 @@ class BudgetServiceProvider extends ServiceProvider
|
||||
$this->app->bind(static function (Application $app): OperationsRepositoryInterface {
|
||||
/** @var OperationsRepositoryInterface $repository */
|
||||
$repository = app(OperationsRepository::class);
|
||||
if ($app->auth->check()) { // @phpstan-ignore-line
|
||||
if ($app->auth->check()) {
|
||||
$repository->setUser(auth()->user());
|
||||
}
|
||||
|
||||
|
||||
@@ -53,7 +53,7 @@ class CategoryServiceProvider extends ServiceProvider
|
||||
$this->app->bind(static function (Application $app): CategoryRepositoryInterface {
|
||||
/** @var CategoryRepository $repository */
|
||||
$repository = app(CategoryRepository::class);
|
||||
if ($app->auth->check()) { // @phpstan-ignore-line
|
||||
if ($app->auth->check()) {
|
||||
$repository->setUser(auth()->user());
|
||||
}
|
||||
|
||||
@@ -63,7 +63,7 @@ class CategoryServiceProvider extends ServiceProvider
|
||||
$this->app->bind(static function (Application $app): OperationsRepositoryInterface {
|
||||
/** @var OperationsRepository $repository */
|
||||
$repository = app(OperationsRepository::class);
|
||||
if ($app->auth->check()) { // @phpstan-ignore-line
|
||||
if ($app->auth->check()) {
|
||||
$repository->setUser(auth()->user());
|
||||
}
|
||||
|
||||
@@ -73,7 +73,7 @@ class CategoryServiceProvider extends ServiceProvider
|
||||
$this->app->bind(static function (Application $app): NoCategoryRepositoryInterface {
|
||||
/** @var NoCategoryRepository $repository */
|
||||
$repository = app(NoCategoryRepository::class);
|
||||
if ($app->auth->check()) { // @phpstan-ignore-line
|
||||
if ($app->auth->check()) {
|
||||
$repository->setUser(auth()->user());
|
||||
}
|
||||
|
||||
|
||||
@@ -52,7 +52,7 @@ class CurrencyServiceProvider extends ServiceProvider
|
||||
/** @var CurrencyRepository $repository */
|
||||
$repository = app(GroupCurrencyRepository::class);
|
||||
// phpstan does not get the reference to auth
|
||||
if ($app->auth->check()) { // @phpstan-ignore-line
|
||||
if ($app->auth->check()) {
|
||||
$repository->setUser(auth()->user());
|
||||
}
|
||||
|
||||
@@ -62,7 +62,7 @@ class CurrencyServiceProvider extends ServiceProvider
|
||||
/** @var GroupCurrencyRepository $repository */
|
||||
$repository = app(GroupCurrencyRepository::class);
|
||||
// phpstan does not get the reference to auth
|
||||
if ($app->auth->check()) { // @phpstan-ignore-line
|
||||
if ($app->auth->check()) {
|
||||
$repository->setUser(auth()->user());
|
||||
}
|
||||
|
||||
@@ -73,7 +73,7 @@ class CurrencyServiceProvider extends ServiceProvider
|
||||
/** @var ExchangeRateRepository $repository */
|
||||
$repository = app(ExchangeRateRepository::class);
|
||||
// phpstan does not get the reference to auth
|
||||
if ($app->auth->check()) { // @phpstan-ignore-line
|
||||
if ($app->auth->check()) {
|
||||
$repository->setUserGroup(auth()->user()->userGroup);
|
||||
}
|
||||
|
||||
|
||||
@@ -132,7 +132,7 @@ class FireflyServiceProvider extends ServiceProvider
|
||||
$this->app->bind(static function (Application $app): ObjectGroupRepositoryInterface {
|
||||
/** @var ObjectGroupRepository $repository */
|
||||
$repository = app(ObjectGroupRepository::class);
|
||||
if ($app->auth->check()) { // @phpstan-ignore-line (phpstan does not understand the reference to auth)
|
||||
if ($app->auth->check()) {
|
||||
$repository->setUser(auth()->user());
|
||||
}
|
||||
|
||||
@@ -142,7 +142,7 @@ class FireflyServiceProvider extends ServiceProvider
|
||||
$this->app->bind(static function (Application $app): PeriodStatisticRepositoryInterface {
|
||||
/** @var PeriodStatisticRepository $repository */
|
||||
$repository = app(PeriodStatisticRepository::class);
|
||||
if ($app->auth->check()) { // @phpstan-ignore-line (phpstan does not understand the reference to auth)
|
||||
if ($app->auth->check()) {
|
||||
$repository->setUser(auth()->user());
|
||||
}
|
||||
|
||||
@@ -152,7 +152,7 @@ class FireflyServiceProvider extends ServiceProvider
|
||||
$this->app->bind(static function (Application $app): WebhookRepositoryInterface {
|
||||
/** @var WebhookRepository $repository */
|
||||
$repository = app(WebhookRepository::class);
|
||||
if ($app->auth->check()) { // @phpstan-ignore-line (phpstan does not understand the reference to auth)
|
||||
if ($app->auth->check()) {
|
||||
$repository->setUser(auth()->user());
|
||||
}
|
||||
|
||||
@@ -170,7 +170,7 @@ class FireflyServiceProvider extends ServiceProvider
|
||||
$this->app->bind(static function (Application $app): RuleEngineInterface {
|
||||
/** @var SearchRuleEngine $engine */
|
||||
$engine = app(SearchRuleEngine::class);
|
||||
if ($app->auth->check()) { // @phpstan-ignore-line (phpstan does not understand the reference to auth)
|
||||
if ($app->auth->check()) {
|
||||
$engine->setUser(auth()->user());
|
||||
}
|
||||
|
||||
@@ -180,7 +180,7 @@ class FireflyServiceProvider extends ServiceProvider
|
||||
$this->app->bind(static function (Application $app): UserGroupRepositoryInterface {
|
||||
/** @var UserGroupRepository $repository */
|
||||
$repository = app(UserGroupRepository::class);
|
||||
if ($app->auth->check()) { // @phpstan-ignore-line (phpstan does not understand the reference to auth)
|
||||
if ($app->auth->check()) {
|
||||
$repository->setUser(auth()->user());
|
||||
}
|
||||
|
||||
|
||||
@@ -63,7 +63,7 @@ class JournalServiceProvider extends ServiceProvider
|
||||
$this->app->bind(static function (Application $app): GroupCollectorInterface {
|
||||
/** @var GroupCollectorInterface $collector */
|
||||
$collector = app(GroupCollector::class);
|
||||
if ($app->auth->check()) { // @phpstan-ignore-line (phpstan does not understand the reference to auth)
|
||||
if ($app->auth->check()) {
|
||||
$collector->setUser(auth()->user());
|
||||
}
|
||||
|
||||
@@ -79,7 +79,7 @@ class JournalServiceProvider extends ServiceProvider
|
||||
$this->app->bind(static function (Application $app): TransactionGroupRepositoryInterface {
|
||||
/** @var TransactionGroupRepositoryInterface $repository */
|
||||
$repository = app(TransactionGroupRepository::class);
|
||||
if ($app->auth->check()) { // @phpstan-ignore-line (phpstan does not understand the reference to auth)
|
||||
if ($app->auth->check()) {
|
||||
$repository->setUser(auth()->user());
|
||||
}
|
||||
|
||||
@@ -95,7 +95,7 @@ class JournalServiceProvider extends ServiceProvider
|
||||
$this->app->bind(static function (Application $app): JournalRepositoryInterface {
|
||||
/** @var JournalRepositoryInterface $repository */
|
||||
$repository = app(JournalRepository::class);
|
||||
if ($app->auth->check()) { // @phpstan-ignore-line (phpstan does not understand the reference to auth)
|
||||
if ($app->auth->check()) {
|
||||
$repository->setUser(auth()->user());
|
||||
}
|
||||
|
||||
@@ -106,7 +106,7 @@ class JournalServiceProvider extends ServiceProvider
|
||||
$this->app->bind(static function (Application $app): JournalAPIRepositoryInterface {
|
||||
/** @var JournalAPIRepositoryInterface $repository */
|
||||
$repository = app(JournalAPIRepository::class);
|
||||
if ($app->auth->check()) { // @phpstan-ignore-line (phpstan does not understand the reference to auth)
|
||||
if ($app->auth->check()) {
|
||||
$repository->setUser(auth()->user());
|
||||
}
|
||||
|
||||
@@ -117,7 +117,7 @@ class JournalServiceProvider extends ServiceProvider
|
||||
$this->app->bind(static function (Application $app): JournalCLIRepositoryInterface {
|
||||
/** @var JournalCLIRepositoryInterface $repository */
|
||||
$repository = app(JournalCLIRepository::class);
|
||||
if ($app->auth->check()) { // @phpstan-ignore-line (phpstan does not understand the reference to auth)
|
||||
if ($app->auth->check()) {
|
||||
$repository->setUser(auth()->user());
|
||||
}
|
||||
|
||||
|
||||
@@ -48,7 +48,7 @@ class PiggyBankServiceProvider extends ServiceProvider
|
||||
$this->app->bind(static function (Application $app): PiggyBankRepositoryInterface {
|
||||
/** @var PiggyBankRepository $repository */
|
||||
$repository = app(PiggyBankRepository::class);
|
||||
if ($app->auth->check()) { // @phpstan-ignore-line (phpstan does not understand the reference to auth)
|
||||
if ($app->auth->check()) {
|
||||
$repository->setUser(auth()->user());
|
||||
}
|
||||
|
||||
|
||||
@@ -49,7 +49,7 @@ class RecurringServiceProvider extends ServiceProvider
|
||||
/** @var RecurringRepositoryInterface $repository */
|
||||
$repository = app(RecurringRepository::class);
|
||||
|
||||
if ($app->auth->check()) { // @phpstan-ignore-line (phpstan does not understand the reference to auth)
|
||||
if ($app->auth->check()) {
|
||||
$repository->setUser(auth()->user());
|
||||
}
|
||||
|
||||
|
||||
@@ -48,7 +48,7 @@ class RuleGroupServiceProvider extends ServiceProvider
|
||||
$this->app->bind(static function (Application $app): RuleGroupRepositoryInterface {
|
||||
/** @var RuleGroupRepository $repository */
|
||||
$repository = app(RuleGroupRepository::class);
|
||||
if ($app->auth->check()) { // @phpstan-ignore-line (phpstan does not understand the reference to auth)
|
||||
if ($app->auth->check()) {
|
||||
$repository->setUser(auth()->user());
|
||||
}
|
||||
|
||||
|
||||
@@ -48,7 +48,7 @@ class RuleServiceProvider extends ServiceProvider
|
||||
$this->app->bind(static function (Application $app): RuleRepositoryInterface {
|
||||
/** @var RuleRepository $repository */
|
||||
$repository = app(RuleRepository::class);
|
||||
if ($app->auth->check()) { // @phpstan-ignore-line (phpstan does not understand the reference to auth)
|
||||
if ($app->auth->check()) {
|
||||
$repository->setUser(auth()->user());
|
||||
}
|
||||
|
||||
|
||||
@@ -52,7 +52,7 @@ class SearchServiceProvider extends ServiceProvider
|
||||
$this->app->bind(static function (Application $app): SearchInterface {
|
||||
/** @var OperatorQuerySearch $search */
|
||||
$search = app(OperatorQuerySearch::class);
|
||||
if ($app->auth->check()) { // @phpstan-ignore-line (phpstan does not understand the reference to auth)
|
||||
if ($app->auth->check()) {
|
||||
$search->setUser(auth()->user());
|
||||
}
|
||||
|
||||
|
||||
@@ -51,7 +51,7 @@ class TagServiceProvider extends ServiceProvider
|
||||
/** @var TagRepository $repository */
|
||||
$repository = app(TagRepository::class);
|
||||
|
||||
if ($app->auth->check()) { // @phpstan-ignore-line (phpstan does not understand the reference to auth)
|
||||
if ($app->auth->check()) {
|
||||
$repository->setUser(auth()->user());
|
||||
}
|
||||
|
||||
@@ -62,7 +62,7 @@ class TagServiceProvider extends ServiceProvider
|
||||
/** @var OperationsRepository $repository */
|
||||
$repository = app(OperationsRepository::class);
|
||||
|
||||
if ($app->auth->check()) { // @phpstan-ignore-line (phpstan does not understand the reference to auth)
|
||||
if ($app->auth->check()) {
|
||||
$repository->setUser(auth()->user());
|
||||
}
|
||||
|
||||
|
||||
@@ -271,7 +271,7 @@ class AccountRepository implements AccountRepositoryInterface, UserGroupInterfac
|
||||
{
|
||||
$query = $this->user
|
||||
->accounts()
|
||||
->with([ // @phpstan-ignore-line
|
||||
->with([
|
||||
'accountmeta' => static function (HasMany $query): void {
|
||||
$query->where('name', 'account_role');
|
||||
},
|
||||
@@ -296,7 +296,7 @@ class AccountRepository implements AccountRepositoryInterface, UserGroupInterfac
|
||||
/** @var Storage $disk */
|
||||
$disk = Storage::disk('upload');
|
||||
|
||||
return $set->each(static function (Attachment $attachment) use ($disk): Attachment { // @phpstan-ignore-line
|
||||
return $set->each(static function (Attachment $attachment) use ($disk): Attachment {
|
||||
$notes = $attachment->notes()->first();
|
||||
$attachment->file_exists = $disk->exists($attachment->fileName());
|
||||
$attachment->notes_text = null !== $notes ? $notes->text : '';
|
||||
@@ -335,7 +335,7 @@ class AccountRepository implements AccountRepositoryInterface, UserGroupInterfac
|
||||
{
|
||||
$query = $this->user
|
||||
->accounts()
|
||||
->with(['accountmeta' => static function (HasMany $query): void { // @phpstan-ignore-line
|
||||
->with(['accountmeta' => static function (HasMany $query): void {
|
||||
$query->where('name', 'account_role');
|
||||
}])
|
||||
;
|
||||
@@ -687,6 +687,31 @@ class AccountRepository implements AccountRepositoryInterface, UserGroupInterfac
|
||||
return $dbQuery->take($limit)->get(['accounts.*']);
|
||||
}
|
||||
|
||||
public function searchAccountIncludingInactive(string $query, array $types, int $limit): Collection
|
||||
{
|
||||
$dbQuery = $this->user
|
||||
->accounts()
|
||||
->orderBy('accounts.order', 'ASC')
|
||||
->orderBy('accounts.account_type_id', 'ASC')
|
||||
->orderBy('accounts.name', 'ASC')
|
||||
->with(['accountType'])
|
||||
;
|
||||
if ('' !== $query) {
|
||||
// split query on spaces just in case:
|
||||
$parts = explode(' ', $query);
|
||||
foreach ($parts as $part) {
|
||||
$search = sprintf('%%%s%%', $part);
|
||||
$dbQuery->whereLike('name', $search);
|
||||
}
|
||||
}
|
||||
if (0 !== count($types)) {
|
||||
$dbQuery->leftJoin('account_types', 'accounts.account_type_id', '=', 'account_types.id');
|
||||
$dbQuery->whereIn('account_types.type', $types);
|
||||
}
|
||||
|
||||
return $dbQuery->take($limit)->get(['accounts.*']);
|
||||
}
|
||||
|
||||
public function searchAccountNr(string $query, array $types, int $limit): Collection
|
||||
{
|
||||
$dbQuery = $this->user
|
||||
|
||||
@@ -156,6 +156,8 @@ interface AccountRepositoryInterface
|
||||
|
||||
public function searchAccount(string $query, array $types, int $limit): Collection;
|
||||
|
||||
public function searchAccountIncludingInactive(string $query, array $types, int $limit): Collection;
|
||||
|
||||
public function searchAccountNr(string $query, array $types, int $limit): Collection;
|
||||
|
||||
public function store(array $data): Account;
|
||||
|
||||
@@ -394,7 +394,7 @@ class OperationsRepository implements OperationsRepositoryInterface, UserGroupIn
|
||||
];
|
||||
|
||||
$array[$currencyId]['transaction_journals'][$journalId] = [
|
||||
'amount' => Steam::{$direction}((string) $journal['amount']), // @phpstan-ignore-line
|
||||
'amount' => Steam::{$direction}((string) $journal['amount']),
|
||||
'date' => $journal['date'],
|
||||
'transaction_journal_id' => $journalId,
|
||||
'budget_name' => $journal['budget_name'],
|
||||
|
||||
@@ -187,7 +187,7 @@ class BillRepository implements BillRepositoryInterface, UserGroupInterface
|
||||
->bills()
|
||||
->where('active', true)
|
||||
->orderBy('bills.name', 'ASC')
|
||||
->get(['bills.*', DB::raw('((bills.amount_min + bills.amount_max) / 2) AS expectedAmount')]) // @phpstan-ignore-line
|
||||
->get(['bills.*', DB::raw('((bills.amount_min + bills.amount_max) / 2) AS expectedAmount')])
|
||||
;
|
||||
}
|
||||
|
||||
@@ -199,7 +199,7 @@ class BillRepository implements BillRepositoryInterface, UserGroupInterface
|
||||
$set = $bill->attachments()->get();
|
||||
$disk = Storage::disk('upload');
|
||||
|
||||
return $set->each(static function (Attachment $attachment) use ($disk): Attachment { // @phpstan-ignore-line
|
||||
return $set->each(static function (Attachment $attachment) use ($disk): Attachment {
|
||||
$notes = $attachment->notes()->first();
|
||||
$attachment->file_exists = $disk->exists($attachment->fileName());
|
||||
$attachment->notes_text = null !== $notes ? $notes->text : '';
|
||||
|
||||
@@ -389,17 +389,13 @@ class AvailableBudgetRepository implements AvailableBudgetRepositoryInterface, U
|
||||
return (string) $budgetLimit->amount;
|
||||
}
|
||||
// if budget limit period is inside AB period, it can be added in full.
|
||||
if (!$limitPeriod->equals($availableBudgetPeriod) && $availableBudgetPeriod->contains($limitPeriod)) {
|
||||
if ($availableBudgetPeriod->contains($limitPeriod)) {
|
||||
Log::debug('This budget limit is smaller than the available budget period.');
|
||||
|
||||
return (string) $budgetLimit->amount;
|
||||
}
|
||||
|
||||
if (
|
||||
!$limitPeriod->equals($availableBudgetPeriod)
|
||||
&& !$availableBudgetPeriod->contains($limitPeriod)
|
||||
&& $availableBudgetPeriod->overlapsWith($limitPeriod)
|
||||
) {
|
||||
if ($availableBudgetPeriod->overlapsWith($limitPeriod)) {
|
||||
Log::debug('This budget limit is something else entirely!');
|
||||
$overlap = $availableBudgetPeriod->overlap($limitPeriod);
|
||||
if ($overlap instanceof Period) {
|
||||
|
||||
@@ -126,6 +126,7 @@ class BudgetLimitRepository implements BudgetLimitRepositoryInterface, UserGroup
|
||||
$user = $budgetLimit->budget->user;
|
||||
$start = $budgetLimit->start_date->clone();
|
||||
$end = $budgetLimit->end_date->clone();
|
||||
Log::debug(sprintf('Send event for DestroyedBudgetLimit (limit #%d, budget #%d)', $budgetLimit->id, $budgetLimit->budget_id));
|
||||
event(new DestroyedBudgetLimit($user, $budgetLimit->budget, $start, $end, true));
|
||||
$budgetLimit->delete();
|
||||
event(new WebhookMessagesRequestSending());
|
||||
@@ -399,6 +400,7 @@ class BudgetLimitRepository implements BudgetLimitRepositoryInterface, UserGroup
|
||||
if (array_key_exists('notes', $data)) {
|
||||
$this->setNoteText($budgetLimit, (string) $data['notes']);
|
||||
}
|
||||
Log::debug(sprintf('Updated budget limit with ID #%d', $budgetLimit->id));
|
||||
$generateMessages = $data['fire_webhooks'] ?? true;
|
||||
event(new UpdatedBudgetLimit($budgetLimit, $generateMessages));
|
||||
event(new WebhookMessagesRequestSending());
|
||||
|
||||
@@ -345,7 +345,7 @@ class BudgetRepository implements BudgetRepositoryInterface, UserGroupInterface
|
||||
|
||||
$disk = Storage::disk('upload');
|
||||
|
||||
return $set->each(static function (Attachment $attachment) use ($disk): Attachment { // @phpstan-ignore-line
|
||||
return $set->each(static function (Attachment $attachment) use ($disk): Attachment {
|
||||
$notes = $attachment->notes()->first();
|
||||
$attachment->file_exists = $disk->exists($attachment->fileName());
|
||||
$attachment->notes_text = null !== $notes ? $notes->text : '';
|
||||
|
||||
@@ -170,7 +170,7 @@ class CategoryRepository implements CategoryRepositoryInterface, UserGroupInterf
|
||||
|
||||
$disk = Storage::disk('upload');
|
||||
|
||||
return $set->each(static function (Attachment $attachment) use ($disk): Attachment { // @phpstan-ignore-line
|
||||
return $set->each(static function (Attachment $attachment) use ($disk): Attachment {
|
||||
$notes = $attachment->notes()->first();
|
||||
$attachment->file_exists = $disk->exists($attachment->fileName());
|
||||
$attachment->notes_text = null !== $notes ? $notes->text : '';
|
||||
|
||||
@@ -298,7 +298,7 @@ class CurrencyRepository implements CurrencyRepositoryInterface, UserGroupInterf
|
||||
->withPivot(['group_default'])
|
||||
->get()
|
||||
;
|
||||
$all->map(static function (TransactionCurrency $current): TransactionCurrency { // @phpstan-ignore-line
|
||||
$all->map(static function (TransactionCurrency $current): TransactionCurrency {
|
||||
$current->userGroupEnabled = true;
|
||||
$current->userGroupNative = 1 === (int) $current->pivot->group_default;
|
||||
|
||||
|
||||
@@ -86,7 +86,7 @@ class JournalAPIRepository implements JournalAPIRepositoryInterface, UserGroupIn
|
||||
public function getPiggyBankEvents(TransactionJournal $journal): Collection
|
||||
{
|
||||
$events = $journal->piggyBankEvents()->get();
|
||||
$events->each(static function (PiggyBankEvent $event): void { // @phpstan-ignore-line
|
||||
$events->each(static function (PiggyBankEvent $event): void {
|
||||
$event->piggyBank = PiggyBank::withTrashed()->find($event->piggy_bank_id);
|
||||
});
|
||||
|
||||
|
||||
@@ -120,7 +120,7 @@ class PiggyBankRepository implements PiggyBankRepositoryInterface, UserGroupInte
|
||||
|
||||
$disk = Storage::disk('upload');
|
||||
|
||||
return $set->each(static function (Attachment $attachment) use ($disk): Attachment { // @phpstan-ignore-line
|
||||
return $set->each(static function (Attachment $attachment) use ($disk): Attachment {
|
||||
$notes = $attachment->notes()->first();
|
||||
$attachment->file_exists = $disk->exists($attachment->fileName());
|
||||
$attachment->notes_text = null !== $notes ? $notes->text : '';
|
||||
@@ -143,7 +143,13 @@ class PiggyBankRepository implements PiggyBankRepositoryInterface, UserGroupInte
|
||||
$amount = '' === $amount ? '0' : $amount;
|
||||
$sum = bcadd($sum, $amount);
|
||||
}
|
||||
Log::debug(sprintf('Current amount in piggy bank #%d ("%s") is %s', $piggyBank->id, $piggyBank->name, $sum));
|
||||
Log::debug(sprintf(
|
||||
'Current amount (at %s) in piggy bank #%d ("%s") is %s',
|
||||
now(config('app.timezone'))->toW3cString(),
|
||||
$piggyBank->id,
|
||||
$piggyBank->name,
|
||||
$sum
|
||||
));
|
||||
|
||||
return $sum;
|
||||
}
|
||||
@@ -233,11 +239,11 @@ class PiggyBankRepository implements PiggyBankRepositoryInterface, UserGroupInte
|
||||
$amount = null;
|
||||
if ((int) $source->transaction_currency_id === $currency->id) {
|
||||
Log::debug('Use normal amount');
|
||||
$amount = Steam::{$operator}($source->amount); // @phpstan-ignore-line
|
||||
$amount = Steam::{$operator}($source->amount);
|
||||
}
|
||||
if ((int) $source->foreign_currency_id === $currency->id) {
|
||||
Log::debug('Use foreign amount');
|
||||
$amount = Steam::{$operator}($source->foreign_amount); // @phpstan-ignore-line
|
||||
$amount = Steam::{$operator}($source->foreign_amount);
|
||||
}
|
||||
if (null === $amount) {
|
||||
Log::debug('No match on currency, so amount remains null, return "0".');
|
||||
|
||||
@@ -177,7 +177,7 @@ class RuleGroupRepository implements RuleGroupRepositoryInterface, UserGroupInte
|
||||
$groups = $this->user
|
||||
->ruleGroups()
|
||||
->orderBy('order', 'ASC')
|
||||
->with([ // @phpstan-ignore-line
|
||||
->with([
|
||||
'rules' => static function (HasMany $query): void {
|
||||
$query->orderBy('order', 'ASC');
|
||||
|
||||
@@ -197,7 +197,7 @@ class RuleGroupRepository implements RuleGroupRepositoryInterface, UserGroupInte
|
||||
}
|
||||
// Log::debug(sprintf('Will filter getRuleGroupsWithRules on "%s".', $filter));
|
||||
|
||||
return $groups->map(static function (RuleGroup $group) use ($filter): RuleGroup { // @phpstan-ignore-line
|
||||
return $groups->map(static function (RuleGroup $group) use ($filter): RuleGroup {
|
||||
// Log::debug(sprintf('Now filtering group #%d', $group->id));
|
||||
// filter the rules in the rule group:
|
||||
$group->rules = $group->rules->filter(static function (Rule $rule) use ($filter): bool {
|
||||
@@ -231,7 +231,7 @@ class RuleGroupRepository implements RuleGroupRepositoryInterface, UserGroupInte
|
||||
->ruleGroups()
|
||||
->orderBy('order', 'ASC')
|
||||
->where('active', true)
|
||||
->with([ // @phpstan-ignore-line
|
||||
->with([
|
||||
'rules' => static function (HasMany $query): void {
|
||||
$query->orderBy('order', 'ASC');
|
||||
$query->where('rules.active', true);
|
||||
@@ -250,7 +250,7 @@ class RuleGroupRepository implements RuleGroupRepositoryInterface, UserGroupInte
|
||||
}
|
||||
Log::debug(sprintf('Will filter getRuleGroupsWithRules on "%s".', $filter));
|
||||
|
||||
return $groups->map(static function (RuleGroup $group) use ($filter): RuleGroup { // @phpstan-ignore-line
|
||||
return $groups->map(static function (RuleGroup $group) use ($filter): RuleGroup {
|
||||
// Log::debug(sprintf('Now filtering group #%d', $group->id));
|
||||
// filter the rules in the rule group:
|
||||
$group->rules = $group->rules->filter(static function (Rule $rule) use ($filter): bool {
|
||||
|
||||
@@ -101,8 +101,12 @@ class OperationsRepository implements OperationsRepositoryInterface, UserGroupIn
|
||||
'currency_code' => (string) $journal['currency_code'],
|
||||
'currency_decimal_places' => (int) $journal['currency_decimal_places'],
|
||||
'foreign_currency_id' => (int) ($journal['foreign_currency_id'] ?? 0),
|
||||
'foreign_amount' => isset($journal['foreign_amount']) ? Steam::negative((string) $journal['foreign_amount']) : null,
|
||||
'pc_amount' => isset($journal['pc_amount']) ? Steam::negative((string) $journal['pc_amount']) : null,
|
||||
'foreign_amount' => array_key_exists('foreign_amount', $journal) && null !== $journal['foreign_amount']
|
||||
? Steam::negative((string) $journal['foreign_amount'])
|
||||
: null,
|
||||
'pc_amount' => array_key_exists('pc_amount', $journal) && null !== $journal['pc_amount']
|
||||
? Steam::negative((string) $journal['pc_amount'])
|
||||
: null,
|
||||
'date' => $journal['date'],
|
||||
'source_account_id' => $journal['source_account_id'],
|
||||
'budget_name' => $journal['budget_name'],
|
||||
@@ -186,8 +190,12 @@ class OperationsRepository implements OperationsRepositoryInterface, UserGroupIn
|
||||
'currency_code' => (string) $journal['currency_code'],
|
||||
'currency_decimal_places' => (int) $journal['currency_decimal_places'],
|
||||
'foreign_currency_id' => (int) ($journal['foreign_currency_id'] ?? 0),
|
||||
'foreign_amount' => isset($journal['foreign_amount']) ? Steam::positive((string) $journal['foreign_amount']) : null,
|
||||
'pc_amount' => isset($journal['pc_amount']) ? Steam::positive((string) $journal['pc_amount']) : null,
|
||||
'foreign_amount' => array_key_exists('foreign_amount', $journal) && null !== $journal['foreign_amount']
|
||||
? Steam::positive((string) $journal['foreign_amount'])
|
||||
: null,
|
||||
'pc_amount' => array_key_exists('pc_amount', $journal) && null !== $journal['pc_amount']
|
||||
? Steam::positive((string) $journal['pc_amount'])
|
||||
: null,
|
||||
'date' => $journal['date'],
|
||||
'source_account_id' => $journal['source_account_id'],
|
||||
'budget_name' => $journal['budget_name'],
|
||||
|
||||
@@ -126,7 +126,7 @@ class TagRepository implements TagRepositoryInterface, UserGroupInterface
|
||||
$set = $tag->attachments()->get();
|
||||
$disk = Storage::disk('upload');
|
||||
|
||||
return $set->each(static function (Attachment $attachment) use ($disk): void { // @phpstan-ignore-line
|
||||
return $set->each(static function (Attachment $attachment) use ($disk): void {
|
||||
/** @var null|Note $note */
|
||||
$note = $attachment->notes()->first();
|
||||
// only used in v1 view of tags
|
||||
|
||||
@@ -101,7 +101,7 @@ class UserGroupRepository implements UserGroupRepositoryInterface, UserGroupInte
|
||||
'webhooks',
|
||||
];
|
||||
foreach ($objects as $object) {
|
||||
foreach ($userGroup->{$object}()->get() as $item) { // @phpstan-ignore-line
|
||||
foreach ($userGroup->{$object}()->get() as $item) {
|
||||
$item->delete();
|
||||
}
|
||||
}
|
||||
@@ -253,14 +253,7 @@ class UserGroupRepository implements UserGroupRepositoryInterface, UserGroupInte
|
||||
// group has multiple members. How many are owner, except the user we're editing now?
|
||||
$ownerCount = $userGroup->groupMemberships()->where('user_role_id', $owner->id)->where('user_id', '!=', $user->id)->count();
|
||||
// if there are no other owners and the current users does not get or keep the owner role, refuse.
|
||||
if (
|
||||
0 === $ownerCount
|
||||
&& (
|
||||
0 === count($data['roles'])
|
||||
|| count($data['roles']) > 0 // @phpstan-ignore-line
|
||||
&& !in_array(UserRoleEnum::OWNER->value, $data['roles'], true)
|
||||
)
|
||||
) {
|
||||
if (0 === $ownerCount && (0 === count($data['roles']) || !in_array(UserRoleEnum::OWNER->value, $data['roles'], true))) {
|
||||
Log::debug('User needs to keep owner role in this group, refuse to act');
|
||||
|
||||
throw new FireflyException('The last owner in this user group must keep the "owner" role.');
|
||||
|
||||
@@ -90,7 +90,7 @@ class WebhookRepository implements WebhookRepositoryInterface, UserGroupInterfac
|
||||
->where('webhook_messages.sent', 0)
|
||||
->where('webhook_messages.errored', 0)
|
||||
->get(['webhook_messages.*'])
|
||||
->filter(static fn (WebhookMessage $message): bool => $message->webhookAttempts()->count() <= 2) // @phpstan-ignore-line
|
||||
->filter(static fn (WebhookMessage $message): bool => $message->webhookAttempts()->count() <= 2)
|
||||
->splice(0, 3)
|
||||
;
|
||||
}
|
||||
|
||||
@@ -41,9 +41,6 @@ class IsValidAccountTypeList implements ValidationRule
|
||||
if (is_string($value)) {
|
||||
$values = explode(',', $value);
|
||||
}
|
||||
if (!is_array($values)) {
|
||||
$fail('validation.invalid_account_list')->translate();
|
||||
}
|
||||
$keys = array_keys($this->types);
|
||||
foreach ($values as $entry) {
|
||||
if (!in_array($entry, $keys, true)) {
|
||||
|
||||
@@ -82,7 +82,7 @@ class BelongsUser implements ValidationRule
|
||||
}
|
||||
$count = 0;
|
||||
foreach ($objects as $object) {
|
||||
$objectValue = trim((string) $object->{$field}); // @phpstan-ignore-line
|
||||
$objectValue = trim((string) $object->{$field});
|
||||
Log::debug(sprintf('Comparing object "%s" with value "%s"', $objectValue, $value));
|
||||
if ($objectValue === $value) {
|
||||
++$count;
|
||||
|
||||
@@ -95,7 +95,7 @@ class BelongsUserGroup implements ValidationRule
|
||||
}
|
||||
$count = 0;
|
||||
foreach ($objects as $object) {
|
||||
$objectValue = trim((string) $object->{$field}); // @phpstan-ignore-line
|
||||
$objectValue = trim((string) $object->{$field});
|
||||
Log::debug(sprintf('Comparing object "%s" with value "%s"', $objectValue, $value));
|
||||
if ($objectValue === $value) {
|
||||
++$count;
|
||||
|
||||
@@ -51,7 +51,7 @@ class IsDateOrTime implements ValidationRule
|
||||
// probably a date format.
|
||||
try {
|
||||
Carbon::createFromFormat('Y-m-d', $value);
|
||||
} catch (InvalidDateException $e) { // @phpstan-ignore-line
|
||||
} catch (InvalidDateException $e) {
|
||||
Log::error(sprintf('"%s" is not a valid date: %s', $value, $e->getMessage()));
|
||||
|
||||
$fail('validation.date_or_time')->translate();
|
||||
@@ -71,7 +71,7 @@ class IsDateOrTime implements ValidationRule
|
||||
// is an atom string, I hope?
|
||||
try {
|
||||
Carbon::parse($value);
|
||||
} catch (InvalidDateException $e) { // @phpstan-ignore-line
|
||||
} catch (InvalidDateException $e) {
|
||||
Log::error(sprintf('"%s" is not a valid date or time: %s', $value, $e->getMessage()));
|
||||
|
||||
$fail('validation.date_or_time')->translate();
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user