mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-12-17 20:08:52 +00:00
🤖 Auto commit for release 'develop' on 2025-11-09
This commit is contained in:
@@ -50,10 +50,10 @@ class AccountValidator
|
||||
use TransferValidation;
|
||||
use WithdrawalValidation;
|
||||
|
||||
public bool $createMode = false;
|
||||
public string $destError = 'No error yet.';
|
||||
public bool $createMode = false;
|
||||
public string $destError = 'No error yet.';
|
||||
public ?Account $destination = null;
|
||||
public ?Account $source = null;
|
||||
public ?Account $source = null;
|
||||
public string $sourceError = 'No error yet.';
|
||||
private AccountRepositoryInterface $accountRepository;
|
||||
private array $combinations;
|
||||
@@ -230,6 +230,7 @@ class AccountValidator
|
||||
protected function canCreateType(string $accountType): bool
|
||||
{
|
||||
$canCreate = [AccountTypeEnum::EXPENSE->value, AccountTypeEnum::REVENUE->value, AccountTypeEnum::INITIAL_BALANCE->value, AccountTypeEnum::LIABILITY_CREDIT->value];
|
||||
|
||||
return in_array($accountType, $canCreate, true);
|
||||
}
|
||||
|
||||
|
||||
@@ -123,6 +123,7 @@ class FireflyValidator extends Validator
|
||||
}
|
||||
$regex = '/^[a-z]{6}[0-9a-z]{2}([0-9a-z]{3})?\z/i';
|
||||
$result = preg_match($regex, $value);
|
||||
|
||||
return 0 !== $result;
|
||||
}
|
||||
|
||||
|
||||
@@ -302,6 +302,7 @@ trait TransactionValidation
|
||||
private function isLiability(Account $account): bool
|
||||
{
|
||||
$type = $account->accountType->type;
|
||||
|
||||
return in_array($type, config('firefly.valid_liabilities'), true);
|
||||
}
|
||||
|
||||
@@ -323,6 +324,7 @@ trait TransactionValidation
|
||||
if ('' === $transaction['foreign_amount']) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return 0 !== bccomp('0', (string) $transaction['foreign_amount']);
|
||||
}
|
||||
|
||||
@@ -750,6 +752,7 @@ trait TransactionValidation
|
||||
// source ID's are equal, return void.
|
||||
return true;
|
||||
}
|
||||
|
||||
// source names are equal, return void.
|
||||
return (bool) $this->arrayEqual($comparison['source_name']);
|
||||
}
|
||||
@@ -765,6 +768,7 @@ trait TransactionValidation
|
||||
// destination ID's are equal, return void.
|
||||
return true;
|
||||
}
|
||||
|
||||
// destination names are equal, return void.
|
||||
return (bool) $this->arrayEqual($comparison['destination_name']);
|
||||
}
|
||||
@@ -783,6 +787,7 @@ trait TransactionValidation
|
||||
// destination ID's are equal, return void.
|
||||
return true;
|
||||
}
|
||||
|
||||
// destination names are equal, return void.
|
||||
return (bool) $this->arrayEqual($comparison['destination_name']);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user