mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
Fix account validation
This commit is contained in:
parent
e96d28b981
commit
fe8635f1ce
@ -57,12 +57,13 @@ trait DepositValidation
|
||||
$result = null;
|
||||
$accountId = array_key_exists('id', $array) ? $array['id'] : null;
|
||||
$accountName = array_key_exists('name', $array) ? $array['name'] : null;
|
||||
$accountIban = array_key_exists('iban', $array) ? $array['iban'] : null;
|
||||
|
||||
Log::debug('Now in validateDepositDestination', $array);
|
||||
|
||||
// source can be any of the following types.
|
||||
$validTypes = $this->combinations[$this->transactionType][$this->source->accountType->type] ?? [];
|
||||
if (null === $accountId && null === $accountName && false === $this->canCreateTypes($validTypes)) {
|
||||
if (null === $accountId && null === $accountName && null === $accountIban && false === $this->canCreateTypes($validTypes)) {
|
||||
// if both values are NULL we return false,
|
||||
// because the destination of a deposit can't be created.
|
||||
$this->destError = (string)trans('validation.deposit_dest_need_data');
|
||||
|
@ -55,10 +55,11 @@ trait TransferValidation
|
||||
{
|
||||
$accountId = array_key_exists('id', $array) ? $array['id'] : null;
|
||||
$accountName = array_key_exists('name', $array) ? $array['name'] : null;
|
||||
$accountIban = array_key_exists('iban', $array) ? $array['iban'] : null;
|
||||
Log::debug('Now in validateTransferDestination', $array);
|
||||
// source can be any of the following types.
|
||||
$validTypes = $this->combinations[$this->transactionType][$this->source->accountType->type] ?? [];
|
||||
if (null === $accountId && null === $accountName && false === $this->canCreateTypes($validTypes)) {
|
||||
if (null === $accountId && null === $accountName && null === $accountIban && false === $this->canCreateTypes($validTypes)) {
|
||||
// if both values are NULL we return false,
|
||||
// because the destination of a transfer can't be created.
|
||||
$this->destError = (string)trans('validation.transfer_dest_need_data');
|
||||
|
@ -56,12 +56,13 @@ trait WithdrawalValidation
|
||||
{
|
||||
$accountId = array_key_exists('id', $array) ? $array['id'] : null;
|
||||
$accountName = array_key_exists('name', $array) ? $array['name'] : null;
|
||||
$accountIban = array_key_exists('iban', $array) ? $array['iban'] : null;
|
||||
Log::debug('Now in validateGenericSource', $array);
|
||||
// source can be any of the following types.
|
||||
$validTypes = [AccountType::ASSET, AccountType::REVENUE, AccountType::LOAN, AccountType::DEBT, AccountType::MORTGAGE];
|
||||
if (null === $accountId && null === $accountName && false === $this->canCreateTypes($validTypes)) {
|
||||
if (null === $accountId && null === $accountName && null === $accountIban && false === $this->canCreateTypes($validTypes)) {
|
||||
// if both values are NULL we return TRUE
|
||||
// because we assume the user doesnt want to submit / change anything.
|
||||
// because we assume the user doesn't want to submit / change anything.
|
||||
$this->sourceError = (string)trans('validation.withdrawal_source_need_data');
|
||||
app('log')->warning('[a] Not a valid source. Need more data.');
|
||||
|
||||
|
@ -204,31 +204,31 @@ return [
|
||||
|
||||
// validation of accounts:
|
||||
'withdrawal_source_need_data' => 'Need to get a valid source account ID and/or valid source account name to continue.',
|
||||
'withdrawal_source_bad_data' => 'Could not find a valid source account when searching for ID ":id" or name ":name".',
|
||||
'withdrawal_dest_need_data' => 'Need to get a valid destination account ID and/or valid destination account name to continue.',
|
||||
'withdrawal_source_bad_data' => '[a] Could not find a valid source account when searching for ID ":id" or name ":name".',
|
||||
'withdrawal_dest_need_data' => '[a] Need to get a valid destination account ID and/or valid destination account name to continue.',
|
||||
'withdrawal_dest_bad_data' => 'Could not find a valid destination account when searching for ID ":id" or name ":name".',
|
||||
|
||||
'reconciliation_source_bad_data' => 'Could not find a valid reconciliation account when searching for ID ":id" or name ":name".',
|
||||
|
||||
'generic_source_bad_data' => 'Could not find a valid source account when searching for ID ":id" or name ":name".',
|
||||
'generic_source_bad_data' => '[e] Could not find a valid source account when searching for ID ":id" or name ":name".',
|
||||
|
||||
'deposit_source_need_data' => 'Need to get a valid source account ID and/or valid source account name to continue.',
|
||||
'deposit_source_bad_data' => 'Could not find a valid source account when searching for ID ":id" or name ":name".',
|
||||
'deposit_dest_need_data' => 'Need to get a valid destination account ID and/or valid destination account name to continue.',
|
||||
'deposit_source_bad_data' => '[b] Could not find a valid source account when searching for ID ":id" or name ":name".',
|
||||
'deposit_dest_need_data' => '[b] Need to get a valid destination account ID and/or valid destination account name to continue.',
|
||||
'deposit_dest_bad_data' => 'Could not find a valid destination account when searching for ID ":id" or name ":name".',
|
||||
'deposit_dest_wrong_type' => 'The submitted destination account is not of the right type.',
|
||||
|
||||
// Ignore this comment
|
||||
|
||||
'transfer_source_need_data' => 'Need to get a valid source account ID and/or valid source account name to continue.',
|
||||
'transfer_source_bad_data' => 'Could not find a valid source account when searching for ID ":id" or name ":name".',
|
||||
'transfer_dest_need_data' => 'Need to get a valid destination account ID and/or valid destination account name to continue.',
|
||||
'transfer_source_bad_data' => '[c] Could not find a valid source account when searching for ID ":id" or name ":name".',
|
||||
'transfer_dest_need_data' => '[c] Need to get a valid destination account ID and/or valid destination account name to continue.',
|
||||
'transfer_dest_bad_data' => 'Could not find a valid destination account when searching for ID ":id" or name ":name".',
|
||||
'need_id_in_edit' => 'Each split must have transaction_journal_id (either valid ID or 0).',
|
||||
|
||||
'ob_source_need_data' => 'Need to get a valid source account ID and/or valid source account name to continue.',
|
||||
'lc_source_need_data' => 'Need to get a valid source account ID to continue.',
|
||||
'ob_dest_need_data' => 'Need to get a valid destination account ID and/or valid destination account name to continue.',
|
||||
'ob_dest_need_data' => '[d] Need to get a valid destination account ID and/or valid destination account name to continue.',
|
||||
'ob_dest_bad_data' => 'Could not find a valid destination account when searching for ID ":id" or name ":name".',
|
||||
'reconciliation_either_account' => 'To submit a reconciliation, you must submit either a source or a destination account. Not both, not neither.',
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user