mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2026-02-02 02:22:52 +00:00
🤖 Auto commit for release 'develop' on 2026-01-23
This commit is contained in:
@@ -79,20 +79,20 @@ class PreferencesController extends Controller
|
||||
*/
|
||||
public function index(AccountRepositoryInterface $repository): Factory|\Illuminate\Contracts\View\View
|
||||
{
|
||||
$accounts = $repository->getAccountsByType([
|
||||
$accounts = $repository->getAccountsByType([
|
||||
AccountTypeEnum::DEFAULT->value,
|
||||
AccountTypeEnum::ASSET->value,
|
||||
AccountTypeEnum::LOAN->value,
|
||||
AccountTypeEnum::DEBT->value,
|
||||
AccountTypeEnum::MORTGAGE->value
|
||||
AccountTypeEnum::MORTGAGE->value,
|
||||
]);
|
||||
$isDocker = env('IS_DOCKER', false); // @phpstan-ignore-line
|
||||
$groupedAccounts = [];
|
||||
$isDocker = env('IS_DOCKER', false); // @phpstan-ignore-line
|
||||
$groupedAccounts = [];
|
||||
|
||||
/** @var Account $account */
|
||||
foreach ($accounts as $account) {
|
||||
$type = $account->accountType->type;
|
||||
$role = sprintf('opt_group_%s', $repository->getMetaValue($account, 'account_role'));
|
||||
$type = $account->accountType->type;
|
||||
$role = sprintf('opt_group_%s', $repository->getMetaValue($account, 'account_role'));
|
||||
|
||||
if (in_array($type, [AccountTypeEnum::MORTGAGE->value, AccountTypeEnum::DEBT->value, AccountTypeEnum::LOAN->value], true)) {
|
||||
$role = sprintf('opt_group_l_%s', $type);
|
||||
@@ -106,48 +106,48 @@ class PreferencesController extends Controller
|
||||
ksort($groupedAccounts);
|
||||
|
||||
/** @var array<int, int> $accountIds */
|
||||
$accountIds = $accounts->pluck('id')->toArray();
|
||||
$viewRange = Navigation::getViewRange(false);
|
||||
$frontpageAccountsPref = Preferences::get('frontpageAccounts', $accountIds);
|
||||
$frontpageAccounts = $frontpageAccountsPref->data;
|
||||
$accountIds = $accounts->pluck('id')->toArray();
|
||||
$viewRange = Navigation::getViewRange(false);
|
||||
$frontpageAccountsPref = Preferences::get('frontpageAccounts', $accountIds);
|
||||
$frontpageAccounts = $frontpageAccountsPref->data;
|
||||
if (!is_array($frontpageAccounts)) {
|
||||
$frontpageAccounts = $accountIds;
|
||||
}
|
||||
$language = Steam::getLanguage();
|
||||
$languages = config('firefly.languages');
|
||||
$locale = Preferences::get('locale', config('firefly.default_locale', 'equal'))->data;
|
||||
$listPageSize = Preferences::get('listPageSize', 50)->data;
|
||||
$darkMode = Preferences::get('darkMode', 'browser')->data;
|
||||
$customFiscalYear = Preferences::get('customFiscalYear', 0)->data;
|
||||
$fiscalYearStartStr = Preferences::get('fiscalYearStart', '01-01')->data;
|
||||
$convertToPrimary = $this->convertToPrimary;
|
||||
$language = Steam::getLanguage();
|
||||
$languages = config('firefly.languages');
|
||||
$locale = Preferences::get('locale', config('firefly.default_locale', 'equal'))->data;
|
||||
$listPageSize = Preferences::get('listPageSize', 50)->data;
|
||||
$darkMode = Preferences::get('darkMode', 'browser')->data;
|
||||
$customFiscalYear = Preferences::get('customFiscalYear', 0)->data;
|
||||
$fiscalYearStartStr = Preferences::get('fiscalYearStart', '01-01')->data;
|
||||
$convertToPrimary = $this->convertToPrimary;
|
||||
if (is_array($fiscalYearStartStr)) {
|
||||
$fiscalYearStartStr = '01-01';
|
||||
}
|
||||
$fiscalYearStart = sprintf('%s-%s', Carbon::now()->format('Y'), (string) $fiscalYearStartStr);
|
||||
$tjOptionalFields = Preferences::get('transaction_journal_optional_fields', [])->data;
|
||||
$availableDarkModes = config('firefly.available_dark_modes');
|
||||
$fiscalYearStart = sprintf('%s-%s', Carbon::now()->format('Y'), (string) $fiscalYearStartStr);
|
||||
$tjOptionalFields = Preferences::get('transaction_journal_optional_fields', [])->data;
|
||||
$availableDarkModes = config('firefly.available_dark_modes');
|
||||
|
||||
// notifications settings
|
||||
$slackUrl = Preferences::getEncrypted('slack_webhook_url', '')->data;
|
||||
$pushoverAppToken = (string) Preferences::getEncrypted('pushover_app_token', '')->data;
|
||||
$pushoverUserToken = (string) Preferences::getEncrypted('pushover_user_token', '')->data;
|
||||
$ntfyServer = Preferences::getEncrypted('ntfy_server', 'https://ntfy.sh')->data;
|
||||
$ntfyTopic = (string) Preferences::getEncrypted('ntfy_topic', '')->data;
|
||||
$ntfyAuth = '1' === Preferences::get('ntfy_auth', false)->data;
|
||||
$ntfyUser = Preferences::getEncrypted('ntfy_user', '')->data;
|
||||
$ntfyPass = (string) Preferences::getEncrypted('ntfy_pass', '')->data;
|
||||
$channels = config('notifications.channels');
|
||||
$forcedAvailability = [];
|
||||
$anonymous = Steam::anonymous();
|
||||
$slackUrl = Preferences::getEncrypted('slack_webhook_url', '')->data;
|
||||
$pushoverAppToken = (string) Preferences::getEncrypted('pushover_app_token', '')->data;
|
||||
$pushoverUserToken = (string) Preferences::getEncrypted('pushover_user_token', '')->data;
|
||||
$ntfyServer = Preferences::getEncrypted('ntfy_server', 'https://ntfy.sh')->data;
|
||||
$ntfyTopic = (string) Preferences::getEncrypted('ntfy_topic', '')->data;
|
||||
$ntfyAuth = '1' === Preferences::get('ntfy_auth', false)->data;
|
||||
$ntfyUser = Preferences::getEncrypted('ntfy_user', '')->data;
|
||||
$ntfyPass = (string) Preferences::getEncrypted('ntfy_pass', '')->data;
|
||||
$channels = config('notifications.channels');
|
||||
$forcedAvailability = [];
|
||||
$anonymous = Steam::anonymous();
|
||||
|
||||
// notification preferences
|
||||
$notifications = [];
|
||||
$notifications = [];
|
||||
foreach (config('notifications.notifications.user') as $key => $info) {
|
||||
if (true === $info['enabled']) {
|
||||
$notifications[$key] = [
|
||||
'enabled' => true === Preferences::get(sprintf('notification_%s', $key), true)->data,
|
||||
'configurable' => $info['configurable']
|
||||
'configurable' => $info['configurable'],
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -155,7 +155,7 @@ class PreferencesController extends Controller
|
||||
foreach ($channels as $channel => $info) {
|
||||
$forcedAvailability[$channel] = true;
|
||||
}
|
||||
$forcedAvailability['ntfy'] = '' !== $ntfyTopic;
|
||||
$forcedAvailability['ntfy'] = '' !== $ntfyTopic;
|
||||
$forcedAvailability['pushover'] = '' !== $pushoverAppToken && '' !== $pushoverUserToken;
|
||||
|
||||
ksort($languages);
|
||||
@@ -168,7 +168,7 @@ class PreferencesController extends Controller
|
||||
Log::error($e->getMessage());
|
||||
$locales = [];
|
||||
}
|
||||
$locales = ['equal' => (string) trans('firefly.equal_to_language')] + $locales;
|
||||
$locales = ['equal' => (string) trans('firefly.equal_to_language')] + $locales;
|
||||
// an important fallback is that the frontPageAccount array gets refilled automatically
|
||||
// when it turns up empty.
|
||||
if (0 === count($frontpageAccounts)) {
|
||||
@@ -215,7 +215,7 @@ class PreferencesController extends Controller
|
||||
'viewRange' => $viewRange,
|
||||
'customFiscalYear' => $customFiscalYear,
|
||||
'listPageSize' => $listPageSize,
|
||||
'fiscalYearStart' => $fiscalYearStart
|
||||
'fiscalYearStart' => $fiscalYearStart,
|
||||
]);
|
||||
}
|
||||
|
||||
@@ -241,7 +241,7 @@ class PreferencesController extends Controller
|
||||
}
|
||||
|
||||
// extract notifications:
|
||||
$all = $request->all();
|
||||
$all = $request->all();
|
||||
foreach (config('notifications.notifications.user') as $key => $info) {
|
||||
$key = sprintf('notification_%s', $key);
|
||||
if (array_key_exists($key, $all)) {
|
||||
@@ -277,7 +277,7 @@ class PreferencesController extends Controller
|
||||
}
|
||||
|
||||
// convert primary
|
||||
$convertToPrimary = 1 === (int) $request->get('convertToPrimary');
|
||||
$convertToPrimary = 1 === (int) $request->get('convertToPrimary');
|
||||
if ($convertToPrimary && !$this->convertToPrimary) {
|
||||
// set to true!
|
||||
Log::debug('User sets convertToPrimary to true.');
|
||||
@@ -289,9 +289,9 @@ class PreferencesController extends Controller
|
||||
Preferences::set('convert_to_primary', $convertToPrimary);
|
||||
|
||||
// custom fiscal year
|
||||
$customFiscalYear = 1 === (int) $request->get('customFiscalYear');
|
||||
$customFiscalYear = 1 === (int) $request->get('customFiscalYear');
|
||||
Preferences::set('customFiscalYear', $customFiscalYear);
|
||||
$fiscalYearString = (string) $request->get('fiscalYearStart');
|
||||
$fiscalYearString = (string) $request->get('fiscalYearStart');
|
||||
if ('' !== $fiscalYearString) {
|
||||
$fiscalYearStart = Carbon::parse($fiscalYearString, config('app.timezone'))->format('m-d');
|
||||
Preferences::set('fiscalYearStart', $fiscalYearStart);
|
||||
@@ -299,15 +299,15 @@ class PreferencesController extends Controller
|
||||
|
||||
// save page size:
|
||||
Preferences::set('listPageSize', 50);
|
||||
$listPageSize = (int) $request->get('listPageSize');
|
||||
$listPageSize = (int) $request->get('listPageSize');
|
||||
if ($listPageSize > 0 && $listPageSize < 1337) {
|
||||
Preferences::set('listPageSize', $listPageSize);
|
||||
}
|
||||
|
||||
// language:
|
||||
/** @var Preference $currentLang */
|
||||
$currentLang = Preferences::get('language', 'en_US');
|
||||
$lang = $request->get('language');
|
||||
$currentLang = Preferences::get('language', 'en_US');
|
||||
$lang = $request->get('language');
|
||||
if (array_key_exists($lang, config('firefly.languages'))) {
|
||||
Preferences::set('language', $lang);
|
||||
}
|
||||
@@ -324,8 +324,8 @@ class PreferencesController extends Controller
|
||||
}
|
||||
|
||||
// optional fields for transactions:
|
||||
$setOptions = $request->get('tj') ?? [];
|
||||
$optionalTj = [
|
||||
$setOptions = $request->get('tj') ?? [];
|
||||
$optionalTj = [
|
||||
'interest_date' => array_key_exists('interest_date', $setOptions),
|
||||
'book_date' => array_key_exists('book_date', $setOptions),
|
||||
'process_date' => array_key_exists('process_date', $setOptions),
|
||||
@@ -337,18 +337,18 @@ class PreferencesController extends Controller
|
||||
'attachments' => array_key_exists('attachments', $setOptions),
|
||||
'external_url' => array_key_exists('external_url', $setOptions),
|
||||
'location' => array_key_exists('location', $setOptions),
|
||||
'links' => array_key_exists('links', $setOptions)
|
||||
'links' => array_key_exists('links', $setOptions),
|
||||
];
|
||||
Preferences::set('transaction_journal_optional_fields', $optionalTj);
|
||||
|
||||
// dark mode
|
||||
$darkMode = $request->get('darkMode') ?? 'browser';
|
||||
$darkMode = $request->get('darkMode') ?? 'browser';
|
||||
if (in_array($darkMode, config('firefly.available_dark_modes'), true)) {
|
||||
Preferences::set('darkMode', $darkMode);
|
||||
}
|
||||
|
||||
// anonymous amounts?
|
||||
$anonymous = '1' === $request->get('anonymous');
|
||||
$anonymous = '1' === $request->get('anonymous');
|
||||
Preferences::set('anonymous', $anonymous);
|
||||
|
||||
// save and continue
|
||||
|
||||
Reference in New Issue
Block a user