mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2026-05-03 20:56:21 +00:00
More moving stuff around.
This commit is contained in:
@@ -6,7 +6,7 @@ use Auth;
|
||||
use Carbon\Carbon;
|
||||
use FireflyIII\Crud\Account\AccountCrudInterface;
|
||||
use FireflyIII\Models\Account;
|
||||
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
|
||||
use FireflyIII\Models\AccountType;
|
||||
|
||||
/**
|
||||
* Class AssetAccountIban
|
||||
@@ -21,9 +21,7 @@ class AssetAccountIban extends BasicConverter implements ConverterInterface
|
||||
*/
|
||||
public function convert(): Account
|
||||
{
|
||||
/** @var AccountRepositoryInterface $repository */
|
||||
$repository = app(AccountRepositoryInterface::class);
|
||||
$crud = app('FireflyIII\Crud\Account\AccountCrudInterface');
|
||||
$crud = app('FireflyIII\Crud\Account\AccountCrudInterface');
|
||||
|
||||
// is mapped? Then it's easy!
|
||||
if (isset($this->mapped[$this->index][$this->value])) {
|
||||
@@ -34,7 +32,7 @@ class AssetAccountIban extends BasicConverter implements ConverterInterface
|
||||
|
||||
|
||||
if (strlen($this->value) > 0) {
|
||||
$account = $this->searchOrCreate($repository, $crud);
|
||||
$account = $this->searchOrCreate($crud);
|
||||
|
||||
return $account;
|
||||
}
|
||||
@@ -43,15 +41,14 @@ class AssetAccountIban extends BasicConverter implements ConverterInterface
|
||||
}
|
||||
|
||||
/**
|
||||
* @param AccountRepositoryInterface $repository
|
||||
* @param AccountCrudInterface $crud
|
||||
* @param AccountCrudInterface $crud
|
||||
*
|
||||
* @return Account
|
||||
*/
|
||||
private function searchOrCreate(AccountRepositoryInterface $repository, AccountCrudInterface $crud)
|
||||
private function searchOrCreate(AccountCrudInterface $crud)
|
||||
{
|
||||
// find or create new account:
|
||||
$set = $repository->getAccountsByType(['Default account', 'Asset account']);
|
||||
$set = $crud->getAccountsByType([AccountType::DEFAULT, AccountType::ASSET]);
|
||||
/** @var Account $entry */
|
||||
foreach ($set as $entry) {
|
||||
if ($entry->iban == $this->value) {
|
||||
|
||||
@@ -5,7 +5,7 @@ namespace FireflyIII\Helpers\Csv\Converter;
|
||||
use Auth;
|
||||
use Carbon\Carbon;
|
||||
use FireflyIII\Models\Account;
|
||||
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
|
||||
use FireflyIII\Models\AccountType;
|
||||
|
||||
/**
|
||||
* Class AssetAccountName
|
||||
@@ -20,9 +20,7 @@ class AssetAccountName extends BasicConverter implements ConverterInterface
|
||||
*/
|
||||
public function convert(): Account
|
||||
{
|
||||
/** @var AccountRepositoryInterface $repository */
|
||||
$repository = app(AccountRepositoryInterface::class);
|
||||
$crud = app('FireflyIII\Crud\Account\AccountCrudInterface');
|
||||
$crud = app('FireflyIII\Crud\Account\AccountCrudInterface');
|
||||
|
||||
if (isset($this->mapped[$this->index][$this->value])) {
|
||||
$account = $crud->find(intval($this->mapped[$this->index][$this->value]));
|
||||
@@ -30,7 +28,7 @@ class AssetAccountName extends BasicConverter implements ConverterInterface
|
||||
return $account;
|
||||
}
|
||||
|
||||
$set = $repository->getAccountsByType(['Default account', 'Asset account']);
|
||||
$set = $crud->getAccountsByType([AccountType::DEFAULT, AccountType::ASSET]);
|
||||
/** @var Account $entry */
|
||||
foreach ($set as $entry) {
|
||||
if ($entry->name == $this->value) {
|
||||
|
||||
@@ -14,7 +14,7 @@ namespace FireflyIII\Helpers\Csv\Converter;
|
||||
use Auth;
|
||||
use Carbon\Carbon;
|
||||
use FireflyIII\Models\Account;
|
||||
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
|
||||
use FireflyIII\Models\AccountType;
|
||||
|
||||
/**
|
||||
* Class AssetAccountNumber
|
||||
@@ -29,9 +29,7 @@ class AssetAccountNumber extends BasicConverter implements ConverterInterface
|
||||
*/
|
||||
public function convert(): Account
|
||||
{
|
||||
/** @var AccountRepositoryInterface $repository */
|
||||
$repository = app(AccountRepositoryInterface::class);
|
||||
$crud = app('FireflyIII\Crud\Account\AccountCrudInterface');
|
||||
$crud = app('FireflyIII\Crud\Account\AccountCrudInterface');
|
||||
|
||||
// is mapped? Then it's easy!
|
||||
if (isset($this->mapped[$this->index][$this->value])) {
|
||||
@@ -43,7 +41,7 @@ class AssetAccountNumber extends BasicConverter implements ConverterInterface
|
||||
$value = $this->value ?? '';
|
||||
if (strlen($value) > 0) {
|
||||
// find or create new account:
|
||||
$set = $repository->getAccountsByType(['Default account', 'Asset account']);
|
||||
$set = $crud->getAccountsByType([AccountType::DEFAULT, AccountType::ASSET]);
|
||||
/** @var Account $entry */
|
||||
foreach ($set as $entry) {
|
||||
$accountNumber = $entry->getMeta('accountNumber');
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
declare(strict_types = 1);
|
||||
namespace FireflyIII\Helpers\Csv\Converter;
|
||||
|
||||
use FireflyIII\Crud\Account\AccountCrudInterface;
|
||||
use FireflyIII\Models\Account;
|
||||
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
|
||||
|
||||
@@ -30,19 +31,19 @@ class OpposingAccountIban extends BasicConverter implements ConverterInterface
|
||||
return $account;
|
||||
}
|
||||
|
||||
return $this->findAccount($repository);
|
||||
return $this->findAccount($crud);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param AccountRepositoryInterface $repository
|
||||
* @param AccountCrudInterface $crud
|
||||
*
|
||||
* @return Account|string
|
||||
*/
|
||||
private function findAccount(AccountRepositoryInterface $repository)
|
||||
private function findAccount(AccountCrudInterface $crud)
|
||||
{
|
||||
if (strlen($this->value) > 0) {
|
||||
|
||||
$set = $repository->getAccountsByType([]);
|
||||
$set = $crud->getAccountsByType([]);
|
||||
/** @var Account $account */
|
||||
foreach ($set as $account) {
|
||||
if ($account->iban == $this->value) {
|
||||
|
||||
@@ -14,7 +14,6 @@ use FireflyIII\Models\Bill;
|
||||
use FireflyIII\Models\Category;
|
||||
use FireflyIII\Models\Tag;
|
||||
use FireflyIII\Models\TransactionJournal;
|
||||
use FireflyIII\Models\TransactionType;
|
||||
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
|
||||
use FireflyIII\Repositories\Bill\BillRepositoryInterface;
|
||||
use FireflyIII\Repositories\Budget\BudgetRepositoryInterface;
|
||||
@@ -23,7 +22,6 @@ use FireflyIII\Repositories\Tag\TagRepositoryInterface;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Query\JoinClause;
|
||||
use Illuminate\Support\Collection;
|
||||
use Log;
|
||||
|
||||
/**
|
||||
* Class ReportHelper
|
||||
|
||||
Reference in New Issue
Block a user