mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
Configuration for import routine.
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* CsvImporter.php
|
* CsvSetup.php
|
||||||
* Copyright (C) 2016 thegrumpydictator@gmail.com
|
* Copyright (C) 2016 thegrumpydictator@gmail.com
|
||||||
*
|
*
|
||||||
* This software may be modified and distributed under the terms
|
* This software may be modified and distributed under the terms
|
||||||
@@ -9,7 +9,7 @@
|
|||||||
|
|
||||||
declare(strict_types = 1);
|
declare(strict_types = 1);
|
||||||
|
|
||||||
namespace FireflyIII\Import\Importer;
|
namespace FireflyIII\Import\Setup;
|
||||||
|
|
||||||
|
|
||||||
use ExpandedForm;
|
use ExpandedForm;
|
||||||
@@ -28,11 +28,11 @@ use Log;
|
|||||||
use Symfony\Component\HttpFoundation\FileBag;
|
use Symfony\Component\HttpFoundation\FileBag;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class CsvImporter
|
* Class CsvSetup
|
||||||
*
|
*
|
||||||
* @package FireflyIII\Import\Importer
|
* @package FireflyIII\Import\Importer
|
||||||
*/
|
*/
|
||||||
class CsvImporter implements ImporterInterface
|
class CsvSetup implements SetupInterface
|
||||||
{
|
{
|
||||||
const EXAMPLE_ROWS = 5;
|
const EXAMPLE_ROWS = 5;
|
||||||
/** @var Account */
|
/** @var Account */
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* ImporterInterface.php
|
* SetupInterface.php
|
||||||
* Copyright (C) 2016 thegrumpydictator@gmail.com
|
* Copyright (C) 2016 thegrumpydictator@gmail.com
|
||||||
*
|
*
|
||||||
* This software may be modified and distributed under the terms
|
* This software may be modified and distributed under the terms
|
||||||
@@ -9,7 +9,7 @@
|
|||||||
|
|
||||||
declare(strict_types = 1);
|
declare(strict_types = 1);
|
||||||
|
|
||||||
namespace FireflyIII\Import\Importer;
|
namespace FireflyIII\Import\Setup;
|
||||||
|
|
||||||
use FireflyIII\Import\Role\Map;
|
use FireflyIII\Import\Role\Map;
|
||||||
use FireflyIII\Models\ImportJob;
|
use FireflyIII\Models\ImportJob;
|
||||||
@@ -17,11 +17,11 @@ use Illuminate\Http\Request;
|
|||||||
use Symfony\Component\HttpFoundation\FileBag;
|
use Symfony\Component\HttpFoundation\FileBag;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Interface ImporterInterface
|
* Interface SetupInterface
|
||||||
*
|
*
|
||||||
* @package FireflyIII\Import\Importer
|
* @package FireflyIII\Import\Setup
|
||||||
*/
|
*/
|
||||||
interface ImporterInterface
|
interface SetupInterface
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -141,11 +141,18 @@ class AccountRepository implements AccountRepositoryInterface
|
|||||||
}
|
}
|
||||||
// remove group by
|
// remove group by
|
||||||
$query->getQuery()->getQuery()->groups = null;
|
$query->getQuery()->getQuery()->groups = null;
|
||||||
|
$ids = $query->get(['transaction_journals.id'])->pluck('id')->toArray();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// that should do it:
|
// 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);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ return [
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
'import_roles' => [
|
'import_roles' => [
|
||||||
'_ignore' => [
|
'_ignore' => [
|
||||||
'mappable' => false,
|
'mappable' => false,
|
||||||
'pre-process-map' => false,
|
'pre-process-map' => false,
|
||||||
'field' => 'ignored',
|
'field' => 'ignored',
|
||||||
@@ -59,41 +59,48 @@ return [
|
|||||||
|
|
||||||
|
|
||||||
],
|
],
|
||||||
'bill-id' => [
|
'bill-id' => [
|
||||||
'mappable' => true,
|
'mappable' => true,
|
||||||
'pre-process-map' => false,
|
'pre-process-map' => false,
|
||||||
'field' => 'bill',
|
'field' => 'bill',
|
||||||
'converter' => 'BillId',
|
'converter' => 'BillId',
|
||||||
'mapper' => 'Bills',
|
'mapper' => 'Bills',
|
||||||
],
|
],
|
||||||
'bill-name' => [
|
'bill-name' => [
|
||||||
'mappable' => true,
|
'mappable' => true,
|
||||||
'pre-process-map' => false,
|
'pre-process-map' => false,
|
||||||
'field' => 'bill',
|
'field' => 'bill',
|
||||||
'converter' => 'BillName',
|
'converter' => 'BillName',
|
||||||
'mapper' => 'Bills',
|
'mapper' => 'Bills',
|
||||||
],
|
],
|
||||||
'currency-id' => [
|
'currency-id' => [
|
||||||
'mappable' => true,
|
'mappable' => true,
|
||||||
'pre-process-map' => false,
|
'pre-process-map' => false,
|
||||||
'field' => 'currency',
|
'field' => 'currency',
|
||||||
'converter' => 'CurrencyId',
|
'converter' => 'CurrencyId',
|
||||||
'mapper' => 'TransactionCurrencies',
|
'mapper' => 'TransactionCurrencies',
|
||||||
],
|
],
|
||||||
'currency-name' => [
|
'currency-name' => [
|
||||||
'mappable' => true,
|
'mappable' => true,
|
||||||
'pre-process-map' => false,
|
'pre-process-map' => false,
|
||||||
'converter' => 'CurrencyName',
|
'converter' => 'CurrencyName',
|
||||||
'field' => 'currency',
|
'field' => 'currency',
|
||||||
'mapper' => 'TransactionCurrencies',
|
'mapper' => 'TransactionCurrencies',
|
||||||
],
|
],
|
||||||
'currency-code' => [
|
'currency-code' => [
|
||||||
'mappable' => true,
|
'mappable' => true,
|
||||||
'pre-process-map' => false,
|
'pre-process-map' => false,
|
||||||
'converter' => 'CurrencyCode',
|
'converter' => 'CurrencyCode',
|
||||||
'field' => 'currency',
|
'field' => 'currency',
|
||||||
'mapper' => 'TransactionCurrencies',
|
'mapper' => 'TransactionCurrencies',
|
||||||
],
|
],
|
||||||
|
'external-id' => [
|
||||||
|
'mappable' => false,
|
||||||
|
'pre-process-map' => false,
|
||||||
|
'converter' => 'ExternalId',
|
||||||
|
'field' => 'external-id',
|
||||||
|
],
|
||||||
|
|
||||||
'currency-symbol' => [
|
'currency-symbol' => [
|
||||||
'mappable' => true,
|
'mappable' => true,
|
||||||
'pre-process-map' => false,
|
'pre-process-map' => false,
|
||||||
@@ -113,7 +120,7 @@ return [
|
|||||||
'converter' => 'Date',
|
'converter' => 'Date',
|
||||||
'field' => 'date',
|
'field' => 'date',
|
||||||
],
|
],
|
||||||
'date-interest' => [
|
'date-interest' => [
|
||||||
'mappable' => false,
|
'mappable' => false,
|
||||||
'pre-process-map' => false,
|
'pre-process-map' => false,
|
||||||
'converter' => 'Date',
|
'converter' => 'Date',
|
||||||
@@ -125,7 +132,7 @@ return [
|
|||||||
'converter' => 'Date',
|
'converter' => 'Date',
|
||||||
'field' => 'date-book',
|
'field' => 'date-book',
|
||||||
],
|
],
|
||||||
'date-process' => [
|
'date-process' => [
|
||||||
'mappable' => false,
|
'mappable' => false,
|
||||||
'pre-process-map' => false,
|
'pre-process-map' => false,
|
||||||
'converter' => 'Date',
|
'converter' => 'Date',
|
||||||
|
|||||||
Reference in New Issue
Block a user