mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-12 15:35:15 +00:00
Fix #1864
This commit is contained in:
@@ -110,7 +110,7 @@ class TransactionFactory
|
|||||||
// all this data is the same for both transactions:
|
// all this data is the same for both transactions:
|
||||||
Log::debug('Searching for currency info.');
|
Log::debug('Searching for currency info.');
|
||||||
$currency = $this->findCurrency($data['currency_id'], $data['currency_code']);
|
$currency = $this->findCurrency($data['currency_id'], $data['currency_code']);
|
||||||
$description = $journal->description === $data['description'] ? null : $data['description'];
|
//$description = $data['description'];
|
||||||
|
|
||||||
// type of source account and destination account depends on journal type:
|
// type of source account and destination account depends on journal type:
|
||||||
$sourceType = $this->accountType($journal, 'source');
|
$sourceType = $this->accountType($journal, 'source');
|
||||||
@@ -135,10 +135,9 @@ class TransactionFactory
|
|||||||
|
|
||||||
// based on the source type, destination type and transaction type, the system can start throwing FireflyExceptions.
|
// based on the source type, destination type and transaction type, the system can start throwing FireflyExceptions.
|
||||||
$this->validateTransaction($sourceAccount->accountType->type, $destinationAccount->accountType->type, $journal->transactionType->type);
|
$this->validateTransaction($sourceAccount->accountType->type, $destinationAccount->accountType->type, $journal->transactionType->type);
|
||||||
|
|
||||||
$source = $this->create(
|
$source = $this->create(
|
||||||
[
|
[
|
||||||
'description' => $description,
|
'description' => $data['description'],
|
||||||
'amount' => app('steam')->negative((string)$data['amount']),
|
'amount' => app('steam')->negative((string)$data['amount']),
|
||||||
'foreign_amount' => null,
|
'foreign_amount' => null,
|
||||||
'currency' => $currency,
|
'currency' => $currency,
|
||||||
@@ -150,7 +149,7 @@ class TransactionFactory
|
|||||||
);
|
);
|
||||||
$dest = $this->create(
|
$dest = $this->create(
|
||||||
[
|
[
|
||||||
'description' => $description,
|
'description' => $data['description'],
|
||||||
'amount' => app('steam')->positive((string)$data['amount']),
|
'amount' => app('steam')->positive((string)$data['amount']),
|
||||||
'foreign_amount' => null,
|
'foreign_amount' => null,
|
||||||
'currency' => $currency,
|
'currency' => $currency,
|
||||||
|
@@ -89,11 +89,10 @@ class TransactionUpdateService
|
|||||||
{
|
{
|
||||||
$currency = $this->findCurrency($data['currency_id'], $data['currency_code']);
|
$currency = $this->findCurrency($data['currency_id'], $data['currency_code']);
|
||||||
$journal = $transaction->transactionJournal;
|
$journal = $transaction->transactionJournal;
|
||||||
$description = $journal->description === $data['description'] ? null : $data['description'];
|
|
||||||
$amount = (string)$data['amount'];
|
$amount = (string)$data['amount'];
|
||||||
$account = null;
|
$account = null;
|
||||||
// update description:
|
// update description:
|
||||||
$transaction->description = $description;
|
$transaction->description = $data['description'];
|
||||||
$foreignAmount = null;
|
$foreignAmount = null;
|
||||||
if ((float)$transaction->amount < 0) {
|
if ((float)$transaction->amount < 0) {
|
||||||
// this is the source transaction.
|
// this is the source transaction.
|
||||||
@@ -112,7 +111,7 @@ class TransactionUpdateService
|
|||||||
}
|
}
|
||||||
|
|
||||||
// update the actual transaction:
|
// update the actual transaction:
|
||||||
$transaction->description = $description;
|
$transaction->description = $data['description'];
|
||||||
$transaction->amount = $amount;
|
$transaction->amount = $amount;
|
||||||
$transaction->foreign_amount = null;
|
$transaction->foreign_amount = null;
|
||||||
$transaction->transaction_currency_id = null === $currency ? $transaction->transaction_currency_id : $currency->id;
|
$transaction->transaction_currency_id = null === $currency ? $transaction->transaction_currency_id : $currency->id;
|
||||||
|
Reference in New Issue
Block a user