mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
Merge branch 'develop' of github.com:firefly-iii/firefly-iii into develop
# Conflicts: # app/Support/Steam.php
This commit is contained in:
commit
6fde693e7a
@ -137,13 +137,13 @@ class AccountController extends Controller
|
||||
|
||||
continue;
|
||||
}
|
||||
//Log::debug(sprintf('Will process expense array "%s" with amount %s', $key, $endBalance));
|
||||
// Log::debug(sprintf('Will process expense array "%s" with amount %s', $key, $endBalance));
|
||||
$searchCode = $this->convertToNative ? $this->defaultCurrency->code : $key;
|
||||
//Log::debug(sprintf('Search code is %s', $searchCode));
|
||||
// Log::debug(sprintf('Search code is %s', $searchCode));
|
||||
// see if there is an accompanying start amount.
|
||||
// grab the difference and find the currency.
|
||||
$startBalance = ($startBalances[$account->id][$key] ?? '0');
|
||||
// Log::debug(sprintf('Start balance is %s', $startBalance));
|
||||
// Log::debug(sprintf('Start balance is %s', $startBalance));
|
||||
$diff = bcsub($endBalance, $startBalance);
|
||||
$currencies[$searchCode] ??= $this->currencyRepository->findByCode($searchCode);
|
||||
if (0 !== bccomp($diff, '0')) {
|
||||
@ -596,13 +596,13 @@ class AccountController extends Controller
|
||||
|
||||
continue;
|
||||
}
|
||||
//Log::debug(sprintf('Will process expense array "%s" with amount %s', $key, $endBalance));
|
||||
// Log::debug(sprintf('Will process expense array "%s" with amount %s', $key, $endBalance));
|
||||
$searchCode = $this->convertToNative ? $this->defaultCurrency->code : $key;
|
||||
//Log::debug(sprintf('Search code is %s', $searchCode));
|
||||
// Log::debug(sprintf('Search code is %s', $searchCode));
|
||||
// see if there is an accompanying start amount.
|
||||
// grab the difference and find the currency.
|
||||
$startBalance = ($startBalances[$account->id][$key] ?? '0');
|
||||
//Log::debug(sprintf('Start balance is %s', $startBalance));
|
||||
// Log::debug(sprintf('Start balance is %s', $startBalance));
|
||||
$diff = bcsub($endBalance, $startBalance);
|
||||
$currencies[$searchCode] ??= $this->currencyRepository->findByCode($searchCode);
|
||||
if (0 !== bccomp($diff, '0')) {
|
||||
|
@ -91,7 +91,7 @@ class ReturnsAvailableChannels
|
||||
}
|
||||
|
||||
// validate presence of of Ntfy settings.
|
||||
$ntfyTopic = (string) app('preferences')->getEncryptedForUser($user, 'ntfy_topic', '')->data;
|
||||
$ntfyTopic = (string) app('preferences')->getEncryptedForUser($user, 'ntfy_topic', '')->data;
|
||||
if ('' !== $ntfyTopic) {
|
||||
Log::debug(sprintf('Enabled ntfy, "%s"', $ntfyTopic));
|
||||
$channels[] = NtfyChannel::class;
|
||||
|
@ -550,9 +550,9 @@ class BillRepository implements BillRepositoryInterface
|
||||
foreach ($set as $transactionJournal) {
|
||||
$setAmount = bcadd($setAmount, Amount::getAmountFromJournalObject($transactionJournal));
|
||||
}
|
||||
//Log::debug(sprintf('Bill #%d ("%s") with %d transaction(s) and sum %s %s', $bill->id, $bill->name, $set->count(), $currency->code, $setAmount));
|
||||
// Log::debug(sprintf('Bill #%d ("%s") with %d transaction(s) and sum %s %s', $bill->id, $bill->name, $set->count(), $currency->code, $setAmount));
|
||||
$return[$currency->id]['sum'] = bcadd($return[$currency->id]['sum'], $setAmount);
|
||||
//Log::debug(sprintf('Total sum is now %s', $return[$currency->id]['sum']));
|
||||
// Log::debug(sprintf('Total sum is now %s', $return[$currency->id]['sum']));
|
||||
}
|
||||
|
||||
return $return;
|
||||
|
@ -47,15 +47,16 @@ class Preferences
|
||||
}
|
||||
|
||||
return Preference::where('user_id', $user->id)
|
||||
->where('name', '!=', 'currencyPreference')
|
||||
->where(function (Builder $q) use ($user): void {
|
||||
$q->whereNull('user_group_id');
|
||||
$q->orWhere('user_group_id', $user->user_group_id);
|
||||
})
|
||||
->get();
|
||||
->where('name', '!=', 'currencyPreference')
|
||||
->where(function (Builder $q) use ($user): void {
|
||||
$q->whereNull('user_group_id');
|
||||
$q->orWhere('user_group_id', $user->user_group_id);
|
||||
})
|
||||
->get()
|
||||
;
|
||||
}
|
||||
|
||||
public function get(string $name, null | array | bool | int | string $default = null): ?Preference
|
||||
public function get(string $name, null|array|bool|int|string $default = null): ?Preference
|
||||
{
|
||||
/** @var null|User $user */
|
||||
$user = auth()->user();
|
||||
@ -69,7 +70,7 @@ class Preferences
|
||||
return $this->getForUser($user, $name, $default);
|
||||
}
|
||||
|
||||
public function getForUser(User $user, string $name, null | array | bool | int | string $default = null): ?Preference
|
||||
public function getForUser(User $user, string $name, null|array|bool|int|string $default = null): ?Preference
|
||||
{
|
||||
// don't care about user group ID, except for some specific preferences.
|
||||
$userGroupId = $this->getUserGroupId($user, $name);
|
||||
@ -121,16 +122,16 @@ class Preferences
|
||||
Cache::put($key, '', 5);
|
||||
}
|
||||
|
||||
public function setForUser(User $user, string $name, null | array | bool | int | string $value): Preference
|
||||
public function setForUser(User $user, string $name, null|array|bool|int|string $value): Preference
|
||||
{
|
||||
$fullName = sprintf('preference%s%s', $user->id, $name);
|
||||
$groupId = $this->getUserGroupId($user, $name);
|
||||
$groupId = 0 === (int) $groupId ? null : (int) $groupId;
|
||||
$fullName = sprintf('preference%s%s', $user->id, $name);
|
||||
$groupId = $this->getUserGroupId($user, $name);
|
||||
$groupId = 0 === (int) $groupId ? null : (int) $groupId;
|
||||
|
||||
Cache::forget($fullName);
|
||||
|
||||
/** @var null|Preference $pref */
|
||||
$pref = Preference::where('user_group_id', $groupId)->where('user_id', $user->id)->where('name', $name)->first(['id', 'name', 'data', 'updated_at', 'created_at']);
|
||||
$pref = Preference::where('user_group_id', $groupId)->where('user_id', $user->id)->where('name', $name)->first(['id', 'name', 'data', 'updated_at', 'created_at']);
|
||||
|
||||
if (null !== $pref && null === $value) {
|
||||
$pref->delete();
|
||||
@ -173,12 +174,13 @@ class Preferences
|
||||
{
|
||||
$result = [];
|
||||
$preferences = Preference::where('user_id', $user->id)
|
||||
->where(function (Builder $q) use ($user): void {
|
||||
$q->whereNull('user_group_id');
|
||||
$q->orWhere('user_group_id', $user->user_group_id);
|
||||
})
|
||||
->whereIn('name', $list)
|
||||
->get(['id', 'name', 'data']);
|
||||
->where(function (Builder $q) use ($user): void {
|
||||
$q->whereNull('user_group_id');
|
||||
$q->orWhere('user_group_id', $user->user_group_id);
|
||||
})
|
||||
->whereIn('name', $list)
|
||||
->get(['id', 'name', 'data'])
|
||||
;
|
||||
|
||||
/** @var Preference $preference */
|
||||
foreach ($preferences as $preference) {
|
||||
@ -220,7 +222,7 @@ class Preferences
|
||||
return $result;
|
||||
}
|
||||
|
||||
public function getEncryptedForUser(User $user, string $name, null | array | bool | int | string $default = null): ?Preference
|
||||
public function getEncryptedForUser(User $user, string $name, null|array|bool|int|string $default = null): ?Preference
|
||||
{
|
||||
$result = $this->getForUser($user, $name, $default);
|
||||
if ('' === $result->data) {
|
||||
@ -245,7 +247,7 @@ class Preferences
|
||||
return $result;
|
||||
}
|
||||
|
||||
public function getFresh(string $name, null | array | bool | int | string $default = null): ?Preference
|
||||
public function getFresh(string $name, null|array|bool|int|string $default = null): ?Preference
|
||||
{
|
||||
/** @var null|User $user */
|
||||
$user = auth()->user();
|
||||
@ -283,7 +285,7 @@ class Preferences
|
||||
Session::forget('first');
|
||||
}
|
||||
|
||||
public function set(string $name, null | array | bool | int | string $value): Preference
|
||||
public function set(string $name, null|array|bool|int|string $value): Preference
|
||||
{
|
||||
/** @var null|User $user */
|
||||
$user = auth()->user();
|
||||
|
@ -339,7 +339,7 @@ class Steam
|
||||
if ($native->id === $accountCurrency?->id) {
|
||||
$return['balance'] = bcadd('' === (string) $account->virtual_balance ? '0' : $account->virtual_balance, $return['balance']);
|
||||
}
|
||||
//Log::debug(sprintf('balance is (%s only) %s (with virtual balance)', $native->code, $this->bcround($return['balance'], 2)));
|
||||
// Log::debug(sprintf('balance is (%s only) %s (with virtual balance)', $native->code, $this->bcround($return['balance'], 2)));
|
||||
|
||||
// native balance
|
||||
$return['native_balance'] = (string) $account->transactions()
|
||||
@ -350,7 +350,7 @@ class Steam
|
||||
;
|
||||
// plus native virtual balance.
|
||||
$return['native_balance'] = bcadd('' === (string) $account->native_virtual_balance ? '0' : $account->native_virtual_balance, $return['native_balance']);
|
||||
//Log::debug(sprintf('native_balance is (all transactions to %s) %s (with virtual balance)', $native->code, $this->bcround($return['native_balance'])));
|
||||
// Log::debug(sprintf('native_balance is (all transactions to %s) %s (with virtual balance)', $native->code, $this->bcround($return['native_balance'])));
|
||||
|
||||
// plus foreign transactions in THIS currency.
|
||||
$sum = (string) $account->transactions()
|
||||
@ -387,9 +387,9 @@ class Steam
|
||||
// }
|
||||
|
||||
if (!$hasCurrency && array_key_exists('balance', $return) && array_key_exists('native_balance', $return)) {
|
||||
// Log::debug('Account has no currency preference, dropping balance in favor of native balance.');
|
||||
// Log::debug('Account has no currency preference, dropping balance in favor of native balance.');
|
||||
$sum = bcadd($return['balance'], $return['native_balance']);
|
||||
// Log::debug(sprintf('%s + %s = %s', $return['balance'], $return['native_balance'], $sum));
|
||||
// Log::debug(sprintf('%s + %s = %s', $return['balance'], $return['native_balance'], $sum));
|
||||
$return['native_balance'] = $sum;
|
||||
unset($return['balance']);
|
||||
}
|
||||
@ -397,7 +397,8 @@ class Steam
|
||||
// Log::debug('Return is', $final);
|
||||
$cache->store($final);
|
||||
|
||||
return $final;
|
||||
return array_merge($return, $others);
|
||||
// Log::debug('Return is', $final);
|
||||
}
|
||||
|
||||
public function filterAccountBalances(array $total, Account $account, bool $convertToNative, ?TransactionCurrency $currency = null): array
|
||||
|
@ -81,7 +81,7 @@ return [
|
||||
'running_balance_column' => env('USE_RUNNING_BALANCE', false),
|
||||
// see cer.php for exchange rates feature flag.
|
||||
],
|
||||
'version' => '6.2.0-alpha.1',
|
||||
'version' => 'develop/2024-12-31',
|
||||
'api_version' => '2.1.0', // field is no longer used.
|
||||
'db_version' => 25,
|
||||
|
||||
|
6
package-lock.json
generated
6
package-lock.json
generated
@ -12114,9 +12114,9 @@
|
||||
"license": "ISC"
|
||||
},
|
||||
"node_modules/yaml": {
|
||||
"version": "2.6.1",
|
||||
"resolved": "https://registry.npmjs.org/yaml/-/yaml-2.6.1.tgz",
|
||||
"integrity": "sha512-7r0XPzioN/Q9kXBro/XPnA6kznR73DHq+GXh5ON7ZozRO6aMjbmiBuKste2wslTFkC5d1dw0GooOCepZXJ2SAg==",
|
||||
"version": "2.7.0",
|
||||
"resolved": "https://registry.npmjs.org/yaml/-/yaml-2.7.0.tgz",
|
||||
"integrity": "sha512-+hSoy/QHluxmC9kCIJyL/uyFmLmc+e5CFR5Wa+bpIhIj85LVb9ZH2nVnqrHoSvKogwODv0ClqZkmiSSaIH5LTA==",
|
||||
"dev": true,
|
||||
"license": "ISC",
|
||||
"bin": {
|
||||
|
Loading…
Reference in New Issue
Block a user