mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-12 23:45:10 +00:00
Replace missing methods.
This commit is contained in:
@@ -69,7 +69,7 @@ class AccountController extends Controller
|
|||||||
public function accounts(AutocompleteRequest $request): JsonResponse
|
public function accounts(AutocompleteRequest $request): JsonResponse
|
||||||
{
|
{
|
||||||
$params = $request->getParameters();
|
$params = $request->getParameters();
|
||||||
$result = $this->repository->searchAccount($params['query'], $params['account_types'], $params['page'], $params['size']);
|
$result = $this->repository->searchAccount($params['query'], $params['account_types'], $params['size']);
|
||||||
$return = [];
|
$return = [];
|
||||||
|
|
||||||
/** @var Account $account */
|
/** @var Account $account */
|
||||||
|
@@ -59,7 +59,7 @@ class TagController extends Controller
|
|||||||
public function tags(AutocompleteRequest $request): JsonResponse
|
public function tags(AutocompleteRequest $request): JsonResponse
|
||||||
{
|
{
|
||||||
$queryParameters = $request->getParameters();
|
$queryParameters = $request->getParameters();
|
||||||
$result = $this->repository->searchTag($queryParameters['query'], $queryParameters['size']);
|
$result = $this->repository->searchTag($queryParameters['query']);
|
||||||
$filtered = $result->map(
|
$filtered = $result->map(
|
||||||
static function (Tag $item) {
|
static function (Tag $item) {
|
||||||
return [
|
return [
|
||||||
|
@@ -67,7 +67,7 @@ class IndexController extends Controller
|
|||||||
$types = $request->getAccountTypes();
|
$types = $request->getAccountTypes();
|
||||||
$sorting = $request->getSortInstructions('accounts');
|
$sorting = $request->getSortInstructions('accounts');
|
||||||
$filters = $request->getFilterInstructions('accounts');
|
$filters = $request->getFilterInstructions('accounts');
|
||||||
$accounts = $this->repository->getAccountsByType($types, $sorting, $filters);
|
$accounts = $this->repository->getAccountsByType($types, $sorting);
|
||||||
$pageSize = $this->parameters->get('limit');
|
$pageSize = $this->parameters->get('limit');
|
||||||
$count = $accounts->count();
|
$count = $accounts->count();
|
||||||
|
|
||||||
|
@@ -122,8 +122,7 @@ class CorrectsUnevenAmount extends Command
|
|||||||
$journals = DB::table('transactions')
|
$journals = DB::table('transactions')
|
||||||
->groupBy('transaction_journal_id')
|
->groupBy('transaction_journal_id')
|
||||||
->whereNull('deleted_at')
|
->whereNull('deleted_at')
|
||||||
->get(['transaction_journal_id', DB::raw('SUM(amount) AS the_sum')]) // @phpstan-ignore-line
|
->get(['transaction_journal_id', DB::raw('SUM(amount) AS the_sum')]);
|
||||||
;
|
|
||||||
|
|
||||||
/** @var \stdClass $entry */
|
/** @var \stdClass $entry */
|
||||||
foreach ($journals as $entry) {
|
foreach ($journals as $entry) {
|
||||||
|
@@ -27,6 +27,7 @@ use Illuminate\Console\Command;
|
|||||||
class ValidatesEnvironmentVariables extends Command
|
class ValidatesEnvironmentVariables extends Command
|
||||||
{
|
{
|
||||||
use ShowsFriendlyMessages;
|
use ShowsFriendlyMessages;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The name and signature of the console command.
|
* The name and signature of the console command.
|
||||||
*
|
*
|
||||||
@@ -37,7 +38,7 @@ class ValidatesEnvironmentVariables extends Command
|
|||||||
/**
|
/**
|
||||||
* The console command description.
|
* The console command description.
|
||||||
*
|
*
|
||||||
* @var string
|
* @var string|null
|
||||||
*/
|
*/
|
||||||
protected $description = 'Makes sure you use the correct variables.';
|
protected $description = 'Makes sure you use the correct variables.';
|
||||||
|
|
||||||
@@ -54,17 +55,18 @@ class ValidatesEnvironmentVariables extends Command
|
|||||||
|
|
||||||
private function validateLanguage(): void
|
private function validateLanguage(): void
|
||||||
{
|
{
|
||||||
$language = env('DEFAULT_LANGUAGE', 'en_US');
|
$language = config('firefly.default_language');
|
||||||
$locale = env('DEFAULT_LOCALE', 'equal');
|
$locale = config('firefly.default_locale');
|
||||||
$options = array_keys(config('firefly.languages'));
|
$options = array_keys(config('firefly.languages'));
|
||||||
if (!in_array($language, $options)) {
|
|
||||||
|
if (!in_array($language, $options, true)) {
|
||||||
$this->friendlyError(sprintf('DEFAULT_LANGUAGE "%s" is not a valid language for Firefly III.', $language));
|
$this->friendlyError(sprintf('DEFAULT_LANGUAGE "%s" is not a valid language for Firefly III.', $language));
|
||||||
$this->friendlyError('Please check your .env file and make sure you use a valid setting.');
|
$this->friendlyError('Please check your .env file and make sure you use a valid setting.');
|
||||||
$this->friendlyError(sprintf('Valid languages are: %s', implode(', ', $options)));
|
$this->friendlyError(sprintf('Valid languages are: %s', implode(', ', $options)));
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
$options[] = 'equal';
|
$options[] = 'equal';
|
||||||
if (!in_array($locale, $options)) {
|
if (!in_array($locale, $options, true)) {
|
||||||
$this->friendlyError(sprintf('DEFAULT_LOCALE "%s" is not a valid local for Firefly III.', $locale));
|
$this->friendlyError(sprintf('DEFAULT_LOCALE "%s" is not a valid local for Firefly III.', $locale));
|
||||||
$this->friendlyError('Please check your .env file and make sure you use a valid setting.');
|
$this->friendlyError('Please check your .env file and make sure you use a valid setting.');
|
||||||
$this->friendlyError(sprintf('Valid locales are: %s', implode(', ', $options)));
|
$this->friendlyError(sprintf('Valid locales are: %s', implode(', ', $options)));
|
||||||
@@ -72,9 +74,10 @@ class ValidatesEnvironmentVariables extends Command
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private function validateGuard(): void {
|
private function validateGuard(): void
|
||||||
$guard = env('AUTHENTICATION_GUARD','web');
|
{
|
||||||
if('web' !== $guard && 'remote_user_guard' !== $guard) {
|
$guard = env('AUTHENTICATION_GUARD', 'web');
|
||||||
|
if ('web' !== $guard && 'remote_user_guard' !== $guard) {
|
||||||
$this->friendlyError(sprintf('AUTHENTICATION_GUARD "%s" is not a valid guard for Firefly III.', $guard));
|
$this->friendlyError(sprintf('AUTHENTICATION_GUARD "%s" is not a valid guard for Firefly III.', $guard));
|
||||||
$this->friendlyError('Please check your .env file and make sure you use a valid setting.');
|
$this->friendlyError('Please check your .env file and make sure you use a valid setting.');
|
||||||
$this->friendlyError('Valid guards are: web, remote_user_guard');
|
$this->friendlyError('Valid guards are: web, remote_user_guard');
|
||||||
@@ -82,9 +85,10 @@ class ValidatesEnvironmentVariables extends Command
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private function validateStaticToken(): void {
|
private function validateStaticToken(): void
|
||||||
$token = (string) env('STATIC_CRON_TOKEN','');
|
{
|
||||||
if(0 !== strlen($token) && 32 !== strlen($token)) {
|
$token = (string) env('STATIC_CRON_TOKEN', '');
|
||||||
|
if (0 !== strlen($token) && 32 !== strlen($token)) {
|
||||||
$this->friendlyError('STATIC_CRON_TOKEN must be empty or a 32-character string.');
|
$this->friendlyError('STATIC_CRON_TOKEN must be empty or a 32-character string.');
|
||||||
$this->friendlyError('Please check your .env file and make sure you use a valid setting.');
|
$this->friendlyError('Please check your .env file and make sure you use a valid setting.');
|
||||||
exit(1);
|
exit(1);
|
||||||
|
@@ -65,6 +65,12 @@ class AccountRepository implements AccountRepositoryInterface, UserGroupInterfac
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[\Override]
|
||||||
|
public function getAccountBalances(Account $account): Collection
|
||||||
|
{
|
||||||
|
return $account->accountBalances;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Find account with same name OR same IBAN or both, but not the same type or ID.
|
* Find account with same name OR same IBAN or both, but not the same type or ID.
|
||||||
*/
|
*/
|
||||||
|
@@ -52,6 +52,7 @@ interface AccountRepositoryInterface
|
|||||||
* Moved here from account CRUD.
|
* Moved here from account CRUD.
|
||||||
*/
|
*/
|
||||||
public function count(array $types): int;
|
public function count(array $types): int;
|
||||||
|
public function getAccountBalances(Account $account): Collection;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Moved here from account CRUD.
|
* Moved here from account CRUD.
|
||||||
|
@@ -126,7 +126,7 @@ trait DepositValidation
|
|||||||
// if the user submits an ID, but that ID is not of the correct type,
|
// if the user submits an ID, but that ID is not of the correct type,
|
||||||
// return false.
|
// return false.
|
||||||
if (null !== $accountId) {
|
if (null !== $accountId) {
|
||||||
$search = $this->getRepository()->find($accountId);
|
$search = $this->accountRepository->find($accountId);
|
||||||
if (null !== $search && !in_array($search->accountType->type, $validTypes, true)) {
|
if (null !== $search && !in_array($search->accountType->type, $validTypes, true)) {
|
||||||
app('log')->debug(sprintf('User submitted an ID (#%d), which is a "%s", so this is not a valid source.', $accountId, $search->accountType->type));
|
app('log')->debug(sprintf('User submitted an ID (#%d), which is a "%s", so this is not a valid source.', $accountId, $search->accountType->type));
|
||||||
app('log')->debug(sprintf('Firefly III accepts ID #%d as valid account data.', $accountId));
|
app('log')->debug(sprintf('Firefly III accepts ID #%d as valid account data.', $accountId));
|
||||||
@@ -140,7 +140,7 @@ trait DepositValidation
|
|||||||
|
|
||||||
// if user submits an IBAN:
|
// if user submits an IBAN:
|
||||||
if (null !== $accountIban) {
|
if (null !== $accountIban) {
|
||||||
$search = $this->getRepository()->findByIbanNull($accountIban, $validTypes);
|
$search = $this->accountRepository->findByIbanNull($accountIban, $validTypes);
|
||||||
if (null !== $search && !in_array($search->accountType->type, $validTypes, true)) {
|
if (null !== $search && !in_array($search->accountType->type, $validTypes, true)) {
|
||||||
app('log')->debug(sprintf('User submitted IBAN ("%s"), which is a "%s", so this is not a valid source.', $accountIban, $search->accountType->type));
|
app('log')->debug(sprintf('User submitted IBAN ("%s"), which is a "%s", so this is not a valid source.', $accountIban, $search->accountType->type));
|
||||||
$result = false;
|
$result = false;
|
||||||
@@ -154,7 +154,7 @@ trait DepositValidation
|
|||||||
|
|
||||||
// if user submits a number:
|
// if user submits a number:
|
||||||
if (null !== $accountNumber && '' !== $accountNumber) {
|
if (null !== $accountNumber && '' !== $accountNumber) {
|
||||||
$search = $this->getRepository()->findByAccountNumber($accountNumber, $validTypes);
|
$search = $this->accountRepository->findByAccountNumber($accountNumber, $validTypes);
|
||||||
if (null !== $search && !in_array($search->accountType->type, $validTypes, true)) {
|
if (null !== $search && !in_array($search->accountType->type, $validTypes, true)) {
|
||||||
app('log')->debug(
|
app('log')->debug(
|
||||||
sprintf('User submitted number ("%s"), which is a "%s", so this is not a valid source.', $accountNumber, $search->accountType->type)
|
sprintf('User submitted number ("%s"), which is a "%s", so this is not a valid source.', $accountNumber, $search->accountType->type)
|
||||||
|
@@ -101,7 +101,7 @@ trait OBValidation
|
|||||||
// return false.
|
// return false.
|
||||||
if (null !== $accountId && null === $accountName) {
|
if (null !== $accountId && null === $accountName) {
|
||||||
app('log')->debug('Source ID is not null, but name is null.');
|
app('log')->debug('Source ID is not null, but name is null.');
|
||||||
$search = $this->getRepository()->find($accountId);
|
$search = $this->accountRepository->find($accountId);
|
||||||
|
|
||||||
// the source resulted in an account, but it's not of a valid type.
|
// the source resulted in an account, but it's not of a valid type.
|
||||||
if (null !== $search && !in_array($search->accountType->type, $validTypes, true)) {
|
if (null !== $search && !in_array($search->accountType->type, $validTypes, true)) {
|
||||||
|
@@ -87,7 +87,7 @@ trait WithdrawalValidation
|
|||||||
|
|
||||||
// if there's an ID it must be of the "validTypes".
|
// if there's an ID it must be of the "validTypes".
|
||||||
if (null !== $accountId && 0 !== $accountId) {
|
if (null !== $accountId && 0 !== $accountId) {
|
||||||
$found = $this->getRepository()->find($accountId);
|
$found = $this->accountRepository->find($accountId);
|
||||||
if (null !== $found) {
|
if (null !== $found) {
|
||||||
$type = $found->accountType->type;
|
$type = $found->accountType->type;
|
||||||
if (in_array($type, $validTypes, true)) {
|
if (in_array($type, $validTypes, true)) {
|
||||||
|
Reference in New Issue
Block a user