Skip to content

Commit

Permalink
Code for #660
Browse files Browse the repository at this point in the history
  • Loading branch information
JC5 committed Jun 9, 2017
1 parent 762d7bc commit 1f9b7fa
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 9 deletions.
20 changes: 11 additions & 9 deletions app/Import/ImportStorage.php
Expand Up @@ -361,17 +361,19 @@ private function storeSingle(int $index, ImportEntry $entry): TransactionJournal

// create new transactions. This is something that needs a rewrite for multiple/split transactions.
$sourceData = [
'account_id' => $accounts['source']->id,
'transaction_journal_id' => $journal->id,
'description' => null,
'amount' => bcmul($amount, '-1'),
'account_id' => $accounts['source']->id,
'transaction_journal_id' => $journal->id,
'transaction_currency_id' => $journal->transaction_currency_id,
'description' => null,
'amount' => bcmul($amount, '-1'),
];

$destinationData = [
'account_id' => $accounts['destination']->id,
'transaction_journal_id' => $journal->id,
'description' => null,
'amount' => $amount,
'account_id' => $accounts['destination']->id,
'transaction_currency_id' => $journal->transaction_currency_id,
'transaction_journal_id' => $journal->id,
'description' => null,
'amount' => $amount,
];

$one = Transaction::create($sourceData);
Expand All @@ -383,7 +385,7 @@ private function storeSingle(int $index, ImportEntry $entry): TransactionJournal
}

if (is_null($two->id)) {
Log::error('Could not create transaction 1.', $two->getErrors()->all());
Log::error('Could not create transaction 2.', $two->getErrors()->all());
$error = true;
}

Expand Down
3 changes: 3 additions & 0 deletions app/Support/Import/CsvImportSupportTrait.php
Expand Up @@ -16,12 +16,15 @@
use FireflyIII\Import\Mapper\MapperInterface;
use FireflyIII\Import\MapperPreProcess\PreProcessorInterface;
use FireflyIII\Import\Specifics\SpecificInterface;
use FireflyIII\Models\ImportJob;
use League\Csv\Reader;
use Log;

/**
* Trait CsvImportSupportTrait
*
* @property ImportJob $job
*
* @package FireflyIII\Support\Import
*/
trait CsvImportSupportTrait
Expand Down

0 comments on commit 1f9b7fa

Please sign in to comment.