mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2026-05-03 20:56:21 +00:00
More stuff for splits.
This commit is contained in:
@@ -18,6 +18,7 @@ use FireflyIII\Http\Requests\SplitJournalFormRequest;
|
||||
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
|
||||
use FireflyIII\Repositories\Budget\BudgetRepositoryInterface;
|
||||
use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface;
|
||||
use FireflyIII\Repositories\PiggyBank\PiggyBankRepositoryInterface;
|
||||
use Log;
|
||||
use Session;
|
||||
|
||||
@@ -41,12 +42,15 @@ class SplitController extends Controller
|
||||
/** @var BudgetRepositoryInterface $budgetRepository */
|
||||
$budgetRepository = app(BudgetRepositoryInterface::class);
|
||||
|
||||
/** @var PiggyBankRepositoryInterface $piggyBankRepository */
|
||||
$piggyBankRepository = app(PiggyBankRepositoryInterface::class);
|
||||
|
||||
// expect data to be in session or in post?
|
||||
$journalData = session('temporary_split_data');
|
||||
$journalData = session('temporary_split_data');
|
||||
$currencies = ExpandedForm::makeSelectList($currencyRepository->get());
|
||||
$assetAccounts = ExpandedForm::makeSelectList($accountRepository->getAccounts(['Default account', 'Asset account']));
|
||||
$budgets = ExpandedForm::makeSelectListWithEmpty($budgetRepository->getActiveBudgets());
|
||||
$piggyBanks = ExpandedForm::makeSelectListWithEmpty($piggyBankRepository->getPiggyBanks());
|
||||
if (!is_array($journalData)) {
|
||||
throw new FireflyException('Could not find transaction data in your session. Please go back and try again.'); // translate me.
|
||||
}
|
||||
@@ -54,7 +58,7 @@ class SplitController extends Controller
|
||||
Log::debug('Journal data', $journalData);
|
||||
|
||||
|
||||
return view('split.journals.from-store', compact('currencies', 'assetAccounts', 'budgets'))->with('data', $journalData);
|
||||
return view('split.journals.from-store', compact('currencies', 'piggyBanks', 'assetAccounts', 'budgets'))->with('data', $journalData);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -55,7 +55,9 @@ class SplitJournalFormRequest extends Request
|
||||
'category' => $this->get('category')[$index] ?? '',
|
||||
'source_account_id' => intval($this->get('source_account_id')),
|
||||
'source_account_name' => $this->get('source_account_name'),
|
||||
'destination_account_id' => $this->get('destination_account_id')[$index] ? intval($this->get('destination_account_id')[$index]) : 0,
|
||||
'destination_account_id' => isset($this->get('destination_account_id')[$index])
|
||||
? intval($this->get('destination_account_id')[$index])
|
||||
: intval($this->get('destination_account_id')),
|
||||
'destination_account_name' => $this->get('destination_account_name')[$index] ?? '',
|
||||
];
|
||||
$data['transactions'][] = $transaction;
|
||||
|
||||
Reference in New Issue
Block a user