Auto commit for release 'branch-v6.2' on 2024-12-22

This commit is contained in:
github-actions
2024-12-22 20:37:54 +01:00
parent d90ac519f7
commit c0499df4ec
91 changed files with 1153 additions and 1163 deletions

View File

@@ -43,21 +43,23 @@ class AccountList implements BinderInterface
if ('allAssetAccounts' === $value) {
/** @var Collection $collection */
$collection = auth()->user()->accounts()
->leftJoin('account_types', 'account_types.id', '=', 'accounts.account_type_id')
->whereIn('account_types.type', [AccountType::ASSET, AccountType::LOAN, AccountType::DEBT, AccountType::MORTGAGE])
->orderBy('accounts.name', 'ASC')
->get(['accounts.*']);
->leftJoin('account_types', 'account_types.id', '=', 'accounts.account_type_id')
->whereIn('account_types.type', [AccountType::ASSET, AccountType::LOAN, AccountType::DEBT, AccountType::MORTGAGE])
->orderBy('accounts.name', 'ASC')
->get(['accounts.*'])
;
}
if ('allAssetAccounts' !== $value) {
$incoming = array_map('\intval', explode(',', $value));
$list = array_merge(array_unique($incoming), [0]);
$incoming = array_map('\intval', explode(',', $value));
$list = array_merge(array_unique($incoming), [0]);
/** @var Collection $collection */
$collection = auth()->user()->accounts()
->leftJoin('account_types', 'account_types.id', '=', 'accounts.account_type_id')
->whereIn('accounts.id', $list)
->orderBy('accounts.name', 'ASC')
->get(['accounts.*']);
->leftJoin('account_types', 'account_types.id', '=', 'accounts.account_type_id')
->whereIn('accounts.id', $list)
->orderBy('accounts.name', 'ASC')
->get(['accounts.*'])
;
}
if ($collection->count() > 0) {

View File

@@ -41,12 +41,13 @@ class BudgetList implements BinderInterface
if (auth()->check()) {
if ('allBudgets' === $value) {
return auth()->user()->budgets()->where('active', true)
->orderBy('order', 'ASC')
->orderBy('name', 'ASC')
->get();
->orderBy('order', 'ASC')
->orderBy('name', 'ASC')
->get()
;
}
$list = array_unique(array_map('\intval', explode(',', $value)));
$list = array_unique(array_map('\intval', explode(',', $value)));
if (0 === count($list)) { // @phpstan-ignore-line
app('log')->warning('Budget list count is zero, return 404.');
@@ -56,9 +57,10 @@ class BudgetList implements BinderInterface
/** @var Collection $collection */
$collection = auth()->user()->budgets()
->where('active', true)
->whereIn('id', $list)
->get();
->where('active', true)
->whereIn('id', $list)
->get()
;
// add empty budget if applicable.
if (in_array(0, $list, true)) {

View File

@@ -41,19 +41,21 @@ class CategoryList implements BinderInterface
if (auth()->check()) {
if ('allCategories' === $value) {
return auth()->user()->categories()
->orderBy('name', 'ASC')
->get();
->orderBy('name', 'ASC')
->get()
;
}
$list = array_unique(array_map('\intval', explode(',', $value)));
$list = array_unique(array_map('\intval', explode(',', $value)));
if (0 === count($list)) { // @phpstan-ignore-line
throw new NotFoundHttpException();
}
/** @var Collection $collection */
$collection = auth()->user()->categories()
->whereIn('id', $list)
->get();
->whereIn('id', $list)
->get()
;
// add empty category if applicable.
if (in_array(0, $list, true)) {

View File

@@ -43,16 +43,16 @@ class Date implements BinderInterface
/** @var FiscalHelperInterface $fiscalHelper */
$fiscalHelper = app(FiscalHelperInterface::class);
$magicWords = [
'currentMonthStart' => today(config('app.timezone'))->startOfMonth(),
'currentMonthEnd' => today(config('app.timezone'))->endOfMonth(),
'currentYearStart' => today(config('app.timezone'))->startOfYear(),
'currentYearEnd' => today(config('app.timezone'))->endOfYear(),
$magicWords = [
'currentMonthStart' => today(config('app.timezone'))->startOfMonth(),
'currentMonthEnd' => today(config('app.timezone'))->endOfMonth(),
'currentYearStart' => today(config('app.timezone'))->startOfYear(),
'currentYearEnd' => today(config('app.timezone'))->endOfYear(),
'previousMonthStart' => today(config('app.timezone'))->startOfMonth()->subDay()->startOfMonth(),
'previousMonthEnd' => today(config('app.timezone'))->startOfMonth()->subDay()->endOfMonth(),
'previousYearStart' => today(config('app.timezone'))->startOfYear()->subDay()->startOfYear(),
'previousYearEnd' => today(config('app.timezone'))->startOfYear()->subDay()->endOfYear(),
'previousMonthStart' => today(config('app.timezone'))->startOfMonth()->subDay()->startOfMonth(),
'previousMonthEnd' => today(config('app.timezone'))->startOfMonth()->subDay()->endOfMonth(),
'previousYearStart' => today(config('app.timezone'))->startOfYear()->subDay()->startOfYear(),
'previousYearEnd' => today(config('app.timezone'))->startOfYear()->subDay()->endOfYear(),
'currentFiscalYearStart' => $fiscalHelper->startOfFiscalYear(today(config('app.timezone'))),
'currentFiscalYearEnd' => $fiscalHelper->endOfFiscalYear(today(config('app.timezone'))),
@@ -68,7 +68,7 @@ class Date implements BinderInterface
try {
$result = new Carbon($value);
} catch (InvalidDateException | InvalidFormatException $e) { // @phpstan-ignore-line
} catch (InvalidDateException|InvalidFormatException $e) { // @phpstan-ignore-line
$message = sprintf('Could not parse date "%s" for user #%d: %s', $value, auth()->user()->id, $e->getMessage());
app('log')->error($message);

View File

@@ -39,7 +39,7 @@ class JournalList implements BinderInterface
public static function routeBinder(string $value, Route $route): array
{
if (auth()->check()) {
$list = self::parseList($value);
$list = self::parseList($value);
// get the journals by using the collector.
/** @var GroupCollectorInterface $collector */
@@ -47,7 +47,7 @@ class JournalList implements BinderInterface
$collector->setTypes([TransactionType::WITHDRAWAL, TransactionType::DEPOSIT, TransactionType::TRANSFER, TransactionType::RECONCILIATION]);
$collector->withCategoryInformation()->withBudgetInformation()->withTagInformation()->withAccountInformation();
$collector->setJournalIds($list);
$result = $collector->getExtractedJournals();
$result = $collector->getExtractedJournals();
if (0 === count($result)) {
throw new NotFoundHttpException();
}

View File

@@ -43,10 +43,11 @@ class TagList implements BinderInterface
if (auth()->check()) {
if ('allTags' === $value) {
return auth()->user()->tags()
->orderBy('tag', 'ASC')
->get();
->orderBy('tag', 'ASC')
->get()
;
}
$list = array_unique(array_map('\strtolower', explode(',', $value)));
$list = array_unique(array_map('\strtolower', explode(',', $value)));
app('log')->debug('List of tags is', $list);
if (0 === count($list)) { // @phpstan-ignore-line
@@ -58,7 +59,7 @@ class TagList implements BinderInterface
/** @var TagRepositoryInterface $repository */
$repository = app(TagRepositoryInterface::class);
$repository->setUser(auth()->user());
$allTags = $repository->get();
$allTags = $repository->get();
$collection = $allTags->filter(
static function (Tag $tag) use ($list) {

View File

@@ -40,7 +40,7 @@ class TagOrId implements BinderInterface
$repository = app(TagRepositoryInterface::class);
$repository->setUser(auth()->user());
$result = $repository->findByTag($value);
$result = $repository->findByTag($value);
if (null === $result) {
$result = $repository->find((int) $value);
}

View File

@@ -42,8 +42,9 @@ class UserGroupAccount implements BinderInterface
/** @var User $user */
$user = auth()->user();
$account = Account::where('id', (int) $value)
->where('user_group_id', $user->user_group_id)
->first();
->where('user_group_id', $user->user_group_id)
->first()
;
if (null !== $account) {
return $account;
}

View File

@@ -42,8 +42,9 @@ class UserGroupBill implements BinderInterface
/** @var User $user */
$user = auth()->user();
$currency = Bill::where('id', (int) $value)
->where('user_group_id', $user->user_group_id)
->first();
->where('user_group_id', $user->user_group_id)
->first()
;
if (null !== $currency) {
return $currency;
}

View File

@@ -39,8 +39,9 @@ class UserGroupExchangeRate implements BinderInterface
/** @var User $user */
$user = auth()->user();
$rate = CurrencyExchangeRate::where('id', (int) $value)
->where('user_group_id', $user->user_group_id)
->first();
->where('user_group_id', $user->user_group_id)
->first()
;
if (null !== $rate) {
return $rate;
}

View File

@@ -39,8 +39,9 @@ class UserGroupTransaction implements BinderInterface
/** @var User $user */
$user = auth()->user();
$group = TransactionGroup::where('id', (int) $value)
->where('user_group_id', $user->user_group_id)
->first();
->where('user_group_id', $user->user_group_id)
->first()
;
if (null !== $group) {
return $group;
}