This commit is contained in:
James Cole
2020-10-28 06:14:12 +01:00
parent 7b9f2b6ce5
commit 3aa835a985
2 changed files with 17 additions and 16 deletions

View File

@@ -47,7 +47,7 @@ class BudgetFormStoreRequest extends FormRequest
'name' => $this->string('name'),
'active' => $this->boolean('active'),
'auto_budget_type' => $this->integer('auto_budget_type'),
'transaction_currency_id' => $this->integer('transaction_currency_id'),
'transaction_currency_id' => $this->integer('auto_budget_currency_id'),
'auto_budget_amount' => $this->string('auto_budget_amount'),
'auto_budget_period' => $this->string('auto_budget_period'),
];

View File

@@ -161,6 +161,7 @@ class BudgetRepository implements BudgetRepositoryInterface
if (null !== $journal) {
return $journal->date;
}
return null;
}
@@ -282,10 +283,10 @@ class BudgetRepository implements BudgetRepositoryInterface
$currencyCode = (string)($data['transaction_currency_code'] ?? '');
$currency = $repos->findNull($currencyId);
if(null === $currency) {
if (null === $currency) {
$currency = $repos->findByCodeNull($currencyCode);
}
if(null === $currency) {
if (null === $currency) {
$currency = app('amount')->getDefaultCurrencyByUser($this->user);
}
@@ -307,7 +308,7 @@ class BudgetRepository implements BudgetRepositoryInterface
$limitRepos->store(
[
'budget_id' => $newBudget->id,
'transaction_currency_id' => $autoBudget->transaction_currency_id,
'currency_id' => $autoBudget->transaction_currency_id,
'start_date' => $start,
'end_date' => $end,
'amount' => $autoBudget->amount,
@@ -353,10 +354,10 @@ class BudgetRepository implements BudgetRepositoryInterface
$currencyCode = (string)($data['transaction_currency_code'] ?? '');
$currency = $repos->findNull($currencyId);
if(null === $currency) {
if (null === $currency) {
$currency = $repos->findByCodeNull($currencyCode);
}
if(null === $currency) {
if (null === $currency) {
$currency = app('amount')->getDefaultCurrencyByUser($this->user);
}