Skip to content

Firefly III: a personal finances manager

Configuration for import routine.

James Cole5a9cf698f741
diff --git a/app/Import/Setup/CsvSetup.php b/app/Import/Setup/CsvSetup.php
index 4df6f69f6f..967b9deeee 100644
--- a/app/Import/Setup/CsvSetup.php
+++ b/app/Import/Setup/CsvSetup.php
@@ -1,6 +1,6 @@
<?php
/**
- * CsvImporter.php
+ * CsvSetup.php
* Copyright (C) 2016 [email protected]
*
* This software may be modified and distributed under the terms
@@ -9,7 +9,7 @@
declare(strict_types = 1);
-namespace FireflyIII\Import\Importer;
+namespace FireflyIII\Import\Setup;
use ExpandedForm;
@@ -28,11 +28,11 @@ use Log;
use Symfony\Component\HttpFoundation\FileBag;
/**
- * Class CsvImporter
+ * Class CsvSetup
*
* @package FireflyIII\Import\Importer
*/
-class CsvImporter implements ImporterInterface
+class CsvSetup implements SetupInterface
{
const EXAMPLE_ROWS = 5;
/** @var Account */
diff --git a/app/Import/Setup/SetupInterface.php b/app/Import/Setup/SetupInterface.php
index 66b72a6f08..497c8e4769 100644
--- a/app/Import/Setup/SetupInterface.php
+++ b/app/Import/Setup/SetupInterface.php
@@ -1,6 +1,6 @@
<?php
/**
- * ImporterInterface.php
+ * SetupInterface.php
* Copyright (C) 2016 [email protected]
*
* This software may be modified and distributed under the terms
@@ -9,7 +9,7 @@
declare(strict_types = 1);
-namespace FireflyIII\Import\Importer;
+namespace FireflyIII\Import\Setup;
use FireflyIII\Import\Role\Map;
use FireflyIII\Models\ImportJob;
@@ -17,11 +17,11 @@ use Illuminate\Http\Request;
use Symfony\Component\HttpFoundation\FileBag;
/**
- * Interface ImporterInterface
+ * Interface SetupInterface
*
- * @package FireflyIII\Import\Importer
+ * @package FireflyIII\Import\Setup
*/
-interface ImporterInterface
+interface SetupInterface
{
/**
diff --git a/app/Repositories/Account/AccountRepository.php b/app/Repositories/Account/AccountRepository.php
index 7a2b650532..b57c93f0f0 100644
--- a/app/Repositories/Account/AccountRepository.php
+++ b/app/Repositories/Account/AccountRepository.php
@@ -141,11 +141,18 @@ class AccountRepository implements AccountRepositoryInterface
}
// remove group by
$query->getQuery()->getQuery()->groups = null;
+ $ids = $query->get(['transaction_journals.id'])->pluck('id')->toArray();
+
+
// that should do it:
- $sum = strval($query->sum('destination.amount'));
+ $sum = $this->user->transactions()
+ ->whereIn('transaction_journal_id', $ids)
+ ->where('amount', '>', '0')
+ ->whereNull('transactions.deleted_at')
+ ->sum('amount');
- return $sum;
+ return strval($sum);
}
diff --git a/config/csv.php b/config/csv.php
index 5b5ac530d5..d4561c8a1a 100644
--- a/config/csv.php
+++ b/config/csv.php
@@ -50,7 +50,7 @@ return [
*
*/
'import_roles' => [
- '_ignore' => [
+ '_ignore' => [
'mappable' => false,
'pre-process-map' => false,
'field' => 'ignored',
@@ -59,41 +59,48 @@ return [
],
- 'bill-id' => [
+ 'bill-id' => [
'mappable' => true,
'pre-process-map' => false,
'field' => 'bill',
'converter' => 'BillId',
'mapper' => 'Bills',
],
- 'bill-name' => [
+ 'bill-name' => [
'mappable' => true,
'pre-process-map' => false,
'field' => 'bill',
'converter' => 'BillName',
'mapper' => 'Bills',
],
- 'currency-id' => [
+ 'currency-id' => [
'mappable' => true,
'pre-process-map' => false,
'field' => 'currency',
'converter' => 'CurrencyId',
'mapper' => 'TransactionCurrencies',
],
- 'currency-name' => [
+ 'currency-name' => [
'mappable' => true,
'pre-process-map' => false,
'converter' => 'CurrencyName',
'field' => 'currency',
'mapper' => 'TransactionCurrencies',
],
- 'currency-code' => [
+ 'currency-code' => [
'mappable' => true,
'pre-process-map' => false,
'converter' => 'CurrencyCode',
'field' => 'currency',
'mapper' => 'TransactionCurrencies',
],
+ 'external-id' => [
+ 'mappable' => false,
+ 'pre-process-map' => false,
+ 'converter' => 'ExternalId',
+ 'field' => 'external-id',
+ ],
+
'currency-symbol' => [
'mappable' => true,
'pre-process-map' => false,
@@ -113,7 +120,7 @@ return [
'converter' => 'Date',
'field' => 'date',
],
- 'date-interest' => [
+ 'date-interest' => [
'mappable' => false,
'pre-process-map' => false,
'converter' => 'Date',
@@ -125,7 +132,7 @@ return [
'converter' => 'Date',
'field' => 'date-book',
],
- 'date-process' => [
+ 'date-process' => [
'mappable' => false,
'pre-process-map' => false,
'converter' => 'Date',