mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2026-01-06 14:12:15 +00:00
Add BIC support. This fixes #430
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user