mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-02-25 18:45:27 -06:00
More CSV related updates.
This commit is contained in:
parent
a4a723cfc6
commit
87c0f1d86e
@ -74,6 +74,7 @@ class AccountCrud implements AccountCrudInterface
|
|||||||
*/
|
*/
|
||||||
public function find(int $accountId): Account
|
public function find(int $accountId): Account
|
||||||
{
|
{
|
||||||
|
Log::debug('Searching for user ', ['user' => $this->user->id]);
|
||||||
$account = $this->user->accounts()->find($accountId);
|
$account = $this->user->accounts()->find($accountId);
|
||||||
if (is_null($account)) {
|
if (is_null($account)) {
|
||||||
return new Account;
|
return new Account;
|
||||||
@ -82,6 +83,33 @@ class AccountCrud implements AccountCrudInterface
|
|||||||
return $account;
|
return $account;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $number
|
||||||
|
* @param array $types
|
||||||
|
*
|
||||||
|
* @return Account
|
||||||
|
*/
|
||||||
|
public function findByAccountNumber(string $number, array $types): Account
|
||||||
|
{
|
||||||
|
$query = $this->user->accounts()
|
||||||
|
->leftJoin('account_meta', 'account_meta.account_id', '=', 'accounts.id')
|
||||||
|
->where('account_meta.name', 'accountNumber')
|
||||||
|
->where('account_meta.data', json_encode($number));
|
||||||
|
|
||||||
|
if (count($types) > 0) {
|
||||||
|
$query->leftJoin('account_types', 'accounts.account_type_id', '=', 'account_types.id');
|
||||||
|
$query->whereIn('account_types.type', $types);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @var Collection $accounts */
|
||||||
|
$accounts = $query->get();
|
||||||
|
if ($accounts->count() > 0) {
|
||||||
|
return $accounts->first();
|
||||||
|
}
|
||||||
|
|
||||||
|
return new Account;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $iban
|
* @param string $iban
|
||||||
* @param array $types
|
* @param array $types
|
||||||
|
@ -53,6 +53,14 @@ interface AccountCrudInterface
|
|||||||
*/
|
*/
|
||||||
public function findByName(string $name, array $types): Account;
|
public function findByName(string $name, array $types): Account;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $number
|
||||||
|
* @param array $types
|
||||||
|
*
|
||||||
|
* @return Account
|
||||||
|
*/
|
||||||
|
public function findByAccountNumber(string $number, array $types): Account;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param array $accountIds
|
* @param array $accountIds
|
||||||
*
|
*
|
||||||
|
@ -117,7 +117,7 @@ class ImportController extends Controller
|
|||||||
/**
|
/**
|
||||||
* This is step 1. Upload a file.
|
* This is step 1. Upload a file.
|
||||||
*
|
*
|
||||||
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
* @return View
|
||||||
*/
|
*/
|
||||||
public function index()
|
public function index()
|
||||||
{
|
{
|
||||||
|
@ -62,7 +62,8 @@ class AssetAccountIban extends BasicConverter implements ConverterInterface
|
|||||||
|
|
||||||
|
|
||||||
$account = $repository->store(
|
$account = $repository->store(
|
||||||
['name' => $value, 'iban' => $value, 'user' => $this->user->id, 'accountType' => 'asset', 'virtualBalance' => 0, 'active' => true]
|
['name' => 'Account with IBAN ' . $value, 'iban' => $value, 'user' => $this->user->id, 'accountType' => 'asset', 'virtualBalance' => 0,
|
||||||
|
'active' => true]
|
||||||
);
|
);
|
||||||
|
|
||||||
return $account;
|
return $account;
|
||||||
|
@ -11,7 +11,9 @@ declare(strict_types = 1);
|
|||||||
|
|
||||||
namespace FireflyIII\Import\Converter;
|
namespace FireflyIII\Import\Converter;
|
||||||
|
|
||||||
use FireflyIII\Exceptions\FireflyException;
|
use FireflyIII\Crud\Account\AccountCrudInterface;
|
||||||
|
use FireflyIII\Models\Account;
|
||||||
|
use Log;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class AssetAccountId
|
* Class AssetAccountId
|
||||||
@ -24,11 +26,41 @@ class AssetAccountId extends BasicConverter implements ConverterInterface
|
|||||||
/**
|
/**
|
||||||
* @param $value
|
* @param $value
|
||||||
*
|
*
|
||||||
* @throws FireflyException
|
* @return Account
|
||||||
*/
|
*/
|
||||||
public function convert($value)
|
public function convert($value)
|
||||||
{
|
{
|
||||||
throw new FireflyException('Importer with name AssetAccountId has not yet been configured.');
|
$value = intval(trim($value));
|
||||||
|
Log::debug('Going to convert using AssetAccountId', ['value' => $value]);
|
||||||
|
|
||||||
|
if ($value === 0) {
|
||||||
|
return new Account;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @var AccountCrudInterface $repository */
|
||||||
|
$repository = app(AccountCrudInterface::class, [$this->user]);
|
||||||
|
|
||||||
|
|
||||||
|
if (isset($this->mapping[$value])) {
|
||||||
|
Log::debug('Found account in mapping. Should exist.', ['value' => $value, 'map' => $this->mapping[$value]]);
|
||||||
|
$account = $repository->find(intval($this->mapping[$value]));
|
||||||
|
if (!is_null($account->id)) {
|
||||||
|
Log::debug('Found account by ID', ['id' => $account->id]);
|
||||||
|
|
||||||
|
return $account;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// not mapped? Still try to find it first:
|
||||||
|
$account = $repository->find($value);
|
||||||
|
if (!is_null($account->id)) {
|
||||||
|
Log::debug('Found account by ID ', ['id' => $account->id]);
|
||||||
|
|
||||||
|
return $account;
|
||||||
|
}
|
||||||
|
|
||||||
|
// should not really happen. If the ID does not match FF, what is FF supposed to do?
|
||||||
|
return new Account;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -11,7 +11,10 @@ declare(strict_types = 1);
|
|||||||
|
|
||||||
namespace FireflyIII\Import\Converter;
|
namespace FireflyIII\Import\Converter;
|
||||||
|
|
||||||
use FireflyIII\Exceptions\FireflyException;
|
use FireflyIII\Crud\Account\AccountCrudInterface;
|
||||||
|
use FireflyIII\Models\Account;
|
||||||
|
use FireflyIII\Models\AccountType;
|
||||||
|
use Log;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class AssetAccountName
|
* Class AssetAccountName
|
||||||
@ -24,11 +27,47 @@ class AssetAccountName extends BasicConverter implements ConverterInterface
|
|||||||
/**
|
/**
|
||||||
* @param $value
|
* @param $value
|
||||||
*
|
*
|
||||||
* @throws FireflyException
|
* @return Account
|
||||||
*/
|
*/
|
||||||
public function convert($value)
|
public function convert($value)
|
||||||
{
|
{
|
||||||
throw new FireflyException('Importer with name AssetAccountName has not yet been configured.');
|
$value = trim($value);
|
||||||
|
Log::debug('Going to convert using AssetAccountName', ['value' => $value]);
|
||||||
|
|
||||||
|
if (strlen($value) === 0) {
|
||||||
|
return new Account;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @var AccountCrudInterface $repository */
|
||||||
|
$repository = app(AccountCrudInterface::class, [$this->user]);
|
||||||
|
|
||||||
|
|
||||||
|
if (isset($this->mapping[$value])) {
|
||||||
|
Log::debug('Found account in mapping. Should exist.', ['value' => $value, 'map' => $this->mapping[$value]]);
|
||||||
|
$account = $repository->find(intval($this->mapping[$value]));
|
||||||
|
if (!is_null($account->id)) {
|
||||||
|
Log::debug('Found account by ID', ['id' => $account->id]);
|
||||||
|
|
||||||
|
return $account;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// not mapped? Still try to find it first:
|
||||||
|
$account = $repository->findByName($value, [AccountType::ASSET]);
|
||||||
|
if (!is_null($account->id)) {
|
||||||
|
Log::debug('Found account by name', ['id' => $account->id]);
|
||||||
|
|
||||||
|
return $account;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$account = $repository->store(
|
||||||
|
['name' => $value, 'iban' => null, 'openingBalance' => 0, 'user' => $this->user->id, 'accountType' => 'asset', 'virtualBalance' => 0,
|
||||||
|
'active' => true]
|
||||||
|
);
|
||||||
|
|
||||||
|
return $account;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -11,7 +11,11 @@ declare(strict_types = 1);
|
|||||||
|
|
||||||
namespace FireflyIII\Import\Converter;
|
namespace FireflyIII\Import\Converter;
|
||||||
|
|
||||||
|
use FireflyIII\Crud\Account\AccountCrudInterface;
|
||||||
use FireflyIII\Exceptions\FireflyException;
|
use FireflyIII\Exceptions\FireflyException;
|
||||||
|
use FireflyIII\Models\Account;
|
||||||
|
use FireflyIII\Models\AccountType;
|
||||||
|
use Log;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class AssetAccountNumber
|
* Class AssetAccountNumber
|
||||||
@ -24,11 +28,46 @@ class AssetAccountNumber extends BasicConverter implements ConverterInterface
|
|||||||
/**
|
/**
|
||||||
* @param $value
|
* @param $value
|
||||||
*
|
*
|
||||||
* @throws FireflyException
|
* @return Account
|
||||||
*/
|
*/
|
||||||
public function convert($value)
|
public function convert($value)
|
||||||
{
|
{
|
||||||
throw new FireflyException('Importer with name AssetAccountNumber has not yet been configured.');
|
$value = trim($value);
|
||||||
|
Log::debug('Going to convert using AssetAccountName', ['value' => $value]);
|
||||||
|
|
||||||
|
if (strlen($value) === 0) {
|
||||||
|
return new Account;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @var AccountCrudInterface $repository */
|
||||||
|
$repository = app(AccountCrudInterface::class, [$this->user]);
|
||||||
|
|
||||||
|
|
||||||
|
if (isset($this->mapping[$value])) {
|
||||||
|
Log::debug('Found account in mapping. Should exist.', ['value' => $value, 'map' => $this->mapping[$value]]);
|
||||||
|
$account = $repository->find(intval($this->mapping[$value]));
|
||||||
|
if (!is_null($account->id)) {
|
||||||
|
Log::debug('Found account by ID', ['id' => $account->id]);
|
||||||
|
|
||||||
|
return $account;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// not mapped? Still try to find it first:
|
||||||
|
$account = $repository->findByAccountNumber($value, [AccountType::ASSET]);
|
||||||
|
if (!is_null($account->id)) {
|
||||||
|
Log::debug('Found account by name', ['id' => $account->id]);
|
||||||
|
|
||||||
|
return $account;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$account = $repository->store(
|
||||||
|
['name' => 'Account with number ' . $value, 'openingBalance' => 0, 'iban' => null, 'user' => $this->user->id, 'accountType' => 'asset',
|
||||||
|
'virtualBalance' => 0, 'active' => true]
|
||||||
|
);
|
||||||
|
|
||||||
|
return $account;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -12,6 +12,9 @@ declare(strict_types = 1);
|
|||||||
namespace FireflyIII\Import\Converter;
|
namespace FireflyIII\Import\Converter;
|
||||||
|
|
||||||
use FireflyIII\Exceptions\FireflyException;
|
use FireflyIII\Exceptions\FireflyException;
|
||||||
|
use FireflyIII\Models\Bill;
|
||||||
|
use FireflyIII\Repositories\Bill\BillRepositoryInterface;
|
||||||
|
use Log;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class BillId
|
* Class BillId
|
||||||
@ -24,11 +27,40 @@ class BillId extends BasicConverter implements ConverterInterface
|
|||||||
/**
|
/**
|
||||||
* @param $value
|
* @param $value
|
||||||
*
|
*
|
||||||
* @throws FireflyException
|
* @return Bill
|
||||||
*/
|
*/
|
||||||
public function convert($value)
|
public function convert($value)
|
||||||
{
|
{
|
||||||
throw new FireflyException('Importer with name BillId has not yet been configured.');
|
$value = intval(trim($value));
|
||||||
|
Log::debug('Going to convert using BillId', ['value' => $value]);
|
||||||
|
|
||||||
|
if ($value === 0) {
|
||||||
|
return new Bill;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @var BillRepositoryInterface $repository */
|
||||||
|
$repository = app(BillRepositoryInterface::class, [$this->user]);
|
||||||
|
|
||||||
|
if (isset($this->mapping[$value])) {
|
||||||
|
Log::debug('Found bill in mapping. Should exist.', ['value' => $value, 'map' => $this->mapping[$value]]);
|
||||||
|
$bill = $repository->find(intval($this->mapping[$value]));
|
||||||
|
if (!is_null($bill->id)) {
|
||||||
|
Log::debug('Found bill by ID', ['id' => $bill->id]);
|
||||||
|
|
||||||
|
return $bill;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// not mapped? Still try to find it first:
|
||||||
|
$bill = $repository->find($value);
|
||||||
|
if (!is_null($bill->id)) {
|
||||||
|
Log::debug('Found bill by ID ', ['id' => $bill->id]);
|
||||||
|
|
||||||
|
return $bill;
|
||||||
|
}
|
||||||
|
|
||||||
|
// should not really happen. If the ID does not match FF, what is FF supposed to do?
|
||||||
|
return new Bill;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -12,6 +12,9 @@ declare(strict_types = 1);
|
|||||||
namespace FireflyIII\Import\Converter;
|
namespace FireflyIII\Import\Converter;
|
||||||
|
|
||||||
use FireflyIII\Exceptions\FireflyException;
|
use FireflyIII\Exceptions\FireflyException;
|
||||||
|
use FireflyIII\Models\Bill;
|
||||||
|
use FireflyIII\Repositories\Bill\BillRepositoryInterface;
|
||||||
|
use Log;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class BillName
|
* Class BillName
|
||||||
@ -28,7 +31,53 @@ class BillName extends BasicConverter implements ConverterInterface
|
|||||||
*/
|
*/
|
||||||
public function convert($value)
|
public function convert($value)
|
||||||
{
|
{
|
||||||
throw new FireflyException('Importer with name BillName has not yet been configured.');
|
$value = trim($value);
|
||||||
|
Log::debug('Going to convert using BillName', ['value' => $value]);
|
||||||
|
|
||||||
|
if (strlen($value) === 0) {
|
||||||
|
return new Bill;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** @var BillRepositoryInterface $repository */
|
||||||
|
$repository = app(BillRepositoryInterface::class, [$this->user]);
|
||||||
|
|
||||||
|
if (isset($this->mapping[$value])) {
|
||||||
|
Log::debug('Found bill in mapping. Should exist.', ['value' => $value, 'map' => $this->mapping[$value]]);
|
||||||
|
$bill = $repository->find(intval($this->mapping[$value]));
|
||||||
|
if (!is_null($bill->id)) {
|
||||||
|
Log::debug('Found bill by ID', ['id' => $bill->id]);
|
||||||
|
|
||||||
|
return $bill;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// not mapped? Still try to find it first:
|
||||||
|
$bill = $repository->findByName($value);
|
||||||
|
if (!is_null($bill->id)) {
|
||||||
|
Log::debug('Found bill by name ', ['id' => $bill->id]);
|
||||||
|
|
||||||
|
return $bill;
|
||||||
|
}
|
||||||
|
|
||||||
|
// create new bill. Use a lot of made up values.
|
||||||
|
$bill = $repository->store(
|
||||||
|
[
|
||||||
|
'name' => $value,
|
||||||
|
'match' => $value,
|
||||||
|
'amount_min' => 1,
|
||||||
|
'user_id' => $this->user->id,
|
||||||
|
'amount_max' => 10,
|
||||||
|
'date' => date('Ymd'),
|
||||||
|
'repeat_freq' => 'monthly',
|
||||||
|
'skip' => 0,
|
||||||
|
'automatch' => 0,
|
||||||
|
'active' => 1,
|
||||||
|
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
return $bill;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -65,40 +65,7 @@ class OpposingAccountIban extends BasicConverter implements ConverterInterface
|
|||||||
|
|
||||||
$account = $repository->store(
|
$account = $repository->store(
|
||||||
['name' => $value, 'iban' => $value, 'user' => $this->user->id, 'accountType' => 'import', 'virtualBalance' => 0, 'active' => true,
|
['name' => $value, 'iban' => $value, 'user' => $this->user->id, 'accountType' => 'import', 'virtualBalance' => 0, 'active' => true,
|
||||||
'openingBalance' => 0<?php
|
'openingBalance' => 0]
|
||||||
/**
|
|
||||||
* AssetAccountId.php
|
|
||||||
* Copyright (C) 2016 thegrumpydictator@gmail.com
|
|
||||||
*
|
|
||||||
* This software may be modified and distributed under the terms
|
|
||||||
* of the MIT license. See the LICENSE file for details.
|
|
||||||
*/
|
|
||||||
|
|
||||||
declare(strict_types = 1);
|
|
||||||
|
|
||||||
namespace FireflyIII\Import\Converter;
|
|
||||||
|
|
||||||
use FireflyIII\Exceptions\FireflyException;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Class AssetAccountId
|
|
||||||
*
|
|
||||||
* @package FireflyIII\Import\Converter
|
|
||||||
*/
|
|
||||||
class AssetAccountId extends BasicConverter implements ConverterInterface
|
|
||||||
{
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param $value
|
|
||||||
*
|
|
||||||
* @throws FireflyException
|
|
||||||
*/
|
|
||||||
public function convert($value)
|
|
||||||
{
|
|
||||||
throw new FireflyException('Importer with name AssetAccountId has not yet been configured.');
|
|
||||||
|
|
||||||
}
|
|
||||||
}]
|
|
||||||
);
|
);
|
||||||
|
|
||||||
return $account;
|
return $account;
|
||||||
|
@ -17,6 +17,7 @@ use FireflyIII\Crud\Account\AccountCrud;
|
|||||||
use FireflyIII\Import\Converter\ConverterInterface;
|
use FireflyIII\Import\Converter\ConverterInterface;
|
||||||
use FireflyIII\Import\ImportEntry;
|
use FireflyIII\Import\ImportEntry;
|
||||||
use FireflyIII\Import\Mapper\MapperInterface;
|
use FireflyIII\Import\Mapper\MapperInterface;
|
||||||
|
use FireflyIII\Import\MapperPreProcess\PreProcessorInterface;
|
||||||
use FireflyIII\Models\AccountType;
|
use FireflyIII\Models\AccountType;
|
||||||
use FireflyIII\Models\ImportJob;
|
use FireflyIII\Models\ImportJob;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
@ -180,16 +181,23 @@ class CsvImporter implements ImporterInterface
|
|||||||
public function saveImportConfiguration(array $data, FileBag $files): bool
|
public function saveImportConfiguration(array $data, FileBag $files): bool
|
||||||
{
|
{
|
||||||
/** @var AccountCrud $repository */
|
/** @var AccountCrud $repository */
|
||||||
$repository = app(AccountCrud::class);
|
$repository = app(AccountCrud::class, [auth()->user()]);
|
||||||
$account = $repository->find(intval($data['csv_import_account']));
|
$account = $repository->find(intval($data['csv_import_account']));
|
||||||
|
|
||||||
$hasHeaders = isset($data['has_headers']) && intval($data['has_headers']) === 1 ? true : false;
|
$hasHeaders = isset($data['has_headers']) && intval($data['has_headers']) === 1 ? true : false;
|
||||||
$config = $this->job->configuration;
|
$config = $this->job->configuration;
|
||||||
$config['has-headers'] = $hasHeaders;
|
$config['has-headers'] = $hasHeaders;
|
||||||
$config['date-format'] = $data['date_format'];
|
$config['date-format'] = $data['date_format'];
|
||||||
$config['delimiter'] = $data['csv_delimiter'];
|
$config['delimiter'] = $data['csv_delimiter'];
|
||||||
|
|
||||||
|
Log::debug('Entered import account.', ['id' => $data['csv_import_account']]);
|
||||||
|
|
||||||
|
|
||||||
if (!is_null($account->id)) {
|
if (!is_null($account->id)) {
|
||||||
|
Log::debug('Found account.', ['id' => $account->id, 'name' => $account->name]);
|
||||||
$config['import-account'] = $account->id;
|
$config['import-account'] = $account->id;
|
||||||
|
} else {
|
||||||
|
Log::error('Could not find anything for csv_import_account.', ['id' => $data['csv_import_account']]);
|
||||||
}
|
}
|
||||||
// loop specifics.
|
// loop specifics.
|
||||||
if (isset($data['specifics']) && is_array($data['specifics'])) {
|
if (isset($data['specifics']) && is_array($data['specifics'])) {
|
||||||
@ -335,21 +343,28 @@ class CsvImporter implements ImporterInterface
|
|||||||
|
|
||||||
foreach ($config['column-do-mapping'] as $index => $mustBeMapped) {
|
foreach ($config['column-do-mapping'] as $index => $mustBeMapped) {
|
||||||
if ($mustBeMapped) {
|
if ($mustBeMapped) {
|
||||||
$column = $config['column-roles'][$index] ?? '_ignore';
|
$column = $config['column-roles'][$index] ?? '_ignore';
|
||||||
$canBeMapped = config('csv.import_roles.' . $column . '.mappable');
|
$canBeMapped = config('csv.import_roles.' . $column . '.mappable');
|
||||||
|
$preProcessMap = config('csv.import_roles.' . $column . '.pre-process-map');
|
||||||
if ($canBeMapped) {
|
if ($canBeMapped) {
|
||||||
$mapperName = '\FireflyIII\Import\Mapper\\' . config('csv.import_roles.' . $column . '.mapper');
|
$mapperName = '\FireflyIII\Import\Mapper\\' . config('csv.import_roles.' . $column . '.mapper');
|
||||||
/** @var MapperInterface $mapper */
|
/** @var MapperInterface $mapper */
|
||||||
$mapper = new $mapperName;
|
$mapper = new $mapperName;
|
||||||
$indexes[] = $index;
|
$indexes[] = $index;
|
||||||
$data[$index] = [
|
$data[$index] = [
|
||||||
'name' => $column,
|
'name' => $column,
|
||||||
'mapper' => $mapperName,
|
'mapper' => $mapperName,
|
||||||
'index' => $index,
|
'index' => $index,
|
||||||
'options' => $mapper->getMap(),
|
'options' => $mapper->getMap(),
|
||||||
'values' => [],
|
'preProcessMap' => null,
|
||||||
|
'values' => [],
|
||||||
];
|
];
|
||||||
|
if ($preProcessMap) {
|
||||||
|
$data[$index]['preProcessMap'] = '\FireflyIII\Import\MapperPreProcess\\' .
|
||||||
|
config('csv.import_roles.' . $column . '.pre-process-mapper');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -358,12 +373,29 @@ class CsvImporter implements ImporterInterface
|
|||||||
$reader = Reader::createFromString($content);
|
$reader = Reader::createFromString($content);
|
||||||
$results = $reader->fetch();
|
$results = $reader->fetch();
|
||||||
|
|
||||||
foreach ($results as $row) {
|
foreach ($results as $rowIndex => $row) {
|
||||||
//do something here
|
//do something here
|
||||||
foreach ($indexes as $index) {
|
foreach ($indexes as $index) { // this is simply 1, 2, 3, etc.
|
||||||
$value = $row[$index];
|
$value = $row[$index];
|
||||||
if (strlen($value) > 0) {
|
if (strlen($value) > 0) {
|
||||||
$data[$index]['values'][] = $row[$index];
|
|
||||||
|
// we can do some preprocessing here,
|
||||||
|
// which is exclusively to fix the tags:
|
||||||
|
if (!is_null($data[$index]['preProcessMap'])) {
|
||||||
|
/** @var PreProcessorInterface $preProcessor */
|
||||||
|
$preProcessor = app($data[$index]['preProcessMap']);
|
||||||
|
$result = $preProcessor->run($value);
|
||||||
|
$data[$index]['values'] = array_merge($data[$index]['values'], $result);
|
||||||
|
|
||||||
|
Log::debug($rowIndex . ':' . $index . 'Value before preprocessor', ['value' => $value]);
|
||||||
|
Log::debug($rowIndex . ':' . $index . 'Value after preprocessor', ['value-new' => $result]);
|
||||||
|
Log::debug($rowIndex . ':' . $index . 'Value after joining', ['value-complete' => $data[$index]['values']]);
|
||||||
|
|
||||||
|
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$data[$index]['values'][] = $value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
28
app/Import/MapperPreProcess/PreProcessorInterface.php
Normal file
28
app/Import/MapperPreProcess/PreProcessorInterface.php
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* PreProcessorInterface.php
|
||||||
|
* Copyright (C) 2016 thegrumpydictator@gmail.com
|
||||||
|
*
|
||||||
|
* This software may be modified and distributed under the terms
|
||||||
|
* of the MIT license. See the LICENSE file for details.
|
||||||
|
*/
|
||||||
|
|
||||||
|
declare(strict_types = 1);
|
||||||
|
|
||||||
|
namespace FireflyIII\Import\MapperPreProcess;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Interface PreProcessorInterface
|
||||||
|
*
|
||||||
|
* @package FireflyIII\Import\MapperPreProcess
|
||||||
|
*/
|
||||||
|
interface PreProcessorInterface
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @param string $value
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function run(string $value): array;
|
||||||
|
|
||||||
|
}
|
31
app/Import/MapperPreProcess/TagsComma.php
Normal file
31
app/Import/MapperPreProcess/TagsComma.php
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* TagsComma.php
|
||||||
|
* Copyright (C) 2016 thegrumpydictator@gmail.com
|
||||||
|
*
|
||||||
|
* This software may be modified and distributed under the terms
|
||||||
|
* of the MIT license. See the LICENSE file for details.
|
||||||
|
*/
|
||||||
|
|
||||||
|
declare(strict_types = 1);
|
||||||
|
|
||||||
|
namespace FireflyIII\Import\MapperPreProcess;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class TagsComma
|
||||||
|
*
|
||||||
|
* @package FireflyIII\Import\MapperPreProcess
|
||||||
|
*/
|
||||||
|
class TagsComma implements PreProcessorInterface
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $value
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function run(string $value): array
|
||||||
|
{
|
||||||
|
return explode(',', $value);
|
||||||
|
}
|
||||||
|
}
|
30
app/Import/MapperPreProcess/TagsSpace.php
Normal file
30
app/Import/MapperPreProcess/TagsSpace.php
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* TagsSpace.php
|
||||||
|
* Copyright (C) 2016 thegrumpydictator@gmail.com
|
||||||
|
*
|
||||||
|
* This software may be modified and distributed under the terms
|
||||||
|
* of the MIT license. See the LICENSE file for details.
|
||||||
|
*/
|
||||||
|
|
||||||
|
declare(strict_types = 1);
|
||||||
|
|
||||||
|
namespace FireflyIII\Import\MapperPreProcess;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class TagsSpace
|
||||||
|
*
|
||||||
|
* @package FireflyIII\Import\MapperPreProcess
|
||||||
|
*/
|
||||||
|
class TagsSpace implements PreProcessorInterface
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @param string $value
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function run(string $value): array
|
||||||
|
{
|
||||||
|
return explode(' ', $value);
|
||||||
|
}
|
||||||
|
}
|
@ -44,7 +44,7 @@ class AccountServiceProvider extends ServiceProvider
|
|||||||
'FireflyIII\Repositories\Account\AccountRepositoryInterface',
|
'FireflyIII\Repositories\Account\AccountRepositoryInterface',
|
||||||
function (Application $app, array $arguments) {
|
function (Application $app, array $arguments) {
|
||||||
if (!isset($arguments[0]) && $app->auth->check()) {
|
if (!isset($arguments[0]) && $app->auth->check()) {
|
||||||
return app('FireflyIII\Repositories\Account\AccountRepository', [$app->auth->user()]);
|
return app('FireflyIII\Repositories\Account\AccountRepository', [auth()->user()]);
|
||||||
}
|
}
|
||||||
if (!isset($arguments[0]) && !$app->auth->check()) {
|
if (!isset($arguments[0]) && !$app->auth->check()) {
|
||||||
throw new FireflyException('There is no user present.');
|
throw new FireflyException('There is no user present.');
|
||||||
|
@ -44,7 +44,7 @@ class AttachmentServiceProvider extends ServiceProvider
|
|||||||
'FireflyIII\Repositories\Attachment\AttachmentRepositoryInterface',
|
'FireflyIII\Repositories\Attachment\AttachmentRepositoryInterface',
|
||||||
function (Application $app, array $arguments) {
|
function (Application $app, array $arguments) {
|
||||||
if (!isset($arguments[0]) && $app->auth->check()) {
|
if (!isset($arguments[0]) && $app->auth->check()) {
|
||||||
return app('FireflyIII\Repositories\Attachment\AttachmentRepository', [$app->auth->user()]);
|
return app('FireflyIII\Repositories\Attachment\AttachmentRepository', [auth()->user()]);
|
||||||
}
|
}
|
||||||
if (!isset($arguments[0]) && !$app->auth->check()) {
|
if (!isset($arguments[0]) && !$app->auth->check()) {
|
||||||
throw new FireflyException('There is no user present.');
|
throw new FireflyException('There is no user present.');
|
||||||
|
@ -44,7 +44,7 @@ class BillServiceProvider extends ServiceProvider
|
|||||||
'FireflyIII\Repositories\Bill\BillRepositoryInterface',
|
'FireflyIII\Repositories\Bill\BillRepositoryInterface',
|
||||||
function (Application $app, array $arguments) {
|
function (Application $app, array $arguments) {
|
||||||
if (!isset($arguments[0]) && $app->auth->check()) {
|
if (!isset($arguments[0]) && $app->auth->check()) {
|
||||||
return app('FireflyIII\Repositories\Bill\BillRepository', [$app->auth->user()]);
|
return app('FireflyIII\Repositories\Bill\BillRepository', [auth()->user()]);
|
||||||
}
|
}
|
||||||
if (!isset($arguments[0]) && !$app->auth->check()) {
|
if (!isset($arguments[0]) && !$app->auth->check()) {
|
||||||
throw new FireflyException('There is no user present.');
|
throw new FireflyException('There is no user present.');
|
||||||
|
@ -44,7 +44,7 @@ class BudgetServiceProvider extends ServiceProvider
|
|||||||
'FireflyIII\Repositories\Budget\BudgetRepositoryInterface',
|
'FireflyIII\Repositories\Budget\BudgetRepositoryInterface',
|
||||||
function (Application $app, array $arguments) {
|
function (Application $app, array $arguments) {
|
||||||
if (!isset($arguments[0]) && $app->auth->check()) {
|
if (!isset($arguments[0]) && $app->auth->check()) {
|
||||||
return app('FireflyIII\Repositories\Budget\BudgetRepository', [$app->auth->user()]);
|
return app('FireflyIII\Repositories\Budget\BudgetRepository', [auth()->user()]);
|
||||||
}
|
}
|
||||||
if (!isset($arguments[0]) && !$app->auth->check()) {
|
if (!isset($arguments[0]) && !$app->auth->check()) {
|
||||||
throw new FireflyException('There is no user present.');
|
throw new FireflyException('There is no user present.');
|
||||||
|
@ -44,7 +44,7 @@ class CategoryServiceProvider extends ServiceProvider
|
|||||||
'FireflyIII\Repositories\Category\CategoryRepositoryInterface',
|
'FireflyIII\Repositories\Category\CategoryRepositoryInterface',
|
||||||
function (Application $app, array $arguments) {
|
function (Application $app, array $arguments) {
|
||||||
if (!isset($arguments[0]) && $app->auth->check()) {
|
if (!isset($arguments[0]) && $app->auth->check()) {
|
||||||
return app('FireflyIII\Repositories\Category\CategoryRepository', [$app->auth->user()]);
|
return app('FireflyIII\Repositories\Category\CategoryRepository', [auth()->user()]);
|
||||||
}
|
}
|
||||||
if (!isset($arguments[0]) && !$app->auth->check()) {
|
if (!isset($arguments[0]) && !$app->auth->check()) {
|
||||||
throw new FireflyException('There is no user present.');
|
throw new FireflyException('There is no user present.');
|
||||||
|
@ -12,8 +12,10 @@ declare(strict_types = 1);
|
|||||||
namespace FireflyIII\Providers;
|
namespace FireflyIII\Providers;
|
||||||
|
|
||||||
use FireflyIII\Exceptions\FireflyException;
|
use FireflyIII\Exceptions\FireflyException;
|
||||||
|
use Illuminate\Auth\AuthManager;
|
||||||
use Illuminate\Foundation\Application;
|
use Illuminate\Foundation\Application;
|
||||||
use Illuminate\Support\ServiceProvider;
|
use Illuminate\Support\ServiceProvider;
|
||||||
|
use Log;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class CrudServiceProvider
|
* Class CrudServiceProvider
|
||||||
@ -49,12 +51,14 @@ class CrudServiceProvider extends ServiceProvider
|
|||||||
$this->app->bind(
|
$this->app->bind(
|
||||||
'FireflyIII\Crud\Account\AccountCrudInterface',
|
'FireflyIII\Crud\Account\AccountCrudInterface',
|
||||||
function (Application $app, array $arguments) {
|
function (Application $app, array $arguments) {
|
||||||
if (!isset($arguments[0]) && $app->auth->check()) {
|
|
||||||
return app('FireflyIII\Crud\Account\AccountCrud', [$app->auth->user()]);
|
if (!isset($arguments[0]) && auth()->check()) {
|
||||||
|
return app('FireflyIII\Crud\Account\AccountCrud', [auth()->user()]);
|
||||||
}
|
}
|
||||||
if (!isset($arguments[0]) && !$app->auth->check()) {
|
if (!isset($arguments[0]) && !$app->auth->check()) {
|
||||||
throw new FireflyException('There is no user present.');
|
throw new FireflyException('There is no user present.');
|
||||||
}
|
}
|
||||||
|
Log::debug('AccountCrud constructor, run with default arguments.', $arguments);
|
||||||
|
|
||||||
return app('FireflyIII\Crud\Account\AccountCrud', $arguments);
|
return app('FireflyIII\Crud\Account\AccountCrud', $arguments);
|
||||||
}
|
}
|
||||||
@ -67,7 +71,7 @@ class CrudServiceProvider extends ServiceProvider
|
|||||||
'FireflyIII\Crud\Split\JournalInterface',
|
'FireflyIII\Crud\Split\JournalInterface',
|
||||||
function (Application $app, array $arguments) {
|
function (Application $app, array $arguments) {
|
||||||
if (!isset($arguments[0]) && $app->auth->check()) {
|
if (!isset($arguments[0]) && $app->auth->check()) {
|
||||||
return app('FireflyIII\Crud\Split\Journal', [$app->auth->user()]);
|
return app('FireflyIII\Crud\Split\Journal', [auth()->user()]);
|
||||||
}
|
}
|
||||||
if (!isset($arguments[0]) && !$app->auth->check()) {
|
if (!isset($arguments[0]) && !$app->auth->check()) {
|
||||||
throw new FireflyException('There is no user present.');
|
throw new FireflyException('There is no user present.');
|
||||||
|
@ -56,7 +56,7 @@ class ExportJobServiceProvider extends ServiceProvider
|
|||||||
'FireflyIII\Repositories\ExportJob\ExportJobRepositoryInterface',
|
'FireflyIII\Repositories\ExportJob\ExportJobRepositoryInterface',
|
||||||
function (Application $app, array $arguments) {
|
function (Application $app, array $arguments) {
|
||||||
if (!isset($arguments[0]) && $app->auth->check()) {
|
if (!isset($arguments[0]) && $app->auth->check()) {
|
||||||
return app('FireflyIII\Repositories\ExportJob\ExportJobRepository', [$app->auth->user()]);
|
return app('FireflyIII\Repositories\ExportJob\ExportJobRepository', [auth()->user()]);
|
||||||
}
|
}
|
||||||
if (!isset($arguments[0]) && !$app->auth->check()) {
|
if (!isset($arguments[0]) && !$app->auth->check()) {
|
||||||
throw new FireflyException('There is no user present.');
|
throw new FireflyException('There is no user present.');
|
||||||
@ -73,7 +73,7 @@ class ExportJobServiceProvider extends ServiceProvider
|
|||||||
'FireflyIII\Repositories\ImportJob\ImportJobRepositoryInterface',
|
'FireflyIII\Repositories\ImportJob\ImportJobRepositoryInterface',
|
||||||
function (Application $app, array $arguments) {
|
function (Application $app, array $arguments) {
|
||||||
if (!isset($arguments[0]) && $app->auth->check()) {
|
if (!isset($arguments[0]) && $app->auth->check()) {
|
||||||
return app('FireflyIII\Repositories\ImportJob\ImportJobRepository', [$app->auth->user()]);
|
return app('FireflyIII\Repositories\ImportJob\ImportJobRepository', [auth()->user()]);
|
||||||
}
|
}
|
||||||
if (!isset($arguments[0]) && !$app->auth->check()) {
|
if (!isset($arguments[0]) && !$app->auth->check()) {
|
||||||
throw new FireflyException('There is no user present.');
|
throw new FireflyException('There is no user present.');
|
||||||
|
@ -44,7 +44,7 @@ class JournalServiceProvider extends ServiceProvider
|
|||||||
'FireflyIII\Repositories\Journal\JournalRepositoryInterface',
|
'FireflyIII\Repositories\Journal\JournalRepositoryInterface',
|
||||||
function (Application $app, array $arguments) {
|
function (Application $app, array $arguments) {
|
||||||
if (!isset($arguments[0]) && $app->auth->check()) {
|
if (!isset($arguments[0]) && $app->auth->check()) {
|
||||||
return app('FireflyIII\Repositories\Journal\JournalRepository', [$app->auth->user()]);
|
return app('FireflyIII\Repositories\Journal\JournalRepository', [auth()->user()]);
|
||||||
}
|
}
|
||||||
if (!isset($arguments[0]) && !$app->auth->check()) {
|
if (!isset($arguments[0]) && !$app->auth->check()) {
|
||||||
throw new FireflyException('There is no user present.');
|
throw new FireflyException('There is no user present.');
|
||||||
|
@ -45,7 +45,7 @@ class PiggyBankServiceProvider extends ServiceProvider
|
|||||||
'FireflyIII\Repositories\PiggyBank\PiggyBankRepositoryInterface',
|
'FireflyIII\Repositories\PiggyBank\PiggyBankRepositoryInterface',
|
||||||
function (Application $app, array $arguments) {
|
function (Application $app, array $arguments) {
|
||||||
if (!isset($arguments[0]) && $app->auth->check()) {
|
if (!isset($arguments[0]) && $app->auth->check()) {
|
||||||
return app('FireflyIII\Repositories\PiggyBank\PiggyBankRepository', [$app->auth->user()]);
|
return app('FireflyIII\Repositories\PiggyBank\PiggyBankRepository', [auth()->user()]);
|
||||||
}
|
}
|
||||||
if (!isset($arguments[0]) && !$app->auth->check()) {
|
if (!isset($arguments[0]) && !$app->auth->check()) {
|
||||||
throw new FireflyException('There is no user present.');
|
throw new FireflyException('There is no user present.');
|
||||||
|
@ -45,7 +45,7 @@ class RuleGroupServiceProvider extends ServiceProvider
|
|||||||
'FireflyIII\Repositories\RuleGroup\RuleGroupRepositoryInterface',
|
'FireflyIII\Repositories\RuleGroup\RuleGroupRepositoryInterface',
|
||||||
function (Application $app, array $arguments) {
|
function (Application $app, array $arguments) {
|
||||||
if (!isset($arguments[0]) && $app->auth->check()) {
|
if (!isset($arguments[0]) && $app->auth->check()) {
|
||||||
return app('FireflyIII\Repositories\RuleGroup\RuleGroupRepository', [$app->auth->user()]);
|
return app('FireflyIII\Repositories\RuleGroup\RuleGroupRepository', [auth()->user()]);
|
||||||
}
|
}
|
||||||
if (!isset($arguments[0]) && !$app->auth->check()) {
|
if (!isset($arguments[0]) && !$app->auth->check()) {
|
||||||
throw new FireflyException('There is no user present.');
|
throw new FireflyException('There is no user present.');
|
||||||
|
@ -44,7 +44,7 @@ class RuleServiceProvider extends ServiceProvider
|
|||||||
'FireflyIII\Repositories\Rule\RuleRepositoryInterface',
|
'FireflyIII\Repositories\Rule\RuleRepositoryInterface',
|
||||||
function (Application $app, array $arguments) {
|
function (Application $app, array $arguments) {
|
||||||
if (!isset($arguments[0]) && $app->auth->check()) {
|
if (!isset($arguments[0]) && $app->auth->check()) {
|
||||||
return app('FireflyIII\Repositories\Rule\RuleRepository', [$app->auth->user()]);
|
return app('FireflyIII\Repositories\Rule\RuleRepository', [auth()->user()]);
|
||||||
}
|
}
|
||||||
if (!isset($arguments[0]) && !$app->auth->check()) {
|
if (!isset($arguments[0]) && !$app->auth->check()) {
|
||||||
throw new FireflyException('There is no user present.');
|
throw new FireflyException('There is no user present.');
|
||||||
|
@ -44,7 +44,7 @@ class TagServiceProvider extends ServiceProvider
|
|||||||
'FireflyIII\Repositories\Tag\TagRepositoryInterface',
|
'FireflyIII\Repositories\Tag\TagRepositoryInterface',
|
||||||
function (Application $app, array $arguments) {
|
function (Application $app, array $arguments) {
|
||||||
if (!isset($arguments[0]) && $app->auth->check()) {
|
if (!isset($arguments[0]) && $app->auth->check()) {
|
||||||
return app('FireflyIII\Repositories\Tag\TagRepository', [$app->auth->user()]);
|
return app('FireflyIII\Repositories\Tag\TagRepository', [auth()->user()]);
|
||||||
}
|
}
|
||||||
if (!isset($arguments[0]) && !$app->auth->check()) {
|
if (!isset($arguments[0]) && !$app->auth->check()) {
|
||||||
throw new FireflyException('There is no user present.');
|
throw new FireflyException('There is no user present.');
|
||||||
|
@ -72,6 +72,27 @@ class BillRepository implements BillRepositoryInterface
|
|||||||
return $bill;
|
return $bill;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Find a bill by name.
|
||||||
|
*
|
||||||
|
* @param string $name
|
||||||
|
*
|
||||||
|
* @return Bill
|
||||||
|
*/
|
||||||
|
public function findByName(string $name) : Bill
|
||||||
|
{
|
||||||
|
$bills = $this->user->bills()->get();
|
||||||
|
|
||||||
|
/** @var Bill $bill */
|
||||||
|
foreach ($bills as $bill) {
|
||||||
|
if ($bill->name === $name) {
|
||||||
|
return $bill;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return new Bill;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return Collection
|
* @return Collection
|
||||||
*/
|
*/
|
||||||
@ -293,6 +314,28 @@ class BillRepository implements BillRepositoryInterface
|
|||||||
return $bill->transactionjournals()->before($end)->after($start)->get();
|
return $bill->transactionjournals()->before($end)->after($start)->get();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param $bill
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getOverallAverage($bill): string
|
||||||
|
{
|
||||||
|
$journals = $bill->transactionjournals()->get();
|
||||||
|
$sum = '0';
|
||||||
|
$count = strval($journals->count());
|
||||||
|
/** @var TransactionJournal $journal */
|
||||||
|
foreach ($journals as $journal) {
|
||||||
|
$sum = bcadd($sum, TransactionJournal::amountPositive($journal));
|
||||||
|
}
|
||||||
|
$avg = '0';
|
||||||
|
if ($journals->count() > 0) {
|
||||||
|
$avg = bcdiv($sum, $count);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $avg;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param Bill $bill
|
* @param Bill $bill
|
||||||
*
|
*
|
||||||
@ -358,6 +401,32 @@ class BillRepository implements BillRepositoryInterface
|
|||||||
return $validRanges;
|
return $validRanges;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param Bill $bill
|
||||||
|
* @param Carbon $date
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getYearAverage(Bill $bill, Carbon $date): string
|
||||||
|
{
|
||||||
|
$journals = $bill->transactionjournals()
|
||||||
|
->where('date', '>=', $date->year . '-01-01')
|
||||||
|
->where('date', '<=', $date->year . '-12-31')
|
||||||
|
->get();
|
||||||
|
$sum = '0';
|
||||||
|
$count = strval($journals->count());
|
||||||
|
/** @var TransactionJournal $journal */
|
||||||
|
foreach ($journals as $journal) {
|
||||||
|
$sum = bcadd($sum, TransactionJournal::amountPositive($journal));
|
||||||
|
}
|
||||||
|
$avg = '0';
|
||||||
|
if ($journals->count() > 0) {
|
||||||
|
$avg = bcdiv($sum, $count);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $avg;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param Bill $bill
|
* @param Bill $bill
|
||||||
*
|
*
|
||||||
@ -557,52 +626,4 @@ class BillRepository implements BillRepositoryInterface
|
|||||||
|
|
||||||
return $wordMatch;
|
return $wordMatch;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param Bill $bill
|
|
||||||
* @param Carbon $date
|
|
||||||
*
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
public function getYearAverage(Bill $bill, Carbon $date): string
|
|
||||||
{
|
|
||||||
$journals = $bill->transactionjournals()
|
|
||||||
->where('date', '>=', $date->year . '-01-01')
|
|
||||||
->where('date', '<=', $date->year . '-12-31')
|
|
||||||
->get();
|
|
||||||
$sum = '0';
|
|
||||||
$count = strval($journals->count());
|
|
||||||
/** @var TransactionJournal $journal */
|
|
||||||
foreach ($journals as $journal) {
|
|
||||||
$sum = bcadd($sum, TransactionJournal::amountPositive($journal));
|
|
||||||
}
|
|
||||||
$avg = '0';
|
|
||||||
if ($journals->count() > 0) {
|
|
||||||
$avg = bcdiv($sum, $count);
|
|
||||||
}
|
|
||||||
|
|
||||||
return $avg;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param $bill
|
|
||||||
*
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
public function getOverallAverage($bill): string
|
|
||||||
{
|
|
||||||
$journals = $bill->transactionjournals()->get();
|
|
||||||
$sum = '0';
|
|
||||||
$count = strval($journals->count());
|
|
||||||
/** @var TransactionJournal $journal */
|
|
||||||
foreach ($journals as $journal) {
|
|
||||||
$sum = bcadd($sum, TransactionJournal::amountPositive($journal));
|
|
||||||
}
|
|
||||||
$avg = '0';
|
|
||||||
if ($journals->count() > 0) {
|
|
||||||
$avg = bcdiv($sum, $count);
|
|
||||||
}
|
|
||||||
|
|
||||||
return $avg;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -32,21 +32,6 @@ interface BillRepositoryInterface
|
|||||||
*/
|
*/
|
||||||
public function destroy(Bill $bill): bool;
|
public function destroy(Bill $bill): bool;
|
||||||
|
|
||||||
/**
|
|
||||||
* @param Bill $bill
|
|
||||||
* @param Carbon $date
|
|
||||||
*
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
public function getYearAverage(Bill $bill, Carbon $date): string;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param $bill
|
|
||||||
*
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
public function getOverallAverage($bill): string;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Find a bill by ID.
|
* Find a bill by ID.
|
||||||
*
|
*
|
||||||
@ -56,6 +41,15 @@ interface BillRepositoryInterface
|
|||||||
*/
|
*/
|
||||||
public function find(int $billId) : Bill;
|
public function find(int $billId) : Bill;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Find a bill by name.
|
||||||
|
*
|
||||||
|
* @param string $name
|
||||||
|
*
|
||||||
|
* @return Bill
|
||||||
|
*/
|
||||||
|
public function findByName(string $name) : Bill;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return Collection
|
* @return Collection
|
||||||
*/
|
*/
|
||||||
@ -128,6 +122,13 @@ interface BillRepositoryInterface
|
|||||||
*/
|
*/
|
||||||
public function getJournalsInRange(Bill $bill, Carbon $start, Carbon $end): Collection;
|
public function getJournalsInRange(Bill $bill, Carbon $start, Carbon $end): Collection;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param $bill
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getOverallAverage($bill): string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param Bill $bill
|
* @param Bill $bill
|
||||||
*
|
*
|
||||||
@ -148,6 +149,14 @@ interface BillRepositoryInterface
|
|||||||
*/
|
*/
|
||||||
public function getRanges(Bill $bill, Carbon $start, Carbon $end): array;
|
public function getRanges(Bill $bill, Carbon $start, Carbon $end): array;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param Bill $bill
|
||||||
|
* @param Carbon $date
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getYearAverage(Bill $bill, Carbon $date): string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param Bill $bill
|
* @param Bill $bill
|
||||||
*
|
*
|
||||||
|
@ -152,21 +152,6 @@ return [
|
|||||||
Collective\Html\HtmlServiceProvider::class,
|
Collective\Html\HtmlServiceProvider::class,
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* More service providers.
|
|
||||||
*/
|
|
||||||
FireflyIII\Providers\CrudServiceProvider::class,
|
|
||||||
FireflyIII\Providers\AccountServiceProvider::class,
|
|
||||||
FireflyIII\Providers\AttachmentServiceProvider::class,
|
|
||||||
FireflyIII\Providers\BillServiceProvider::class,
|
|
||||||
FireflyIII\Providers\BudgetServiceProvider::class,
|
|
||||||
FireflyIII\Providers\CategoryServiceProvider::class,
|
|
||||||
FireflyIII\Providers\ExportJobServiceProvider::class,
|
|
||||||
FireflyIII\Providers\JournalServiceProvider::class,
|
|
||||||
FireflyIII\Providers\PiggyBankServiceProvider::class,
|
|
||||||
FireflyIII\Providers\RuleServiceProvider::class,
|
|
||||||
FireflyIII\Providers\RuleGroupServiceProvider::class,
|
|
||||||
FireflyIII\Providers\TagServiceProvider::class,
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -186,6 +171,24 @@ return [
|
|||||||
'TwigBridge\ServiceProvider',
|
'TwigBridge\ServiceProvider',
|
||||||
'PragmaRX\Google2FA\Vendor\Laravel\ServiceProvider',
|
'PragmaRX\Google2FA\Vendor\Laravel\ServiceProvider',
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* More service providers.
|
||||||
|
*/
|
||||||
|
FireflyIII\Providers\CrudServiceProvider::class,
|
||||||
|
FireflyIII\Providers\AccountServiceProvider::class,
|
||||||
|
FireflyIII\Providers\AttachmentServiceProvider::class,
|
||||||
|
FireflyIII\Providers\BillServiceProvider::class,
|
||||||
|
FireflyIII\Providers\BudgetServiceProvider::class,
|
||||||
|
FireflyIII\Providers\CategoryServiceProvider::class,
|
||||||
|
FireflyIII\Providers\ExportJobServiceProvider::class,
|
||||||
|
FireflyIII\Providers\JournalServiceProvider::class,
|
||||||
|
FireflyIII\Providers\PiggyBankServiceProvider::class,
|
||||||
|
FireflyIII\Providers\RuleServiceProvider::class,
|
||||||
|
FireflyIII\Providers\RuleGroupServiceProvider::class,
|
||||||
|
FireflyIII\Providers\TagServiceProvider::class,
|
||||||
|
|
||||||
|
|
||||||
],
|
],
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
288
config/csv.php
288
config/csv.php
@ -14,179 +14,247 @@ return [
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* Configuration for possible column roles.
|
* Configuration for possible column roles.
|
||||||
|
*
|
||||||
|
* The key is the short name for the column role. There are five values, which mean this:
|
||||||
|
*
|
||||||
|
* 'mappable'
|
||||||
|
* Whether or not the value in the CSV column can be linked to an existing value in your
|
||||||
|
* Firefly database. For example: account names can be linked to existing account names you have already
|
||||||
|
* so double entries cannot occur. This process is called "mapping". You have to make each unique value in your
|
||||||
|
* CSV file to an existing entry in your database. For example, map all account names in your CSV file to existing
|
||||||
|
* accounts. If you have an entry that does not exist in your database, you can set Firefly to ignore it, and it will
|
||||||
|
* create it.
|
||||||
|
*
|
||||||
|
* 'pre-process-map'
|
||||||
|
* In the case of tags, there are multiple values in one csv column (for example: "expense groceries snack" in one column).
|
||||||
|
* This means the content of the column must be "pre processed" aka split in parts so the importer can work with the data.
|
||||||
|
*
|
||||||
|
* 'pre-process-mapper'
|
||||||
|
* This is the class that will actually do the pre-processing.
|
||||||
|
*
|
||||||
|
* 'field'
|
||||||
|
* I don't believe this value is used any more, but I am not sure.
|
||||||
|
*
|
||||||
|
* 'converter'
|
||||||
|
* The converter is a class in app/Import/Converter that converts the given value into an object Firefly understands.
|
||||||
|
* The CategoryName converter can convert a category name into an actual category. This converter will take a mapping
|
||||||
|
* into account: if you mapped "Groceries" to category "Groceries" the converter will simply return "Groceries" instead of
|
||||||
|
* trying to make a new category also named Groceries.
|
||||||
|
*
|
||||||
|
* 'mapper'
|
||||||
|
* When you map data (see "mappable") you need a list of stuff you can map to. If you say a certain column is mappable
|
||||||
|
* and the column contains "category names", the mapper will be "Category" and it will give you a list of possible categories.
|
||||||
|
* This way the importer always presents you with a valid list of things to map to.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*
|
||||||
*/
|
*/
|
||||||
'import_roles' => [
|
'import_roles' => [
|
||||||
'_ignore' => [
|
'_ignore' => [
|
||||||
'mappable' => false,
|
'mappable' => false,
|
||||||
'field' => 'ignored',
|
'pre-process-map' => false,
|
||||||
'converter' => 'Ignore',
|
'field' => 'ignored',
|
||||||
|
'converter' => 'Ignore',
|
||||||
|
'mapper' => null,
|
||||||
|
|
||||||
|
|
||||||
],
|
],
|
||||||
'bill-id' => [
|
'bill-id' => [
|
||||||
'mappable' => false,
|
'mappable' => false,
|
||||||
'field' => 'bill',
|
'pre-process-map' => false,
|
||||||
'converter' => 'BillId',
|
'field' => 'bill',
|
||||||
'mapper' => 'Bills',
|
'converter' => 'BillId',
|
||||||
|
'mapper' => 'Bills',
|
||||||
],
|
],
|
||||||
'bill-name' => [
|
'bill-name' => [
|
||||||
'mappable' => true,
|
'mappable' => true,
|
||||||
'field' => 'bill',
|
'pre-process-map' => false,
|
||||||
'converter' => 'BillName',
|
'field' => 'bill',
|
||||||
'mapper' => 'Bills',
|
'converter' => 'BillName',
|
||||||
|
'mapper' => 'Bills',
|
||||||
],
|
],
|
||||||
'currency-id' => [
|
'currency-id' => [
|
||||||
'mappable' => true,
|
'mappable' => true,
|
||||||
'field' => 'currency',
|
'pre-process-map' => false,
|
||||||
'converter' => 'CurrencyId',
|
'field' => 'currency',
|
||||||
'mapper' => 'TransactionCurrencies',
|
'converter' => 'CurrencyId',
|
||||||
|
'mapper' => 'TransactionCurrencies',
|
||||||
],
|
],
|
||||||
'currency-name' => [
|
'currency-name' => [
|
||||||
'mappable' => true,
|
'mappable' => true,
|
||||||
'converter' => 'CurrencyName',
|
'pre-process-map' => false,
|
||||||
'field' => 'currency',
|
'converter' => 'CurrencyName',
|
||||||
'mapper' => 'TransactionCurrencies',
|
'field' => 'currency',
|
||||||
|
'mapper' => 'TransactionCurrencies',
|
||||||
],
|
],
|
||||||
'currency-code' => [
|
'currency-code' => [
|
||||||
'mappable' => true,
|
'mappable' => true,
|
||||||
'converter' => 'CurrencyCode',
|
'pre-process-map' => false,
|
||||||
'field' => 'currency',
|
'converter' => 'CurrencyCode',
|
||||||
'mapper' => 'TransactionCurrencies',
|
'field' => 'currency',
|
||||||
|
'mapper' => 'TransactionCurrencies',
|
||||||
],
|
],
|
||||||
'currency-symbol' => [
|
'currency-symbol' => [
|
||||||
'mappable' => true,
|
'mappable' => true,
|
||||||
'converter' => 'CurrencySymbol',
|
'pre-process-map' => false,
|
||||||
'field' => 'currency',
|
'converter' => 'CurrencySymbol',
|
||||||
'mapper' => 'TransactionCurrencies',
|
'field' => 'currency',
|
||||||
|
'mapper' => 'TransactionCurrencies',
|
||||||
],
|
],
|
||||||
'description' => [
|
'description' => [
|
||||||
'mappable' => false,
|
'mappable' => false,
|
||||||
'converter' => 'Description',
|
'pre-process-map' => false,
|
||||||
'field' => 'description',
|
'converter' => 'Description',
|
||||||
|
'field' => 'description',
|
||||||
],
|
],
|
||||||
'date-transaction' => [
|
'date-transaction' => [
|
||||||
'mappable' => false,
|
'mappable' => false,
|
||||||
'converter' => 'Date',
|
'pre-process-map' => false,
|
||||||
'field' => 'date',
|
'converter' => 'Date',
|
||||||
|
'field' => 'date',
|
||||||
],
|
],
|
||||||
'date-rent' => [
|
'date-rent' => [
|
||||||
'mappable' => false,
|
'mappable' => false,
|
||||||
'converter' => 'Date',
|
'pre-process-map' => false,
|
||||||
'field' => 'date-rent',
|
'converter' => 'Date',
|
||||||
|
'field' => 'date-rent',
|
||||||
],
|
],
|
||||||
'budget-id' => [
|
'budget-id' => [
|
||||||
'mappable' => true,
|
'mappable' => true,
|
||||||
'converter' => 'BudgetId',
|
'pre-process-map' => false,
|
||||||
'field' => 'budget',
|
'converter' => 'BudgetId',
|
||||||
'mapper' => 'Budgets',
|
'field' => 'budget',
|
||||||
|
'mapper' => 'Budgets',
|
||||||
],
|
],
|
||||||
'budget-name' => [
|
'budget-name' => [
|
||||||
'mappable' => true,
|
'mappable' => true,
|
||||||
'converter' => 'BudgetName',
|
'pre-process-map' => false,
|
||||||
'field' => 'budget',
|
'converter' => 'BudgetName',
|
||||||
'mapper' => 'Budgets',
|
'field' => 'budget',
|
||||||
|
'mapper' => 'Budgets',
|
||||||
],
|
],
|
||||||
'rabo-debet-credit' => [
|
'rabo-debet-credit' => [
|
||||||
'mappable' => false,
|
'mappable' => false,
|
||||||
'converter' => 'RabobankDebetCredit',
|
'pre-process-map' => false,
|
||||||
'field' => 'amount-modifier',
|
'converter' => 'RabobankDebetCredit',
|
||||||
|
'field' => 'amount-modifier',
|
||||||
],
|
],
|
||||||
'ing-debet-credit' => [
|
'ing-debet-credit' => [
|
||||||
'mappable' => false,
|
'mappable' => false,
|
||||||
'converter' => 'INGDebetCredit',
|
'pre-process-map' => false,
|
||||||
'field' => 'amount-modifier',
|
'converter' => 'INGDebetCredit',
|
||||||
|
'field' => 'amount-modifier',
|
||||||
],
|
],
|
||||||
'category-id' => [
|
'category-id' => [
|
||||||
'mappable' => true,
|
'mappable' => true,
|
||||||
'converter' => 'CategoryId',
|
'pre-process-map' => false,
|
||||||
'field' => 'category',
|
'converter' => 'CategoryId',
|
||||||
'mapper' => 'Categories',
|
'field' => 'category',
|
||||||
|
'mapper' => 'Categories',
|
||||||
],
|
],
|
||||||
'category-name' => [
|
'category-name' => [
|
||||||
'mappable' => true,
|
'mappable' => true,
|
||||||
'converter' => 'CategoryName',
|
'pre-process-map' => false,
|
||||||
'field' => 'category',
|
'converter' => 'CategoryName',
|
||||||
'mapper' => 'Categories',
|
'field' => 'category',
|
||||||
|
'mapper' => 'Categories',
|
||||||
],
|
],
|
||||||
'tags-comma' => [
|
'tags-comma' => [
|
||||||
'mappable' => false,
|
'mappable' => true,
|
||||||
'field' => 'tags',
|
'pre-process-map' => true,
|
||||||
'converter' => 'TagsComma',
|
'pre-process-mapper' => 'TagsComma',
|
||||||
'mapper' => 'Tags',
|
'field' => 'tags',
|
||||||
|
'converter' => 'TagsComma',
|
||||||
|
'mapper' => 'Tags',
|
||||||
],
|
],
|
||||||
'tags-space' => [
|
'tags-space' => [
|
||||||
'mappable' => false,
|
'mappable' => true,
|
||||||
'field' => 'tags',
|
'pre-process-map' => true,
|
||||||
'converter' => 'TagsSpace',
|
'pre-process-mapper' => 'TagsSpace',
|
||||||
'mapper' => 'Tags',
|
'field' => 'tags',
|
||||||
|
'converter' => 'TagsSpace',
|
||||||
|
'mapper' => 'Tags',
|
||||||
],
|
],
|
||||||
'account-id' => [
|
'account-id' => [
|
||||||
'mappable' => true,
|
'mappable' => true,
|
||||||
'field' => 'asset-account-id',
|
'pre-process-map' => false,
|
||||||
'converter' => 'AssetAccountId',
|
'field' => 'asset-account-id',
|
||||||
'mapper' => 'AssetAccounts',
|
'converter' => 'AssetAccountId',
|
||||||
|
'mapper' => 'AssetAccounts',
|
||||||
],
|
],
|
||||||
'account-name' => [
|
'account-name' => [
|
||||||
'mappable' => true,
|
'mappable' => true,
|
||||||
'field' => 'asset-account-name',
|
'pre-process-map' => false,
|
||||||
'converter' => 'AssetAccountName',
|
'field' => 'asset-account-name',
|
||||||
'mapper' => 'AssetAccounts',
|
'converter' => 'AssetAccountName',
|
||||||
|
'mapper' => 'AssetAccounts',
|
||||||
],
|
],
|
||||||
'account-iban' => [
|
'account-iban' => [
|
||||||
'mappable' => true,
|
'mappable' => true,
|
||||||
'field' => 'asset-account-iban',
|
'pre-process-map' => false,
|
||||||
'converter' => 'AssetAccountIban',
|
'field' => 'asset-account-iban',
|
||||||
'mapper' => 'AssetAccountIbans',
|
'converter' => 'AssetAccountIban',
|
||||||
|
'mapper' => 'AssetAccountIbans',
|
||||||
|
|
||||||
],
|
],
|
||||||
'account-number' => [
|
'account-number' => [
|
||||||
'mappable' => true,
|
'mappable' => true,
|
||||||
'field' => 'asset-account-number',
|
'pre-process-map' => false,
|
||||||
'converter' => 'AssetAccountNumber',
|
'field' => 'asset-account-number',
|
||||||
'mapper' => 'AssetAccounts',
|
'converter' => 'AssetAccountNumber',
|
||||||
|
'mapper' => 'AssetAccounts',
|
||||||
],
|
],
|
||||||
'opposing-id' => [
|
'opposing-id' => [
|
||||||
'mappable' => true,
|
'mappable' => true,
|
||||||
'field' => 'opposing-account-id',
|
'pre-process-map' => false,
|
||||||
'converter' => 'OpposingAccountId',
|
'field' => 'opposing-account-id',
|
||||||
'mapper' => 'OpposingAccounts',
|
'converter' => 'OpposingAccountId',
|
||||||
|
'mapper' => 'OpposingAccounts',
|
||||||
],
|
],
|
||||||
'opposing-name' => [
|
'opposing-name' => [
|
||||||
'mappable' => true,
|
'mappable' => true,
|
||||||
'field' => 'opposing-account-name',
|
'pre-process-map' => false,
|
||||||
'converter' => 'OpposingAccountName',
|
'field' => 'opposing-account-name',
|
||||||
'mapper' => 'OpposingAccounts',
|
'converter' => 'OpposingAccountName',
|
||||||
|
'mapper' => 'OpposingAccounts',
|
||||||
],
|
],
|
||||||
'opposing-iban' => [
|
'opposing-iban' => [
|
||||||
'mappable' => true,
|
'mappable' => true,
|
||||||
'field' => 'opposing-account-iban',
|
'pre-process-map' => false,
|
||||||
'converter' => 'OpposingAccountIban',
|
'field' => 'opposing-account-iban',
|
||||||
'mapper' => 'OpposingAccountIbans',
|
'converter' => 'OpposingAccountIban',
|
||||||
|
'mapper' => 'OpposingAccountIbans',
|
||||||
],
|
],
|
||||||
'opposing-number' => [
|
'opposing-number' => [
|
||||||
'mappable' => true,
|
'mappable' => true,
|
||||||
'field' => 'opposing-account-number',
|
'pre-process-map' => false,
|
||||||
'converter' => 'OpposingAccountNumber',
|
'field' => 'opposing-account-number',
|
||||||
'mapper' => 'OpposingAccounts',
|
'converter' => 'OpposingAccountNumber',
|
||||||
|
'mapper' => 'OpposingAccounts',
|
||||||
],
|
],
|
||||||
'amount' => [
|
'amount' => [
|
||||||
'mappable' => false,
|
'mappable' => false,
|
||||||
'converter' => 'Amount',
|
'pre-process-map' => false,
|
||||||
'field' => 'amount',
|
'converter' => 'Amount',
|
||||||
|
'field' => 'amount',
|
||||||
],
|
],
|
||||||
'sepa-ct-id' => [
|
'sepa-ct-id' => [
|
||||||
'mappable' => false,
|
'mappable' => false,
|
||||||
'converter' => 'Description',
|
'pre-process-map' => false,
|
||||||
'field' => 'description',
|
'converter' => 'Description',
|
||||||
|
'field' => 'description',
|
||||||
],
|
],
|
||||||
'sepa-ct-op' => [
|
'sepa-ct-op' => [
|
||||||
'mappable' => false,
|
'mappable' => false,
|
||||||
'converter' => 'Description',
|
'pre-process-map' => false,
|
||||||
'field' => 'description',
|
'converter' => 'Description',
|
||||||
|
'field' => 'description',
|
||||||
],
|
],
|
||||||
'sepa-db' => [
|
'sepa-db' => [
|
||||||
'mappable' => false,
|
'mappable' => false,
|
||||||
'converter' => 'Description',
|
'pre-process-map' => false,
|
||||||
'field' => 'description',
|
'converter' => 'Description',
|
||||||
|
'field' => 'description',
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
|
|
||||||
|
@ -38,7 +38,7 @@
|
|||||||
{{ ExpandedForm.checkbox('has_headers',1,job.configuration['has-headers'],{helpText: trans('csv.header_help')}) }}
|
{{ ExpandedForm.checkbox('has_headers',1,job.configuration['has-headers'],{helpText: trans('csv.header_help')}) }}
|
||||||
{{ ExpandedForm.text('date_format',job.configuration['date-format'],{helpText: trans('csv.date_help', {dateExample: phpdate('Ymd')}) }) }}
|
{{ ExpandedForm.text('date_format',job.configuration['date-format'],{helpText: trans('csv.date_help', {dateExample: phpdate('Ymd')}) }) }}
|
||||||
{{ ExpandedForm.select('csv_delimiter', data.delimiters, job.configuration['delimiter'], {helpText: trans('csv.delimiter_help') } ) }}
|
{{ ExpandedForm.select('csv_delimiter', data.delimiters, job.configuration['delimiter'], {helpText: trans('csv.delimiter_help') } ) }}
|
||||||
{{ ExpandedForm.select('csv_import_account', data.accounts, 0, {helpText: trans('csv.import_account_help')} ) }}
|
{{ ExpandedForm.select('csv_import_account', data.accounts, job.configuration['import-account'], {helpText: trans('csv.import_account_help')} ) }}
|
||||||
|
|
||||||
{% for type, specific in data.specifics %}
|
{% for type, specific in data.specifics %}
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
|
Loading…
Reference in New Issue
Block a user