Auto commit for release 'develop' on 2024-12-30

This commit is contained in:
github-actions
2024-12-30 04:12:18 +01:00
parent 9f25880a59
commit 0579c8565d
40 changed files with 301 additions and 303 deletions

View File

@@ -406,16 +406,16 @@
}, },
{ {
"name": "friendsofphp/php-cs-fixer", "name": "friendsofphp/php-cs-fixer",
"version": "v3.65.0", "version": "v3.66.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer.git", "url": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer.git",
"reference": "79d4f3e77b250a7d8043d76c6af8f0695e8a469f" "reference": "5f5f2a142ff36b93c41885bca29cc5f861c013e6"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/zipball/79d4f3e77b250a7d8043d76c6af8f0695e8a469f", "url": "https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/zipball/5f5f2a142ff36b93c41885bca29cc5f861c013e6",
"reference": "79d4f3e77b250a7d8043d76c6af8f0695e8a469f", "reference": "5f5f2a142ff36b93c41885bca29cc5f861c013e6",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@@ -441,7 +441,7 @@
"symfony/polyfill-mbstring": "^1.28", "symfony/polyfill-mbstring": "^1.28",
"symfony/polyfill-php80": "^1.28", "symfony/polyfill-php80": "^1.28",
"symfony/polyfill-php81": "^1.28", "symfony/polyfill-php81": "^1.28",
"symfony/process": "^5.4 || ^6.0 || ^7.0", "symfony/process": "^5.4 || ^6.0 || ^7.0 <7.2",
"symfony/stopwatch": "^5.4 || ^6.0 || ^7.0" "symfony/stopwatch": "^5.4 || ^6.0 || ^7.0"
}, },
"require-dev": { "require-dev": {
@@ -497,7 +497,7 @@
], ],
"support": { "support": {
"issues": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues", "issues": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues",
"source": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/tree/v3.65.0" "source": "https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/tree/v3.66.0"
}, },
"funding": [ "funding": [
{ {
@@ -505,7 +505,7 @@
"type": "github" "type": "github"
} }
], ],
"time": "2024-11-25T00:39:24+00:00" "time": "2024-12-29T13:46:23+00:00"
}, },
{ {
"name": "psr/container", "name": "psr/container",
@@ -2246,16 +2246,16 @@
}, },
{ {
"name": "symfony/process", "name": "symfony/process",
"version": "v7.2.0", "version": "v7.1.8",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/process.git", "url": "https://github.com/symfony/process.git",
"reference": "d34b22ba9390ec19d2dd966c40aa9e8462f27a7e" "reference": "42783370fda6e538771f7c7a36e9fa2ee3a84892"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/process/zipball/d34b22ba9390ec19d2dd966c40aa9e8462f27a7e", "url": "https://api.github.com/repos/symfony/process/zipball/42783370fda6e538771f7c7a36e9fa2ee3a84892",
"reference": "d34b22ba9390ec19d2dd966c40aa9e8462f27a7e", "reference": "42783370fda6e538771f7c7a36e9fa2ee3a84892",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@@ -2287,7 +2287,7 @@
"description": "Executes commands in sub-processes", "description": "Executes commands in sub-processes",
"homepage": "https://symfony.com", "homepage": "https://symfony.com",
"support": { "support": {
"source": "https://github.com/symfony/process/tree/v7.2.0" "source": "https://github.com/symfony/process/tree/v7.1.8"
}, },
"funding": [ "funding": [
{ {
@@ -2303,7 +2303,7 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2024-11-06T14:24:19+00:00" "time": "2024-11-06T14:23:19+00:00"
}, },
{ {
"name": "symfony/service-contracts", "name": "symfony/service-contracts",

View File

@@ -94,8 +94,8 @@ abstract class Controller extends BaseController
if ($page < 1) { if ($page < 1) {
$page = 1; $page = 1;
} }
if ($page > pow(2,16)) { if ($page > 2 ** 16) {
$page = pow(2, 16); $page = 2 ** 16;
} }
$bag->set('page', $page); $bag->set('page', $page);

View File

@@ -93,8 +93,8 @@ class Controller extends BaseController
if ($page < 1) { if ($page < 1) {
$page = 1; $page = 1;
} }
if ($page > pow(2,16)) { if ($page > 2 ** 16) {
$page = pow(2, 16); $page = 2 ** 16;
} }
$bag->set('page', $page); $bag->set('page', $page);

View File

@@ -62,10 +62,6 @@ class PiggyBankFactory
/** /**
* Store a piggy bank or come back with an exception. * Store a piggy bank or come back with an exception.
*
* @param array $data
*
* @return PiggyBank
*/ */
public function store(array $data): PiggyBank public function store(array $data): PiggyBank
{ {
@@ -117,6 +113,7 @@ class PiggyBankFactory
$piggyBank->encrypted = false; $piggyBank->encrypted = false;
$piggyBank->save(); $piggyBank->save();
$piggyBank->touch(); $piggyBank->touch();
return $piggyBank; return $piggyBank;
} }
@@ -132,6 +129,7 @@ class PiggyBankFactory
$currency = $this->currencyRepository->find((int) ($data['transaction_currency_id'] ?? 0)); $currency = $this->currencyRepository->find((int) ($data['transaction_currency_id'] ?? 0));
} }
$currency ??= $defaultCurrency; $currency ??= $defaultCurrency;
return $currency; return $currency;
} }
@@ -144,12 +142,12 @@ class PiggyBankFactory
} }
// first find by ID: // first find by ID:
if ($piggyBankId > 0) { if ($piggyBankId > 0) {
$piggyBank = PiggyBank $piggyBank = PiggyBank::leftJoin('account_piggy_bank', 'account_piggy_bank.piggy_bank_id', '=', 'piggy_banks.id')
::leftJoin('account_piggy_bank', 'account_piggy_bank.piggy_bank_id', '=', 'piggy_banks.id')
->leftJoin('accounts', 'accounts.id', '=', 'account_piggy_bank.account_id') ->leftJoin('accounts', 'accounts.id', '=', 'account_piggy_bank.account_id')
->where('accounts.user_id', $this->user->id) ->where('accounts.user_id', $this->user->id)
->where('piggy_banks.id', $piggyBankId) ->where('piggy_banks.id', $piggyBankId)
->first(['piggy_banks.*']); ->first(['piggy_banks.*'])
;
if (null !== $piggyBank) { if (null !== $piggyBank) {
return $piggyBank; return $piggyBank;
} }
@@ -169,12 +167,12 @@ class PiggyBankFactory
public function findByName(string $name): ?PiggyBank public function findByName(string $name): ?PiggyBank
{ {
return PiggyBank return PiggyBank::leftJoin('account_piggy_bank', 'account_piggy_bank.piggy_bank_id', '=', 'piggy_banks.id')
::leftJoin('account_piggy_bank', 'account_piggy_bank.piggy_bank_id', '=', 'piggy_banks.id')
->leftJoin('accounts', 'accounts.id', '=', 'account_piggy_bank.account_id') ->leftJoin('accounts', 'accounts.id', '=', 'account_piggy_bank.account_id')
->where('accounts.user_id', $this->user->id) ->where('accounts.user_id', $this->user->id)
->where('piggy_banks.name', $name) ->where('piggy_banks.name', $name)
->first(['piggy_banks.*']); ->first(['piggy_banks.*'])
;
} }
private function setOrder(PiggyBank $piggyBank, array $data): PiggyBank private function setOrder(PiggyBank $piggyBank, array $data): PiggyBank
@@ -186,6 +184,7 @@ class PiggyBankFactory
} }
$piggyBank->order = $order; $piggyBank->order = $order;
$piggyBank->saveQuietly(); $piggyBank->saveQuietly();
return $piggyBank; return $piggyBank;
} }
@@ -193,8 +192,7 @@ class PiggyBankFactory
public function resetOrder(): void public function resetOrder(): void
{ {
// TODO duplicate code // TODO duplicate code
$set = PiggyBank $set = PiggyBank::leftJoin('account_piggy_bank', 'account_piggy_bank.piggy_bank_id', '=', 'piggy_banks.id')
::leftJoin('account_piggy_bank', 'account_piggy_bank.piggy_bank_id', '=', 'piggy_banks.id')
->leftJoin('accounts', 'accounts.id', '=', 'account_piggy_bank.account_id') ->leftJoin('accounts', 'accounts.id', '=', 'account_piggy_bank.account_id')
->where('accounts.user_id', $this->user->id) ->where('accounts.user_id', $this->user->id)
->with( ->with(
@@ -202,7 +200,8 @@ class PiggyBankFactory
'objectGroups', 'objectGroups',
] ]
) )
->orderBy('piggy_banks.order', 'ASC')->get(['piggy_banks.*']); ->orderBy('piggy_banks.order', 'ASC')->get(['piggy_banks.*'])
;
$current = 1; $current = 1;
foreach ($set as $piggyBank) { foreach ($set as $piggyBank) {
if ($piggyBank->order !== $current) { if ($piggyBank->order !== $current) {
@@ -214,7 +213,6 @@ class PiggyBankFactory
} }
} }
private function getMaxOrder(): int private function getMaxOrder(): int
{ {
return (int) $this->piggyBankRepository->getPiggyBanks()->max('order'); return (int) $this->piggyBankRepository->getPiggyBanks()->max('order');

View File

@@ -131,9 +131,11 @@ class PreferencesEventHandler
->where('transaction_journals.user_group_id', $userGroup->id) ->where('transaction_journals.user_group_id', $userGroup->id)
->where(static function (Builder $q): void { ->where(static function (Builder $q): void {
$q->whereNotNull('native_amount') $q->whereNotNull('native_amount')
->orWhereNotNull('native_foreign_amount'); ->orWhereNotNull('native_foreign_amount')
;
}) })
->update(['native_amount' => null, 'native_foreign_amount' => null]); ->update(['native_amount' => null, 'native_foreign_amount' => null])
;
Log::debug(sprintf('Reset %d transactions.', $success)); Log::debug(sprintf('Reset %d transactions.', $success));
} }
} }

View File

@@ -39,7 +39,7 @@ class AvailableBudgetObserver
public function updated(AvailableBudget $availableBudget): void public function updated(AvailableBudget $availableBudget): void
{ {
//Log::debug('Observe "updated" of an available budget.'); // Log::debug('Observe "updated" of an available budget.');
$this->updateNativeAmount($availableBudget); $this->updateNativeAmount($availableBudget);
} }

View File

@@ -51,7 +51,7 @@ class AutoBudget extends Model
'amount' => 'string', 'amount' => 'string',
'native_amount' => 'string', 'native_amount' => 'string',
]; ];
protected $fillable = ['budget_id', 'amount', 'period','native_amount']; protected $fillable = ['budget_id', 'amount', 'period', 'native_amount'];
public function budget(): BelongsTo public function budget(): BelongsTo
{ {

View File

@@ -53,7 +53,7 @@ class AvailableBudget extends Model
'native_amount' => 'string', 'native_amount' => 'string',
]; ];
protected $fillable = ['user_id', 'user_group_id', 'transaction_currency_id', 'amount', 'start_date', 'end_date', 'start_date_tz', 'end_date_tz','native_amount']; protected $fillable = ['user_id', 'user_group_id', 'transaction_currency_id', 'amount', 'start_date', 'end_date', 'start_date_tz', 'end_date_tz', 'native_amount'];
/** /**
* Route binder. Converts the key in the URL to the specified object (or throw 404). * Route binder. Converts the key in the URL to the specified object (or throw 404).

View File

@@ -56,7 +56,7 @@ class PiggyBank extends Model
'native_target_amount' => 'string', 'native_target_amount' => 'string',
]; ];
protected $fillable = ['name', 'order', 'target_amount', 'start_date', 'start_date_tz', 'target_date', 'target_date_tz', 'active', 'transaction_currency_id','native_target_amount']; protected $fillable = ['name', 'order', 'target_amount', 'start_date', 'start_date_tz', 'target_date', 'target_date_tz', 'active', 'transaction_currency_id', 'native_target_amount'];
/** /**
* Route binder. Converts the key in the URL to the specified object (or throw 404). * Route binder. Converts the key in the URL to the specified object (or throw 404).

View File

@@ -45,7 +45,7 @@ class PiggyBankEvent extends Model
'amount' => 'native_string', 'amount' => 'native_string',
]; ];
protected $fillable = ['piggy_bank_id', 'transaction_journal_id', 'date', 'date_tz', 'amount','native_amount']; protected $fillable = ['piggy_bank_id', 'transaction_journal_id', 'date', 'date_tz', 'amount', 'native_amount'];
protected $hidden = ['amount_encrypted']; protected $hidden = ['amount_encrypted'];

View File

@@ -28,12 +28,10 @@ use Carbon\Carbon;
use FireflyIII\Enums\TransactionTypeEnum; use FireflyIII\Enums\TransactionTypeEnum;
use FireflyIII\Helpers\Collector\GroupCollectorInterface; use FireflyIII\Helpers\Collector\GroupCollectorInterface;
use FireflyIII\Models\TransactionCurrency; use FireflyIII\Models\TransactionCurrency;
use FireflyIII\Support\Facades\Amount;
use FireflyIII\Support\Report\Summarizer\TransactionSummarizer; use FireflyIII\Support\Report\Summarizer\TransactionSummarizer;
use FireflyIII\User; use FireflyIII\User;
use Illuminate\Contracts\Auth\Authenticatable; use Illuminate\Contracts\Auth\Authenticatable;
use Illuminate\Support\Collection; use Illuminate\Support\Collection;
use Illuminate\Support\Facades\Log;
/** /**
* Class OperationsRepository * Class OperationsRepository
@@ -68,7 +66,7 @@ class OperationsRepository implements OperationsRepositoryInterface
return $collector->getExtractedJournals(); return $collector->getExtractedJournals();
} }
public function setUser(null | Authenticatable | User $user): void public function setUser(null|Authenticatable|User $user): void
{ {
if ($user instanceof User) { if ($user instanceof User) {
$this->user = $user; $this->user = $user;
@@ -132,8 +130,7 @@ class OperationsRepository implements OperationsRepositoryInterface
?Collection $accounts = null, ?Collection $accounts = null,
?Collection $expense = null, ?Collection $expense = null,
?TransactionCurrency $currency = null ?TransactionCurrency $currency = null
): array ): array {
{
$journals = $this->getTransactionsForSum(TransactionTypeEnum::WITHDRAWAL->value, $start, $end, $accounts, $expense, $currency); $journals = $this->getTransactionsForSum(TransactionTypeEnum::WITHDRAWAL->value, $start, $end, $accounts, $expense, $currency);
return $this->groupByCurrency($journals, 'negative'); return $this->groupByCurrency($journals, 'negative');
@@ -150,8 +147,7 @@ class OperationsRepository implements OperationsRepositoryInterface
?Collection $accounts = null, ?Collection $accounts = null,
?Collection $opposing = null, ?Collection $opposing = null,
?TransactionCurrency $currency = null ?TransactionCurrency $currency = null
): array ): array {
{
$start->startOfDay(); $start->startOfDay();
$end->endOfDay(); $end->endOfDay();
@@ -191,7 +187,8 @@ class OperationsRepository implements OperationsRepositoryInterface
/** @var GroupCollectorInterface $collector */ /** @var GroupCollectorInterface $collector */
$collector = app(GroupCollectorInterface::class); $collector = app(GroupCollectorInterface::class);
$collector->setUser($this->user)->setRange($start, $end)->setTypes([$type])->withAccountInformation() $collector->setUser($this->user)->setRange($start, $end)->setTypes([$type])->withAccountInformation()
->setForeignCurrency($currency); ->setForeignCurrency($currency)
;
if (TransactionTypeEnum::WITHDRAWAL->value === $type) { if (TransactionTypeEnum::WITHDRAWAL->value === $type) {
if (null !== $accounts) { if (null !== $accounts) {
$collector->setSourceAccounts($accounts); $collector->setSourceAccounts($accounts);
@@ -221,6 +218,7 @@ class OperationsRepository implements OperationsRepositoryInterface
private function groupByCurrency(array $journals, string $direction): array private function groupByCurrency(array $journals, string $direction): array
{ {
$summarizer = new TransactionSummarizer($this->user); $summarizer = new TransactionSummarizer($this->user);
return $summarizer->groupByCurrencyId($journals, $direction); return $summarizer->groupByCurrencyId($journals, $direction);
} }
@@ -233,8 +231,7 @@ class OperationsRepository implements OperationsRepositoryInterface
?Collection $accounts = null, ?Collection $accounts = null,
?Collection $expense = null, ?Collection $expense = null,
?TransactionCurrency $currency = null ?TransactionCurrency $currency = null
): array ): array {
{
$journals = $this->getTransactionsForSum(TransactionTypeEnum::WITHDRAWAL->value, $start, $end, $accounts, $expense, $currency); $journals = $this->getTransactionsForSum(TransactionTypeEnum::WITHDRAWAL->value, $start, $end, $accounts, $expense, $currency);
return $this->groupByDirection($journals, 'destination', 'negative'); return $this->groupByDirection($journals, 'destination', 'negative');
@@ -243,6 +240,7 @@ class OperationsRepository implements OperationsRepositoryInterface
private function groupByDirection(array $journals, string $direction, string $method): array private function groupByDirection(array $journals, string $direction, string $method): array
{ {
$summarizer = new TransactionSummarizer($this->user); $summarizer = new TransactionSummarizer($this->user);
return $summarizer->groupByDirection($journals, $method, $direction); return $summarizer->groupByDirection($journals, $method, $direction);
} }
@@ -255,8 +253,7 @@ class OperationsRepository implements OperationsRepositoryInterface
?Collection $accounts = null, ?Collection $accounts = null,
?Collection $expense = null, ?Collection $expense = null,
?TransactionCurrency $currency = null ?TransactionCurrency $currency = null
): array ): array {
{
$journals = $this->getTransactionsForSum(TransactionTypeEnum::WITHDRAWAL->value, $start, $end, $accounts, $expense, $currency); $journals = $this->getTransactionsForSum(TransactionTypeEnum::WITHDRAWAL->value, $start, $end, $accounts, $expense, $currency);
return $this->groupByDirection($journals, 'source', 'negative'); return $this->groupByDirection($journals, 'source', 'negative');
@@ -271,8 +268,7 @@ class OperationsRepository implements OperationsRepositoryInterface
?Collection $accounts = null, ?Collection $accounts = null,
?Collection $revenue = null, ?Collection $revenue = null,
?TransactionCurrency $currency = null ?TransactionCurrency $currency = null
): array ): array {
{
$journals = $this->getTransactionsForSum(TransactionTypeEnum::DEPOSIT->value, $start, $end, $accounts, $revenue, $currency); $journals = $this->getTransactionsForSum(TransactionTypeEnum::DEPOSIT->value, $start, $end, $accounts, $revenue, $currency);
return $this->groupByCurrency($journals, 'positive'); return $this->groupByCurrency($journals, 'positive');
@@ -287,8 +283,7 @@ class OperationsRepository implements OperationsRepositoryInterface
?Collection $accounts = null, ?Collection $accounts = null,
?Collection $revenue = null, ?Collection $revenue = null,
?TransactionCurrency $currency = null ?TransactionCurrency $currency = null
): array ): array {
{
$journals = $this->getTransactionsForSum(TransactionTypeEnum::DEPOSIT->value, $start, $end, $accounts, $revenue, $currency); $journals = $this->getTransactionsForSum(TransactionTypeEnum::DEPOSIT->value, $start, $end, $accounts, $revenue, $currency);
return $this->groupByDirection($journals, 'destination', 'positive'); return $this->groupByDirection($journals, 'destination', 'positive');
@@ -303,8 +298,7 @@ class OperationsRepository implements OperationsRepositoryInterface
?Collection $accounts = null, ?Collection $accounts = null,
?Collection $revenue = null, ?Collection $revenue = null,
?TransactionCurrency $currency = null ?TransactionCurrency $currency = null
): array ): array {
{
$journals = $this->getTransactionsForSum(TransactionTypeEnum::DEPOSIT->value, $start, $end, $accounts, $revenue, $currency); $journals = $this->getTransactionsForSum(TransactionTypeEnum::DEPOSIT->value, $start, $end, $accounts, $revenue, $currency);
return $this->groupByDirection($journals, 'source', 'positive'); return $this->groupByDirection($journals, 'source', 'positive');

View File

@@ -29,12 +29,10 @@ use FireflyIII\Enums\TransactionTypeEnum;
use FireflyIII\Helpers\Collector\GroupCollectorInterface; use FireflyIII\Helpers\Collector\GroupCollectorInterface;
use FireflyIII\Models\TransactionCurrency; use FireflyIII\Models\TransactionCurrency;
use FireflyIII\Models\TransactionType; use FireflyIII\Models\TransactionType;
use FireflyIII\Support\Facades\Amount;
use FireflyIII\Support\Report\Summarizer\TransactionSummarizer; use FireflyIII\Support\Report\Summarizer\TransactionSummarizer;
use FireflyIII\User; use FireflyIII\User;
use Illuminate\Contracts\Auth\Authenticatable; use Illuminate\Contracts\Auth\Authenticatable;
use Illuminate\Support\Collection; use Illuminate\Support\Collection;
use Illuminate\Support\Facades\Log;
/** /**
* Class NoBudgetRepository * Class NoBudgetRepository
@@ -106,6 +104,7 @@ class NoBudgetRepository implements NoBudgetRepositoryInterface
$collector->withBudgetInformation(); $collector->withBudgetInformation();
$journals = $collector->getExtractedJournals(); $journals = $collector->getExtractedJournals();
$summarizer = new TransactionSummarizer($this->user); $summarizer = new TransactionSummarizer($this->user);
return $summarizer->groupByCurrencyId($journals); return $summarizer->groupByCurrencyId($journals);
} }
} }

View File

@@ -256,6 +256,7 @@ class OperationsRepository implements OperationsRepositoryInterface
Log::debug('STOP looking for transactions in the foreign currency.'); Log::debug('STOP looking for transactions in the foreign currency.');
} }
$summarizer = new TransactionSummarizer($this->user); $summarizer = new TransactionSummarizer($this->user);
return $summarizer->groupByCurrencyId($journals); return $summarizer->groupByCurrencyId($journals);
} }
} }

View File

@@ -27,12 +27,10 @@ namespace FireflyIII\Repositories\Category;
use Carbon\Carbon; use Carbon\Carbon;
use FireflyIII\Helpers\Collector\GroupCollectorInterface; use FireflyIII\Helpers\Collector\GroupCollectorInterface;
use FireflyIII\Models\TransactionType; use FireflyIII\Models\TransactionType;
use FireflyIII\Support\Facades\Amount;
use FireflyIII\Support\Report\Summarizer\TransactionSummarizer; use FireflyIII\Support\Report\Summarizer\TransactionSummarizer;
use FireflyIII\User; use FireflyIII\User;
use Illuminate\Contracts\Auth\Authenticatable; use Illuminate\Contracts\Auth\Authenticatable;
use Illuminate\Support\Collection; use Illuminate\Support\Collection;
use Illuminate\Support\Facades\Log;
/** /**
* Class NoCategoryRepository * Class NoCategoryRepository
@@ -154,6 +152,7 @@ class NoCategoryRepository implements NoCategoryRepositoryInterface
} }
$journals = $collector->getExtractedJournals(); $journals = $collector->getExtractedJournals();
$summarizer = new TransactionSummarizer($this->user); $summarizer = new TransactionSummarizer($this->user);
return $summarizer->groupByCurrencyId($journals); return $summarizer->groupByCurrencyId($journals);
} }

View File

@@ -341,6 +341,7 @@ class OperationsRepository implements OperationsRepositoryInterface
$collector->withCategoryInformation(); $collector->withCategoryInformation();
$journals = $collector->getExtractedJournals(); $journals = $collector->getExtractedJournals();
$summarizer = new TransactionSummarizer($this->user); $summarizer = new TransactionSummarizer($this->user);
return $summarizer->groupByCurrencyId($journals); return $summarizer->groupByCurrencyId($journals);
} }

View File

@@ -166,6 +166,7 @@ class Amount
return $this->getDefaultCurrencyByUserGroup($user->userGroup); return $this->getDefaultCurrencyByUserGroup($user->userGroup);
} }
} }
return $this->getSystemCurrency(); return $this->getSystemCurrency();
} }
@@ -325,11 +326,11 @@ class Amount
} }
// default is amount before currency // default is amount before currency
$format = $posA . $posD . '%v' . $space . $posB . '%s' . $posC . $posE; $format = $posA.$posD.'%v'.$space.$posB.'%s'.$posC.$posE;
if ($csPrecedes) { if ($csPrecedes) {
// alternative is currency before amount // alternative is currency before amount
$format = $posA . $posB . '%s' . $posC . $space . $posD . '%v' . $posE; $format = $posA.$posB.'%s'.$posC.$space.$posD.'%v'.$posE;
} }
return $format; return $format;

View File

@@ -507,12 +507,12 @@ class Navigation
$diff = $start->diffInMonths($end, true); $diff = $start->diffInMonths($end, true);
Log::debug(sprintf('preferredCarbonFormat(%s, %s) = %f', $start->format('Y-m-d'), $end->format('Y-m-d'), $diff)); Log::debug(sprintf('preferredCarbonFormat(%s, %s) = %f', $start->format('Y-m-d'), $end->format('Y-m-d'), $diff));
if ($diff >= 1.001) { if ($diff >= 1.001) {
// Log::debug(sprintf('Return Y-m because %s', $diff)); // Log::debug(sprintf('Return Y-m because %s', $diff));
$format = 'Y-m'; $format = 'Y-m';
} }
if ($diff >= 12.001) { if ($diff >= 12.001) {
// Log::debug(sprintf('Return Y because %s', $diff)); // Log::debug(sprintf('Return Y because %s', $diff));
$format = 'Y'; $format = 'Y';
} }

View File

@@ -1,4 +1,5 @@
<?php <?php
/* /*
* TransactionSummarizer.php * TransactionSummarizer.php
* Copyright (c) 2024 james@firefly-iii.org. * Copyright (c) 2024 james@firefly-iii.org.
@@ -83,7 +84,7 @@ class TransactionSummarizer
$currencyDecimalPlaces = $journal['foreign_currency_decimal_places']; $currencyDecimalPlaces = $journal['foreign_currency_decimal_places'];
} }
} }
if(!$this->convertToNative) { if (!$this->convertToNative) {
// default to the normal amount, but also // default to the normal amount, but also
} }
$amount = (string) ($journal[$field] ?? '0'); $amount = (string) ($journal[$field] ?? '0');
@@ -95,14 +96,16 @@ class TransactionSummarizer
'currency_code' => $currencyCode, 'currency_code' => $currencyCode,
'currency_decimal_places' => $currencyDecimalPlaces, 'currency_decimal_places' => $currencyDecimalPlaces,
]; ];
$array[$currencyId]['sum'] = bcadd($array[$currencyId]['sum'], app('steam')->$method($amount)); $array[$currencyId]['sum'] = bcadd($array[$currencyId]['sum'], app('steam')->{$method}($amount));
Log::debug(sprintf('Journal #%d adds amount %s %s', $journal['transaction_journal_id'], $currencyCode, $amount)); Log::debug(sprintf('Journal #%d adds amount %s %s', $journal['transaction_journal_id'], $currencyCode, $amount));
} }
Log::debug('End of sumExpenses.', $array); Log::debug('End of sumExpenses.', $array);
return $array; return $array;
} }
public function groupByDirection(array $journals, string $method, string $direction): array { public function groupByDirection(array $journals, string $method, string $direction): array
{
$array = []; $array = [];
$idKey = sprintf('%s_account_id', $direction); $idKey = sprintf('%s_account_id', $direction);
@@ -174,5 +177,4 @@ class TransactionSummarizer
return $array; return $array;
} }
} }

View File

@@ -58,7 +58,7 @@ class AccountTransformer extends AbstractTransformer
// get account type: // get account type:
$fullType = $account->accountType->type; $fullType = $account->accountType->type;
$accountType = (string) config(sprintf( 'firefly.shortNamesByFullName.%s', $fullType)); $accountType = (string) config(sprintf('firefly.shortNamesByFullName.%s', $fullType));
$liabilityType = (string) config(sprintf('firefly.shortLiabilityNameByFullName.%s', $fullType)); $liabilityType = (string) config(sprintf('firefly.shortLiabilityNameByFullName.%s', $fullType));
$liabilityType = '' === $liabilityType ? null : strtolower($liabilityType); $liabilityType = '' === $liabilityType ? null : strtolower($liabilityType);
$liabilityDirection = $this->repository->getMetaValue($account, 'liability_direction'); $liabilityDirection = $this->repository->getMetaValue($account, 'liability_direction');

View File

@@ -16,9 +16,9 @@ This project adheres to [Semantic Versioning](http://semver.org/).
- [Issue 7945](https://github.com/firefly-iii/firefly-iii/issues/7945) ("Rules" that only trigger manually) reported by @SekoiaTree - [Issue 7945](https://github.com/firefly-iii/firefly-iii/issues/7945) ("Rules" that only trigger manually) reported by @SekoiaTree
- [Issue 6760](https://github.com/firefly-iii/firefly-iii/issues/6760) (Add a new trigger for automated rules) reported by @Gsyltc - [Issue 6760](https://github.com/firefly-iii/firefly-iii/issues/6760) (Add a new trigger for automated rules) reported by @Gsyltc
- [Issue 6557](https://github.com/firefly-iii/firefly-iii/issues/6557) (Piggy Banks - Draw Funds from Multiple Accounts) reported by @BugPhobic - [Issue 6557](https://github.com/firefly-iii/firefly-iii/issues/6557) (Piggy Banks - Draw Funds from Multiple Accounts) reported by @BugPhobic
- #5532 - [Issue 5532](https://github.com/firefly-iii/firefly-iii/issues/5532) (Asset prices and exchange rates) reported by @svozniuk
- #6314 - [Issue 6314](https://github.com/firefly-iii/firefly-iii/issues/6314) (Currencies and exchange rates) reported by @JC5
- #9586 - [Issue 9586](https://github.com/firefly-iii/firefly-iii/issues/9586) (Non en_US translated string in sign-up mail) reported by @benni347
### Changed ### Changed

26
composer.lock generated
View File

@@ -2614,16 +2614,16 @@
}, },
{ {
"name": "league/commonmark", "name": "league/commonmark",
"version": "2.6.0", "version": "2.6.1",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/thephpleague/commonmark.git", "url": "https://github.com/thephpleague/commonmark.git",
"reference": "d150f911e0079e90ae3c106734c93137c184f932" "reference": "d990688c91cedfb69753ffc2512727ec646df2ad"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/thephpleague/commonmark/zipball/d150f911e0079e90ae3c106734c93137c184f932", "url": "https://api.github.com/repos/thephpleague/commonmark/zipball/d990688c91cedfb69753ffc2512727ec646df2ad",
"reference": "d150f911e0079e90ae3c106734c93137c184f932", "reference": "d990688c91cedfb69753ffc2512727ec646df2ad",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@@ -2717,7 +2717,7 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2024-12-07T15:34:16+00:00" "time": "2024-12-29T14:10:59+00:00"
}, },
{ {
"name": "league/config", "name": "league/config",
@@ -10193,20 +10193,20 @@
}, },
{ {
"name": "barryvdh/laravel-ide-helper", "name": "barryvdh/laravel-ide-helper",
"version": "v3.3.0", "version": "v3.4.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/barryvdh/laravel-ide-helper.git", "url": "https://github.com/barryvdh/laravel-ide-helper.git",
"reference": "b7675670f75914bf34afdea52a6c2fe3781f7c44" "reference": "2a41415f01bf3c409d200f6cdd940c1e7d86cfd3"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/barryvdh/laravel-ide-helper/zipball/b7675670f75914bf34afdea52a6c2fe3781f7c44", "url": "https://api.github.com/repos/barryvdh/laravel-ide-helper/zipball/2a41415f01bf3c409d200f6cdd940c1e7d86cfd3",
"reference": "b7675670f75914bf34afdea52a6c2fe3781f7c44", "reference": "2a41415f01bf3c409d200f6cdd940c1e7d86cfd3",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"barryvdh/reflection-docblock": "^2.1.2", "barryvdh/reflection-docblock": "^2.2",
"composer/class-map-generator": "^1.0", "composer/class-map-generator": "^1.0",
"ext-json": "*", "ext-json": "*",
"illuminate/console": "^11.15", "illuminate/console": "^11.15",
@@ -10239,7 +10239,7 @@
] ]
}, },
"branch-alias": { "branch-alias": {
"dev-master": "3.2-dev" "dev-master": "3.4-dev"
} }
}, },
"autoload": { "autoload": {
@@ -10271,7 +10271,7 @@
], ],
"support": { "support": {
"issues": "https://github.com/barryvdh/laravel-ide-helper/issues", "issues": "https://github.com/barryvdh/laravel-ide-helper/issues",
"source": "https://github.com/barryvdh/laravel-ide-helper/tree/v3.3.0" "source": "https://github.com/barryvdh/laravel-ide-helper/tree/v3.4.0"
}, },
"funding": [ "funding": [
{ {
@@ -10283,7 +10283,7 @@
"type": "github" "type": "github"
} }
], ],
"time": "2024-12-18T08:24:19+00:00" "time": "2024-12-29T12:10:58+00:00"
}, },
{ {
"name": "barryvdh/reflection-docblock", "name": "barryvdh/reflection-docblock",

View File

@@ -81,7 +81,7 @@ return [
'running_balance_column' => env('USE_RUNNING_BALANCE', false), 'running_balance_column' => env('USE_RUNNING_BALANCE', false),
// see cer.php for exchange rates feature flag. // see cer.php for exchange rates feature flag.
], ],
'version' => 'develop/2024-12-28', 'version' => 'develop/2024-12-30',
'api_version' => '2.1.0', // field is no longer used. 'api_version' => '2.1.0', // field is no longer used.
'db_version' => 25, 'db_version' => 25,

View File

@@ -133,7 +133,7 @@
"header_exchange_rates": "Wechselkurse", "header_exchange_rates": "Wechselkurse",
"exchange_rates_intro": "Firefly III unterst\u00fctzt das Herunterladen und Verwenden von Wechselkursen. Lesen Sie mehr dar\u00fcber in <a href=\u201ehttps:\/\/docs.firefly-iii.org\/LOL_NOT_FINISHED_YET_TODO\u201c>der Dokumentation<\/a>.", "exchange_rates_intro": "Firefly III unterst\u00fctzt das Herunterladen und Verwenden von Wechselkursen. Lesen Sie mehr dar\u00fcber in <a href=\u201ehttps:\/\/docs.firefly-iii.org\/LOL_NOT_FINISHED_YET_TODO\u201c>der Dokumentation<\/a>.",
"exchange_rates_from_to": "Zwischen {from} und {to} (und umgekehrt)", "exchange_rates_from_to": "Zwischen {from} und {to} (und umgekehrt)",
"exchange_rates_intro_rates": "Firefly III uses the following exchange rates. The inverse is automatically calculated when it is not provided. If no exchange rate exists for the date of the transaction, Firefly III will go back in time to find one. If none are present, the rate \"1\" will be used.", "exchange_rates_intro_rates": "Firefly III verwendet die folgenden Wechselkurse. Der Kehrwert wird automatisch berechnet, wenn er nicht angegeben wurde. Wenn f\u00fcr das Datum der Transaktion kein Wechselkurs vorhanden ist, sucht Firefly III in der Vergangenheit nach einem Kurs. Wenn keine vorhanden sind, wird der Kurs \u201e1\u201c verwendet.",
"header_exchange_rates_rates": "Wechselkurse", "header_exchange_rates_rates": "Wechselkurse",
"header_exchange_rates_table": "Tabelle mit Wechselkursen", "header_exchange_rates_table": "Tabelle mit Wechselkursen",
"help_rate_form": "An diesem Tag, wie viele {to} werden Sie f\u00fcr {from} bekommen?", "help_rate_form": "An diesem Tag, wie viele {to} werden Sie f\u00fcr {from} bekommen?",

View File

@@ -36,7 +36,7 @@
"is_reconciled_fields_dropped": "Omdat deze transactie al is afgestemd, kan je het bedrag noch de rekeningen wijzigen.", "is_reconciled_fields_dropped": "Omdat deze transactie al is afgestemd, kan je het bedrag noch de rekeningen wijzigen.",
"tags": "Tags", "tags": "Tags",
"no_budget": "(geen budget)", "no_budget": "(geen budget)",
"no_bill": "(no subscription)", "no_bill": "(geen abonnement)",
"category": "Categorie", "category": "Categorie",
"attachments": "Bijlagen", "attachments": "Bijlagen",
"notes": "Notities", "notes": "Notities",
@@ -52,7 +52,7 @@
"destination_account_reconciliation": "Je kan de doelrekening van een afstemming niet wijzigen.", "destination_account_reconciliation": "Je kan de doelrekening van een afstemming niet wijzigen.",
"source_account_reconciliation": "Je kan de bronrekening van een afstemming niet wijzigen.", "source_account_reconciliation": "Je kan de bronrekening van een afstemming niet wijzigen.",
"budget": "Budget", "budget": "Budget",
"bill": "Subscription", "bill": "Abonnement",
"you_create_withdrawal": "Je maakt een uitgave.", "you_create_withdrawal": "Je maakt een uitgave.",
"you_create_transfer": "Je maakt een overschrijving.", "you_create_transfer": "Je maakt een overschrijving.",
"you_create_deposit": "Je maakt inkomsten.", "you_create_deposit": "Je maakt inkomsten.",
@@ -133,7 +133,7 @@
"header_exchange_rates": "Wisselkoersen", "header_exchange_rates": "Wisselkoersen",
"exchange_rates_intro": "Firefly III kan wisselkoersen downloaden en gebruiken. Lees hier meer over in <a href=\"https:\/\/docs.firefly-iii.org\/LOL_NOT_FINISHED_YET_TODO\">de documentatie<\/a>.", "exchange_rates_intro": "Firefly III kan wisselkoersen downloaden en gebruiken. Lees hier meer over in <a href=\"https:\/\/docs.firefly-iii.org\/LOL_NOT_FINISHED_YET_TODO\">de documentatie<\/a>.",
"exchange_rates_from_to": "Tussen {from} en {to} (en andersom)", "exchange_rates_from_to": "Tussen {from} en {to} (en andersom)",
"exchange_rates_intro_rates": "Firefly III uses the following exchange rates. The inverse is automatically calculated when it is not provided. If no exchange rate exists for the date of the transaction, Firefly III will go back in time to find one. If none are present, the rate \"1\" will be used.", "exchange_rates_intro_rates": "Firefly III gebruikt de volgende wisselkoersen. De inverse berekent zichzelf als deze niet is opgegeven. Als er geen wisselkoers bestaat voor de datum van de transactie, gaat Firefly III terug in de tijd om er een te vinden. Als er geen aanwezig is, zal de koers \"1\" gebruikt worden.",
"header_exchange_rates_rates": "Wisselkoersen", "header_exchange_rates_rates": "Wisselkoersen",
"header_exchange_rates_table": "Tabel met wisselkoersen", "header_exchange_rates_table": "Tabel met wisselkoersen",
"help_rate_form": "Hoeveel {to} krijg je op deze dag voor \u00e9\u00e9n {from}?", "help_rate_form": "Hoeveel {to} krijg je op deze dag voor \u00e9\u00e9n {from}?",

View File

@@ -54,6 +54,7 @@ abstract class TestCase extends BaseTestCase
protected function createAuthenticatedUser(): User protected function createAuthenticatedUser(): User
{ {
$group = UserGroup::create(['title' => 'test@email.com']); $group = UserGroup::create(['title' => 'test@email.com']);
return User::create([ return User::create([
'email' => 'test@email.com', 'email' => 'test@email.com',
'password' => 'password', 'password' => 'password',