mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-03 20:20:37 -06:00
Fixes for #233
This commit is contained in:
parent
e953f58c74
commit
21181d8d8e
@ -42,6 +42,7 @@ class AccountController extends Controller
|
|||||||
|
|
||||||
$subTitleIcon = Config::get('firefly.subIconsByIdentifier.' . $what);
|
$subTitleIcon = Config::get('firefly.subIconsByIdentifier.' . $what);
|
||||||
$subTitle = trans('firefly.make_new_' . $what . '_account');
|
$subTitle = trans('firefly.make_new_' . $what . '_account');
|
||||||
|
Session::flash('preFilled', []);
|
||||||
|
|
||||||
// put previous url in session if not redirect from store (not "create another").
|
// put previous url in session if not redirect from store (not "create another").
|
||||||
if (session('accounts.create.fromStore') !== true) {
|
if (session('accounts.create.fromStore') !== true) {
|
||||||
|
@ -34,6 +34,9 @@ class AccountRepository implements AccountRepositoryInterface
|
|||||||
/** @var User */
|
/** @var User */
|
||||||
private $user;
|
private $user;
|
||||||
|
|
||||||
|
/** @var array */
|
||||||
|
private $validFields = ['accountRole', 'ccMonthlyPaymentDate', 'ccType', 'accountNumber'];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* AttachmentRepository constructor.
|
* AttachmentRepository constructor.
|
||||||
*
|
*
|
||||||
@ -448,7 +451,7 @@ class AccountRepository implements AccountRepositoryInterface
|
|||||||
$this->updateMetadata($account, $data);
|
$this->updateMetadata($account, $data);
|
||||||
$openingBalance = $this->openingBalanceTransaction($account);
|
$openingBalance = $this->openingBalanceTransaction($account);
|
||||||
if ($data['openingBalance'] != 0) {
|
if ($data['openingBalance'] != 0) {
|
||||||
if ($openingBalance) {
|
if (!is_null($openingBalance->id)) {
|
||||||
$this->updateInitialBalance($account, $openingBalance, $data);
|
$this->updateInitialBalance($account, $openingBalance, $data);
|
||||||
} else {
|
} else {
|
||||||
$type = $data['openingBalance'] < 0 ? 'expense' : 'revenue';
|
$type = $data['openingBalance'] < 0 ? 'expense' : 'revenue';
|
||||||
@ -570,8 +573,7 @@ class AccountRepository implements AccountRepositoryInterface
|
|||||||
*/
|
*/
|
||||||
protected function storeMetadata(Account $account, array $data)
|
protected function storeMetadata(Account $account, array $data)
|
||||||
{
|
{
|
||||||
$validFields = ['accountRole', 'ccMonthlyPaymentDate', 'ccType'];
|
foreach ($this->validFields as $field) {
|
||||||
foreach ($validFields as $field) {
|
|
||||||
if (isset($data[$field])) {
|
if (isset($data[$field])) {
|
||||||
$metaData = new AccountMeta(
|
$metaData = new AccountMeta(
|
||||||
[
|
[
|
||||||
@ -621,9 +623,7 @@ class AccountRepository implements AccountRepositoryInterface
|
|||||||
*/
|
*/
|
||||||
protected function updateMetadata(Account $account, array $data)
|
protected function updateMetadata(Account $account, array $data)
|
||||||
{
|
{
|
||||||
$validFields = ['accountRole', 'ccMonthlyPaymentDate', 'ccType'];
|
foreach ($this->validFields as $field) {
|
||||||
|
|
||||||
foreach ($validFields as $field) {
|
|
||||||
$entry = $account->accountMeta()->where('name', $field)->first();
|
$entry = $account->accountMeta()->where('name', $field)->first();
|
||||||
|
|
||||||
if (isset($data[$field])) {
|
if (isset($data[$field])) {
|
||||||
|
Loading…
Reference in New Issue
Block a user