mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-11 23:28:54 +00:00
🤖 Auto commit for release 'develop' on 2025-08-03
This commit is contained in:
@@ -93,7 +93,7 @@ class ShowController extends Controller
|
||||
|
||||
// make paginator:
|
||||
$paginator = new LengthAwarePaginator($availableBudgets, $count, $pageSize, $this->parameters->get('page'));
|
||||
$paginator->setPath(route('api.v1.available-budgets.index') . $this->buildParams());
|
||||
$paginator->setPath(route('api.v1.available-budgets.index').$this->buildParams());
|
||||
|
||||
/** @var AvailableBudgetTransformer $transformer */
|
||||
$transformer = app(AvailableBudgetTransformer::class);
|
||||
|
@@ -25,7 +25,6 @@ declare(strict_types=1);
|
||||
namespace FireflyIII\Api\V1\Requests\Models\PiggyBank;
|
||||
|
||||
use Illuminate\Contracts\Validation\Validator;
|
||||
use FireflyIII\Exceptions\FireflyException;
|
||||
use FireflyIII\Models\TransactionCurrency;
|
||||
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
|
||||
use FireflyIII\Rules\IsValidZeroOrMoreAmount;
|
||||
@@ -97,7 +96,7 @@ class StoreRequest extends FormRequest
|
||||
// validate start before end only if both are there.
|
||||
$data = $validator->getData();
|
||||
$currency = $this->getCurrencyFromData($validator, $data);
|
||||
if(null === $currency) {
|
||||
if (null === $currency) {
|
||||
return;
|
||||
}
|
||||
$targetAmount = (string) ($data['target_amount'] ?? '0');
|
||||
@@ -148,6 +147,7 @@ class StoreRequest extends FormRequest
|
||||
}
|
||||
}
|
||||
$validator->errors()->add('transaction_currency_id', trans('validation.require_currency_id_code'));
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
@@ -32,7 +32,6 @@ use FireflyIII\Models\TransactionGroup;
|
||||
use FireflyIII\Models\TransactionJournal;
|
||||
use FireflyIII\Models\Webhook;
|
||||
use FireflyIII\Models\WebhookMessage;
|
||||
use FireflyIII\Support\Facades\Amount;
|
||||
use FireflyIII\Support\JsonApi\Enrichments\AccountEnrichment;
|
||||
use FireflyIII\Transformers\AccountTransformer;
|
||||
use FireflyIII\Transformers\TransactionGroupTransformer;
|
||||
|
@@ -151,6 +151,7 @@ class ShowController extends Controller
|
||||
$enrichment->setUser($admin);
|
||||
$enrichment->setStart($start);
|
||||
$enrichment->setEnd($end);
|
||||
|
||||
/** @var Bill $bill */
|
||||
$bill = $enrichment->enrichSingle($bill);
|
||||
|
||||
|
@@ -32,7 +32,7 @@ use FireflyIII\Support\Report\Summarizer\TransactionSummarizer;
|
||||
use FireflyIII\Support\Repositories\UserGroup\UserGroupInterface;
|
||||
use FireflyIII\Support\Repositories\UserGroup\UserGroupTrait;
|
||||
use Illuminate\Support\Collection;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Override;
|
||||
|
||||
/**
|
||||
* Class NoBudgetRepository
|
||||
@@ -100,7 +100,8 @@ class NoBudgetRepository implements NoBudgetRepositoryInterface, UserGroupInterf
|
||||
return $summarizer->groupByCurrencyId($journals);
|
||||
}
|
||||
|
||||
#[\Override] public function collectExpenses(Carbon $start, Carbon $end, ?Collection $accounts = null, ?TransactionCurrency $currency = null): array
|
||||
#[Override]
|
||||
public function collectExpenses(Carbon $start, Carbon $end, ?Collection $accounts = null, ?TransactionCurrency $currency = null): array
|
||||
{
|
||||
/** @var GroupCollectorInterface $collector */
|
||||
$collector = app(GroupCollectorInterface::class);
|
||||
@@ -114,7 +115,7 @@ class NoBudgetRepository implements NoBudgetRepositoryInterface, UserGroupInterf
|
||||
}
|
||||
$collector->withoutBudget();
|
||||
$collector->withBudgetInformation();
|
||||
|
||||
return $collector->getExtractedJournals();
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -39,6 +39,7 @@ use FireflyIII\Support\Repositories\UserGroup\UserGroupInterface;
|
||||
use FireflyIII\Support\Repositories\UserGroup\UserGroupTrait;
|
||||
use Illuminate\Support\Collection;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Override;
|
||||
|
||||
/**
|
||||
* Class OperationsRepository
|
||||
@@ -231,8 +232,7 @@ class OperationsRepository implements OperationsRepositoryInterface, UserGroupIn
|
||||
?Collection $budgets = null,
|
||||
?TransactionCurrency $currency = null,
|
||||
bool $convertToPrimary = false
|
||||
): array
|
||||
{
|
||||
): array {
|
||||
Log::debug(sprintf('Start of %s(date, date, array, array, "%s", %s).', __METHOD__, $currency?->code, var_export($convertToPrimary, true)));
|
||||
// this collector excludes all transfers TO liabilities (which are also withdrawals)
|
||||
// because those expenses only become expenses once they move from the liability to the friend.
|
||||
@@ -255,7 +255,8 @@ class OperationsRepository implements OperationsRepositoryInterface, UserGroupIn
|
||||
$collector->setUser($this->user)
|
||||
->setRange($start, $end)
|
||||
// ->excludeDestinationAccounts($selection)
|
||||
->setTypes([TransactionTypeEnum::WITHDRAWAL->value]);
|
||||
->setTypes([TransactionTypeEnum::WITHDRAWAL->value])
|
||||
;
|
||||
|
||||
if ($accounts instanceof Collection) {
|
||||
$collector->setAccounts($accounts);
|
||||
@@ -297,7 +298,8 @@ class OperationsRepository implements OperationsRepositoryInterface, UserGroupIn
|
||||
return $summarizer->groupByCurrencyId($expenses, 'negative', false);
|
||||
}
|
||||
|
||||
#[\Override] public function collectExpenses(Carbon $start, Carbon $end, ?Collection $accounts = null, ?Collection $budgets = null, ?TransactionCurrency $currency = null): array
|
||||
#[Override]
|
||||
public function collectExpenses(Carbon $start, Carbon $end, ?Collection $accounts = null, ?Collection $budgets = null, ?TransactionCurrency $currency = null): array
|
||||
{
|
||||
Log::debug(sprintf('Start of %s(date, date, array, array, "%s").', __METHOD__, $currency?->code));
|
||||
// this collector excludes all transfers TO liabilities (which are also withdrawals)
|
||||
@@ -321,7 +323,8 @@ class OperationsRepository implements OperationsRepositoryInterface, UserGroupIn
|
||||
$collector->setUser($this->user)
|
||||
->setRange($start, $end)
|
||||
// ->excludeDestinationAccounts($selection)
|
||||
->setTypes([TransactionTypeEnum::WITHDRAWAL->value]);
|
||||
->setTypes([TransactionTypeEnum::WITHDRAWAL->value])
|
||||
;
|
||||
|
||||
if ($accounts instanceof Collection) {
|
||||
$collector->setAccounts($accounts);
|
||||
@@ -336,6 +339,7 @@ class OperationsRepository implements OperationsRepositoryInterface, UserGroupIn
|
||||
if ($budgets->count() > 0) {
|
||||
$collector->setBudgets($budgets);
|
||||
}
|
||||
|
||||
return $collector->getExtractedJournals();
|
||||
}
|
||||
}
|
||||
|
@@ -86,7 +86,7 @@ class AccountEnrichment implements EnrichmentInterface
|
||||
}
|
||||
|
||||
#[Override]
|
||||
public function enrichSingle(array | Model $model): Account | array
|
||||
public function enrichSingle(array|Model $model): Account|array
|
||||
{
|
||||
Log::debug(__METHOD__);
|
||||
$collection = new Collection([$model]);
|
||||
@@ -143,7 +143,8 @@ class AccountEnrichment implements EnrichmentInterface
|
||||
{
|
||||
$set = AccountMeta::whereIn('name', ['is_multi_currency', 'include_net_worth', 'currency_id', 'account_role', 'account_number', 'BIC', 'liability_direction', 'interest', 'interest_period', 'current_debt'])
|
||||
->whereIn('account_id', $this->accountIds)
|
||||
->get(['account_meta.id', 'account_meta.account_id', 'account_meta.name', 'account_meta.data'])->toArray();
|
||||
->get(['account_meta.id', 'account_meta.account_id', 'account_meta.name', 'account_meta.data'])->toArray()
|
||||
;
|
||||
|
||||
/** @var array $entry */
|
||||
foreach ($set as $entry) {
|
||||
@@ -169,7 +170,8 @@ class AccountEnrichment implements EnrichmentInterface
|
||||
$notes = Note::query()->whereIn('noteable_id', $this->accountIds)
|
||||
->whereNotNull('notes.text')
|
||||
->where('notes.text', '!=', '')
|
||||
->where('noteable_type', Account::class)->get(['notes.noteable_id', 'notes.text'])->toArray();
|
||||
->where('noteable_type', Account::class)->get(['notes.noteable_id', 'notes.text'])->toArray()
|
||||
;
|
||||
foreach ($notes as $note) {
|
||||
$this->notes[(int) $note['noteable_id']] = (string) $note['text'];
|
||||
}
|
||||
@@ -179,7 +181,8 @@ class AccountEnrichment implements EnrichmentInterface
|
||||
private function collectLocations(): void
|
||||
{
|
||||
$locations = Location::query()->whereIn('locatable_id', $this->accountIds)
|
||||
->where('locatable_type', Account::class)->get(['locations.locatable_id', 'locations.latitude', 'locations.longitude', 'locations.zoom_level'])->toArray();
|
||||
->where('locatable_type', Account::class)->get(['locations.locatable_id', 'locations.latitude', 'locations.longitude', 'locations.zoom_level'])->toArray()
|
||||
;
|
||||
foreach ($locations as $location) {
|
||||
$this->locations[(int) $location['locatable_id']]
|
||||
= [
|
||||
@@ -201,7 +204,8 @@ class AccountEnrichment implements EnrichmentInterface
|
||||
->setUserGroup($this->userGroup)
|
||||
->setAccounts($this->collection)
|
||||
->withAccountInformation()
|
||||
->setTypes([TransactionTypeEnum::OPENING_BALANCE->value]);
|
||||
->setTypes([TransactionTypeEnum::OPENING_BALANCE->value])
|
||||
;
|
||||
$journals = $collector->getExtractedJournals();
|
||||
foreach ($journals as $journal) {
|
||||
$this->openingBalances[(int) $journal['source_account_id']]
|
||||
@@ -354,8 +358,7 @@ class AccountEnrichment implements EnrichmentInterface
|
||||
if (null === $this->date) {
|
||||
return today();
|
||||
}
|
||||
|
||||
return $this->date;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* AvailableBudgetEnrichment.php
|
||||
* Copyright (c) 2025 james@firefly-iii.org.
|
||||
@@ -35,6 +36,7 @@ use FireflyIII\User;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Support\Collection;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Override;
|
||||
|
||||
class AvailableBudgetEnrichment implements EnrichmentInterface
|
||||
{
|
||||
@@ -65,7 +67,8 @@ class AvailableBudgetEnrichment implements EnrichmentInterface
|
||||
$this->repository = app(BudgetRepositoryInterface::class);
|
||||
}
|
||||
|
||||
#[\Override] public function enrich(Collection $collection): Collection
|
||||
#[Override]
|
||||
public function enrich(Collection $collection): Collection
|
||||
{
|
||||
$this->collection = $collection;
|
||||
$this->collectIds();
|
||||
@@ -75,7 +78,8 @@ class AvailableBudgetEnrichment implements EnrichmentInterface
|
||||
return $this->collection;
|
||||
}
|
||||
|
||||
#[\Override] public function enrichSingle(Model | array $model): array | Model
|
||||
#[Override]
|
||||
public function enrichSingle(array|Model $model): array|Model
|
||||
{
|
||||
Log::debug(__METHOD__);
|
||||
$collection = new Collection([$model]);
|
||||
@@ -84,13 +88,15 @@ class AvailableBudgetEnrichment implements EnrichmentInterface
|
||||
return $collection->first();
|
||||
}
|
||||
|
||||
#[\Override] public function setUser(User $user): void
|
||||
#[Override]
|
||||
public function setUser(User $user): void
|
||||
{
|
||||
$this->user = $user;
|
||||
$this->setUserGroup($user->userGroup);
|
||||
}
|
||||
|
||||
#[\Override] public function setUserGroup(UserGroup $userGroup): void
|
||||
#[Override]
|
||||
public function setUserGroup(UserGroup $userGroup): void
|
||||
{
|
||||
$this->userGroup = $userGroup;
|
||||
$this->noBudgetRepository->setUserGroup($userGroup);
|
||||
@@ -153,9 +159,8 @@ class AvailableBudgetEnrichment implements EnrichmentInterface
|
||||
'pc_spent_outside_budgets' => $pcSpentOutsideBudgets[$id] ?? [],
|
||||
];
|
||||
$item->meta = $meta;
|
||||
|
||||
return $item;
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@@ -117,7 +117,7 @@ class SubscriptionEnrichment implements EnrichmentInterface
|
||||
return $collection;
|
||||
}
|
||||
|
||||
public function enrichSingle(array | Model $model): array | Model
|
||||
public function enrichSingle(array|Model $model): array|Model
|
||||
{
|
||||
Log::debug(__METHOD__);
|
||||
$collection = new Collection([$model]);
|
||||
@@ -131,7 +131,8 @@ class SubscriptionEnrichment implements EnrichmentInterface
|
||||
$notes = Note::query()->whereIn('noteable_id', $this->subscriptionIds)
|
||||
->whereNotNull('notes.text')
|
||||
->where('notes.text', '!=', '')
|
||||
->where('noteable_type', Bill::class)->get(['notes.noteable_id', 'notes.text'])->toArray();
|
||||
->where('noteable_type', Bill::class)->get(['notes.noteable_id', 'notes.text'])->toArray()
|
||||
;
|
||||
foreach ($notes as $note) {
|
||||
$this->notes[(int) $note['noteable_id']] = (string) $note['text'];
|
||||
}
|
||||
@@ -163,7 +164,8 @@ class SubscriptionEnrichment implements EnrichmentInterface
|
||||
$set = DB::table('object_groupables')
|
||||
->whereIn('object_groupable_id', $this->subscriptionIds)
|
||||
->where('object_groupable_type', Bill::class)
|
||||
->get(['object_groupable_id', 'object_group_id']);
|
||||
->get(['object_groupable_id', 'object_group_id'])
|
||||
;
|
||||
|
||||
$ids = array_unique($set->pluck('object_group_id')->toArray());
|
||||
|
||||
@@ -231,7 +233,8 @@ class SubscriptionEnrichment implements EnrichmentInterface
|
||||
'transactions.amount',
|
||||
'transactions.foreign_amount',
|
||||
]
|
||||
);
|
||||
)
|
||||
;
|
||||
Log::debug(sprintf('Count %d entries in set', $set->count()));
|
||||
|
||||
// for each bill, do a loop.
|
||||
|
@@ -58,7 +58,7 @@ class AvailableBudgetTransformer extends AbstractTransformer
|
||||
$pcAmount = app('steam')->bcround($availableBudget->native_amount, $this->primary->decimal_places);
|
||||
}
|
||||
|
||||
$data = [
|
||||
return [
|
||||
'id' => (string) $availableBudget->id,
|
||||
'created_at' => $availableBudget->created_at->toAtomString(),
|
||||
'updated_at' => $availableBudget->updated_at->toAtomString(),
|
||||
@@ -87,12 +87,9 @@ class AvailableBudgetTransformer extends AbstractTransformer
|
||||
'links' => [
|
||||
[
|
||||
'rel' => 'self',
|
||||
'uri' => '/available_budgets/' . $availableBudget->id,
|
||||
'uri' => '/available_budgets/'.$availableBudget->id,
|
||||
],
|
||||
],
|
||||
];
|
||||
return $data;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@@ -100,7 +100,7 @@ class BillTransformer extends AbstractTransformer
|
||||
'links' => [
|
||||
[
|
||||
'rel' => 'self',
|
||||
'uri' => '/bills/' . $bill->id,
|
||||
'uri' => '/bills/'.$bill->id,
|
||||
],
|
||||
],
|
||||
];
|
||||
|
@@ -94,7 +94,7 @@ class TransactionGroupTransformer extends AbstractTransformer
|
||||
'links' => [
|
||||
[
|
||||
'rel' => 'self',
|
||||
'uri' => '/transactions/' . $first['transaction_group_id'],
|
||||
'uri' => '/transactions/'.$first['transaction_group_id'],
|
||||
],
|
||||
],
|
||||
];
|
||||
@@ -283,7 +283,7 @@ class TransactionGroupTransformer extends AbstractTransformer
|
||||
'links' => [
|
||||
[
|
||||
'rel' => 'self',
|
||||
'uri' => '/transactions/' . $group->id,
|
||||
'uri' => '/transactions/'.$group->id,
|
||||
],
|
||||
],
|
||||
];
|
||||
|
10
composer.lock
generated
10
composer.lock
generated
@@ -3711,16 +3711,16 @@
|
||||
},
|
||||
{
|
||||
"name": "nesbot/carbon",
|
||||
"version": "3.10.1",
|
||||
"version": "3.10.2",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/CarbonPHP/carbon.git",
|
||||
"reference": "1fd1935b2d90aef2f093c5e35f7ae1257c448d00"
|
||||
"reference": "76b5c07b8a9d2025ed1610e14cef1f3fd6ad2c24"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/CarbonPHP/carbon/zipball/1fd1935b2d90aef2f093c5e35f7ae1257c448d00",
|
||||
"reference": "1fd1935b2d90aef2f093c5e35f7ae1257c448d00",
|
||||
"url": "https://api.github.com/repos/CarbonPHP/carbon/zipball/76b5c07b8a9d2025ed1610e14cef1f3fd6ad2c24",
|
||||
"reference": "76b5c07b8a9d2025ed1610e14cef1f3fd6ad2c24",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -3812,7 +3812,7 @@
|
||||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2025-06-21T15:19:35+00:00"
|
||||
"time": "2025-08-02T09:36:06+00:00"
|
||||
},
|
||||
{
|
||||
"name": "nette/schema",
|
||||
|
@@ -78,8 +78,8 @@ return [
|
||||
'running_balance_column' => env('USE_RUNNING_BALANCE', false),
|
||||
// see cer.php for exchange rates feature flag.
|
||||
],
|
||||
'version' => 'develop/2025-08-01',
|
||||
'build_time' => 1754070848,
|
||||
'version' => 'develop/2025-08-03',
|
||||
'build_time' => 1754232243,
|
||||
'api_version' => '2.1.0', // field is no longer used.
|
||||
'db_version' => 26,
|
||||
|
||||
|
0
public/v1/js/.gitkeep
Executable file → Normal file
0
public/v1/js/.gitkeep
Executable file → Normal file
@@ -110,7 +110,6 @@
|
||||
"/public/v1/js/lib/jquery.autocomplete.min.js": "/public/v1/js/lib/jquery.autocomplete.min.js",
|
||||
"/public/v1/js/lib/jquery.color-2.1.2.min.js": "/public/v1/js/lib/jquery.color-2.1.2.min.js",
|
||||
"/public/v1/js/lib/modernizr-custom.js": "/public/v1/js/lib/modernizr-custom.js",
|
||||
"/public/v1/js/lib/moment/af_ZA.js": "/public/v1/js/lib/moment/af_ZA.js",
|
||||
"/public/v1/js/lib/moment/bg_BG.js": "/public/v1/js/lib/moment/bg_BG.js",
|
||||
"/public/v1/js/lib/moment/ca_ES.js": "/public/v1/js/lib/moment/ca_ES.js",
|
||||
"/public/v1/js/lib/moment/cs_CZ.js": "/public/v1/js/lib/moment/cs_CZ.js",
|
||||
|
@@ -154,7 +154,7 @@
|
||||
"url": "URL",
|
||||
"active": "Aktywny",
|
||||
"interest_date": "Data odsetek",
|
||||
"administration_currency": "Primary currency",
|
||||
"administration_currency": "Waluta podstawowa",
|
||||
"title": "Tytu\u0142",
|
||||
"date": "Data",
|
||||
"book_date": "Data ksi\u0119gowania",
|
||||
@@ -174,7 +174,7 @@
|
||||
"list": {
|
||||
"title": "Tytu\u0142",
|
||||
"active": "Jest aktywny?",
|
||||
"primary_currency": "Primary currency",
|
||||
"primary_currency": "Waluta podstawowa",
|
||||
"trigger": "Wyzwalacz",
|
||||
"response": "Odpowied\u017a",
|
||||
"delivery": "Dor\u0119czenie",
|
||||
|
Reference in New Issue
Block a user