mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-13 16:00:13 +00:00
Fix split deposit.
This commit is contained in:
@@ -105,9 +105,6 @@ class Journal implements JournalInterface
|
||||
*/
|
||||
public function updateJournal(TransactionJournal $journal, array $data): TransactionJournal
|
||||
{
|
||||
echo '<pre>';
|
||||
print_r($data);
|
||||
|
||||
$journal->description = $data['journal_description'];
|
||||
$journal->transaction_currency_id = $data['journal_currency_id'];
|
||||
$journal->date = $data['date'];
|
||||
@@ -167,7 +164,8 @@ class Journal implements JournalInterface
|
||||
{
|
||||
$destinationAccount = Account::where('user_id', $this->user->id)->where('id', $data['destination_account_id'])->first(['accounts.*']);
|
||||
|
||||
if (strlen($data['source_account_name']) > 0) {
|
||||
|
||||
if (isset($data['source_account_name']) && strlen($data['source_account_name']) > 0) {
|
||||
$sourceType = AccountType::where('type', 'Revenue account')->first();
|
||||
$sourceAccount = Account::firstOrCreateEncrypted(
|
||||
['user_id' => $this->user->id, 'account_type_id' => $sourceType->id, 'name' => $data['source_account_name'], 'active' => 1]
|
||||
|
@@ -59,14 +59,10 @@ class SplitJournalFormRequest extends Request
|
||||
'amount' => round($this->get('amount')[$index], 2),
|
||||
'budget_id' => $this->get('budget_id')[$index] ? intval($this->get('budget_id')[$index]) : 0,
|
||||
'category' => $this->get('category')[$index] ?? '',
|
||||
'source_account_id' => intval($this->get('journal_source_account_id')),
|
||||
'source_account_name' => $this->get('journal_source_account_name'),
|
||||
'piggy_bank_id' => isset($this->get('piggy_bank_id')[$index])
|
||||
? intval($this->get('piggy_bank_id')[$index])
|
||||
: 0,
|
||||
'destination_account_id' => isset($this->get('destination_account_id')[$index])
|
||||
? intval($this->get('destination_account_id')[$index])
|
||||
: intval($this->get('journal_destination_account_id')),
|
||||
'source_account_id' => isset($this->get('source_account_id')[$index]) ? intval($this->get('source_account_id')[$index]) : intval($this->get('journal_source_account_id')),
|
||||
'source_account_name' => $this->get('source_account_name')[$index] ?? '',
|
||||
'piggy_bank_id' => isset($this->get('piggy_bank_id')[$index]) ? intval($this->get('piggy_bank_id')[$index]) : 0,
|
||||
'destination_account_id' => isset($this->get('destination_account_id')[$index]) ? intval($this->get('destination_account_id')[$index]) : intval($this->get('journal_destination_account_id')),
|
||||
'destination_account_name' => $this->get('destination_account_name')[$index] ?? '',
|
||||
];
|
||||
$data['transactions'][] = $transaction;
|
||||
|
@@ -29,6 +29,7 @@ return [
|
||||
'lastMatch' => 'Last match',
|
||||
'split_number' => 'Split #',
|
||||
'destination' => 'Destination',
|
||||
'source' => 'Source',
|
||||
'expectedMatch' => 'Expected match',
|
||||
'automatch' => 'Auto match?',
|
||||
'repeat_freq' => 'Repeats',
|
||||
|
@@ -85,9 +85,12 @@
|
||||
<tr>
|
||||
<th>{{ trans('list.split_number') }}</th>
|
||||
<th>{{ trans('list.description') }}</th>
|
||||
{% if preFilled.what == 'withdrawal' or preFilled.what == 'deposit' %}
|
||||
{% if preFilled.what == 'withdrawal' %}
|
||||
<th>{{ trans('list.destination') }}</th>
|
||||
{% endif %}
|
||||
{% if preFilled.what == 'deposit' %}
|
||||
<th>{{ trans('list.source') }}</th>
|
||||
{% endif %}
|
||||
<th>{{ trans('list.amount') }}</th>
|
||||
{% if preFilled.what == 'withdrawal' %}
|
||||
<th>{{ trans('list.budget') }}</th>
|
||||
|
@@ -94,9 +94,12 @@
|
||||
<th>{{ trans('list.description') }}</th>
|
||||
|
||||
<!-- withdrawal and deposit have a destination. -->
|
||||
{% if preFilled.what == 'withdrawal' or preFilled.what == 'deposit' %}
|
||||
{% if preFilled.what == 'withdrawal' %}
|
||||
<th>{{ trans('list.destination') }}</th>
|
||||
{% endif %}
|
||||
{% if preFilled.what == 'deposit' %}
|
||||
<th>{{ trans('list.source') }}</th>
|
||||
{% endif %}
|
||||
|
||||
<th>{{ trans('list.amount') }}</th>
|
||||
|
||||
|
Reference in New Issue
Block a user