mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-08-29 17:25:20 +00:00
Compare commits
23 Commits
develop-20
...
v6.3.1
Author | SHA1 | Date | |
---|---|---|---|
|
39b61c71e8 | ||
|
fa2c964790 | ||
|
134aeb3a46 | ||
|
6f6e1a4ff4 | ||
|
b743bf3d9e | ||
|
84ee6f16c9 | ||
|
9fe39e42b3 | ||
|
4013c7e316 | ||
|
0b76747531 | ||
|
3129756b37 | ||
|
b0df383004 | ||
|
9c5b1df86c | ||
|
5854e24775 | ||
|
3f873422f2 | ||
|
f898990773 | ||
|
a5759ab1c6 | ||
|
9bd6417e02 | ||
|
cd12a10214 | ||
|
ee8cb62e04 | ||
|
11d2f8d471 | ||
|
0a48c0c20f | ||
|
8bc764d6ef | ||
|
4b4f568558 |
2
.github/workflows/depsreview.yml
vendored
2
.github/workflows/depsreview.yml
vendored
@@ -9,7 +9,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: 'Checkout repository'
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@v5
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: 'Dependency review'
|
||||
|
16
.github/workflows/release.yml
vendored
16
.github/workflows/release.yml
vendored
@@ -50,7 +50,7 @@ jobs:
|
||||
git pull
|
||||
echo "Current branch is $(git branch --show-current)"
|
||||
env:
|
||||
version: ${{ github.event_name == 'schedule' && 'develop' || github.event.inputs.version }}
|
||||
version: ${{ github.event_name == 'schedule' && 'develop' || inputs.version }}
|
||||
- name: Configure Git
|
||||
run: |
|
||||
# do some configuration
|
||||
@@ -118,7 +118,7 @@ jobs:
|
||||
env:
|
||||
FIREFLY_III_ROOT: /github/workspace
|
||||
GH_TOKEN: ""
|
||||
FF_III_VERSION: ${{ github.event_name == 'schedule' && 'develop' || github.event.inputs.version }}
|
||||
FF_III_VERSION: ${{ github.event_name == 'schedule' && 'develop' || inputs.version }}
|
||||
- name: Generate JSON v1
|
||||
id: json-v1
|
||||
uses: JC5/firefly-iii-dev@main
|
||||
@@ -221,7 +221,7 @@ jobs:
|
||||
echo "tarName=$tarName" >> "$GITHUB_ENV"
|
||||
echo "BRANCH_NAME=$BRANCH_NAME" >> "$GITHUB_ENV"
|
||||
env:
|
||||
version: ${{ github.event_name == 'schedule' && 'develop' || github.event.inputs.version }}
|
||||
version: ${{ github.event_name == 'schedule' && 'develop' || inputs.version }}
|
||||
- name: Commit all changes
|
||||
run: |
|
||||
# add all content, except output.txt (this contains the changelog and/or the download instructions)
|
||||
@@ -232,12 +232,12 @@ jobs:
|
||||
git commit -m "🤖 Auto commit for release '$version' on $(date +'%Y-%m-%d')" || true
|
||||
git push
|
||||
env:
|
||||
version: ${{ github.event_name == 'schedule' && 'develop' || github.event.inputs.version }}
|
||||
version: ${{ github.event_name == 'schedule' && 'develop' || inputs.version }}
|
||||
- name: Generate release description
|
||||
id: release-description
|
||||
uses: JC5/firefly-iii-dev@main
|
||||
with:
|
||||
action: "ff3:generate-release-notes firefly-iii ${{ github.event.inputs.version }}"
|
||||
action: "ff3:generate-release-notes firefly-iii ${{ inputs.version || 'develop' }}"
|
||||
output: 'output'
|
||||
env:
|
||||
FIREFLY_III_ROOT: /github/workspace
|
||||
@@ -291,7 +291,7 @@ jobs:
|
||||
echo "DONE!"
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
version: ${{ github.event_name == 'schedule' && 'develop' || github.event.inputs.version }}
|
||||
version: ${{ github.event_name == 'schedule' && 'develop' || inputs.version }}
|
||||
- name: Create archives
|
||||
run: |
|
||||
echo "Create zip file $zipName"
|
||||
@@ -375,7 +375,7 @@ jobs:
|
||||
fi
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
version: ${{ github.event_name == 'schedule' && 'develop' || github.event.inputs.version }}
|
||||
version: ${{ github.event_name == 'schedule' && 'develop' || inputs.version }}
|
||||
- name: Upload artifacts
|
||||
run: |
|
||||
# add zip file to release.
|
||||
@@ -411,4 +411,4 @@ jobs:
|
||||
rm -f $tarName.sha256
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
version: ${{ github.event_name == 'schedule' && 'develop' || github.event.inputs.version }}
|
||||
version: ${{ github.event_name == 'schedule' && 'develop' || inputs.version }}
|
||||
|
@@ -96,7 +96,6 @@ class ShowController extends Controller
|
||||
$paginator = new LengthAwarePaginator($budgetLimits, $count, $pageSize, $this->parameters->get('page'));
|
||||
$paginator->setPath(route('api.v1.budgets.limits.index', [$budget->id]).$this->buildParams());
|
||||
|
||||
|
||||
// enrich
|
||||
$enrichment = new BudgetLimitEnrichment();
|
||||
$enrichment->setUser($admin);
|
||||
|
@@ -1,39 +0,0 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* Created.php
|
||||
* Copyright (c) 2023 james@firefly-iii.org
|
||||
*
|
||||
* This file is part of Firefly III (https://github.com/firefly-iii).
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace FireflyIII\Events\Model\BudgetLimit;
|
||||
|
||||
use FireflyIII\Events\Event;
|
||||
use FireflyIII\Models\BudgetLimit;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
|
||||
/**
|
||||
* Class Created
|
||||
*/
|
||||
class Created extends Event
|
||||
{
|
||||
use SerializesModels;
|
||||
|
||||
public function __construct(public BudgetLimit $budgetLimit) {}
|
||||
}
|
@@ -1,39 +0,0 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* Deleted.php
|
||||
* Copyright (c) 2023 james@firefly-iii.org
|
||||
*
|
||||
* This file is part of Firefly III (https://github.com/firefly-iii).
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace FireflyIII\Events\Model\BudgetLimit;
|
||||
|
||||
use FireflyIII\Events\Event;
|
||||
use FireflyIII\Models\BudgetLimit;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
|
||||
/**
|
||||
* Class Deleted
|
||||
*/
|
||||
class Deleted extends Event
|
||||
{
|
||||
use SerializesModels;
|
||||
|
||||
public function __construct(public BudgetLimit $budgetLimit) {}
|
||||
}
|
@@ -1,39 +0,0 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* Updated.php
|
||||
* Copyright (c) 2023 james@firefly-iii.org
|
||||
*
|
||||
* This file is part of Firefly III (https://github.com/firefly-iii).
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace FireflyIII\Events\Model\BudgetLimit;
|
||||
|
||||
use FireflyIII\Events\Event;
|
||||
use FireflyIII\Models\BudgetLimit;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
|
||||
/**
|
||||
* Class Updated
|
||||
*/
|
||||
class Updated extends Event
|
||||
{
|
||||
use SerializesModels;
|
||||
|
||||
public function __construct(public BudgetLimit $budgetLimit) {}
|
||||
}
|
@@ -27,13 +27,19 @@ namespace FireflyIII\Generator\Webhook;
|
||||
use FireflyIII\Enums\WebhookResponse;
|
||||
use FireflyIII\Enums\WebhookTrigger;
|
||||
use FireflyIII\Exceptions\FireflyException;
|
||||
use FireflyIII\Models\Budget;
|
||||
use FireflyIII\Models\BudgetLimit;
|
||||
use FireflyIII\Models\Transaction;
|
||||
use FireflyIII\Models\TransactionGroup;
|
||||
use FireflyIII\Models\TransactionJournal;
|
||||
use FireflyIII\Models\Webhook;
|
||||
use FireflyIII\Models\WebhookMessage;
|
||||
use FireflyIII\Support\JsonApi\Enrichments\AccountEnrichment;
|
||||
use FireflyIII\Support\JsonApi\Enrichments\BudgetEnrichment;
|
||||
use FireflyIII\Support\JsonApi\Enrichments\BudgetLimitEnrichment;
|
||||
use FireflyIII\Transformers\AccountTransformer;
|
||||
use FireflyIII\Transformers\BudgetLimitTransformer;
|
||||
use FireflyIII\Transformers\BudgetTransformer;
|
||||
use FireflyIII\Transformers\TransactionGroupTransformer;
|
||||
use FireflyIII\User;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
@@ -112,15 +118,13 @@ class StandardMessageGenerator implements MessageGeneratorInterface
|
||||
$class = $model::class;
|
||||
// Line is ignored because all of Firefly III's Models have an id property.
|
||||
Log::debug(sprintf('Now in generateMessage(#%d, %s#%d)', $webhook->id, $class, $model->id));
|
||||
Log::debug($webhook->response);
|
||||
Log::debug(WebhookResponse::from($webhook->response)->name);
|
||||
$uuid = Uuid::uuid4();
|
||||
$basicMessage = [
|
||||
'uuid' => $uuid->toString(),
|
||||
'user_id' => 0,
|
||||
'user_group_id' => 0,
|
||||
'trigger' => $webhook->trigger->name,
|
||||
'response' => WebhookResponse::from((int) $webhook->response)->name,
|
||||
'trigger' => WebhookTrigger::from((int)$webhook->trigger)->name,
|
||||
'response' => WebhookResponse::from((int)$webhook->response)->name,
|
||||
'url' => $webhook->url,
|
||||
'version' => sprintf('v%d', $this->getVersion()),
|
||||
'content' => [],
|
||||
@@ -134,6 +138,19 @@ class StandardMessageGenerator implements MessageGeneratorInterface
|
||||
|
||||
return;
|
||||
|
||||
case Budget::class:
|
||||
/** @var Budget $model */
|
||||
$basicMessage['user_id'] = $model->user_id;
|
||||
$basicMessage['user_group_id'] = $model->user_group_id;
|
||||
|
||||
break;
|
||||
|
||||
case BudgetLimit::class:
|
||||
$basicMessage['user_id'] = $model->budget->user_id;
|
||||
$basicMessage['user_group_id'] = $model->budget->user_group_id;
|
||||
|
||||
break;
|
||||
|
||||
case TransactionGroup::class:
|
||||
/** @var TransactionGroup $model */
|
||||
$basicMessage['user_id'] = $model->user_id;
|
||||
@@ -149,6 +166,38 @@ class StandardMessageGenerator implements MessageGeneratorInterface
|
||||
|
||||
return;
|
||||
|
||||
case WebhookResponse::BUDGET->value:
|
||||
$basicMessage['content'] = [];
|
||||
if ($model instanceof Budget) {
|
||||
$enrichment = new BudgetEnrichment();
|
||||
$enrichment->setUser($model->user);
|
||||
$model = $enrichment->enrichSingle($model);
|
||||
$transformer = new BudgetTransformer();
|
||||
$basicMessage['content'] = $transformer->transform($model);
|
||||
}
|
||||
if ($model instanceof BudgetLimit) {
|
||||
$user = $model->budget->user;
|
||||
$enrichment = new BudgetEnrichment();
|
||||
$enrichment->setUser($user);
|
||||
$enrichment->setStart($model->start_date);
|
||||
$enrichment->setEnd($model->end_date);
|
||||
$budget = $enrichment->enrichSingle($model->budget);
|
||||
|
||||
$enrichment = new BudgetLimitEnrichment();
|
||||
$enrichment->setUser($user);
|
||||
|
||||
$parameters = new ParameterBag();
|
||||
$parameters->set('start', $model->start_date);
|
||||
$parameters->set('end', $model->end_date);
|
||||
|
||||
$model = $enrichment->enrichSingle($model);
|
||||
$transformer = new BudgetLimitTransformer();
|
||||
$transformer->setParameters($parameters);
|
||||
$basicMessage['content'] = $transformer->transform($model);
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case WebhookResponse::NONE->value:
|
||||
$basicMessage['content'] = [];
|
||||
|
||||
|
@@ -27,17 +27,7 @@ namespace FireflyIII\Handlers\Events\Model;
|
||||
use FireflyIII\Events\Model\BudgetLimit\Created;
|
||||
use FireflyIII\Events\Model\BudgetLimit\Deleted;
|
||||
use FireflyIII\Events\Model\BudgetLimit\Updated;
|
||||
use FireflyIII\Models\AvailableBudget;
|
||||
use FireflyIII\Models\Budget;
|
||||
use FireflyIII\Models\BudgetLimit;
|
||||
use FireflyIII\Repositories\Budget\BudgetLimitRepositoryInterface;
|
||||
use FireflyIII\User;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Psr\Container\ContainerExceptionInterface;
|
||||
use Psr\Container\NotFoundExceptionInterface;
|
||||
use Spatie\Period\Boundaries;
|
||||
use Spatie\Period\Period;
|
||||
use Spatie\Period\Precision;
|
||||
|
||||
/**
|
||||
* Class BudgetLimitHandler
|
||||
@@ -47,212 +37,9 @@ class BudgetLimitHandler
|
||||
public function created(Created $event): void
|
||||
{
|
||||
Log::debug(sprintf('BudgetLimitHandler::created(#%s)', $event->budgetLimit->id));
|
||||
$this->updateAvailableBudget($event->budgetLimit);
|
||||
}
|
||||
|
||||
private function updateAvailableBudget(BudgetLimit $budgetLimit): void
|
||||
{
|
||||
Log::debug(sprintf('Now in updateAvailableBudget(limit #%d)', $budgetLimit->id));
|
||||
public function deleted(Deleted $event): void {}
|
||||
|
||||
/** @var null|Budget $budget */
|
||||
$budget = Budget::find($budgetLimit->budget_id);
|
||||
if (null === $budget) {
|
||||
Log::warning('Budget is null, probably deleted, find deleted version.');
|
||||
|
||||
/** @var null|Budget $budget */
|
||||
$budget = Budget::withTrashed()->find($budgetLimit->budget_id);
|
||||
}
|
||||
if (null === $budget) {
|
||||
Log::warning('Budget is still null, cannot continue, will delete budget limit.');
|
||||
$budgetLimit->forceDelete();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/** @var null|User $user */
|
||||
$user = $budget->user;
|
||||
|
||||
// sanity check. It happens when the budget has been deleted so the original user is unknown.
|
||||
if (null === $user) {
|
||||
Log::warning('User is null, cannot continue.');
|
||||
$budgetLimit->forceDelete();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// based on the view range of the user (month week quarter etc) the budget limit could
|
||||
// either overlap multiple available budget periods or be contained in a single one.
|
||||
// all have to be created or updated.
|
||||
try {
|
||||
$viewRange = app('preferences')->getForUser($user, 'viewRange', '1M')->data;
|
||||
} catch (ContainerExceptionInterface|NotFoundExceptionInterface $e) {
|
||||
Log::error($e->getMessage());
|
||||
$viewRange = '1M';
|
||||
}
|
||||
// safety catch
|
||||
if (null === $viewRange || is_array($viewRange)) {
|
||||
$viewRange = '1M';
|
||||
}
|
||||
$viewRange = (string) $viewRange;
|
||||
|
||||
$start = app('navigation')->startOfPeriod($budgetLimit->start_date, $viewRange);
|
||||
$end = app('navigation')->startOfPeriod($budgetLimit->end_date, $viewRange);
|
||||
$end = app('navigation')->endOfPeriod($end, $viewRange);
|
||||
|
||||
// limit period in total is:
|
||||
$limitPeriod = Period::make($start, $end, precision: Precision::DAY(), boundaries: Boundaries::EXCLUDE_NONE());
|
||||
Log::debug(sprintf('Limit period is from %s to %s', $start->format('Y-m-d'), $end->format('Y-m-d')));
|
||||
|
||||
// from the start until the end of the budget limit, need to loop!
|
||||
$current = clone $start;
|
||||
while ($current <= $end) {
|
||||
$currentEnd = app('navigation')->endOfPeriod($current, $viewRange);
|
||||
|
||||
// create or find AB for this particular period, and set the amount accordingly.
|
||||
/** @var null|AvailableBudget $availableBudget */
|
||||
$availableBudget = $user->availableBudgets()->where('start_date', $current->format('Y-m-d'))->where('end_date', $currentEnd->format('Y-m-d'))->where('transaction_currency_id', $budgetLimit->transaction_currency_id)->first();
|
||||
|
||||
if (null !== $availableBudget) {
|
||||
Log::debug('Found 1 AB, will update.');
|
||||
$this->calculateAmount($availableBudget);
|
||||
}
|
||||
if (null === $availableBudget) {
|
||||
Log::debug('No AB found, will create.');
|
||||
// if not exists:
|
||||
$currentPeriod = Period::make($current, $currentEnd, precision: Precision::DAY(), boundaries: Boundaries::EXCLUDE_NONE());
|
||||
$daily = $this->getDailyAmount($budgetLimit);
|
||||
$amount = bcmul($daily, (string) $currentPeriod->length(), 12);
|
||||
|
||||
// no need to calculate if period is equal.
|
||||
if ($currentPeriod->equals($limitPeriod)) {
|
||||
$amount = 0 === $budgetLimit->id ? '0' : $budgetLimit->amount;
|
||||
}
|
||||
if (0 === bccomp($amount, '0')) {
|
||||
Log::debug('Amount is zero, will not create AB.');
|
||||
}
|
||||
if (0 !== bccomp($amount, '0')) {
|
||||
Log::debug(sprintf('Will create AB for period %s to %s', $current->format('Y-m-d'), $currentEnd->format('Y-m-d')));
|
||||
$availableBudget = new AvailableBudget(
|
||||
[
|
||||
'user_id' => $user->id,
|
||||
'user_group_id' => $user->user_group_id,
|
||||
'transaction_currency_id' => $budgetLimit->transaction_currency_id,
|
||||
'start_date' => $current,
|
||||
'start_date_tz' => $current->format('e'),
|
||||
'end_date' => $currentEnd,
|
||||
'end_date_tz' => $currentEnd->format('e'),
|
||||
'amount' => $amount,
|
||||
]
|
||||
);
|
||||
$availableBudget->save();
|
||||
Log::debug(sprintf('ID of new AB is #%d', $availableBudget->id));
|
||||
$this->calculateAmount($availableBudget);
|
||||
}
|
||||
}
|
||||
|
||||
// prep for next loop
|
||||
$current = app('navigation')->addPeriod($current, $viewRange, 0);
|
||||
}
|
||||
}
|
||||
|
||||
private function calculateAmount(AvailableBudget $availableBudget): void
|
||||
{
|
||||
$repository = app(BudgetLimitRepositoryInterface::class);
|
||||
$repository->setUser($availableBudget->user);
|
||||
$newAmount = '0';
|
||||
$abPeriod = Period::make($availableBudget->start_date, $availableBudget->end_date, Precision::DAY());
|
||||
Log::debug(
|
||||
sprintf(
|
||||
'Now at AB #%d, ("%s" to "%s")',
|
||||
$availableBudget->id,
|
||||
$availableBudget->start_date->format('Y-m-d'),
|
||||
$availableBudget->end_date->format('Y-m-d')
|
||||
)
|
||||
);
|
||||
// have to recalculate everything just in case.
|
||||
$set = $repository->getAllBudgetLimitsByCurrency($availableBudget->transactionCurrency, $availableBudget->start_date, $availableBudget->end_date);
|
||||
Log::debug(sprintf('Found %d interesting budget limit(s).', $set->count()));
|
||||
|
||||
/** @var BudgetLimit $budgetLimit */
|
||||
foreach ($set as $budgetLimit) {
|
||||
Log::debug(
|
||||
sprintf(
|
||||
'Found interesting budget limit #%d ("%s" to "%s")',
|
||||
$budgetLimit->id,
|
||||
$budgetLimit->start_date->format('Y-m-d'),
|
||||
$budgetLimit->end_date->format('Y-m-d')
|
||||
)
|
||||
);
|
||||
// overlap in days:
|
||||
$limitPeriod = Period::make(
|
||||
$budgetLimit->start_date,
|
||||
$budgetLimit->end_date,
|
||||
precision : Precision::DAY(),
|
||||
boundaries: Boundaries::EXCLUDE_NONE()
|
||||
);
|
||||
// if both equal each other, amount from this BL must be added to the AB
|
||||
if ($limitPeriod->equals($abPeriod)) {
|
||||
Log::debug('This budget limit is equal to the available budget period.');
|
||||
$newAmount = bcadd($newAmount, (string) $budgetLimit->amount);
|
||||
}
|
||||
// if budget limit period is inside AB period, it can be added in full.
|
||||
if (!$limitPeriod->equals($abPeriod) && $abPeriod->contains($limitPeriod)) {
|
||||
Log::debug('This budget limit is smaller than the available budget period.');
|
||||
$newAmount = bcadd($newAmount, (string) $budgetLimit->amount);
|
||||
}
|
||||
if (!$limitPeriod->equals($abPeriod) && !$abPeriod->contains($limitPeriod) && $abPeriod->overlapsWith($limitPeriod)) {
|
||||
Log::debug('This budget limit is something else entirely!');
|
||||
$overlap = $abPeriod->overlap($limitPeriod);
|
||||
if ($overlap instanceof Period) {
|
||||
$length = $overlap->length();
|
||||
$daily = bcmul($this->getDailyAmount($budgetLimit), (string) $length);
|
||||
$newAmount = bcadd($newAmount, $daily);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (0 === bccomp('0', $newAmount)) {
|
||||
Log::debug('New amount is zero, deleting AB.');
|
||||
$availableBudget->delete();
|
||||
|
||||
return;
|
||||
}
|
||||
Log::debug(sprintf('Concluded new amount for this AB must be %s', $newAmount));
|
||||
$availableBudget->amount = app('steam')->bcround($newAmount, $availableBudget->transactionCurrency->decimal_places);
|
||||
$availableBudget->save();
|
||||
}
|
||||
|
||||
private function getDailyAmount(BudgetLimit $budgetLimit): string
|
||||
{
|
||||
if (0 === $budgetLimit->id) {
|
||||
return '0';
|
||||
}
|
||||
$limitPeriod = Period::make(
|
||||
$budgetLimit->start_date,
|
||||
$budgetLimit->end_date,
|
||||
precision : Precision::DAY(),
|
||||
boundaries: Boundaries::EXCLUDE_NONE()
|
||||
);
|
||||
$days = $limitPeriod->length();
|
||||
$amount = bcdiv($budgetLimit->amount, (string) $days, 12);
|
||||
Log::debug(
|
||||
sprintf('Total amount for budget limit #%d is %s. Nr. of days is %d. Amount per day is %s', $budgetLimit->id, $budgetLimit->amount, $days, $amount)
|
||||
);
|
||||
|
||||
return $amount;
|
||||
}
|
||||
|
||||
public function deleted(Deleted $event): void
|
||||
{
|
||||
Log::debug(sprintf('BudgetLimitHandler::deleted(#%s)', $event->budgetLimit->id));
|
||||
$budgetLimit = $event->budgetLimit;
|
||||
$budgetLimit->id = 0;
|
||||
$this->updateAvailableBudget($event->budgetLimit);
|
||||
}
|
||||
|
||||
public function updated(Updated $event): void
|
||||
{
|
||||
Log::debug(sprintf('BudgetLimitHandler::updated(#%s)', $event->budgetLimit->id));
|
||||
$this->updateAvailableBudget($event->budgetLimit);
|
||||
}
|
||||
public function updated(Updated $event): void {}
|
||||
}
|
||||
|
@@ -24,17 +24,36 @@ declare(strict_types=1);
|
||||
|
||||
namespace FireflyIII\Handlers\Observer;
|
||||
|
||||
use FireflyIII\Enums\WebhookTrigger;
|
||||
use FireflyIII\Events\RequestedSendWebhookMessages;
|
||||
use FireflyIII\Generator\Webhook\MessageGeneratorInterface;
|
||||
use FireflyIII\Models\BudgetLimit;
|
||||
use FireflyIII\Support\Facades\Amount;
|
||||
use FireflyIII\Support\Http\Api\ExchangeRateConverter;
|
||||
use FireflyIII\Support\Observers\RecalculatesAvailableBudgetsTrait;
|
||||
use Illuminate\Support\Collection;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
class BudgetLimitObserver
|
||||
{
|
||||
use RecalculatesAvailableBudgetsTrait;
|
||||
|
||||
public function created(BudgetLimit $budgetLimit): void
|
||||
{
|
||||
Log::debug('Observe "created" of a budget limit.');
|
||||
$this->updatePrimaryCurrencyAmount($budgetLimit);
|
||||
$this->updateAvailableBudget($budgetLimit);
|
||||
|
||||
$user = $budgetLimit->budget->user;
|
||||
|
||||
/** @var MessageGeneratorInterface $engine */
|
||||
$engine = app(MessageGeneratorInterface::class);
|
||||
$engine->setUser($user);
|
||||
$engine->setObjects(new Collection()->push($budgetLimit));
|
||||
$engine->setTrigger(WebhookTrigger::STORE_UPDATE_BUDGET_LIMIT);
|
||||
$engine->generateMessages();
|
||||
|
||||
event(new RequestedSendWebhookMessages());
|
||||
}
|
||||
|
||||
private function updatePrimaryCurrencyAmount(BudgetLimit $budgetLimit): void
|
||||
@@ -60,5 +79,17 @@ class BudgetLimitObserver
|
||||
{
|
||||
Log::debug('Observe "updated" of a budget limit.');
|
||||
$this->updatePrimaryCurrencyAmount($budgetLimit);
|
||||
$this->updateAvailableBudget($budgetLimit);
|
||||
|
||||
$user = $budgetLimit->budget->user;
|
||||
|
||||
/** @var MessageGeneratorInterface $engine */
|
||||
$engine = app(MessageGeneratorInterface::class);
|
||||
$engine->setUser($user);
|
||||
$engine->setObjects(new Collection()->push($budgetLimit));
|
||||
$engine->setTrigger(WebhookTrigger::STORE_UPDATE_BUDGET_LIMIT);
|
||||
$engine->generateMessages();
|
||||
|
||||
event(new RequestedSendWebhookMessages());
|
||||
}
|
||||
}
|
||||
|
@@ -23,19 +23,70 @@ declare(strict_types=1);
|
||||
|
||||
namespace FireflyIII\Handlers\Observer;
|
||||
|
||||
use FireflyIII\Enums\WebhookTrigger;
|
||||
use FireflyIII\Events\RequestedSendWebhookMessages;
|
||||
use FireflyIII\Generator\Webhook\MessageGeneratorInterface;
|
||||
use FireflyIII\Models\Attachment;
|
||||
use FireflyIII\Models\Budget;
|
||||
use FireflyIII\Models\BudgetLimit;
|
||||
use FireflyIII\Repositories\Attachment\AttachmentRepositoryInterface;
|
||||
use FireflyIII\Support\Observers\RecalculatesAvailableBudgetsTrait;
|
||||
use Illuminate\Support\Collection;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
/**
|
||||
* Class BudgetObserver
|
||||
*/
|
||||
class BudgetObserver
|
||||
{
|
||||
use RecalculatesAvailableBudgetsTrait;
|
||||
|
||||
public function created(Budget $budget): void
|
||||
{
|
||||
Log::debug(sprintf('Observe "created" of budget #%d ("%s").', $budget->id, $budget->name));
|
||||
|
||||
// fire event.
|
||||
$user = $budget->user;
|
||||
|
||||
/** @var MessageGeneratorInterface $engine */
|
||||
$engine = app(MessageGeneratorInterface::class);
|
||||
$engine->setUser($user);
|
||||
$engine->setObjects(new Collection()->push($budget));
|
||||
$engine->setTrigger(WebhookTrigger::STORE_BUDGET);
|
||||
$engine->generateMessages();
|
||||
|
||||
event(new RequestedSendWebhookMessages());
|
||||
}
|
||||
|
||||
public function updated(Budget $budget): void
|
||||
{
|
||||
Log::debug(sprintf('Observe "updated" of budget #%d ("%s").', $budget->id, $budget->name));
|
||||
$user = $budget->user;
|
||||
|
||||
/** @var MessageGeneratorInterface $engine */
|
||||
$engine = app(MessageGeneratorInterface::class);
|
||||
$engine->setUser($user);
|
||||
$engine->setObjects(new Collection()->push($budget));
|
||||
$engine->setTrigger(WebhookTrigger::UPDATE_BUDGET);
|
||||
$engine->generateMessages();
|
||||
|
||||
event(new RequestedSendWebhookMessages());
|
||||
}
|
||||
|
||||
public function deleting(Budget $budget): void
|
||||
{
|
||||
app('log')->debug('Observe "deleting" of a budget.');
|
||||
Log::debug('Observe "deleting" of a budget.');
|
||||
|
||||
$user = $budget->user;
|
||||
|
||||
/** @var MessageGeneratorInterface $engine */
|
||||
$engine = app(MessageGeneratorInterface::class);
|
||||
$engine->setUser($user);
|
||||
$engine->setObjects(new Collection()->push($budget));
|
||||
$engine->setTrigger(WebhookTrigger::DESTROY_BUDGET);
|
||||
$engine->generateMessages();
|
||||
|
||||
event(new RequestedSendWebhookMessages());
|
||||
|
||||
$repository = app(AttachmentRepositoryInterface::class);
|
||||
$repository->setUser($budget->user);
|
||||
@@ -49,7 +100,10 @@ class BudgetObserver
|
||||
/** @var BudgetLimit $budgetLimit */
|
||||
foreach ($budgetLimits as $budgetLimit) {
|
||||
// this loop exists so several events are fired.
|
||||
$budgetLimit->delete();
|
||||
$copy = clone $budgetLimit;
|
||||
$copy->id = 0;
|
||||
$this->updateAvailableBudget($copy);
|
||||
$budgetLimit->deleteQuietly(); // delete is quietly when in a loop.
|
||||
}
|
||||
|
||||
$budget->notes()->delete();
|
||||
|
@@ -24,6 +24,7 @@ declare(strict_types=1);
|
||||
namespace FireflyIII\Handlers\Observer;
|
||||
|
||||
use FireflyIII\Models\TransactionGroup;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
/**
|
||||
* Class TransactionGroup
|
||||
@@ -32,7 +33,7 @@ class TransactionGroupObserver
|
||||
{
|
||||
public function deleting(TransactionGroup $transactionGroup): void
|
||||
{
|
||||
app('log')->debug('Observe "deleting" of a transaction group.');
|
||||
Log::debug('Observe "deleting" of a transaction group.');
|
||||
foreach ($transactionGroup->transactionJournals()->get() as $journal) {
|
||||
$journal->delete();
|
||||
}
|
||||
|
@@ -26,6 +26,7 @@ namespace FireflyIII\Handlers\Observer;
|
||||
use FireflyIII\Models\Attachment;
|
||||
use FireflyIII\Models\TransactionJournal;
|
||||
use FireflyIII\Repositories\Attachment\AttachmentRepositoryInterface;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
/**
|
||||
* Class TransactionJournalObserver
|
||||
@@ -34,7 +35,7 @@ class TransactionJournalObserver
|
||||
{
|
||||
public function deleting(TransactionJournal $transactionJournal): void
|
||||
{
|
||||
app('log')->debug('Observe "deleting" of a transaction journal.');
|
||||
Log::debug('Observe "deleting" of a transaction journal.');
|
||||
|
||||
$repository = app(AttachmentRepositoryInterface::class);
|
||||
$repository->setUser($transactionJournal->user);
|
||||
|
@@ -29,9 +29,6 @@ use FireflyIII\Events\DestroyedTransactionGroup;
|
||||
use FireflyIII\Events\DetectedNewIPAddress;
|
||||
use FireflyIII\Events\Model\Bill\WarnUserAboutBill;
|
||||
use FireflyIII\Events\Model\Bill\WarnUserAboutOverdueSubscriptions;
|
||||
use FireflyIII\Events\Model\BudgetLimit\Created;
|
||||
use FireflyIII\Events\Model\BudgetLimit\Deleted;
|
||||
use FireflyIII\Events\Model\BudgetLimit\Updated;
|
||||
use FireflyIII\Events\Model\PiggyBank\ChangedAmount;
|
||||
use FireflyIII\Events\Model\PiggyBank\ChangedName;
|
||||
use FireflyIII\Events\Model\Rule\RuleActionFailedOnArray;
|
||||
@@ -219,17 +216,6 @@ class EventServiceProvider extends ServiceProvider
|
||||
'FireflyIII\Handlers\Events\Model\PiggyBankEventHandler@changedPiggyBankName',
|
||||
],
|
||||
|
||||
// budget related events: CRUD budget limit
|
||||
Created::class => [
|
||||
'FireflyIII\Handlers\Events\Model\BudgetLimitHandler@created',
|
||||
],
|
||||
Updated::class => [
|
||||
'FireflyIII\Handlers\Events\Model\BudgetLimitHandler@updated',
|
||||
],
|
||||
Deleted::class => [
|
||||
'FireflyIII\Handlers\Events\Model\BudgetLimitHandler@deleted',
|
||||
],
|
||||
|
||||
// rule actions
|
||||
RuleActionFailedOnArray::class => [
|
||||
'FireflyIII\Handlers\Events\Model\RuleHandler@ruleActionFailedOnArray',
|
||||
|
212
app/Support/Observers/RecalculatesAvailableBudgetsTrait.php
Normal file
212
app/Support/Observers/RecalculatesAvailableBudgetsTrait.php
Normal file
@@ -0,0 +1,212 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace FireflyIII\Support\Observers;
|
||||
|
||||
use FireflyIII\Models\AvailableBudget;
|
||||
use FireflyIII\Models\Budget;
|
||||
use FireflyIII\Models\BudgetLimit;
|
||||
use FireflyIII\Repositories\Budget\BudgetLimitRepositoryInterface;
|
||||
use FireflyIII\User;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Psr\Container\ContainerExceptionInterface;
|
||||
use Psr\Container\NotFoundExceptionInterface;
|
||||
use Spatie\Period\Boundaries;
|
||||
use Spatie\Period\Period;
|
||||
use Spatie\Period\Precision;
|
||||
|
||||
trait RecalculatesAvailableBudgetsTrait
|
||||
{
|
||||
private function updateAvailableBudget(BudgetLimit $budgetLimit): void
|
||||
{
|
||||
Log::debug(sprintf('Now in updateAvailableBudget(limit #%d)', $budgetLimit->id));
|
||||
|
||||
/** @var null|Budget $budget */
|
||||
$budget = Budget::find($budgetLimit->budget_id);
|
||||
if (null === $budget) {
|
||||
Log::warning('Budget is null, probably deleted, find deleted version.');
|
||||
|
||||
/** @var null|Budget $budget */
|
||||
$budget = Budget::withTrashed()->find($budgetLimit->budget_id);
|
||||
}
|
||||
if (null === $budget) {
|
||||
Log::warning('Budget is still null, cannot continue, will delete budget limit.');
|
||||
$budgetLimit->forceDelete();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/** @var null|User $user */
|
||||
$user = $budget->user;
|
||||
|
||||
// sanity check. It happens when the budget has been deleted so the original user is unknown.
|
||||
if (null === $user) {
|
||||
Log::warning('User is null, cannot continue.');
|
||||
$budgetLimit->forceDelete();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// based on the view range of the user (month week quarter etc) the budget limit could
|
||||
// either overlap multiple available budget periods or be contained in a single one.
|
||||
// all have to be created or updated.
|
||||
try {
|
||||
$viewRange = app('preferences')->getForUser($user, 'viewRange', '1M')->data;
|
||||
} catch (ContainerExceptionInterface|NotFoundExceptionInterface $e) {
|
||||
Log::error($e->getMessage());
|
||||
$viewRange = '1M';
|
||||
}
|
||||
// safety catch
|
||||
if (null === $viewRange || is_array($viewRange)) {
|
||||
$viewRange = '1M';
|
||||
}
|
||||
$viewRange = (string) $viewRange;
|
||||
|
||||
$start = app('navigation')->startOfPeriod($budgetLimit->start_date, $viewRange);
|
||||
$end = app('navigation')->startOfPeriod($budgetLimit->end_date, $viewRange);
|
||||
$end = app('navigation')->endOfPeriod($end, $viewRange);
|
||||
|
||||
// limit period in total is:
|
||||
$limitPeriod = Period::make($start, $end, precision: Precision::DAY(), boundaries: Boundaries::EXCLUDE_NONE());
|
||||
Log::debug(sprintf('Limit period is from %s to %s', $start->format('Y-m-d'), $end->format('Y-m-d')));
|
||||
|
||||
// from the start until the end of the budget limit, need to loop!
|
||||
$current = clone $start;
|
||||
while ($current <= $end) {
|
||||
$currentEnd = app('navigation')->endOfPeriod($current, $viewRange);
|
||||
|
||||
// create or find AB for this particular period, and set the amount accordingly.
|
||||
/** @var null|AvailableBudget $availableBudget */
|
||||
$availableBudget = $user->availableBudgets()->where('start_date', $current->format('Y-m-d'))->where('end_date', $currentEnd->format('Y-m-d'))->where('transaction_currency_id', $budgetLimit->transaction_currency_id)->first();
|
||||
|
||||
if (null !== $availableBudget) {
|
||||
Log::debug('Found 1 AB, will update.');
|
||||
$this->calculateAmount($availableBudget);
|
||||
}
|
||||
if (null === $availableBudget) {
|
||||
Log::debug('No AB found, will create.');
|
||||
// if not exists:
|
||||
$currentPeriod = Period::make($current, $currentEnd, precision: Precision::DAY(), boundaries: Boundaries::EXCLUDE_NONE());
|
||||
$daily = $this->getDailyAmount($budgetLimit);
|
||||
$amount = bcmul($daily, (string) $currentPeriod->length(), 12);
|
||||
|
||||
// no need to calculate if period is equal.
|
||||
if ($currentPeriod->equals($limitPeriod)) {
|
||||
$amount = 0 === $budgetLimit->id ? '0' : $budgetLimit->amount;
|
||||
}
|
||||
if (0 === bccomp($amount, '0')) {
|
||||
Log::debug('Amount is zero, will not create AB.');
|
||||
}
|
||||
if (0 !== bccomp($amount, '0')) {
|
||||
Log::debug(sprintf('Will create AB for period %s to %s', $current->format('Y-m-d'), $currentEnd->format('Y-m-d')));
|
||||
$availableBudget = new AvailableBudget(
|
||||
[
|
||||
'user_id' => $user->id,
|
||||
'user_group_id' => $user->user_group_id,
|
||||
'transaction_currency_id' => $budgetLimit->transaction_currency_id,
|
||||
'start_date' => $current,
|
||||
'start_date_tz' => $current->format('e'),
|
||||
'end_date' => $currentEnd,
|
||||
'end_date_tz' => $currentEnd->format('e'),
|
||||
'amount' => $amount,
|
||||
]
|
||||
);
|
||||
$availableBudget->save();
|
||||
Log::debug(sprintf('ID of new AB is #%d', $availableBudget->id));
|
||||
$this->calculateAmount($availableBudget);
|
||||
}
|
||||
}
|
||||
|
||||
// prep for next loop
|
||||
$current = app('navigation')->addPeriod($current, $viewRange, 0);
|
||||
}
|
||||
}
|
||||
|
||||
private function calculateAmount(AvailableBudget $availableBudget): void
|
||||
{
|
||||
$repository = app(BudgetLimitRepositoryInterface::class);
|
||||
$repository->setUser($availableBudget->user);
|
||||
$newAmount = '0';
|
||||
$abPeriod = Period::make($availableBudget->start_date, $availableBudget->end_date, Precision::DAY());
|
||||
Log::debug(
|
||||
sprintf(
|
||||
'Now at AB #%d, ("%s" to "%s")',
|
||||
$availableBudget->id,
|
||||
$availableBudget->start_date->format('Y-m-d'),
|
||||
$availableBudget->end_date->format('Y-m-d')
|
||||
)
|
||||
);
|
||||
// have to recalculate everything just in case.
|
||||
$set = $repository->getAllBudgetLimitsByCurrency($availableBudget->transactionCurrency, $availableBudget->start_date, $availableBudget->end_date);
|
||||
Log::debug(sprintf('Found %d interesting budget limit(s).', $set->count()));
|
||||
|
||||
/** @var BudgetLimit $budgetLimit */
|
||||
foreach ($set as $budgetLimit) {
|
||||
Log::debug(
|
||||
sprintf(
|
||||
'Found interesting budget limit #%d ("%s" to "%s")',
|
||||
$budgetLimit->id,
|
||||
$budgetLimit->start_date->format('Y-m-d'),
|
||||
$budgetLimit->end_date->format('Y-m-d')
|
||||
)
|
||||
);
|
||||
// overlap in days:
|
||||
$limitPeriod = Period::make(
|
||||
$budgetLimit->start_date,
|
||||
$budgetLimit->end_date,
|
||||
precision : Precision::DAY(),
|
||||
boundaries: Boundaries::EXCLUDE_NONE()
|
||||
);
|
||||
// if both equal each other, amount from this BL must be added to the AB
|
||||
if ($limitPeriod->equals($abPeriod)) {
|
||||
Log::debug('This budget limit is equal to the available budget period.');
|
||||
$newAmount = bcadd($newAmount, (string) $budgetLimit->amount);
|
||||
}
|
||||
// if budget limit period is inside AB period, it can be added in full.
|
||||
if (!$limitPeriod->equals($abPeriod) && $abPeriod->contains($limitPeriod)) {
|
||||
Log::debug('This budget limit is smaller than the available budget period.');
|
||||
$newAmount = bcadd($newAmount, (string) $budgetLimit->amount);
|
||||
}
|
||||
if (!$limitPeriod->equals($abPeriod) && !$abPeriod->contains($limitPeriod) && $abPeriod->overlapsWith($limitPeriod)) {
|
||||
Log::debug('This budget limit is something else entirely!');
|
||||
$overlap = $abPeriod->overlap($limitPeriod);
|
||||
if ($overlap instanceof Period) {
|
||||
$length = $overlap->length();
|
||||
$daily = bcmul($this->getDailyAmount($budgetLimit), (string) $length);
|
||||
$newAmount = bcadd($newAmount, $daily);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (0 === bccomp('0', $newAmount)) {
|
||||
Log::debug('New amount is zero, deleting AB.');
|
||||
$availableBudget->delete();
|
||||
|
||||
return;
|
||||
}
|
||||
Log::debug(sprintf('Concluded new amount for this AB must be %s', $newAmount));
|
||||
$availableBudget->amount = app('steam')->bcround($newAmount, $availableBudget->transactionCurrency->decimal_places);
|
||||
$availableBudget->save();
|
||||
}
|
||||
|
||||
private function getDailyAmount(BudgetLimit $budgetLimit): string
|
||||
{
|
||||
if (0 === $budgetLimit->id) {
|
||||
return '0';
|
||||
}
|
||||
$limitPeriod = Period::make(
|
||||
$budgetLimit->start_date,
|
||||
$budgetLimit->end_date,
|
||||
precision : Precision::DAY(),
|
||||
boundaries: Boundaries::EXCLUDE_NONE()
|
||||
);
|
||||
$days = $limitPeriod->length();
|
||||
$amount = bcdiv($budgetLimit->amount, (string) $days, 12);
|
||||
Log::debug(
|
||||
sprintf('Total amount for budget limit #%d is %s. Nr. of days is %d. Amount per day is %s', $budgetLimit->id, $budgetLimit->amount, $days, $amount)
|
||||
);
|
||||
|
||||
return $amount;
|
||||
}
|
||||
}
|
@@ -356,8 +356,10 @@ class Steam
|
||||
continue;
|
||||
}
|
||||
$accountSum = array_values($accountSum)[0];
|
||||
$sumOfAmount = (string)$accountSum['sum_of_amount'];
|
||||
$sumOfAmount = $this->floatalize('' === $sumOfAmount ? '0' : $sumOfAmount);
|
||||
$sumsByCode = [
|
||||
$accountSum['code'] => $accountSum['sum_of_amount'],
|
||||
$accountSum['code'] => $sumOfAmount,
|
||||
];
|
||||
|
||||
// Log::debug('All balances are (joined)', $others);
|
||||
|
12
changelog.md
12
changelog.md
@@ -3,7 +3,17 @@
|
||||
All notable changes to this project will be documented in this file.
|
||||
This project adheres to [Semantic Versioning](http://semver.org/).
|
||||
|
||||
## 6.3.0 - 2025-08-xx
|
||||
## 6.3.1 - 2025-08-19
|
||||
|
||||
### Fixed
|
||||
|
||||
- [Discussion 10768](https://github.com/orgs/firefly-iii/discussions/10768) (Argument #1 ($start) must be of type Carbon\Carbon, null given) started by @tangodance
|
||||
- [Issue 10771](https://github.com/firefly-iii/firefly-iii/issues/10771) (/v1/budgets/{id}/limits seems broken) reported by @Sceptorrh
|
||||
- [Issue 10773](https://github.com/firefly-iii/firefly-iii/issues/10773) (API: Wrong Return types) reported by @dreautall
|
||||
- [Issue 10775](https://github.com/firefly-iii/firefly-iii/issues/10775) (API: /v1/chart/account/overview broken) reported by @dreautall
|
||||
- [Issue 10782](https://github.com/firefly-iii/firefly-iii/issues/10782) ([error'] /accounts/[asset,expense,revenue]) reported by @vkanev
|
||||
|
||||
## 6.3.0 - 2025-08-17
|
||||
|
||||
> [!WARNING]
|
||||
> Firefly III v6.3.0 introduces a lot of API changes that deal with multi-currency support. Make sure your beloved apps are updated to support this.
|
||||
|
@@ -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-18',
|
||||
'build_time' => 1755508267,
|
||||
'version' => '6.3.1',
|
||||
'build_time' => 1755540382,
|
||||
'api_version' => '2.1.0', // field is no longer used.
|
||||
'db_version' => 26,
|
||||
|
||||
|
12
package-lock.json
generated
12
package-lock.json
generated
@@ -5700,9 +5700,9 @@
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/electron-to-chromium": {
|
||||
"version": "1.5.203",
|
||||
"resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.203.tgz",
|
||||
"integrity": "sha512-uz4i0vLhfm6dLZWbz/iH88KNDV+ivj5+2SA+utpgjKaj9Q0iDLuwk6Idhe9BTxciHudyx6IvTvijhkPvFGUQ0g==",
|
||||
"version": "1.5.204",
|
||||
"resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.204.tgz",
|
||||
"integrity": "sha512-s9VbBXWxfDrl67PlO4avwh0/GU2vcwx8Fph3wlR8LJl7ySGYId59EFE17VWVcuC3sLWNPENm6Z/uGqKbkPCcXA==",
|
||||
"dev": true,
|
||||
"license": "ISC"
|
||||
},
|
||||
@@ -11850,9 +11850,9 @@
|
||||
"license": "BSD-2-Clause"
|
||||
},
|
||||
"node_modules/webpack": {
|
||||
"version": "5.101.2",
|
||||
"resolved": "https://registry.npmjs.org/webpack/-/webpack-5.101.2.tgz",
|
||||
"integrity": "sha512-4JLXU0tD6OZNVqlwzm3HGEhAHufSiyv+skb7q0d2367VDMzrU1Q/ZeepvkcHH0rZie6uqEtTQQe0OEOOluH3Mg==",
|
||||
"version": "5.101.3",
|
||||
"resolved": "https://registry.npmjs.org/webpack/-/webpack-5.101.3.tgz",
|
||||
"integrity": "sha512-7b0dTKR3Ed//AD/6kkx/o7duS8H3f1a4w3BYpIriX4BzIhjkn4teo05cptsxvLesHFKK5KObnadmCHBwGc+51A==",
|
||||
"dev": true,
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
|
@@ -93,6 +93,7 @@ export default {
|
||||
},
|
||||
watch: {
|
||||
value() {
|
||||
console.log('Value changed to ' + this.value);
|
||||
this.trigger = this.value;
|
||||
},
|
||||
trigger(newValue) {
|
||||
|
@@ -129,6 +129,8 @@ export default {
|
||||
this.id = parseInt(response.data.data.id);
|
||||
|
||||
// trigger value on content
|
||||
console.log('Trigger is ' + response.data.data.attributes.trigger);
|
||||
// TODO does not need to be hard coded.
|
||||
if ('STORE_TRANSACTION' === response.data.data.attributes.trigger) {
|
||||
this.trigger = 100;
|
||||
}
|
||||
@@ -138,6 +140,18 @@ export default {
|
||||
if ('DESTROY_TRANSACTION' === response.data.data.attributes.trigger) {
|
||||
this.trigger = 120;
|
||||
}
|
||||
if ('STORE_BUDGET' === response.data.data.attributes.trigger) {
|
||||
this.trigger = 200;
|
||||
}
|
||||
if ('UPDATE_BUDGET' === response.data.data.attributes.trigger) {
|
||||
this.trigger = 210;
|
||||
}
|
||||
if ('DESTROY_BUDGET' === response.data.data.attributes.trigger) {
|
||||
this.trigger = 220;
|
||||
}
|
||||
if ('STORE_UPDATE_BUDGET_LIMIT' === response.data.data.attributes.trigger) {
|
||||
this.trigger = 230;
|
||||
}
|
||||
|
||||
// response value
|
||||
if ('TRANSACTIONS' === response.data.data.attributes.response) {
|
||||
@@ -146,6 +160,9 @@ export default {
|
||||
if ('ACCOUNTS' === response.data.data.attributes.response) {
|
||||
this.response = 210;
|
||||
}
|
||||
if ('BUDGET' === response.data.data.attributes.response) {
|
||||
this.response = 230;
|
||||
}
|
||||
if ('NONE' === response.data.data.attributes.response) {
|
||||
this.response = 220;
|
||||
}
|
||||
|
Reference in New Issue
Block a user