mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2026-02-07 20:54:32 +00:00
Compare commits
17 Commits
develop-20
...
develop-20
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e74163a7ec | ||
|
|
c60094d231 | ||
|
|
39d46d469c | ||
|
|
6caea5ffa3 | ||
|
|
4024f76a51 | ||
|
|
de84946371 | ||
|
|
6d4aca54de | ||
|
|
256262b2ba | ||
|
|
fb035ba594 | ||
|
|
20776949a6 | ||
|
|
ad5a8a2934 | ||
|
|
e37ef69491 | ||
|
|
df8a406c58 | ||
|
|
88d3e01065 | ||
|
|
7a1c32f1aa | ||
|
|
54df0d44f7 | ||
|
|
1f7775032b |
@@ -1,50 +0,0 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/*
|
||||
* TriggeredStoredTransactionGroup.php
|
||||
* Copyright (c) 2025 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/>.
|
||||
*/
|
||||
|
||||
namespace FireflyIII\Events\Model\TransactionGroup;
|
||||
|
||||
use FireflyIII\Events\Event;
|
||||
use FireflyIII\Models\RuleGroup;
|
||||
use FireflyIII\Models\TransactionGroup;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
class TriggeredStoredTransactionGroup extends Event
|
||||
{
|
||||
use SerializesModels;
|
||||
|
||||
public ?RuleGroup $ruleGroup = null;
|
||||
|
||||
/**
|
||||
* Create a new event instance.
|
||||
*/
|
||||
public function __construct(
|
||||
public TransactionGroup $transactionGroup,
|
||||
?RuleGroup $ruleGroup = null
|
||||
) {
|
||||
$this->ruleGroup = $ruleGroup;
|
||||
}
|
||||
}
|
||||
@@ -152,7 +152,7 @@ class ProfileController extends Controller
|
||||
}
|
||||
$repository->unblockUser($user);
|
||||
// also remove the "remote_guard_alt_email" preference.
|
||||
Preferences::delete('remote_guard_alt_email');
|
||||
Preferences::deleteForUser($user, 'remote_guard_alt_email');
|
||||
|
||||
// return to log in.
|
||||
session()->flash('success', (string) trans('firefly.login_with_new_email'));
|
||||
|
||||
@@ -26,16 +26,15 @@ namespace FireflyIII\Http\Controllers\RuleGroup;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Exception;
|
||||
use FireflyIII\Events\Model\TransactionGroup\TriggeredStoredTransactionGroup;
|
||||
use FireflyIII\Helpers\Collector\GroupCollectorInterface;
|
||||
use FireflyIII\Http\Controllers\Controller;
|
||||
use FireflyIII\Http\Requests\SelectTransactionsRequest;
|
||||
use FireflyIII\Models\RuleGroup;
|
||||
use FireflyIII\Models\TransactionGroup;
|
||||
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
|
||||
use FireflyIII\Repositories\RuleGroup\RuleGroupRepositoryInterface;
|
||||
use FireflyIII\TransactionRules\Engine\RuleEngineInterface;
|
||||
use FireflyIII\User;
|
||||
use Illuminate\Contracts\View\Factory;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use Illuminate\Support\Collection;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
use Illuminate\View\View;
|
||||
|
||||
@@ -45,6 +44,7 @@ use Illuminate\View\View;
|
||||
class ExecutionController extends Controller
|
||||
{
|
||||
private readonly AccountRepositoryInterface $repository;
|
||||
private readonly RuleGroupRepositoryInterface $ruleGroupRepository;
|
||||
|
||||
/**
|
||||
* ExecutionController constructor.
|
||||
@@ -52,11 +52,13 @@ class ExecutionController extends Controller
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->repository = app(AccountRepositoryInterface::class);
|
||||
$this->repository = app(AccountRepositoryInterface::class);
|
||||
$this->ruleGroupRepository = app(RuleGroupRepositoryInterface::class);
|
||||
$this->middleware(function ($request, $next) {
|
||||
app('view')->share('title', (string) trans('firefly.rules'));
|
||||
app('view')->share('mainTitleIcon', 'fa-random');
|
||||
$this->repository->setUser(auth()->user());
|
||||
$this->ruleGroupRepository->setUser(auth()->user());
|
||||
|
||||
return $next($request);
|
||||
});
|
||||
@@ -70,44 +72,37 @@ class ExecutionController extends Controller
|
||||
public function execute(SelectTransactionsRequest $request, RuleGroup $ruleGroup): RedirectResponse
|
||||
{
|
||||
Log::debug(sprintf('You have selected rule group #%d', $ruleGroup->id));
|
||||
// Get parameters specified by the user
|
||||
$accounts = $request->get('accounts');
|
||||
$set = new Collection();
|
||||
if (is_array($accounts)) {
|
||||
$set = $this->repository->getAccountsById($accounts);
|
||||
}
|
||||
|
||||
/** @var GroupCollectorInterface $collector */
|
||||
$collector = app(GroupCollectorInterface::class);
|
||||
if (count($set) > 0) {
|
||||
$collector->setAccounts($set);
|
||||
}
|
||||
// start code
|
||||
/** @var User $user */
|
||||
$user = auth()->user();
|
||||
$accounts = implode(',', $request->get('accounts'));
|
||||
// create new rule engine:
|
||||
$newRuleEngine = app(RuleEngineInterface::class);
|
||||
$newRuleEngine->setUser($user);
|
||||
|
||||
// add date operators.
|
||||
if (null !== $request->get('start')) {
|
||||
$startDate = new Carbon($request->get('start'));
|
||||
$collector->setStart($startDate);
|
||||
$newRuleEngine->addOperator(['type' => 'date_after', 'value' => $startDate->format('Y-m-d')]);
|
||||
}
|
||||
if (null !== $request->get('end')) {
|
||||
$endDate = new Carbon($request->get('end'));
|
||||
$collector->setEnd($endDate);
|
||||
$newRuleEngine->addOperator(['type' => 'date_before', 'value' => $endDate->format('Y-m-d')]);
|
||||
}
|
||||
$final = $collector->getGroups();
|
||||
$ids = $final->pluck('id')->toArray();
|
||||
Log::debug(sprintf('Found %d groups collected from %d account(s)', $final->count(), $set->count()));
|
||||
foreach (array_chunk($ids, 1337) as $setOfIds) {
|
||||
Log::debug(sprintf('Now processing %d groups', count($setOfIds)));
|
||||
$groups = TransactionGroup::whereIn('id', $setOfIds)->get();
|
||||
|
||||
/** @var TransactionGroup $group */
|
||||
foreach ($groups as $group) {
|
||||
Log::debug(sprintf('Processing group #%d.', $group->id));
|
||||
event(new TriggeredStoredTransactionGroup($group, $ruleGroup));
|
||||
}
|
||||
}
|
||||
// add extra operators:
|
||||
$newRuleEngine->addOperator(['type' => 'account_id', 'value' => $accounts]);
|
||||
|
||||
// set rules:
|
||||
$rules = $this->ruleGroupRepository->getActiveRules($ruleGroup);
|
||||
|
||||
$newRuleEngine->setRules($rules);
|
||||
$newRuleEngine->fire();
|
||||
$resultCount = $newRuleEngine->getResults();
|
||||
|
||||
// Tell the user that the job is queued
|
||||
session()->flash('success', (string) trans('firefly.applied_rule_group_selection', ['title' => $ruleGroup->title]));
|
||||
session()->flash('success', trans_choice('firefly.applied_rule_group_selection', $resultCount, ['title' => $ruleGroup->title]));
|
||||
|
||||
return redirect()->route('rules.index');
|
||||
}
|
||||
|
||||
@@ -194,7 +194,12 @@ class ShowController extends Controller
|
||||
foreach ($group['transactions'] as $transaction) {
|
||||
// add normal amount:
|
||||
$symbol = $transaction['currency_symbol'];
|
||||
$amounts[$symbol] ??= ['amount' => '0', 'symbol' => $symbol, 'decimal_places' => $transaction['currency_decimal_places']];
|
||||
$amounts[$symbol] ??= [
|
||||
'amount' => '0',
|
||||
'symbol' => $symbol,
|
||||
'decimal_places' => $transaction['currency_decimal_places'],
|
||||
'approximate' => false,
|
||||
];
|
||||
$amounts[$symbol]['amount'] = bcadd($amounts[$symbol]['amount'], (string) $transaction['amount']);
|
||||
|
||||
// add foreign amount:
|
||||
@@ -207,17 +212,23 @@ class ShowController extends Controller
|
||||
$foreignSymbol = $transaction['foreign_currency_symbol'];
|
||||
$amounts[$foreignSymbol] ??= [
|
||||
'amount' => '0',
|
||||
'approximate' => false,
|
||||
'symbol' => $foreignSymbol,
|
||||
'decimal_places' => $transaction['foreign_currency_decimal_places'],
|
||||
];
|
||||
$amounts[$foreignSymbol]['amount'] = bcadd($amounts[$foreignSymbol]['amount'], (string) $transaction['foreign_amount']);
|
||||
}
|
||||
// add primary currency amount
|
||||
if (null !== $transaction['pc_amount'] && $transaction['currency_id'] !== $this->primaryCurrency->id) {
|
||||
// add primary currency amount, but only if it is not the foreign amount or the current one.
|
||||
if (
|
||||
null !== $transaction['pc_amount']
|
||||
&& $transaction['currency_id'] !== $this->primaryCurrency->id
|
||||
&& $transaction['foreign_currency_code'] !== $this->primaryCurrency->code
|
||||
) {
|
||||
// same for foreign currency:
|
||||
$primarySymbol = $this->primaryCurrency->symbol;
|
||||
$amounts[$primarySymbol] ??= [
|
||||
'amount' => '0',
|
||||
'approximate' => true,
|
||||
'symbol' => $this->primaryCurrency->symbol,
|
||||
'decimal_places' => $this->primaryCurrency->decimal_places,
|
||||
];
|
||||
|
||||
@@ -29,6 +29,11 @@ trait SupportsGroupProcessingTrait
|
||||
protected function processRules(Collection $set, string $type): void
|
||||
{
|
||||
Log::debug(sprintf('Will now processRules("%s") for %d journal(s)', $type, $set->count()));
|
||||
|
||||
if (0 === $set->count()) {
|
||||
return;
|
||||
}
|
||||
|
||||
$array = $set->pluck('id')->toArray();
|
||||
|
||||
/** @var TransactionJournal $first */
|
||||
@@ -63,10 +68,16 @@ trait SupportsGroupProcessingTrait
|
||||
|
||||
return;
|
||||
}
|
||||
// find the earliest date in the set, based on date and _internal_previous_date
|
||||
$earliest = $objects->transactionJournals->pluck('date')->sort()->first();
|
||||
$fromInternalDate = $this->getFromInternalDate($objects->transactionJournals->pluck('id')->toArray());
|
||||
$earliest = $fromInternalDate->lt($earliest) ? $fromInternalDate : $earliest;
|
||||
if (0 === $objects->accounts->count()) {
|
||||
return;
|
||||
}
|
||||
$earliest = today()->subDays(2);
|
||||
if ($objects->transactionJournals->count() > 0) {
|
||||
// find the earliest date in the set, based on date and _internal_previous_date
|
||||
$earliest = $objects->transactionJournals->pluck('date')->sort()->first();
|
||||
$fromInternalDate = $this->getFromInternalDate($objects->transactionJournals->pluck('id')->toArray());
|
||||
$earliest = $fromInternalDate->lt($earliest) ? $fromInternalDate : $earliest;
|
||||
}
|
||||
Log::debug(sprintf('Found earliest date: %s', $earliest->toW3cString()));
|
||||
|
||||
Log::debug('Found accounts to process', $objects->accounts->pluck('id')->toArray());
|
||||
@@ -78,6 +89,8 @@ trait SupportsGroupProcessingTrait
|
||||
{
|
||||
if (!auth()->check()) {
|
||||
Log::debug('Will NOT remove period statistics for all objects, because no user detected.');
|
||||
|
||||
return;
|
||||
}
|
||||
Log::debug('Will now remove period statistics for all objects.');
|
||||
|
||||
@@ -122,6 +135,10 @@ trait SupportsGroupProcessingTrait
|
||||
{
|
||||
Log::debug(sprintf('Will now create webhook messages for %d group(s)', $groups->count()));
|
||||
|
||||
if (0 === $groups->count()) {
|
||||
return;
|
||||
}
|
||||
|
||||
/** @var TransactionGroup $first */
|
||||
$first = $groups->first();
|
||||
$user = $first->user;
|
||||
|
||||
@@ -91,7 +91,14 @@ class BudgetLimitRepository implements BudgetLimitRepositoryInterface, UserGroup
|
||||
|
||||
/** @var BudgetLimit $budgetLimit */
|
||||
foreach ($set as $budgetLimit) {
|
||||
$result = bcadd((string) $budgetLimit->amount, $result);
|
||||
if ($budgetLimit->start_date->isSameDay($start) && $budgetLimit->end_date->isSameDay($end)) {
|
||||
$result = bcadd((string) $budgetLimit->amount, $result);
|
||||
|
||||
continue;
|
||||
}
|
||||
$period = Period::make($start, $end, precision: Precision::DAY(), boundaries: Boundaries::EXCLUDE_NONE());
|
||||
$amountPerDay = $this->getDailyAmount($budgetLimit);
|
||||
$result = bcadd($result, bcmul((string) $period->length(), $amountPerDay));
|
||||
}
|
||||
|
||||
return $result;
|
||||
|
||||
@@ -60,6 +60,7 @@ class CategoryRepository implements CategoryRepositoryInterface, UserGroupInterf
|
||||
|
||||
public function categoryStartsWith(string $query, int $limit): Collection
|
||||
{
|
||||
Log::debug(sprintf('Find a category that starts with "%s"', $query));
|
||||
$search = $this->user->categories();
|
||||
if ('' !== $query) {
|
||||
$search->whereLike('name', sprintf('%s%%', $query));
|
||||
|
||||
@@ -95,6 +95,11 @@ class PeriodStatisticRepository implements PeriodStatisticRepositoryInterface, U
|
||||
#[Override]
|
||||
public function deleteStatisticsForPrefix(string $prefix, Collection $dates): void
|
||||
{
|
||||
if (null === $this->userGroup) {
|
||||
Log::warning('No user group, so cannot continue.');
|
||||
|
||||
return;
|
||||
}
|
||||
$count = $this->userGroup
|
||||
->periodStatistics()
|
||||
->where(function (Builder $q) use ($dates): void {
|
||||
|
||||
@@ -144,7 +144,7 @@ class RuleGroupRepository implements RuleGroupRepositoryInterface, UserGroupInte
|
||||
|
||||
public function getActiveRules(RuleGroup $group): Collection
|
||||
{
|
||||
return $group->rules()->where('rules.active', true)->get(['rules.*']);
|
||||
return $group->rules()->where('rules.active', true)->orderBy('rules.order', 'ASC')->get(['rules.*']);
|
||||
}
|
||||
|
||||
public function getActiveStoreRules(RuleGroup $group): Collection
|
||||
|
||||
@@ -27,6 +27,10 @@ namespace FireflyIII\Services\Internal\Support;
|
||||
use Carbon\Carbon;
|
||||
use Deprecated;
|
||||
use FireflyIII\Enums\AccountTypeEnum;
|
||||
use FireflyIII\Events\Model\TransactionGroup\CreatedSingleTransactionGroup;
|
||||
use FireflyIII\Events\Model\TransactionGroup\TransactionGroupEventFlags;
|
||||
use FireflyIII\Events\Model\TransactionGroup\TransactionGroupEventObjects;
|
||||
use FireflyIII\Events\Model\TransactionGroup\UpdatedSingleTransactionGroup;
|
||||
use FireflyIII\Exceptions\DuplicateTransactionException;
|
||||
use FireflyIII\Exceptions\FireflyException;
|
||||
use FireflyIII\Factory\AccountMetaFactory;
|
||||
@@ -384,15 +388,15 @@ trait AccountServiceTrait
|
||||
protected function createOBGroupV2(Account $account, string $openingBalance, Carbon $openingBalanceDate): TransactionGroup
|
||||
{
|
||||
Log::debug('Now going to create an OB group.');
|
||||
$language = Preferences::getForUser($account->user, 'language', 'en_US')->data;
|
||||
$language = Preferences::getForUser($account->user, 'language', 'en_US')->data;
|
||||
if (is_array($language)) {
|
||||
$language = 'en_US';
|
||||
}
|
||||
$language = (string) $language;
|
||||
$sourceId = null;
|
||||
$sourceName = null;
|
||||
$destId = null;
|
||||
$destName = null;
|
||||
$language = (string) $language;
|
||||
$sourceId = null;
|
||||
$sourceName = null;
|
||||
$destId = null;
|
||||
$destName = null;
|
||||
|
||||
// amount is positive.
|
||||
if (1 === bccomp($openingBalance, '0')) {
|
||||
@@ -414,16 +418,16 @@ trait AccountServiceTrait
|
||||
}
|
||||
|
||||
// make amount positive, regardless:
|
||||
$amount = Steam::positive($openingBalance);
|
||||
$amount = Steam::positive($openingBalance);
|
||||
|
||||
// get or grab currency:
|
||||
$currency = $this->accountRepository->getAccountCurrency($account);
|
||||
$currency = $this->accountRepository->getAccountCurrency($account);
|
||||
if (null === $currency) {
|
||||
$currency = Amount::getPrimaryCurrencyByUserGroup($account->user->userGroup);
|
||||
}
|
||||
|
||||
// submit to factory:
|
||||
$submission = [
|
||||
$submission = [
|
||||
'group_title' => null,
|
||||
'user' => $account->user,
|
||||
'user_group' => $account->user->userGroup,
|
||||
@@ -455,7 +459,7 @@ trait AccountServiceTrait
|
||||
Log::debug('Going for submission in createOBGroupV2', $submission);
|
||||
|
||||
/** @var TransactionGroupFactory $factory */
|
||||
$factory = app(TransactionGroupFactory::class);
|
||||
$factory = app(TransactionGroupFactory::class);
|
||||
$factory->setUser($account->user);
|
||||
|
||||
try {
|
||||
@@ -466,6 +470,13 @@ trait AccountServiceTrait
|
||||
|
||||
throw new FireflyException($e->getMessage(), 0, $e);
|
||||
}
|
||||
Preferences::mark();
|
||||
$objects = TransactionGroupEventObjects::collectFromTransactionGroup($group);
|
||||
$flags = new TransactionGroupEventFlags();
|
||||
$flags->applyRules = false;
|
||||
$flags->fireWebhooks = false;
|
||||
$flags->batchSubmission = false;
|
||||
event(new CreatedSingleTransactionGroup($flags, $objects));
|
||||
|
||||
return $group;
|
||||
}
|
||||
@@ -610,23 +621,23 @@ trait AccountServiceTrait
|
||||
{
|
||||
Log::debug(sprintf('Now in %s', __METHOD__));
|
||||
// create if not exists:
|
||||
$obGroup = $this->getOBGroup($account);
|
||||
$obGroup = $this->getOBGroup($account);
|
||||
if (null === $obGroup) {
|
||||
return $this->createOBGroupV2($account, $openingBalance, $openingBalanceDate);
|
||||
}
|
||||
Log::debug('Update OB group');
|
||||
|
||||
// if exists, update:
|
||||
$currency = $this->accountRepository->getAccountCurrency($account);
|
||||
$currency = $this->accountRepository->getAccountCurrency($account);
|
||||
if (null === $currency) {
|
||||
$currency = Amount::getPrimaryCurrencyByUserGroup($account->user->userGroup);
|
||||
}
|
||||
|
||||
// simply grab the first journal and change it:
|
||||
$journal = $this->getObJournal($obGroup);
|
||||
$obTransaction = $this->getOBTransaction($journal, $account);
|
||||
$accountTransaction = $this->getNotOBTransaction($journal, $account);
|
||||
$journal->date = $openingBalanceDate;
|
||||
$journal = $this->getObJournal($obGroup);
|
||||
$obTransaction = $this->getOBTransaction($journal, $account);
|
||||
$accountTransaction = $this->getNotOBTransaction($journal, $account);
|
||||
$journal->date = $openingBalanceDate;
|
||||
$journal->transactionCurrency()->associate($currency);
|
||||
|
||||
// if amount is negative:
|
||||
@@ -656,6 +667,13 @@ trait AccountServiceTrait
|
||||
$journal->save();
|
||||
$obGroup->refresh();
|
||||
|
||||
$objects = TransactionGroupEventObjects::collectFromTransactionGroup($obGroup);
|
||||
$flags = new TransactionGroupEventFlags();
|
||||
$flags->applyRules = false;
|
||||
$flags->fireWebhooks = false;
|
||||
$flags->batchSubmission = false;
|
||||
event(new UpdatedSingleTransactionGroup($flags, $objects));
|
||||
|
||||
return $obGroup;
|
||||
}
|
||||
|
||||
|
||||
@@ -38,6 +38,9 @@ class Calculator
|
||||
private static ?SplObjectStorage $intervalMap = null; // @phpstan-ignore-line
|
||||
// @phpstan-ignore-line
|
||||
// @phpstan-ignore-line
|
||||
// @phpstan-ignore-line
|
||||
// @phpstan-ignore-line
|
||||
// @phpstan-ignore-line
|
||||
private static array $intervals = [];
|
||||
|
||||
public function isAvailablePeriodicity(Periodicity $periodicity): bool
|
||||
|
||||
@@ -94,6 +94,12 @@ class ExportDataGenerator
|
||||
|
||||
// @phpstan-ignore-line
|
||||
|
||||
// @phpstan-ignore-line
|
||||
|
||||
// @phpstan-ignore-line
|
||||
|
||||
// @phpstan-ignore-line
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->accounts = new Collection();
|
||||
|
||||
@@ -83,12 +83,21 @@ trait PeriodOverview
|
||||
private Collection $statistics; // temp data holder
|
||||
// temp data holder
|
||||
// temp data holder
|
||||
// temp data holder
|
||||
// temp data holder
|
||||
// temp data holder
|
||||
private array $transactions; // temp data holder
|
||||
|
||||
// temp data holder
|
||||
|
||||
// temp data holder
|
||||
|
||||
// temp data holder
|
||||
|
||||
// temp data holder
|
||||
|
||||
// temp data holder
|
||||
|
||||
/**
|
||||
* This method returns "period entries", so nov-2015, dec-2015, etc. (this depends on the users session range)
|
||||
* and for each period, the amount of money spent and earned. This is a complex operation which is cached for
|
||||
|
||||
@@ -43,9 +43,15 @@ class AvailableBudgetEnrichment implements EnrichmentInterface
|
||||
private Collection $collection; // @phpstan-ignore-line
|
||||
// @phpstan-ignore-line
|
||||
// @phpstan-ignore-line
|
||||
// @phpstan-ignore-line
|
||||
// @phpstan-ignore-line
|
||||
// @phpstan-ignore-line
|
||||
private readonly bool $convertToPrimary; // @phpstan-ignore-line
|
||||
// @phpstan-ignore-line
|
||||
// @phpstan-ignore-line
|
||||
// @phpstan-ignore-line
|
||||
// @phpstan-ignore-line
|
||||
// @phpstan-ignore-line
|
||||
private array $currencies = [];
|
||||
private array $currencyIds = [];
|
||||
private array $ids = [];
|
||||
|
||||
@@ -43,6 +43,9 @@ class BudgetLimitEnrichment implements EnrichmentInterface
|
||||
private readonly bool $convertToPrimary; // @phpstan-ignore-line
|
||||
// @phpstan-ignore-line
|
||||
// @phpstan-ignore-line
|
||||
// @phpstan-ignore-line
|
||||
// @phpstan-ignore-line
|
||||
// @phpstan-ignore-line
|
||||
private array $currencies = [];
|
||||
private array $currencyIds = [];
|
||||
private Carbon $end;
|
||||
|
||||
@@ -45,9 +45,15 @@ class PiggyBankEnrichment implements EnrichmentInterface
|
||||
private array $accountIds = []; // @phpstan-ignore-line
|
||||
// @phpstan-ignore-line
|
||||
// @phpstan-ignore-line
|
||||
// @phpstan-ignore-line
|
||||
// @phpstan-ignore-line
|
||||
// @phpstan-ignore-line
|
||||
private array $accounts = []; // @phpstan-ignore-line
|
||||
// @phpstan-ignore-line
|
||||
// @phpstan-ignore-line
|
||||
// @phpstan-ignore-line
|
||||
// @phpstan-ignore-line
|
||||
// @phpstan-ignore-line
|
||||
private array $amounts = [];
|
||||
private Collection $collection;
|
||||
private array $currencies = [];
|
||||
|
||||
@@ -40,9 +40,15 @@ class PiggyBankEventEnrichment implements EnrichmentInterface
|
||||
private array $accountCurrencies = []; // @phpstan-ignore-line
|
||||
// @phpstan-ignore-line
|
||||
// @phpstan-ignore-line
|
||||
// @phpstan-ignore-line
|
||||
// @phpstan-ignore-line
|
||||
// @phpstan-ignore-line
|
||||
private array $accountIds = []; // @phpstan-ignore-line
|
||||
// @phpstan-ignore-line
|
||||
// @phpstan-ignore-line
|
||||
// @phpstan-ignore-line
|
||||
// @phpstan-ignore-line
|
||||
// @phpstan-ignore-line
|
||||
private Collection $collection;
|
||||
private array $currencies = [];
|
||||
private array $groupIds = [];
|
||||
|
||||
@@ -49,6 +49,9 @@ class SubscriptionEnrichment implements EnrichmentInterface
|
||||
private Collection $collection; // @phpstan-ignore-line
|
||||
// @phpstan-ignore-line
|
||||
// @phpstan-ignore-line
|
||||
// @phpstan-ignore-line
|
||||
// @phpstan-ignore-line
|
||||
// @phpstan-ignore-line
|
||||
private readonly bool $convertToPrimary;
|
||||
private ?Carbon $end = null;
|
||||
private array $mappedObjects = [];
|
||||
|
||||
@@ -59,6 +59,12 @@ class TransactionGroupEnrichment implements EnrichmentInterface
|
||||
|
||||
// @phpstan-ignore-line
|
||||
|
||||
// @phpstan-ignore-line
|
||||
|
||||
// @phpstan-ignore-line
|
||||
|
||||
// @phpstan-ignore-line
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->dateFields = ['interest_date', 'book_date', 'process_date', 'due_date', 'payment_date', 'invoice_date'];
|
||||
|
||||
@@ -45,9 +45,15 @@ class WebhookEnrichment implements EnrichmentInterface
|
||||
private array $deliveries = []; // @phpstan-ignore-line
|
||||
// @phpstan-ignore-line
|
||||
// @phpstan-ignore-line
|
||||
// @phpstan-ignore-line
|
||||
// @phpstan-ignore-line
|
||||
// @phpstan-ignore-line
|
||||
private array $ids = []; // @phpstan-ignore-line
|
||||
// @phpstan-ignore-line
|
||||
// @phpstan-ignore-line
|
||||
// @phpstan-ignore-line
|
||||
// @phpstan-ignore-line
|
||||
// @phpstan-ignore-line
|
||||
private array $responses = [];
|
||||
private array $triggers = [];
|
||||
private array $webhookDeliveries = [];
|
||||
|
||||
@@ -75,6 +75,17 @@ class Preferences
|
||||
return true;
|
||||
}
|
||||
|
||||
public function deleteForUser(User $user, string $name): bool
|
||||
{
|
||||
$fullName = sprintf('preference%s%s', auth()->user()->id, $name);
|
||||
if (Cache::has($fullName)) {
|
||||
Cache::forget($fullName);
|
||||
}
|
||||
Preference::where('user_id', $user->id)->where('name', $name)->delete();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Find by name, has no user ID in it, because the method is called from an unauthenticated route any way.
|
||||
*/
|
||||
|
||||
@@ -57,12 +57,13 @@ class QueryParser implements QueryParserInterface
|
||||
while ($this->position < $count) {
|
||||
$char = $chrArray[$this->position];
|
||||
$nextChar = $chrArray[$this->position + 1] ?? '';
|
||||
$prevChar = $chrArray[$this->position - 1] ?? '';
|
||||
// Log::debug(sprintf('Char #%d: %s', $this->position, $char));
|
||||
|
||||
// If we're in a quoted string, we treat all characters except another quote as ordinary characters
|
||||
if ($inQuotes) {
|
||||
if ('\\' === $char && '"' === $nextChar) {
|
||||
// Log::debug('BACKSLASH!');
|
||||
if ('\\' === $char && '"' === $nextChar && '\\' !== $prevChar) {
|
||||
// Log::debug('Found a backslash and the next one is a double quote.');
|
||||
// escaped quote, pretend it's a normal char and continue two places (skipping the actual character).
|
||||
$tokenUnderConstruction .= '\\'.$nextChar;
|
||||
$this->position += 2;
|
||||
|
||||
39
changelog.md
39
changelog.md
@@ -3,6 +3,45 @@
|
||||
All notable changes to this project will be documented in this file.
|
||||
This project adheres to [Semantic Versioning](http://semver.org/).
|
||||
|
||||
## v6.4.17 - 2026-02-06
|
||||
|
||||
### Added
|
||||
|
||||
- Batch processing. Firefly III now has a setting (under `/settings`) that allows you to send `"batch_processing": true` with new transactions over the API. If this setting is enabled and the value is `true`, Firefly III will not fire rules, webhooks or other events untill you either send `false` with a transaction OR use the [API end point](https://api-docs.firefly-iii.org/) `/v1/api/batch/finish`. This should speed up (large) data imports. It's a little experimental, use at your own risk.
|
||||
- [Issue 11614](https://github.com/firefly-iii/firefly-iii/issues/11614) (Add New Taiwan Dollar to Currency Seeder) reported by @nick322
|
||||
- [Issue 11246](https://github.com/firefly-iii/firefly-iii/issues/11246) (Distinguish automatically converted amount from foreign amount) reported by @jfpedroza
|
||||
|
||||
### Changed
|
||||
|
||||
- A lot of code in Firefly III is code responding to changes made by other code. These lines of code are called events, listeners, observers, handlers, etc. They were a bit of a mess and I cleaned them all up. This should greatly improve the reliability of debt amounts and running balance consistency. Bugs are always possible, let me know.
|
||||
|
||||
### Deprecated
|
||||
|
||||
- PHP 8.4 is still on my list to be disabled, beware.
|
||||
|
||||
### Fixed
|
||||
|
||||
- [Issue 11399](https://github.com/firefly-iii/firefly-iii/issues/11399) (Unusual behavior in audit logs (multi-currency)) reported by @jgmm81
|
||||
- [Discussion 11431](https://github.com/orgs/firefly-iii/discussions/11431) (Settings don't get saved) started by @PVTejas
|
||||
- [Issue 11541](https://github.com/firefly-iii/firefly-iii/issues/11541) (Display running balance fails for transactions between accounts with different currencies) reported by @SledgehammerPL
|
||||
- [Issue 11544](https://github.com/firefly-iii/firefly-iii/issues/11544) (Clean up events and handlers) reported by @JC5
|
||||
- [Issue 11546](https://github.com/firefly-iii/firefly-iii/issues/11546) (Wrong invitation expiry time) reported by @GunoH
|
||||
- [Issue 11563](https://github.com/firefly-iii/firefly-iii/issues/11563) (Tag Report/Insight API Endpoint for Tags Non Functional) reported by @Unsantae
|
||||
- [PR 11569](https://github.com/firefly-iii/firefly-iii/pull/11569) (Fix layout overflow issues with long content in v1 and v2 layouts) reported by @gian21391
|
||||
- [PR 11589](https://github.com/firefly-iii/firefly-iii/pull/11589) (apply user-selected light/dark mode to form elements (checkboxes, date picker) [Issue 8613](https://github.com/firefly-iii/firefly-iii/issues/8613) (Some minor color issues) reported by @rumpff [Issue 7620](https://github.com/firefly-iii/firefly-iii/issues/7620) (Issues with light mode) reported by @rchl) reported by @mateuszkulapl
|
||||
- [Issue 11597](https://github.com/firefly-iii/firefly-iii/issues/11597) (Changing category doesn't recompute stats) reported by @jlauwers
|
||||
- [Issue 11601](https://github.com/firefly-iii/firefly-iii/issues/11601) (Only ungrouped piggy banks are listed when creating a transaction) reported by @jgmm81
|
||||
- [Issue 11620](https://github.com/firefly-iii/firefly-iii/issues/11620) (Add database indexes to improve reporting query performance) reported by @Zakmaf
|
||||
- [PR 11632](https://github.com/firefly-iii/firefly-iii/pull/11632) (fix v2 layout dashboard transactions load) reported by @mateuszkulapl
|
||||
- [Issue 11657](https://github.com/firefly-iii/firefly-iii/issues/11657) (since v6.4.16: Backslash in category names cannot be matched in rules) reported by @37-b-j
|
||||
- [Issue 11660](https://github.com/firefly-iii/firefly-iii/issues/11660) (Display of negative values of transfers) reported by @Robubble
|
||||
- Confirming your new email address would result in an error.
|
||||
|
||||
### API
|
||||
|
||||
- [API end point](https://api-docs.firefly-iii.org/) `/v1/api/batch/finish`.
|
||||
|
||||
|
||||
## v6.4.16 - 2026-01-18
|
||||
|
||||
> [!WARNING]
|
||||
|
||||
38
composer.lock
generated
38
composer.lock
generated
@@ -10530,16 +10530,16 @@
|
||||
},
|
||||
{
|
||||
"name": "fruitcake/laravel-debugbar",
|
||||
"version": "v4.0.6",
|
||||
"version": "v4.0.7",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/fruitcake/laravel-debugbar.git",
|
||||
"reference": "0cbf2986de59f66870cee565491b81eb89f8d25e"
|
||||
"reference": "a9cc62c81cd0bda4ca7410229487638d7df786be"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/fruitcake/laravel-debugbar/zipball/0cbf2986de59f66870cee565491b81eb89f8d25e",
|
||||
"reference": "0cbf2986de59f66870cee565491b81eb89f8d25e",
|
||||
"url": "https://api.github.com/repos/fruitcake/laravel-debugbar/zipball/a9cc62c81cd0bda4ca7410229487638d7df786be",
|
||||
"reference": "a9cc62c81cd0bda4ca7410229487638d7df786be",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -10616,7 +10616,7 @@
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/fruitcake/laravel-debugbar/issues",
|
||||
"source": "https://github.com/fruitcake/laravel-debugbar/tree/v4.0.6"
|
||||
"source": "https://github.com/fruitcake/laravel-debugbar/tree/v4.0.7"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
@@ -10628,7 +10628,7 @@
|
||||
"type": "github"
|
||||
}
|
||||
],
|
||||
"time": "2026-02-04T11:48:53+00:00"
|
||||
"time": "2026-02-06T20:53:50+00:00"
|
||||
},
|
||||
{
|
||||
"name": "hamcrest/hamcrest-php",
|
||||
@@ -11198,16 +11198,16 @@
|
||||
},
|
||||
{
|
||||
"name": "php-debugbar/php-debugbar",
|
||||
"version": "v3.3.0",
|
||||
"version": "v3.3.1",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/php-debugbar/php-debugbar.git",
|
||||
"reference": "e22287890107602af6a113dc7975b3d77c542e5f"
|
||||
"reference": "afdaa2e56aca9d56b5bb2bad041bd2f6002017cf"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/php-debugbar/php-debugbar/zipball/e22287890107602af6a113dc7975b3d77c542e5f",
|
||||
"reference": "e22287890107602af6a113dc7975b3d77c542e5f",
|
||||
"url": "https://api.github.com/repos/php-debugbar/php-debugbar/zipball/afdaa2e56aca9d56b5bb2bad041bd2f6002017cf",
|
||||
"reference": "afdaa2e56aca9d56b5bb2bad041bd2f6002017cf",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
@@ -11284,7 +11284,7 @@
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/php-debugbar/php-debugbar/issues",
|
||||
"source": "https://github.com/php-debugbar/php-debugbar/tree/v3.3.0"
|
||||
"source": "https://github.com/php-debugbar/php-debugbar/tree/v3.3.1"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
@@ -11296,7 +11296,7 @@
|
||||
"type": "github"
|
||||
}
|
||||
],
|
||||
"time": "2026-01-28T12:57:47+00:00"
|
||||
"time": "2026-02-06T21:09:38+00:00"
|
||||
},
|
||||
{
|
||||
"name": "php-debugbar/symfony-bridge",
|
||||
@@ -12014,21 +12014,21 @@
|
||||
},
|
||||
{
|
||||
"name": "rector/rector",
|
||||
"version": "2.3.5",
|
||||
"version": "2.3.6",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/rectorphp/rector.git",
|
||||
"reference": "9442f4037de6a5347ae157fe8e6c7cda9d909070"
|
||||
"reference": "ca9ebb81d280cd362ea39474dabd42679e32ca6b"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/rectorphp/rector/zipball/9442f4037de6a5347ae157fe8e6c7cda9d909070",
|
||||
"reference": "9442f4037de6a5347ae157fe8e6c7cda9d909070",
|
||||
"url": "https://api.github.com/repos/rectorphp/rector/zipball/ca9ebb81d280cd362ea39474dabd42679e32ca6b",
|
||||
"reference": "ca9ebb81d280cd362ea39474dabd42679e32ca6b",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"php": "^7.4|^8.0",
|
||||
"phpstan/phpstan": "^2.1.36"
|
||||
"phpstan/phpstan": "^2.1.38"
|
||||
},
|
||||
"conflict": {
|
||||
"rector/rector-doctrine": "*",
|
||||
@@ -12062,7 +12062,7 @@
|
||||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/rectorphp/rector/issues",
|
||||
"source": "https://github.com/rectorphp/rector/tree/2.3.5"
|
||||
"source": "https://github.com/rectorphp/rector/tree/2.3.6"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
@@ -12070,7 +12070,7 @@
|
||||
"type": "github"
|
||||
}
|
||||
],
|
||||
"time": "2026-01-28T15:22:48+00:00"
|
||||
"time": "2026-02-06T14:25:06+00:00"
|
||||
},
|
||||
{
|
||||
"name": "sebastian/cli-parser",
|
||||
|
||||
@@ -78,8 +78,8 @@ return [
|
||||
'running_balance_column' => (bool)envNonEmpty('USE_RUNNING_BALANCE', true), // this is only the default value, is not used.
|
||||
// see cer.php for exchange rates feature flag.
|
||||
],
|
||||
'version' => 'develop/2026-02-06',
|
||||
'build_time' => 1770383155,
|
||||
'version' => 'develop/2026-02-07',
|
||||
'build_time' => 1770445439,
|
||||
'api_version' => '2.1.0', // field is no longer used.
|
||||
'db_version' => 28, // field is no longer used.
|
||||
|
||||
|
||||
@@ -33,16 +33,12 @@ class ChangesFor3101 extends Migration
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
}
|
||||
public function down(): void {}
|
||||
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @SuppressWarnings("PHPMD.ShortMethodName")
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
}
|
||||
public function up(): void {}
|
||||
}
|
||||
|
||||
@@ -39,9 +39,7 @@ class FixNullables extends Migration
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
}
|
||||
public function down(): void {}
|
||||
|
||||
/**
|
||||
* Run the migrations.
|
||||
|
||||
@@ -34,16 +34,12 @@ class ChangesForV474 extends Migration
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
}
|
||||
public function down(): void {}
|
||||
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @SuppressWarnings("PHPMD.ShortMethodName")
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
}
|
||||
public function up(): void {}
|
||||
}
|
||||
|
||||
@@ -37,9 +37,7 @@ class ChangesForV4711 extends Migration
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
}
|
||||
public function down(): void {}
|
||||
|
||||
/**
|
||||
* Run the migrations.
|
||||
|
||||
@@ -37,9 +37,7 @@ class ChangesForV4712 extends Migration
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
}
|
||||
public function down(): void {}
|
||||
|
||||
/**
|
||||
* Run the migrations.
|
||||
|
||||
@@ -35,9 +35,7 @@ class ExtendCurrencyInfo extends Migration
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
}
|
||||
public function down(): void {}
|
||||
|
||||
/**
|
||||
* Run the migrations.
|
||||
|
||||
@@ -34,9 +34,7 @@ return new class() extends Migration {
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
}
|
||||
public function down(): void {}
|
||||
|
||||
/**
|
||||
* Run the migrations.
|
||||
|
||||
@@ -31,9 +31,7 @@ return new class() extends Migration {
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
}
|
||||
public function down(): void {}
|
||||
|
||||
/**
|
||||
* Run the migrations.
|
||||
|
||||
@@ -51,9 +51,7 @@ return new class() extends Migration {
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
}
|
||||
public function down(): void {}
|
||||
|
||||
/**
|
||||
* Run the migrations.
|
||||
|
||||
@@ -825,7 +825,7 @@ return [
|
||||
'execute' => 'Execute',
|
||||
'apply_rule_group_selection' => 'Apply rule group ":title" to a selection of your transactions',
|
||||
'apply_rule_group_selection_intro' => 'Rule groups like ":title" are normally only applied to new or updated transactions, but you can tell Firefly III to run all the rules in this group on a selection of your existing transactions. This can be useful when you have updated a group of rules and you need the changes to be applied to all of your other transactions.',
|
||||
'applied_rule_group_selection' => 'Rule group ":title" has been applied to your selection.',
|
||||
'applied_rule_group_selection' => '{0} No transactions in your selection were changed by the rules in rule group ":title".|[1] One transaction in your selection was changed by the rules in rule group ":title".|[2,*] :count transactions in your selection were changed by the rules in rule group ":title".',
|
||||
'rule_run_after_creation' => 'If you check this box, you get the opportunity to run the rule after it has been created.',
|
||||
'rule_run_after_edit' => 'If you check this box, you get the opportunity to run the rule after it has been updated.',
|
||||
|
||||
|
||||
@@ -64,7 +64,7 @@
|
||||
{% if group.transaction_type == 'Deposit' %}
|
||||
{{ formatAmountBySymbol(sum.amount*-1, sum.currency_symbol, sum.currency_decimal_places) }}
|
||||
{% if convertToPrimary and 0 != sum.pc_amount %}
|
||||
({{ formatAmountBySymbol(sum.pc_amount*-1, primaryCurrency.symbol, primaryCurrency.decimal_places) }})
|
||||
(~ {{ formatAmountBySymbol(sum.pc_amount*-1, primaryCurrency.symbol, primaryCurrency.decimal_places) }})
|
||||
{% endif %}
|
||||
{% if loop.index != group.sums|length %},{% endif %}
|
||||
|
||||
@@ -72,14 +72,14 @@
|
||||
<span class="text-info money-transfer">
|
||||
{{ formatAmountBySymbol(sum.amount*-1, sum.currency_symbol, sum.currency_decimal_places, false) }}
|
||||
{% if convertToPrimary and 0 != sum.pc_amount %}
|
||||
({{ formatAmountBySymbol(sum.pc_amount*-1, primaryCurrency.symbol, primaryCurrency.decimal_places) }})
|
||||
(~ {{ formatAmountBySymbol(sum.pc_amount*-1, primaryCurrency.symbol, primaryCurrency.decimal_places) }})
|
||||
{% endif %}
|
||||
{% if loop.index != group.sums|length %},{% endif %}
|
||||
</span>
|
||||
{% else %}
|
||||
{{ formatAmountBySymbol(sum.amount, sum.currency_symbol, sum.currency_decimal_places) }}
|
||||
{% if convertToPrimary and 0 != sum.pc_amount %}
|
||||
({{ formatAmountBySymbol(sum.pc_amount*-1, primaryCurrency.symbol, primaryCurrency.decimal_places) }})
|
||||
(~ {{ formatAmountBySymbol(sum.pc_amount*-1, primaryCurrency.symbol, primaryCurrency.decimal_places) }})
|
||||
{% endif %}
|
||||
{% if loop.index != group.sums|length %},{% endif %}
|
||||
{% endif %}
|
||||
@@ -174,13 +174,18 @@
|
||||
{% endif %}
|
||||
{# primary currency amount of deposit #}
|
||||
{% if convertToPrimary and 0 != transaction.pc_amount %}
|
||||
({{ formatAmountBySymbol(transaction.pc_amount*-1, primaryCurrency.symbol, primaryCurrency.decimal_places) }})
|
||||
(~ {{ formatAmountBySymbol(transaction.pc_amount*-1, primaryCurrency.symbol, primaryCurrency.decimal_places) }})
|
||||
{% endif %}
|
||||
{# transfer #}
|
||||
{% elseif transaction.transaction_type_type == 'Transfer' %}
|
||||
<span class="text-info money-transfer">
|
||||
{# amount of transfer #}
|
||||
{% if transaction.source_account_id == account.id %}
|
||||
{{ formatAmountBySymbol(transaction.amount, transaction.currency_symbol, transaction.currency_decimal_places, false) }}
|
||||
{% endif %}
|
||||
{% if transaction.source_account_id != account.id %}
|
||||
{{ formatAmountBySymbol(transaction.amount*-1, transaction.currency_symbol, transaction.currency_decimal_places, false) }}
|
||||
{% endif %}
|
||||
|
||||
{# foreign amount of transfer #}
|
||||
{% if null != transaction.foreign_amount %}
|
||||
@@ -189,7 +194,7 @@
|
||||
|
||||
{# primary currency amount of transfer #}
|
||||
{% if convertToPrimary and 0 != transaction.pc_amount %}
|
||||
({{ formatAmountBySymbol(transaction.pc_amount*-1, primaryCurrency.symbol, primaryCurrency.decimal_places) }})
|
||||
(~ {{ formatAmountBySymbol(transaction.pc_amount*-1, primaryCurrency.symbol, primaryCurrency.decimal_places) }})
|
||||
{% endif %}
|
||||
</span>
|
||||
{# opening balance #}
|
||||
@@ -200,7 +205,7 @@
|
||||
({{ formatAmountBySymbol(transaction.foreign_amount*-1, transaction.foreign_currency_symbol, transaction.foreign_currency_decimal_places) }})
|
||||
{% endif %}
|
||||
{% if convertToPrimary and 0 != transaction.pc_amount %}
|
||||
({{ formatAmountBySymbol(transaction.pc_amount*-1, primaryCurrency.symbol, primaryCurrency.decimal_places) }})
|
||||
(~ {{ formatAmountBySymbol(transaction.pc_amount*-1, primaryCurrency.symbol, primaryCurrency.decimal_places) }})
|
||||
{% endif %}
|
||||
{% else %}
|
||||
{{ formatAmountBySymbol(transaction.amount, transaction.currency_symbol, transaction.currency_decimal_places) }}
|
||||
@@ -208,7 +213,7 @@
|
||||
({{ formatAmountBySymbol(transaction.foreign_amount, transaction.foreign_currency_symbol, transaction.foreign_currency_decimal_places) }})
|
||||
{% endif %}
|
||||
{% if convertToPrimary and 0 != transaction.pc_amount %}
|
||||
({{ formatAmountBySymbol(transaction.pc_amount, primaryCurrency.symbol, primaryCurrency.decimal_places) }})
|
||||
(~ {{ formatAmountBySymbol(transaction.pc_amount, primaryCurrency.symbol, primaryCurrency.decimal_places) }})
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{# reconciliation #}
|
||||
@@ -219,7 +224,7 @@
|
||||
({{ formatAmountBySymbol(transaction.foreign_amount*-1, transaction.foreign_currency_symbol, transaction.foreign_currency_decimal_places) }})
|
||||
{% endif %}
|
||||
{% if convertToPrimary and 0 != transaction.pc_amount %}
|
||||
({{ formatAmountBySymbol(transaction.pc_amount*-1, primaryCurrency.symbol, primaryCurrency.decimal_places) }})
|
||||
(~ {{ formatAmountBySymbol(transaction.pc_amount*-1, primaryCurrency.symbol, primaryCurrency.decimal_places) }})
|
||||
{% endif %}
|
||||
{% else %}
|
||||
{{ formatAmountBySymbol(transaction.amount, transaction.currency_symbol, transaction.currency_decimal_places) }}
|
||||
@@ -227,7 +232,7 @@
|
||||
({{ formatAmountBySymbol(transaction.foreign_amount, transaction.foreign_currency_symbol, transaction.foreign_currency_decimal_places) }})
|
||||
{% endif %}
|
||||
{% if convertToPrimary and 0 != transaction.pc_amount %}
|
||||
({{ formatAmountBySymbol(transaction.pc_amount, primaryCurrency.symbol, primaryCurrency.decimal_places) }})
|
||||
(~ {{ formatAmountBySymbol(transaction.pc_amount, primaryCurrency.symbol, primaryCurrency.decimal_places) }})
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{# liability credit #}
|
||||
@@ -238,7 +243,7 @@
|
||||
({{ formatAmountBySymbol(transaction.foreign_amount, transaction.foreign_currency_symbol, transaction.foreign_currency_decimal_places) }})
|
||||
{% endif %}
|
||||
{% if convertToPrimary and 0 != transaction.pc_amount %}
|
||||
({{ formatAmountBySymbol(transaction.pc_amount, primaryCurrency.symbol, primaryCurrency.decimal_places) }})
|
||||
(~ {{ formatAmountBySymbol(transaction.pc_amount, primaryCurrency.symbol, primaryCurrency.decimal_places) }})
|
||||
{% endif %}
|
||||
{% else %}
|
||||
{{ formatAmountBySymbol(transaction.amount*-1, transaction.currency_symbol, transaction.currency_decimal_places) }}
|
||||
@@ -246,7 +251,7 @@
|
||||
({{ formatAmountBySymbol(transaction.foreign_amount*-1, transaction.foreign_currency_symbol, transaction.foreign_currency_decimal_places) }})
|
||||
{% endif %}
|
||||
{% if convertToPrimary and 0 != transaction.pc_amount %}
|
||||
({{ formatAmountBySymbol(transaction.pc_amount*-1, primaryCurrency.symbol, primaryCurrency.decimal_places) }})
|
||||
(~ {{ formatAmountBySymbol(transaction.pc_amount*-1, primaryCurrency.symbol, primaryCurrency.decimal_places) }})
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
@@ -260,14 +265,14 @@
|
||||
{% if null != transaction.foreign_amount %}
|
||||
({{ formatAmountBySymbol(transaction.foreign_amount, transaction.foreign_currency_symbol, transaction.foreign_currency_decimal_places) }})
|
||||
{% endif %}
|
||||
{# primary currency amount of withdrawal #}
|
||||
{% if convertToPrimary and 0 != transaction.pc_amount %}
|
||||
({{ formatAmountBySymbol(transaction.pc_amount, primaryCurrency.symbol, primaryCurrency.decimal_places) }})
|
||||
{# primary currency amount of withdrawal, if not in foreign currency #}
|
||||
{% if convertToPrimary and 0 != transaction.pc_amount and primaryCurrency.id != transaction.foreign_currency_id %}
|
||||
(~ {{ formatAmountBySymbol(transaction.pc_amount, primaryCurrency.symbol, primaryCurrency.decimal_places) }})
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
</td>
|
||||
{% if (fireflyiiiconfig('use_running_balance', true)) %}
|
||||
<td>
|
||||
<td style="{{ style|raw }};text-align:right">
|
||||
{# RUNNING BALANCE #}
|
||||
{% if (null == transaction.balance_dirty or false == transaction.balance_dirty) and null != transaction.destination_balance_after and null != transaction.source_balance_after %}
|
||||
{% if transaction.transaction_type_type == 'Deposit' %}
|
||||
@@ -304,9 +309,9 @@
|
||||
{% endif %}
|
||||
{% elseif transaction.transaction_type_type == 'Opening balance' %}
|
||||
{% if account.id == transaction.source_account_id %}
|
||||
<span title="Opening balance, dest">{{ formatAmountBySymbol(transaction.destination_balance_after, transaction.currency_symbol, transaction.currency_decimal_places) }}</span>
|
||||
{% elseif account.id == transaction.destination_account_id %}
|
||||
<span title="Opening balance, src">{{ formatAmountBySymbol(transaction.source_balance_after, transaction.currency_symbol, transaction.currency_decimal_places) }}</span>
|
||||
{% elseif account.id == transaction.destination_account_id %}
|
||||
<span title="Opening balance, dest">{{ formatAmountBySymbol(transaction.destination_balance_after, transaction.currency_symbol, transaction.currency_decimal_places) }}</span>
|
||||
{% else %}
|
||||
-
|
||||
{% endif %}
|
||||
|
||||
@@ -164,13 +164,12 @@
|
||||
<td>
|
||||
{% for amount in amounts %}
|
||||
{% if first.transaction_type_type == 'Withdrawal' %}
|
||||
{{ formatAmountBySymbol(amount.amount,amount.symbol, amount.decimal_places) }}{% if loop.index0 != amounts|length -1 %}, {% endif %}
|
||||
{% if amount.approximate %}~ {% endif %}{{ formatAmountBySymbol(amount.amount,amount.symbol, amount.decimal_places) }}{% if loop.index0 != amounts|length -1 %}, {% endif %}
|
||||
{% elseif first.transaction_type_type == 'Deposit' %}
|
||||
{{ formatAmountBySymbol(amount.amount*-1,amount.symbol, amount.decimal_places) }}{% if loop.index0 != amounts|length -1 %}, {% endif %}
|
||||
{% if amount.approximate %}~ {% endif %}{{ formatAmountBySymbol(amount.amount*-1,amount.symbol, amount.decimal_places) }}{% if loop.index0 != amounts|length -1 %}, {% endif %}
|
||||
{% elseif first.transaction_type_type == 'Transfer' %}
|
||||
<span class="text-info money-transfer">
|
||||
|
||||
{{ formatAmountBySymbol(amount.amount*-1, amount.symbol, amount.decimal_places, false) }}{% if loop.index0 != amounts|length -1 %}, {% endif %}
|
||||
{% if amount.approximate %}~ {% endif %}{{ formatAmountBySymbol(amount.amount*-1, amount.symbol, amount.decimal_places, false) }}{% if loop.index0 != amounts|length -1 %}, {% endif %}
|
||||
</span>
|
||||
{% elseif first.transaction_type_type == 'Opening balance' %}
|
||||
{# Opening balance stored amount is always negative: find out which way the money goes #}
|
||||
@@ -315,15 +314,15 @@
|
||||
</span>
|
||||
{% endif %}
|
||||
|
||||
<!-- do primary currency amount -->
|
||||
{% if null != journal.pc_amount and primaryCurrency.id != journal.currency_id %}
|
||||
<!-- do primary currency amount, if foreign amount is not the same. -->
|
||||
{% if null != journal.pc_amount and primaryCurrency.id != journal.currency_id and primaryCurrency.id != journal.foreign_currency_id %}
|
||||
{% if first.transaction_type_type == 'Withdrawal' %}
|
||||
({{ formatAmountBySymbol(journal.pc_amount, primaryCurrency.symbol, primaryCurrency.decimal_places) }})
|
||||
(~ {{ formatAmountBySymbol(journal.pc_amount, primaryCurrency.symbol, primaryCurrency.decimal_places) }})
|
||||
{% elseif first.transaction_type_type == 'Deposit' %}
|
||||
({{ formatAmountBySymbol(journal.pc_amount*-1, primaryCurrency.symbol, primaryCurrency.decimal_places) }})
|
||||
(~ {{ formatAmountBySymbol(journal.pc_amount*-1, primaryCurrency.symbol, primaryCurrency.decimal_places) }})
|
||||
{% elseif first.transaction_type_type == 'Transfer' %}
|
||||
<span class="text-info money-transfer">
|
||||
({{ formatAmountBySymbol(journal.pc_amount*-1, primaryCurrency.symbol, primaryCurrency.decimal_places, false) }})
|
||||
(~ {{ formatAmountBySymbol(journal.pc_amount*-1, primaryCurrency.symbol, primaryCurrency.decimal_places, false) }})
|
||||
</span>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
Reference in New Issue
Block a user