mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
Check submission sizes.
This commit is contained in:
parent
81a11ee5b4
commit
a49cf1fd3d
48
.ci/php-cs-fixer/composer.lock
generated
48
.ci/php-cs-fixer/composer.lock
generated
@ -536,16 +536,16 @@
|
||||
},
|
||||
{
|
||||
"name": "symfony/console",
|
||||
"version": "v7.0.1",
|
||||
"version": "v7.0.2",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/console.git",
|
||||
"reference": "cdce5c684b2f920bb1343deecdfba356ffad83d5"
|
||||
"reference": "f8587c4cdc5acad67af71c37db34ef03af91e59c"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/console/zipball/cdce5c684b2f920bb1343deecdfba356ffad83d5",
|
||||
"reference": "cdce5c684b2f920bb1343deecdfba356ffad83d5",
|
||||
"url": "https://api.github.com/repos/symfony/console/zipball/f8587c4cdc5acad67af71c37db34ef03af91e59c",
|
||||
"reference": "f8587c4cdc5acad67af71c37db34ef03af91e59c",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@ -609,7 +609,7 @@
|
||||
"terminal"
|
||||
],
|
||||
"support": {
|
||||
"source": "https://github.com/symfony/console/tree/v7.0.1"
|
||||
"source": "https://github.com/symfony/console/tree/v7.0.2"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
@ -625,7 +625,7 @@
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2023-12-01T15:10:06+00:00"
|
||||
"time": "2023-12-10T16:54:46+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/deprecation-contracts",
|
||||
@ -696,16 +696,16 @@
|
||||
},
|
||||
{
|
||||
"name": "symfony/event-dispatcher",
|
||||
"version": "v7.0.0",
|
||||
"version": "v7.0.2",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/event-dispatcher.git",
|
||||
"reference": "c459b40ffe67c49af6fd392aac374c9edf8a027e"
|
||||
"reference": "098b62ae81fdd6cbf941f355059f617db28f4f9a"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/c459b40ffe67c49af6fd392aac374c9edf8a027e",
|
||||
"reference": "c459b40ffe67c49af6fd392aac374c9edf8a027e",
|
||||
"url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/098b62ae81fdd6cbf941f355059f617db28f4f9a",
|
||||
"reference": "098b62ae81fdd6cbf941f355059f617db28f4f9a",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@ -756,7 +756,7 @@
|
||||
"description": "Provides tools that allow your application components to communicate with each other by dispatching events and listening to them",
|
||||
"homepage": "https://symfony.com",
|
||||
"support": {
|
||||
"source": "https://github.com/symfony/event-dispatcher/tree/v7.0.0"
|
||||
"source": "https://github.com/symfony/event-dispatcher/tree/v7.0.2"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
@ -772,7 +772,7 @@
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2023-07-27T16:29:09+00:00"
|
||||
"time": "2023-12-27T22:24:19+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/event-dispatcher-contracts",
|
||||
@ -1538,16 +1538,16 @@
|
||||
},
|
||||
{
|
||||
"name": "symfony/process",
|
||||
"version": "v7.0.0",
|
||||
"version": "v7.0.2",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/process.git",
|
||||
"reference": "13bdb1670c7f510494e04fcb2bfa29af63db9c0d"
|
||||
"reference": "acd3eb5cb02382c1cb0287ba29b2908cc6ffa83a"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/process/zipball/13bdb1670c7f510494e04fcb2bfa29af63db9c0d",
|
||||
"reference": "13bdb1670c7f510494e04fcb2bfa29af63db9c0d",
|
||||
"url": "https://api.github.com/repos/symfony/process/zipball/acd3eb5cb02382c1cb0287ba29b2908cc6ffa83a",
|
||||
"reference": "acd3eb5cb02382c1cb0287ba29b2908cc6ffa83a",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@ -1579,7 +1579,7 @@
|
||||
"description": "Executes commands in sub-processes",
|
||||
"homepage": "https://symfony.com",
|
||||
"support": {
|
||||
"source": "https://github.com/symfony/process/tree/v7.0.0"
|
||||
"source": "https://github.com/symfony/process/tree/v7.0.2"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
@ -1595,7 +1595,7 @@
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2023-11-20T16:43:42+00:00"
|
||||
"time": "2023-12-24T09:15:37+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/service-contracts",
|
||||
@ -1743,16 +1743,16 @@
|
||||
},
|
||||
{
|
||||
"name": "symfony/string",
|
||||
"version": "v7.0.0",
|
||||
"version": "v7.0.2",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/string.git",
|
||||
"reference": "92bd2bfbba476d4a1838e5e12168bef2fd1e6620"
|
||||
"reference": "cc78f14f91f5e53b42044d0620961c48028ff9f5"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/string/zipball/92bd2bfbba476d4a1838e5e12168bef2fd1e6620",
|
||||
"reference": "92bd2bfbba476d4a1838e5e12168bef2fd1e6620",
|
||||
"url": "https://api.github.com/repos/symfony/string/zipball/cc78f14f91f5e53b42044d0620961c48028ff9f5",
|
||||
"reference": "cc78f14f91f5e53b42044d0620961c48028ff9f5",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@ -1809,7 +1809,7 @@
|
||||
"utf8"
|
||||
],
|
||||
"support": {
|
||||
"source": "https://github.com/symfony/string/tree/v7.0.0"
|
||||
"source": "https://github.com/symfony/string/tree/v7.0.2"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
@ -1825,7 +1825,7 @@
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2023-11-29T08:40:23+00:00"
|
||||
"time": "2023-12-10T16:54:46+00:00"
|
||||
}
|
||||
],
|
||||
"packages-dev": [],
|
||||
|
@ -62,7 +62,7 @@ class ShowController extends Controller
|
||||
return response()
|
||||
->api($this->jsonApiObject('budgets', $budget, $transformer))
|
||||
->header('Content-Type', self::CONTENT_TYPE)
|
||||
;
|
||||
;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -115,6 +115,7 @@ class AccountFormRequest extends FormRequest
|
||||
'amount_currency_id_virtual_balance' => 'exists:transaction_currencies,id',
|
||||
'what' => 'in:'.$types,
|
||||
'interest_period' => 'in:daily,monthly,yearly',
|
||||
'notes' => 'between:1,65536|nullable',
|
||||
];
|
||||
$rules = Location::requestRules($rules);
|
||||
|
||||
|
@ -65,6 +65,7 @@ class BudgetFormStoreRequest extends FormRequest
|
||||
'auto_budget_currency_id' => 'exists:transaction_currencies,id',
|
||||
'auto_budget_amount' => 'min:0|max:1000000000|required_if:auto_budget_type,1|required_if:auto_budget_type,2',
|
||||
'auto_budget_period' => 'in:daily,weekly,monthly,quarterly,half_year,yearly',
|
||||
'notes' => 'between:1,65536|nullable',
|
||||
];
|
||||
}
|
||||
|
||||
|
@ -75,6 +75,7 @@ class BudgetFormUpdateRequest extends FormRequest
|
||||
'auto_budget_currency_id' => 'exists:transaction_currencies,id',
|
||||
'auto_budget_amount' => 'min:0|max:1000000000|required_if:auto_budget_type,1|required_if:auto_budget_type,2|numeric',
|
||||
'auto_budget_period' => 'in:daily,weekly,monthly,quarterly,half_year,yearly',
|
||||
'notes' => 'between:1,65536|nullable',
|
||||
];
|
||||
}
|
||||
|
||||
|
@ -63,7 +63,8 @@ class CategoryFormRequest extends FormRequest
|
||||
|
||||
// fixed
|
||||
return [
|
||||
'name' => $nameRule,
|
||||
'name' => $nameRule,
|
||||
'notes' => 'between:1,65536|nullable',
|
||||
];
|
||||
}
|
||||
}
|
||||
|
@ -44,7 +44,7 @@ class JournalLinkRequest extends FormRequest
|
||||
$return = [];
|
||||
$linkType = $this->get('link_type');
|
||||
$parts = explode('_', $linkType);
|
||||
$return['link_type_id'] = (int)$parts[0];
|
||||
$return['link_type_id'] = (int) $parts[0];
|
||||
$return['transaction_journal_id'] = $this->convertInteger('opposing');
|
||||
$return['notes'] = $this->convertString('notes');
|
||||
$return['direction'] = $parts[1];
|
||||
|
@ -64,7 +64,7 @@ class PiggyBankStoreRequest extends FormRequest
|
||||
'targetdate' => 'date|nullable',
|
||||
'order' => 'integer|min:1',
|
||||
'object_group' => 'min:0|max:255',
|
||||
'notes' => 'between:1,65536|nullable',
|
||||
'notes' => 'between:1,65536|nullable',
|
||||
];
|
||||
}
|
||||
}
|
||||
|
@ -68,7 +68,7 @@ class PiggyBankUpdateRequest extends FormRequest
|
||||
'targetdate' => 'date|nullable',
|
||||
'order' => 'integer|max:65536|min:1',
|
||||
'object_group' => 'min:0|max:255',
|
||||
'notes' => 'between:1,65536|nullable',
|
||||
'notes' => 'between:1,65536|nullable',
|
||||
];
|
||||
}
|
||||
}
|
||||
|
@ -161,7 +161,7 @@ class RecurrenceFormRequest extends FormRequest
|
||||
'first_date' => 'required|date|after:'.$today->format('Y-m-d'),
|
||||
'repetition_type' => ['required', new ValidRecurrenceRepetitionValue(), new ValidRecurrenceRepetitionType(), 'between:1,20'],
|
||||
'skip' => 'required|numeric|integer|gte:0|lte:31',
|
||||
|
||||
'notes' => 'between:1,65536|nullable',
|
||||
// optional for recurrence:
|
||||
'recurring_description' => 'between:0,65000',
|
||||
'active' => 'numeric|between:0,1',
|
||||
|
@ -53,7 +53,7 @@ class ReportFormRequest extends FormRequest
|
||||
$collection = new Collection();
|
||||
if (is_array($set)) {
|
||||
foreach ($set as $accountId) {
|
||||
$account = $repository->find((int)$accountId);
|
||||
$account = $repository->find((int) $accountId);
|
||||
if (null !== $account) {
|
||||
$collection->push($account);
|
||||
}
|
||||
@ -74,7 +74,7 @@ class ReportFormRequest extends FormRequest
|
||||
$collection = new Collection();
|
||||
if (is_array($set)) {
|
||||
foreach ($set as $budgetId) {
|
||||
$budget = $repository->find((int)$budgetId);
|
||||
$budget = $repository->find((int) $budgetId);
|
||||
if (null !== $budget) {
|
||||
$collection->push($budget);
|
||||
}
|
||||
@ -95,7 +95,7 @@ class ReportFormRequest extends FormRequest
|
||||
$collection = new Collection();
|
||||
if (is_array($set)) {
|
||||
foreach ($set as $categoryId) {
|
||||
$category = $repository->find((int)$categoryId);
|
||||
$category = $repository->find((int) $categoryId);
|
||||
if (null !== $category) {
|
||||
$collection->push($category);
|
||||
}
|
||||
@ -116,7 +116,7 @@ class ReportFormRequest extends FormRequest
|
||||
$collection = new Collection();
|
||||
if (is_array($set)) {
|
||||
foreach ($set as $accountId) {
|
||||
$account = $repository->find((int)$accountId);
|
||||
$account = $repository->find((int) $accountId);
|
||||
if (null !== $account) {
|
||||
$collection->push($account);
|
||||
}
|
||||
@ -135,13 +135,13 @@ class ReportFormRequest extends FormRequest
|
||||
{
|
||||
$date = today(config('app.timezone'));
|
||||
$range = $this->get('daterange');
|
||||
$parts = explode(' - ', (string)$range);
|
||||
$parts = explode(' - ', (string) $range);
|
||||
if (2 === count($parts)) {
|
||||
$string = $parts[1];
|
||||
// validate as date
|
||||
// if regex for YYYY-MM-DD:
|
||||
$pattern = '/^(19|20)\d\d-(0[1-9]|1[012])-(0[1-9]|[12][\d]|3[01])$/';
|
||||
$result = preg_match($pattern, $string);
|
||||
$result = preg_match($pattern, $string);
|
||||
if (false !== $result && 0 !== $result) {
|
||||
try {
|
||||
$date = new Carbon($parts[1]);
|
||||
@ -173,13 +173,13 @@ class ReportFormRequest extends FormRequest
|
||||
{
|
||||
$date = today(config('app.timezone'));
|
||||
$range = $this->get('daterange');
|
||||
$parts = explode(' - ', (string)$range);
|
||||
$parts = explode(' - ', (string) $range);
|
||||
if (2 === count($parts)) {
|
||||
$string = $parts[0];
|
||||
// validate as date
|
||||
// if regex for YYYY-MM-DD:
|
||||
$pattern = '/^(19|20)\d\d-(0[1-9]|1[012])-(0[1-9]|[12][\d]|3[01])$/';
|
||||
$result = preg_match($pattern, $string);
|
||||
$result = preg_match($pattern, $string);
|
||||
if (false !== $result && 0 !== $result) {
|
||||
try {
|
||||
$date = new Carbon($parts[0]);
|
||||
@ -227,7 +227,7 @@ class ReportFormRequest extends FormRequest
|
||||
|
||||
continue;
|
||||
}
|
||||
$tag = $repository->find((int)$tagTag);
|
||||
$tag = $repository->find((int) $tagTag);
|
||||
if (null !== $tag) {
|
||||
$collection->push($tag);
|
||||
}
|
||||
|
@ -130,8 +130,8 @@ class RuleFormRequest extends FormRequest
|
||||
$set = [
|
||||
'type' => $trigger['type'] ?? 'invalid',
|
||||
'value' => $trigger['value'] ?? '',
|
||||
'stop_processing' => 1 === (int)$stopProcessing,
|
||||
'prohibited' => 1 === (int)$prohibited,
|
||||
'stop_processing' => 1 === (int) $stopProcessing,
|
||||
'prohibited' => 1 === (int) $prohibited,
|
||||
];
|
||||
$set = self::replaceAmountTrigger($set);
|
||||
$return[] = $set;
|
||||
@ -151,7 +151,7 @@ class RuleFormRequest extends FormRequest
|
||||
$return[] = [
|
||||
'type' => $action['type'] ?? 'invalid',
|
||||
'value' => $action['value'] ?? '',
|
||||
'stop_processing' => 1 === (int)$stopProcessing,
|
||||
'stop_processing' => 1 === (int) $stopProcessing,
|
||||
];
|
||||
}
|
||||
}
|
||||
|
@ -60,7 +60,8 @@ class BudgetRepository implements BudgetRepositoryInterface
|
||||
$search->where('name', 'LIKE', sprintf('%%%s', $query));
|
||||
}
|
||||
$search->orderBy('order', 'ASC')
|
||||
->orderBy('name', 'ASC')->where('active', true);
|
||||
->orderBy('name', 'ASC')->where('active', true)
|
||||
;
|
||||
|
||||
return $search->take($limit)->get();
|
||||
}
|
||||
@ -72,7 +73,8 @@ class BudgetRepository implements BudgetRepositoryInterface
|
||||
$search->where('name', 'LIKE', sprintf('%s%%', $query));
|
||||
}
|
||||
$search->orderBy('order', 'ASC')
|
||||
->orderBy('name', 'ASC')->where('active', true);
|
||||
->orderBy('name', 'ASC')->where('active', true)
|
||||
;
|
||||
|
||||
return $search->take($limit)->get();
|
||||
}
|
||||
@ -151,7 +153,7 @@ class BudgetRepository implements BudgetRepositoryInterface
|
||||
return $return;
|
||||
}
|
||||
|
||||
public function setUser(null | Authenticatable | User $user): void
|
||||
public function setUser(null|Authenticatable|User $user): void
|
||||
{
|
||||
if ($user instanceof User) {
|
||||
$this->user = $user;
|
||||
@ -161,9 +163,10 @@ class BudgetRepository implements BudgetRepositoryInterface
|
||||
public function getActiveBudgets(): Collection
|
||||
{
|
||||
return $this->user->budgets()->where('active', true)
|
||||
->orderBy('order', 'ASC')
|
||||
->orderBy('name', 'ASC')
|
||||
->get();
|
||||
->orderBy('order', 'ASC')
|
||||
->orderBy('name', 'ASC')
|
||||
->get()
|
||||
;
|
||||
}
|
||||
|
||||
public function budgetedInPeriodForBudget(Budget $budget, Carbon $start, Carbon $end): array
|
||||
@ -331,7 +334,8 @@ class BudgetRepository implements BudgetRepositoryInterface
|
||||
public function getBudgets(): Collection
|
||||
{
|
||||
return $this->user->budgets()->orderBy('order', 'ASC')
|
||||
->orderBy('name', 'ASC')->get();
|
||||
->orderBy('name', 'ASC')->get()
|
||||
;
|
||||
}
|
||||
|
||||
public function destroyAutoBudget(Budget $budget): void
|
||||
@ -415,8 +419,9 @@ class BudgetRepository implements BudgetRepositoryInterface
|
||||
public function getInactiveBudgets(): Collection
|
||||
{
|
||||
return $this->user->budgets()
|
||||
->orderBy('order', 'ASC')
|
||||
->orderBy('name', 'ASC')->where('active', 0)->get();
|
||||
->orderBy('order', 'ASC')
|
||||
->orderBy('name', 'ASC')->where('active', 0)->get()
|
||||
;
|
||||
}
|
||||
|
||||
public function getNoteText(Budget $budget): ?string
|
||||
@ -436,7 +441,8 @@ class BudgetRepository implements BudgetRepositoryInterface
|
||||
$search->where('name', 'LIKE', sprintf('%%%s%%', $query));
|
||||
}
|
||||
$search->orderBy('order', 'ASC')
|
||||
->orderBy('name', 'ASC')->where('active', true);
|
||||
->orderBy('name', 'ASC')->where('active', true)
|
||||
;
|
||||
|
||||
return $search->take($limit)->get();
|
||||
}
|
||||
@ -470,10 +476,11 @@ class BudgetRepository implements BudgetRepositoryInterface
|
||||
/** @var GroupCollectorInterface $collector */
|
||||
$collector = app(GroupCollectorInterface::class);
|
||||
$collector->setUser($this->user)
|
||||
->setRange($start, $end)
|
||||
->excludeDestinationAccounts($selection)
|
||||
->setTypes([TransactionType::WITHDRAWAL])
|
||||
->setBudgets($this->getActiveBudgets());
|
||||
->setRange($start, $end)
|
||||
->excludeDestinationAccounts($selection)
|
||||
->setTypes([TransactionType::WITHDRAWAL])
|
||||
->setBudgets($this->getActiveBudgets())
|
||||
;
|
||||
|
||||
$journals = $collector->getExtractedJournals();
|
||||
$array = [];
|
||||
@ -531,10 +538,11 @@ class BudgetRepository implements BudgetRepositoryInterface
|
||||
/** @var GroupCollectorInterface $collector */
|
||||
$collector = app(GroupCollectorInterface::class);
|
||||
$collector->setUser($this->user)
|
||||
->setRange($start, $end)
|
||||
->excludeDestinationAccounts($selection)
|
||||
->setTypes([TransactionType::WITHDRAWAL])
|
||||
->setBudget($budget);
|
||||
->setRange($start, $end)
|
||||
->excludeDestinationAccounts($selection)
|
||||
->setTypes([TransactionType::WITHDRAWAL])
|
||||
->setBudget($budget)
|
||||
;
|
||||
|
||||
$journals = $collector->getExtractedJournals();
|
||||
$array = [];
|
||||
@ -705,10 +713,11 @@ class BudgetRepository implements BudgetRepositoryInterface
|
||||
{
|
||||
$types = ['set_budget'];
|
||||
$actions = RuleAction::leftJoin('rules', 'rules.id', '=', 'rule_actions.rule_id')
|
||||
->where('rules.user_id', $this->user->id)
|
||||
->whereIn('rule_actions.action_type', $types)
|
||||
->where('rule_actions.action_value', $oldName)
|
||||
->get(['rule_actions.*']);
|
||||
->where('rules.user_id', $this->user->id)
|
||||
->whereIn('rule_actions.action_type', $types)
|
||||
->where('rule_actions.action_value', $oldName)
|
||||
->get(['rule_actions.*'])
|
||||
;
|
||||
app('log')->debug(sprintf('Found %d actions to update.', $actions->count()));
|
||||
|
||||
/** @var RuleAction $action */
|
||||
@ -723,10 +732,11 @@ class BudgetRepository implements BudgetRepositoryInterface
|
||||
{
|
||||
$types = ['budget_is'];
|
||||
$triggers = RuleTrigger::leftJoin('rules', 'rules.id', '=', 'rule_triggers.rule_id')
|
||||
->where('rules.user_id', $this->user->id)
|
||||
->whereIn('rule_triggers.trigger_type', $types)
|
||||
->where('rule_triggers.trigger_value', $oldName)
|
||||
->get(['rule_triggers.*']);
|
||||
->where('rules.user_id', $this->user->id)
|
||||
->whereIn('rule_triggers.trigger_type', $types)
|
||||
->where('rule_triggers.trigger_value', $oldName)
|
||||
->get(['rule_triggers.*'])
|
||||
;
|
||||
app('log')->debug(sprintf('Found %d triggers to update.', $triggers->count()));
|
||||
|
||||
/** @var RuleTrigger $trigger */
|
||||
|
Loading…
Reference in New Issue
Block a user