mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2024-12-26 08:51:12 -06:00
Add BIC support. This fixes #430
This commit is contained in:
parent
8279cf0e88
commit
8cdbc96aa5
@ -171,6 +171,7 @@ class AccountController extends Controller
|
||||
'accountRole' => $account->getMeta('accountRole'),
|
||||
'ccType' => $account->getMeta('ccType'),
|
||||
'ccMonthlyPaymentDate' => $account->getMeta('ccMonthlyPaymentDate'),
|
||||
'BIC' => $account->getMeta('BIC'),
|
||||
'openingBalanceDate' => $openingBalanceDate,
|
||||
'openingBalance' => $openingBalanceAmount,
|
||||
'virtualBalance' => $account->virtual_balance,
|
||||
|
@ -42,10 +42,11 @@ class AccountFormRequest extends Request
|
||||
'name' => trim($this->input('name')),
|
||||
'active' => intval($this->input('active')) === 1,
|
||||
'accountType' => $this->input('what'),
|
||||
'currency_id' => intval($this->input('currency_id')),
|
||||
'currency_id' => intval($this->input('currency_id')),
|
||||
'virtualBalance' => round($this->input('virtualBalance'), 2),
|
||||
'virtualBalanceCurrency' => intval($this->input('amount_currency_id_virtualBalance')),
|
||||
'iban' => trim($this->input('iban')),
|
||||
'BIC' => trim($this->input('BIC')),
|
||||
'accountNumber' => trim($this->input('accountNumber')),
|
||||
'accountRole' => $this->input('accountRole'),
|
||||
'openingBalance' => round($this->input('openingBalance'), 2),
|
||||
@ -79,6 +80,7 @@ class AccountFormRequest extends Request
|
||||
'name' => $nameRule,
|
||||
'openingBalance' => 'numeric',
|
||||
'iban' => 'iban',
|
||||
'BIC' => 'bic',
|
||||
'virtualBalance' => 'numeric',
|
||||
'openingBalanceDate' => 'date',
|
||||
'currency_id' => 'exists:transaction_currencies,id',
|
||||
|
@ -41,7 +41,7 @@ class AccountRepository implements AccountRepositoryInterface
|
||||
/** @var User */
|
||||
private $user;
|
||||
/** @var array */
|
||||
private $validFields = ['accountRole', 'ccMonthlyPaymentDate', 'ccType', 'accountNumber','currency_id'];
|
||||
private $validFields = ['accountRole', 'ccMonthlyPaymentDate', 'ccType', 'accountNumber', 'currency_id', 'BIC'];
|
||||
|
||||
/**
|
||||
* AttachmentRepository constructor.
|
||||
@ -60,7 +60,7 @@ class AccountRepository implements AccountRepositoryInterface
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function count(array $types):int
|
||||
public function count(array $types): int
|
||||
{
|
||||
$count = $this->user->accounts()->accountTypeIn($types)->count();
|
||||
|
||||
@ -482,7 +482,7 @@ class AccountRepository implements AccountRepositoryInterface
|
||||
*
|
||||
* @return Account
|
||||
*/
|
||||
protected function storeOpposingAccount(float $amount, string $name):Account
|
||||
protected function storeOpposingAccount(float $amount, string $name): Account
|
||||
{
|
||||
$type = $amount < 0 ? 'expense' : 'revenue';
|
||||
$opposingData = [
|
||||
|
@ -119,6 +119,6 @@ interface AccountRepositoryInterface
|
||||
*
|
||||
* @return Account
|
||||
*/
|
||||
public function store(array $data) : Account;
|
||||
public function store(array $data): Account;
|
||||
|
||||
}
|
||||
|
@ -57,8 +57,6 @@ class FireflyValidator extends Validator
|
||||
* @param $value
|
||||
*
|
||||
* @return bool
|
||||
* @internal param $parameters
|
||||
*
|
||||
*
|
||||
*/
|
||||
public function validate2faCode($attribute, $value): bool
|
||||
@ -95,6 +93,27 @@ class FireflyValidator extends Validator
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $attribute
|
||||
* @param $value
|
||||
*
|
||||
* @return bool
|
||||
*
|
||||
*/
|
||||
public function validateBic($attribute, $value): bool
|
||||
{
|
||||
$regex = '/^[a-z]{6}[0-9a-z]{2}([0-9a-z]{3})?\z/i';
|
||||
$result = preg_match($regex, $value);
|
||||
if ($result === false) {
|
||||
return false;
|
||||
}
|
||||
if ($result === 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $attribute
|
||||
* @param $value
|
||||
|
@ -31,6 +31,7 @@ return [
|
||||
'journal_asset_source_account' => 'Asset account (source)',
|
||||
'journal_source_account_name' => 'Revenue account (source)',
|
||||
'journal_source_account_id' => 'Asset account (source)',
|
||||
'BIC' => 'BIC',
|
||||
'account_from_id' => 'From account',
|
||||
'account_to_id' => 'To account',
|
||||
'source_account' => 'Source account',
|
||||
|
@ -21,6 +21,7 @@ return [
|
||||
'file_too_large' => 'File ":name" is too large.',
|
||||
'belongs_to_user' => 'The value of :attribute is unknown',
|
||||
'accepted' => 'The :attribute must be accepted.',
|
||||
'bic' => 'This is not a valid BIC.',
|
||||
'active_url' => 'The :attribute is not a valid URL.',
|
||||
'after' => 'The :attribute must be a date after :date.',
|
||||
'alpha' => 'The :attribute may only contain letters.',
|
||||
|
@ -34,6 +34,7 @@
|
||||
<div class="box-body">
|
||||
|
||||
{{ ExpandedForm.text('iban') }}
|
||||
{{ ExpandedForm.text('BIC', null, {maxlength: 11}) }}
|
||||
{{ ExpandedForm.text('accountNumber') }}
|
||||
|
||||
{% if what == 'asset' %}
|
||||
|
@ -32,6 +32,7 @@
|
||||
</div>
|
||||
<div class="box-body">
|
||||
{{ ExpandedForm.text('iban') }}
|
||||
{{ ExpandedForm.text('BIC', null, {maxlength: 11}) }}
|
||||
{{ ExpandedForm.text('accountNumber') }}
|
||||
|
||||
{% if account.accounttype.type == 'Default account' or account.accounttype.type == 'Asset account' %}
|
||||
|
Loading…
Reference in New Issue
Block a user