mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-09-18 18:44:16 +00:00
Merge laravel 5.4 into develop.
This commit is contained in:
@@ -79,7 +79,8 @@ class CreateImport extends Command
|
||||
$this->info(sprintf('Type of import: %s', $type));
|
||||
|
||||
/** @var ImportJobRepositoryInterface $jobRepository */
|
||||
$jobRepository = app(ImportJobRepositoryInterface::class, [$user]);
|
||||
$jobRepository = app(ImportJobRepositoryInterface::class);
|
||||
$jobRepository->setUser($user);
|
||||
$job = $jobRepository->create($type);
|
||||
$this->line(sprintf('Created job "%s"...', $job->key));
|
||||
|
||||
|
@@ -39,9 +39,9 @@ class Kernel extends ConsoleKernel
|
||||
*/
|
||||
protected $bootstrappers
|
||||
= [
|
||||
'Illuminate\Foundation\Bootstrap\DetectEnvironment',
|
||||
'Illuminate\Foundation\Bootstrap\LoadEnvironmentVariables',
|
||||
'Illuminate\Foundation\Bootstrap\LoadConfiguration',
|
||||
'FireflyIII\Bootstrap\ConfigureLogging',
|
||||
//'FireflyIII\Bootstrap\ConfigureLogging',
|
||||
'Illuminate\Foundation\Bootstrap\HandleExceptions',
|
||||
'Illuminate\Foundation\Bootstrap\RegisterFacades',
|
||||
'Illuminate\Foundation\Bootstrap\SetRequestForConsole',
|
||||
|
@@ -43,10 +43,8 @@ class AttachmentCollector extends BasicCollector implements CollectorInterface
|
||||
|
||||
/**
|
||||
* AttachmentCollector constructor.
|
||||
*
|
||||
* @param ExportJob $job
|
||||
*/
|
||||
public function __construct(ExportJob $job)
|
||||
public function __construct()
|
||||
{
|
||||
/** @var AttachmentRepositoryInterface repository */
|
||||
$this->repository = app(AttachmentRepositoryInterface::class);
|
||||
@@ -54,7 +52,7 @@ class AttachmentCollector extends BasicCollector implements CollectorInterface
|
||||
$this->uploadDisk = Storage::disk('upload');
|
||||
$this->exportDisk = Storage::disk('export');
|
||||
|
||||
parent::__construct($job);
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -31,13 +31,10 @@ class BasicCollector
|
||||
|
||||
/**
|
||||
* BasicCollector constructor.
|
||||
*
|
||||
* @param ExportJob $job
|
||||
*/
|
||||
public function __construct(ExportJob $job)
|
||||
public function __construct()
|
||||
{
|
||||
$this->entries = new Collection;
|
||||
$this->job = $job;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -56,5 +53,13 @@ class BasicCollector
|
||||
$this->entries = $entries;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param ExportJob $job
|
||||
*/
|
||||
public function setJob(ExportJob $job)
|
||||
{
|
||||
$this->job = $job;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@@ -13,6 +13,7 @@ declare(strict_types = 1);
|
||||
|
||||
namespace FireflyIII\Export\Collector;
|
||||
|
||||
use FireflyIII\Models\ExportJob;
|
||||
use Illuminate\Support\Collection;
|
||||
|
||||
/**
|
||||
@@ -32,6 +33,13 @@ interface CollectorInterface
|
||||
*/
|
||||
public function run(): bool;
|
||||
|
||||
/**
|
||||
* @param ExportJob $job
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function setJob(ExportJob $job);
|
||||
|
||||
/**
|
||||
* @param Collection $entries
|
||||
*
|
||||
|
@@ -14,7 +14,6 @@ declare(strict_types = 1);
|
||||
namespace FireflyIII\Export\Collector;
|
||||
|
||||
use Crypt;
|
||||
use FireflyIII\Models\ExportJob;
|
||||
use Illuminate\Contracts\Encryption\DecryptException;
|
||||
use Log;
|
||||
use Storage;
|
||||
@@ -35,22 +34,12 @@ class UploadCollector extends BasicCollector implements CollectorInterface
|
||||
|
||||
/**
|
||||
* AttachmentCollector constructor.
|
||||
*
|
||||
* @param ExportJob $job
|
||||
*/
|
||||
public function __construct(ExportJob $job)
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct($job);
|
||||
|
||||
Log::debug('Going to collect attachments', ['key' => $job->key]);
|
||||
|
||||
// make storage:
|
||||
parent::__construct();
|
||||
$this->uploadDisk = Storage::disk('upload');
|
||||
$this->exportDisk = Storage::disk('export');
|
||||
|
||||
// file names associated with the old import routine.
|
||||
$this->vintageFormat = sprintf('csv-upload-%d-', auth()->user()->id);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -60,6 +49,11 @@ class UploadCollector extends BasicCollector implements CollectorInterface
|
||||
*/
|
||||
public function run(): bool
|
||||
{
|
||||
Log::debug('Going to collect attachments', ['key' => $this->job->key]);
|
||||
|
||||
// file names associated with the old import routine.
|
||||
$this->vintageFormat = sprintf('csv-upload-%d-', $this->job->user->id);
|
||||
|
||||
// collect old upload files (names beginning with "csv-upload".
|
||||
$this->collectVintageUploads();
|
||||
|
||||
|
@@ -26,17 +26,15 @@ class BasicExporter
|
||||
{
|
||||
/** @var ExportJob */
|
||||
protected $job;
|
||||
private $entries;
|
||||
/** @var Collection */
|
||||
private $entries;
|
||||
|
||||
/**
|
||||
* BasicExporter constructor.
|
||||
*
|
||||
* @param ExportJob $job
|
||||
*/
|
||||
public function __construct(ExportJob $job)
|
||||
public function __construct()
|
||||
{
|
||||
$this->entries = new Collection;
|
||||
$this->job = $job;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -55,5 +53,13 @@ class BasicExporter
|
||||
$this->entries = $entries;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param ExportJob $job
|
||||
*/
|
||||
public function setJob(ExportJob $job)
|
||||
{
|
||||
$this->job = $job;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@@ -14,7 +14,6 @@ declare(strict_types = 1);
|
||||
namespace FireflyIII\Export\Exporter;
|
||||
|
||||
use FireflyIII\Export\Entry\Entry;
|
||||
use FireflyIII\Models\ExportJob;
|
||||
use League\Csv\Writer;
|
||||
use SplFileObject;
|
||||
|
||||
@@ -30,13 +29,10 @@ class CsvExporter extends BasicExporter implements ExporterInterface
|
||||
|
||||
/**
|
||||
* CsvExporter constructor.
|
||||
*
|
||||
* @param ExportJob $job
|
||||
*/
|
||||
public function __construct(ExportJob $job)
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct($job);
|
||||
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -13,6 +13,7 @@ declare(strict_types = 1);
|
||||
|
||||
namespace FireflyIII\Export\Exporter;
|
||||
|
||||
use FireflyIII\Models\ExportJob;
|
||||
use Illuminate\Support\Collection;
|
||||
|
||||
/**
|
||||
@@ -45,4 +46,9 @@ interface ExporterInterface
|
||||
*/
|
||||
public function setEntries(Collection $entries);
|
||||
|
||||
/**
|
||||
* @param ExportJob $job
|
||||
*/
|
||||
public function setJob(ExportJob $job);
|
||||
|
||||
}
|
||||
|
@@ -19,7 +19,6 @@ use FireflyIII\Export\Collector\JournalExportCollector;
|
||||
use FireflyIII\Export\Collector\UploadCollector;
|
||||
use FireflyIII\Export\Entry\Entry;
|
||||
use FireflyIII\Models\ExportJob;
|
||||
use Illuminate\Filesystem\FilesystemAdapter;
|
||||
use Illuminate\Support\Collection;
|
||||
use Log;
|
||||
use Storage;
|
||||
@@ -54,21 +53,12 @@ class Processor implements ProcessorInterface
|
||||
|
||||
/**
|
||||
* Processor constructor.
|
||||
*
|
||||
* @param array $settings
|
||||
*/
|
||||
public function __construct(array $settings)
|
||||
public function __construct()
|
||||
{
|
||||
// save settings
|
||||
$this->settings = $settings;
|
||||
$this->accounts = $settings['accounts'];
|
||||
$this->exportFormat = $settings['exportFormat'];
|
||||
$this->includeAttachments = $settings['includeAttachments'];
|
||||
$this->includeOldUploads = $settings['includeOldUploads'];
|
||||
$this->job = $settings['job'];
|
||||
$this->journals = new Collection;
|
||||
$this->exportEntries = new Collection;
|
||||
$this->files = new Collection;
|
||||
$this->journals = new Collection;
|
||||
$this->exportEntries = new Collection;
|
||||
$this->files = new Collection;
|
||||
|
||||
}
|
||||
|
||||
@@ -78,7 +68,8 @@ class Processor implements ProcessorInterface
|
||||
public function collectAttachments(): bool
|
||||
{
|
||||
/** @var AttachmentCollector $attachmentCollector */
|
||||
$attachmentCollector = app(AttachmentCollector::class, [$this->job]);
|
||||
$attachmentCollector = app(AttachmentCollector::class);
|
||||
$attachmentCollector->setJob($this->job);
|
||||
$attachmentCollector->setDates($this->settings['startDate'], $this->settings['endDate']);
|
||||
$attachmentCollector->run();
|
||||
$this->files = $this->files->merge($attachmentCollector->getEntries());
|
||||
@@ -92,7 +83,8 @@ class Processor implements ProcessorInterface
|
||||
public function collectJournals(): bool
|
||||
{
|
||||
/** @var JournalExportCollector $collector */
|
||||
$collector = app(JournalExportCollector::class, [$this->job]);
|
||||
$collector = app(JournalExportCollector::class);
|
||||
$collector->setJob($this->job);
|
||||
$collector->setDates($this->settings['startDate'], $this->settings['endDate']);
|
||||
$collector->setAccounts($this->settings['accounts']);
|
||||
$collector->run();
|
||||
@@ -108,7 +100,8 @@ class Processor implements ProcessorInterface
|
||||
public function collectOldUploads(): bool
|
||||
{
|
||||
/** @var UploadCollector $uploadCollector */
|
||||
$uploadCollector = app(UploadCollector::class, [$this->job]);
|
||||
$uploadCollector = app(UploadCollector::class);
|
||||
$uploadCollector->setJob($this->job);
|
||||
$uploadCollector->run();
|
||||
|
||||
$this->files = $this->files->merge($uploadCollector->getEntries());
|
||||
@@ -166,7 +159,8 @@ class Processor implements ProcessorInterface
|
||||
public function exportJournals(): bool
|
||||
{
|
||||
$exporterClass = config('firefly.export_formats.' . $this->exportFormat);
|
||||
$exporter = app($exporterClass, [$this->job]);
|
||||
$exporter = app($exporterClass);
|
||||
$exporter->setJob($this->job);
|
||||
$exporter->setEntries($this->exportEntries);
|
||||
$exporter->run();
|
||||
$this->files->push($exporter->getFileName());
|
||||
@@ -182,6 +176,20 @@ class Processor implements ProcessorInterface
|
||||
return $this->files;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $settings
|
||||
*/
|
||||
public function setSettings(array $settings)
|
||||
{
|
||||
// save settings
|
||||
$this->settings = $settings;
|
||||
$this->accounts = $settings['accounts'];
|
||||
$this->exportFormat = $settings['exportFormat'];
|
||||
$this->includeAttachments = $settings['includeAttachments'];
|
||||
$this->includeOldUploads = $settings['includeOldUploads'];
|
||||
$this->job = $settings['job'];
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
|
@@ -25,11 +25,8 @@ interface ProcessorInterface
|
||||
|
||||
/**
|
||||
* Processor constructor.
|
||||
*
|
||||
* @param array $settings
|
||||
*
|
||||
*/
|
||||
public function __construct(array $settings);
|
||||
public function __construct();
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
@@ -65,4 +62,9 @@ interface ProcessorInterface
|
||||
* @return Collection
|
||||
*/
|
||||
public function getFiles(): Collection;
|
||||
|
||||
/**
|
||||
* @param array $settings
|
||||
*/
|
||||
public function setSettings(array $settings);
|
||||
}
|
||||
|
@@ -139,7 +139,8 @@ class MonthReportGenerator implements ReportGeneratorInterface
|
||||
{
|
||||
|
||||
/** @var JournalCollectorInterface $collector */
|
||||
$collector = app(JournalCollectorInterface::class, [auth()->user()]);
|
||||
$collector = app(JournalCollectorInterface::class);
|
||||
$collector->setUser(auth()->user());
|
||||
$collector->setAccounts(new Collection([$account]))->setRange($this->start, $this->end);
|
||||
$journals = $collector->getJournals();
|
||||
$journals = $journals->reverse();
|
||||
|
@@ -185,7 +185,8 @@ class MonthReportGenerator extends Support implements ReportGeneratorInterface
|
||||
}
|
||||
|
||||
/** @var JournalCollectorInterface $collector */
|
||||
$collector = app(JournalCollectorInterface::class, [auth()->user()]);
|
||||
$collector = app(JournalCollectorInterface::class);
|
||||
$collector->setUser(auth()->user());
|
||||
$collector->setAccounts($this->accounts)->setRange($this->start, $this->end)
|
||||
->setTypes([TransactionType::WITHDRAWAL])
|
||||
->setBudgets($this->budgets)->withOpposingAccount()->disableFilter();
|
||||
|
@@ -195,7 +195,8 @@ class MonthReportGenerator extends Support implements ReportGeneratorInterface
|
||||
}
|
||||
|
||||
/** @var JournalCollectorInterface $collector */
|
||||
$collector = app(JournalCollectorInterface::class, [auth()->user()]);
|
||||
$collector = app(JournalCollectorInterface::class);
|
||||
$collector->setUser(auth()->user());
|
||||
$collector->setAccounts($this->accounts)->setRange($this->start, $this->end)
|
||||
->setTypes([TransactionType::WITHDRAWAL, TransactionType::TRANSFER])
|
||||
->setCategories($this->categories)->withOpposingAccount()->disableFilter();
|
||||
@@ -218,7 +219,8 @@ class MonthReportGenerator extends Support implements ReportGeneratorInterface
|
||||
}
|
||||
|
||||
/** @var JournalCollectorInterface $collector */
|
||||
$collector = app(JournalCollectorInterface::class, [auth()->user()]);
|
||||
$collector = app(JournalCollectorInterface::class);
|
||||
$collector->setUser(auth()->user());
|
||||
$collector->setAccounts($this->accounts)->setRange($this->start, $this->end)
|
||||
->setTypes([TransactionType::DEPOSIT, TransactionType::TRANSFER])
|
||||
->setCategories($this->categories)->withOpposingAccount();
|
||||
|
@@ -85,7 +85,8 @@ class MetaPieChart implements MetaPieChartInterface
|
||||
// also collect all other transactions
|
||||
if ($this->collectOtherObjects && $direction === 'expense') {
|
||||
/** @var JournalCollectorInterface $collector */
|
||||
$collector = app(JournalCollectorInterface::class, [$this->user]);
|
||||
$collector = app(JournalCollectorInterface::class);
|
||||
$collector->setUser($this->user);
|
||||
$collector->setAccounts($this->accounts)->setRange($this->start, $this->end)->setTypes([TransactionType::WITHDRAWAL]);
|
||||
$journals = $collector->getJournals();
|
||||
$sum = strval($journals->sum('transaction_amount'));
|
||||
@@ -96,7 +97,8 @@ class MetaPieChart implements MetaPieChartInterface
|
||||
|
||||
if ($this->collectOtherObjects && $direction === 'income') {
|
||||
/** @var JournalCollectorInterface $collector */
|
||||
$collector = app(JournalCollectorInterface::class, [auth()->user()]);
|
||||
$collector = app(JournalCollectorInterface::class);
|
||||
$collector->setUser(auth()->user());
|
||||
$collector->setAccounts($this->accounts)->setRange($this->start, $this->end)->setTypes([TransactionType::DEPOSIT]);
|
||||
$journals = $collector->getJournals();
|
||||
$sum = strval($journals->sum('transaction_amount'));
|
||||
@@ -201,7 +203,8 @@ class MetaPieChart implements MetaPieChartInterface
|
||||
$modifier = 1;
|
||||
}
|
||||
/** @var JournalCollectorInterface $collector */
|
||||
$collector = app(JournalCollectorInterface::class, [auth()->user()]);
|
||||
$collector = app(JournalCollectorInterface::class);
|
||||
$collector->setUser(auth()->user());
|
||||
$collector->setAccounts($this->accounts);
|
||||
$collector->setRange($this->start, $this->end);
|
||||
$collector->setTypes($types);
|
||||
@@ -258,7 +261,8 @@ class MetaPieChart implements MetaPieChartInterface
|
||||
{
|
||||
$chartData = [];
|
||||
$names = [];
|
||||
$repository = app($this->repositories[$type], [$this->user]);
|
||||
$repository = app($this->repositories[$type]);
|
||||
$repository->setUser($this->user);
|
||||
foreach ($array as $objectId => $amount) {
|
||||
if (!isset($names[$objectId])) {
|
||||
$object = $repository->find(intval($objectId));
|
||||
|
@@ -96,17 +96,6 @@ class JournalCollector implements JournalCollectorInterface
|
||||
/** @var User */
|
||||
private $user;
|
||||
|
||||
/**
|
||||
* JournalCollector constructor.
|
||||
*
|
||||
* @param User $user
|
||||
*/
|
||||
public function __construct(User $user)
|
||||
{
|
||||
$this->user = $user;
|
||||
$this->query = $this->startQuery();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
* @throws FireflyException
|
||||
@@ -168,7 +157,7 @@ class JournalCollector implements JournalCollectorInterface
|
||||
{
|
||||
$this->run = true;
|
||||
/** @var Collection $set */
|
||||
$set = $this->query->get(array_values($this->fields));
|
||||
$set = $this->query->get(array_values($this->fields));
|
||||
Log::debug(sprintf('Count of set is %d', $set->count()));
|
||||
$set = $this->filterTransfers($set);
|
||||
Log::debug(sprintf('Count of set after filterTransfers() is %d', $set->count()));
|
||||
@@ -244,7 +233,8 @@ class JournalCollector implements JournalCollectorInterface
|
||||
public function setAllAssetAccounts(): JournalCollectorInterface
|
||||
{
|
||||
/** @var AccountRepositoryInterface $repository */
|
||||
$repository = app(AccountRepositoryInterface::class, [$this->user]);
|
||||
$repository = app(AccountRepositoryInterface::class);
|
||||
$repository->setUser($this->user);
|
||||
$accounts = $repository->getAccountsByType([AccountType::ASSET, AccountType::DEFAULT]);
|
||||
if ($accounts->count() > 0) {
|
||||
$accountIds = $accounts->pluck('id')->toArray();
|
||||
@@ -456,6 +446,37 @@ class JournalCollector implements JournalCollectorInterface
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param User $user
|
||||
*/
|
||||
public function setUser(User $user)
|
||||
{
|
||||
$this->user = $user;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public function startQuery()
|
||||
{
|
||||
/** @var EloquentBuilder $query */
|
||||
$query = Transaction::leftJoin('transaction_journals', 'transaction_journals.id', '=', 'transactions.transaction_journal_id')
|
||||
->leftJoin('transaction_currencies', 'transaction_currencies.id', 'transaction_journals.transaction_currency_id')
|
||||
->leftJoin('transaction_types', 'transaction_types.id', 'transaction_journals.transaction_type_id')
|
||||
->leftJoin('bills', 'bills.id', 'transaction_journals.bill_id')
|
||||
->leftJoin('accounts', 'accounts.id', '=', 'transactions.account_id')
|
||||
->leftJoin('account_types', 'accounts.account_type_id', 'account_types.id')
|
||||
->whereNull('transactions.deleted_at')
|
||||
->whereNull('transaction_journals.deleted_at')
|
||||
->where('transaction_journals.user_id', $this->user->id)
|
||||
->orderBy('transaction_journals.date', 'DESC')
|
||||
->orderBy('transaction_journals.order', 'ASC')
|
||||
->orderBy('transaction_journals.id', 'DESC');
|
||||
|
||||
$this->query = $query;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @return JournalCollectorInterface
|
||||
*/
|
||||
@@ -729,27 +750,4 @@ class JournalCollector implements JournalCollectorInterface
|
||||
$this->query->leftJoin('tag_transaction_journal', 'tag_transaction_journal.transaction_journal_id', '=', 'transaction_journals.id');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return EloquentBuilder
|
||||
*/
|
||||
private function startQuery(): EloquentBuilder
|
||||
{
|
||||
/** @var EloquentBuilder $query */
|
||||
$query = Transaction::leftJoin('transaction_journals', 'transaction_journals.id', '=', 'transactions.transaction_journal_id')
|
||||
->leftJoin('transaction_currencies', 'transaction_currencies.id', 'transaction_journals.transaction_currency_id')
|
||||
->leftJoin('transaction_types', 'transaction_types.id', 'transaction_journals.transaction_type_id')
|
||||
->leftJoin('bills', 'bills.id', 'transaction_journals.bill_id')
|
||||
->leftJoin('accounts', 'accounts.id', '=', 'transactions.account_id')
|
||||
->leftJoin('account_types', 'accounts.account_type_id', 'account_types.id')
|
||||
->whereNull('transactions.deleted_at')
|
||||
->whereNull('transaction_journals.deleted_at')
|
||||
->where('transaction_journals.user_id', $this->user->id)
|
||||
->orderBy('transaction_journals.date', 'DESC')
|
||||
->orderBy('transaction_journals.order', 'ASC')
|
||||
->orderBy('transaction_journals.id', 'DESC');
|
||||
|
||||
return $query;
|
||||
|
||||
}
|
||||
}
|
||||
|
@@ -17,6 +17,7 @@ use Carbon\Carbon;
|
||||
use FireflyIII\Models\Budget;
|
||||
use FireflyIII\Models\Category;
|
||||
use FireflyIII\Models\Tag;
|
||||
use FireflyIII\User;
|
||||
use Illuminate\Pagination\LengthAwarePaginator;
|
||||
use Illuminate\Support\Collection;
|
||||
|
||||
@@ -27,7 +28,6 @@ use Illuminate\Support\Collection;
|
||||
*/
|
||||
interface JournalCollectorInterface
|
||||
{
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
@@ -84,7 +84,6 @@ interface JournalCollectorInterface
|
||||
*/
|
||||
public function setBudget(Budget $budget): JournalCollectorInterface;
|
||||
|
||||
|
||||
/**
|
||||
* @param Collection $budgets
|
||||
*
|
||||
@@ -149,6 +148,13 @@ interface JournalCollectorInterface
|
||||
*/
|
||||
public function setTypes(array $types): JournalCollectorInterface;
|
||||
|
||||
public function setUser(User $user);
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public function startQuery();
|
||||
|
||||
/**
|
||||
* @return JournalCollectorInterface
|
||||
*/
|
||||
|
@@ -68,7 +68,8 @@ class ReportHelper implements ReportHelperInterface
|
||||
/** @var BillRepositoryInterface $repository */
|
||||
$repository = app(BillRepositoryInterface::class);
|
||||
$bills = $repository->getBillsForAccounts($accounts);
|
||||
$collector = app(JournalCollectorInterface::class, [auth()->user()]);
|
||||
$collector = app(JournalCollectorInterface::class);
|
||||
$collector->setUser(auth()->user());
|
||||
$collector->setAccounts($accounts)->setRange($start, $end)->setBills($bills);
|
||||
$journals = $collector->getJournals();
|
||||
$collection = new BillCollection;
|
||||
|
@@ -23,7 +23,6 @@ use FireflyIII\Models\Account;
|
||||
use FireflyIII\Models\AccountType;
|
||||
use FireflyIII\Models\Transaction;
|
||||
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
|
||||
use FireflyIII\Repositories\Account\AccountRepositoryInterface as ARI;
|
||||
use FireflyIII\Repositories\Account\AccountTaskerInterface;
|
||||
use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface;
|
||||
use FireflyIII\Support\CacheProperties;
|
||||
@@ -96,12 +95,12 @@ class AccountController extends Controller
|
||||
}
|
||||
|
||||
/**
|
||||
* @param ARI $repository
|
||||
* @param Account $account
|
||||
* @param AccountRepositoryInterface $repository
|
||||
* @param Account $account
|
||||
*
|
||||
* @return View
|
||||
*/
|
||||
public function delete(ARI $repository, Account $account)
|
||||
public function delete(AccountRepositoryInterface $repository, Account $account)
|
||||
{
|
||||
$typeName = config('firefly.shortNamesByFullName.' . $account->accountType->type);
|
||||
$subTitle = trans('firefly.delete_' . $typeName . '_account', ['name' => $account->name]);
|
||||
@@ -118,12 +117,12 @@ class AccountController extends Controller
|
||||
|
||||
/**
|
||||
* @param Request $request
|
||||
* @param ARI $repository
|
||||
* @param AccountRepositoryInterface $repository
|
||||
* @param Account $account
|
||||
*
|
||||
* @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
|
||||
*/
|
||||
public function destroy(Request $request, ARI $repository, Account $account)
|
||||
public function destroy(Request $request, AccountRepositoryInterface $repository, Account $account)
|
||||
{
|
||||
$type = $account->accountType->type;
|
||||
$typeName = config('firefly.shortNamesByFullName.' . $type);
|
||||
@@ -191,12 +190,12 @@ class AccountController extends Controller
|
||||
}
|
||||
|
||||
/**
|
||||
* @param ARI $repository
|
||||
* @param AccountRepositoryInterface $repository
|
||||
* @param string $what
|
||||
*
|
||||
* @return View
|
||||
*/
|
||||
public function index(ARI $repository, string $what)
|
||||
public function index(AccountRepositoryInterface $repository, string $what)
|
||||
{
|
||||
$what = $what ?? 'asset';
|
||||
$subTitle = trans('firefly.' . $what . '_accounts');
|
||||
@@ -262,7 +261,7 @@ class AccountController extends Controller
|
||||
|
||||
/**
|
||||
* @param Request $request
|
||||
* @param ARI $repository
|
||||
* @param AccountRepositoryInterface $repository
|
||||
* @param Account $account
|
||||
*
|
||||
* @return View
|
||||
@@ -276,7 +275,8 @@ class AccountController extends Controller
|
||||
|
||||
// replace with journal collector:
|
||||
/** @var JournalCollectorInterface $collector */
|
||||
$collector = app(JournalCollectorInterface::class, [auth()->user()]);
|
||||
$collector = app(JournalCollectorInterface::class);
|
||||
$collector->setUser(auth()->user());
|
||||
$collector->setAccounts(new Collection([$account]))->setLimit($pageSize)->setPage($page);
|
||||
$journals = $collector->getPaginatedJournals();
|
||||
$journals->setPath('accounts/show/' . $account->id . '/all');
|
||||
@@ -310,7 +310,8 @@ class AccountController extends Controller
|
||||
|
||||
// replace with journal collector:
|
||||
/** @var JournalCollectorInterface $collector */
|
||||
$collector = app(JournalCollectorInterface::class, [auth()->user()]);
|
||||
$collector = app(JournalCollectorInterface::class);
|
||||
$collector->setUser(auth()->user());
|
||||
$collector->setAccounts(new Collection([$account]))->setRange($start, $end)->setLimit($pageSize)->setPage($page);
|
||||
$journals = $collector->getPaginatedJournals();
|
||||
$journals->setPath('accounts/show/' . $account->id . '/' . $date);
|
||||
@@ -324,12 +325,12 @@ class AccountController extends Controller
|
||||
|
||||
/**
|
||||
* @param AccountFormRequest $request
|
||||
* @param ARI $repository
|
||||
* @param AccountRepositoryInterface $repository
|
||||
*
|
||||
* @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
|
||||
*
|
||||
*/
|
||||
public function store(AccountFormRequest $request, ARI $repository)
|
||||
public function store(AccountFormRequest $request, AccountRepositoryInterface $repository)
|
||||
{
|
||||
$data = $request->getAccountData();
|
||||
$account = $repository->store($data);
|
||||
@@ -357,12 +358,12 @@ class AccountController extends Controller
|
||||
|
||||
/**
|
||||
* @param AccountFormRequest $request
|
||||
* @param ARI $repository
|
||||
* @param AccountRepositoryInterface $repository
|
||||
* @param Account $account
|
||||
*
|
||||
* @return $this|\Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
|
||||
*/
|
||||
public function update(AccountFormRequest $request, ARI $repository, Account $account)
|
||||
public function update(AccountFormRequest $request, AccountRepositoryInterface $repository, Account $account)
|
||||
{
|
||||
$data = $request->getAccountData();
|
||||
$repository->update($account, $data);
|
||||
@@ -409,8 +410,8 @@ class AccountController extends Controller
|
||||
*/
|
||||
private function periodEntries(Account $account): Collection
|
||||
{
|
||||
/** @var ARI $repository */
|
||||
$repository = app(ARI::class);
|
||||
/** @var AccountRepositoryInterface $repository */
|
||||
$repository = app(AccountRepositoryInterface::class);
|
||||
/** @var AccountTaskerInterface $tasker */
|
||||
$tasker = app(AccountTaskerInterface::class);
|
||||
|
||||
|
@@ -208,7 +208,8 @@ class BillController extends Controller
|
||||
|
||||
// use collector:
|
||||
/** @var JournalCollectorInterface $collector */
|
||||
$collector = app(JournalCollectorInterface::class, [auth()->user()]);
|
||||
$collector = app(JournalCollectorInterface::class);
|
||||
$collector->setUser(auth()->user());
|
||||
$collector->setAllAssetAccounts()->setBills(new Collection([$bill]))->setLimit($pageSize)->setPage($page)->withBudgetInformation()
|
||||
->withCategoryInformation();
|
||||
$journals = $collector->getPaginatedJournals();
|
||||
|
@@ -202,7 +202,8 @@ class BudgetController extends Controller
|
||||
|
||||
// collector
|
||||
/** @var JournalCollectorInterface $collector */
|
||||
$collector = app(JournalCollectorInterface::class, [auth()->user()]);
|
||||
$collector = app(JournalCollectorInterface::class);
|
||||
$collector->setUser(auth()->user());
|
||||
$collector->setAllAssetAccounts()->setRange($start, $end)->setLimit($pageSize)->setPage($page)->withoutBudget();
|
||||
$journals = $collector->getPaginatedJournals();
|
||||
$journals->setPath('/budgets/list/noBudget');
|
||||
@@ -243,7 +244,8 @@ class BudgetController extends Controller
|
||||
$repetition = null;
|
||||
// collector:
|
||||
/** @var JournalCollectorInterface $collector */
|
||||
$collector = app(JournalCollectorInterface::class, [auth()->user()]);
|
||||
$collector = app(JournalCollectorInterface::class);
|
||||
$collector->setUser(auth()->user());
|
||||
$collector->setAllAssetAccounts()->setRange($start, $end)->setBudget($budget)->setLimit($pageSize)->setPage($page)->withCategoryInformation();
|
||||
$journals = $collector->getPaginatedJournals();
|
||||
$journals->setPath('/budgets/show/' . $budget->id);
|
||||
@@ -280,7 +282,8 @@ class BudgetController extends Controller
|
||||
|
||||
// collector:
|
||||
/** @var JournalCollectorInterface $collector */
|
||||
$collector = app(JournalCollectorInterface::class, [auth()->user()]);
|
||||
$collector = app(JournalCollectorInterface::class);
|
||||
$collector->setUser(auth()->user());
|
||||
$collector->setAllAssetAccounts()->setRange($budgetLimit->start_date, $budgetLimit->end_date)
|
||||
->setBudget($budget)->setLimit($pageSize)->setPage($page)->withCategoryInformation();
|
||||
$journals = $collector->getPaginatedJournals();
|
||||
|
@@ -157,7 +157,8 @@ class CategoryController extends Controller
|
||||
|
||||
// new collector:
|
||||
/** @var JournalCollectorInterface $collector */
|
||||
$collector = app(JournalCollectorInterface::class, [auth()->user()]);
|
||||
$collector = app(JournalCollectorInterface::class);
|
||||
$collector->setUser(auth()->user());
|
||||
$collector->setAllAssetAccounts()->setRange($start, $end)->withoutCategory();//->groupJournals();
|
||||
$journals = $collector->getJournals();
|
||||
$subTitle = trans(
|
||||
|
@@ -416,7 +416,8 @@ class BudgetController extends Controller
|
||||
{
|
||||
// collector
|
||||
/** @var JournalCollectorInterface $collector */
|
||||
$collector = app(JournalCollectorInterface::class, [auth()->user()]);
|
||||
$collector = app(JournalCollectorInterface::class);
|
||||
$collector->setUser(auth()->user());
|
||||
$types = [TransactionType::WITHDRAWAL];
|
||||
$collector->setAllAssetAccounts()->setTypes($types)->setRange($start, $end)->withoutBudget();
|
||||
$journals = $collector->getJournals();
|
||||
|
@@ -239,7 +239,8 @@ class BudgetReportController extends Controller
|
||||
private function getExpenses(Collection $accounts, Collection $budgets, Carbon $start, Carbon $end): Collection
|
||||
{
|
||||
/** @var JournalCollectorInterface $collector */
|
||||
$collector = app(JournalCollectorInterface::class, [auth()->user()]);
|
||||
$collector = app(JournalCollectorInterface::class);
|
||||
$collector->setUser(auth()->user());
|
||||
$collector->setAccounts($accounts)->setRange($start, $end)->setTypes([TransactionType::WITHDRAWAL, TransactionType::TRANSFER])
|
||||
->setBudgets($budgets)->withOpposingAccount()->disableFilter();
|
||||
$accountIds = $accounts->pluck('id')->toArray();
|
||||
|
@@ -284,7 +284,8 @@ class CategoryReportController extends Controller
|
||||
private function getExpenses(Collection $accounts, Collection $categories, Carbon $start, Carbon $end): Collection
|
||||
{
|
||||
/** @var JournalCollectorInterface $collector */
|
||||
$collector = app(JournalCollectorInterface::class, [auth()->user()]);
|
||||
$collector = app(JournalCollectorInterface::class);
|
||||
$collector->setUser(auth()->user());
|
||||
$collector->setAccounts($accounts)->setRange($start, $end)->setTypes([TransactionType::WITHDRAWAL, TransactionType::TRANSFER])
|
||||
->setCategories($categories)->withOpposingAccount()->disableFilter();
|
||||
$accountIds = $accounts->pluck('id')->toArray();
|
||||
@@ -305,7 +306,8 @@ class CategoryReportController extends Controller
|
||||
private function getIncome(Collection $accounts, Collection $categories, Carbon $start, Carbon $end): Collection
|
||||
{
|
||||
/** @var JournalCollectorInterface $collector */
|
||||
$collector = app(JournalCollectorInterface::class, [auth()->user()]);
|
||||
$collector = app(JournalCollectorInterface::class);
|
||||
$collector->setUser(auth()->user());
|
||||
$collector->setAccounts($accounts)->setRange($start, $end)->setTypes([TransactionType::DEPOSIT, TransactionType::TRANSFER])
|
||||
->setCategories($categories)->withOpposingAccount();
|
||||
$accountIds = $accounts->pluck('id')->toArray();
|
||||
|
@@ -150,7 +150,8 @@ class ExportController extends Controller
|
||||
$jobs->changeStatus($job, 'export_status_make_exporter');
|
||||
|
||||
/** @var ProcessorInterface $processor */
|
||||
$processor = app(ProcessorInterface::class, [$settings]);
|
||||
$processor = app(ProcessorInterface::class);
|
||||
$processor->setSettings($settings);
|
||||
|
||||
/*
|
||||
* Collect journals:
|
||||
|
@@ -103,7 +103,8 @@ class ReportController extends Controller
|
||||
switch (true) {
|
||||
case ($role === BalanceLine::ROLE_DEFAULTROLE && !is_null($budget->id)):
|
||||
/** @var JournalCollectorInterface $collector */
|
||||
$collector = app(JournalCollectorInterface::class, [auth()->user()]);
|
||||
$collector = app(JournalCollectorInterface::class);
|
||||
$collector->setUser(auth()->user());
|
||||
$collector
|
||||
->setAccounts(new Collection([$account]))
|
||||
->setRange($attributes['startDate'], $attributes['endDate'])
|
||||
@@ -114,7 +115,8 @@ class ReportController extends Controller
|
||||
case ($role === BalanceLine::ROLE_DEFAULTROLE && is_null($budget->id)):
|
||||
$budget->name = strval(trans('firefly.no_budget'));
|
||||
/** @var JournalCollectorInterface $collector */
|
||||
$collector = app(JournalCollectorInterface::class, [auth()->user()]);
|
||||
$collector = app(JournalCollectorInterface::class);
|
||||
$collector->setUser(auth()->user());
|
||||
$collector
|
||||
->setAccounts(new Collection([$account]))
|
||||
->setTypes($types)
|
||||
@@ -124,7 +126,8 @@ class ReportController extends Controller
|
||||
break;
|
||||
case ($role === BalanceLine::ROLE_DIFFROLE):
|
||||
/** @var JournalCollectorInterface $collector */
|
||||
$collector = app(JournalCollectorInterface::class, [auth()->user()]);
|
||||
$collector = app(JournalCollectorInterface::class);
|
||||
$collector->setUser(auth()->user());
|
||||
$collector
|
||||
->setAccounts(new Collection([$account]))
|
||||
->setTypes($types)
|
||||
@@ -169,7 +172,8 @@ class ReportController extends Controller
|
||||
$repository = app(BudgetRepositoryInterface::class);
|
||||
$budget = $repository->find(intval($attributes['budgetId']));
|
||||
/** @var JournalCollectorInterface $collector */
|
||||
$collector = app(JournalCollectorInterface::class, [auth()->user()]);
|
||||
$collector = app(JournalCollectorInterface::class);
|
||||
$collector->setUser(auth()->user());
|
||||
|
||||
$collector
|
||||
->setAccounts($attributes['accounts'])
|
||||
@@ -203,7 +207,8 @@ class ReportController extends Controller
|
||||
$category = $repository->find(intval($attributes['categoryId']));
|
||||
$types = [TransactionType::WITHDRAWAL, TransactionType::TRANSFER];
|
||||
/** @var JournalCollectorInterface $collector */
|
||||
$collector = app(JournalCollectorInterface::class, [auth()->user()]);
|
||||
$collector = app(JournalCollectorInterface::class);
|
||||
$collector->setUser(auth()->user());
|
||||
$collector->setAccounts($attributes['accounts'])->setTypes($types)
|
||||
->setRange($attributes['startDate'], $attributes['endDate'])
|
||||
->setCategory($category);
|
||||
@@ -230,7 +235,8 @@ class ReportController extends Controller
|
||||
$account = $repository->find(intval($attributes['accountId']));
|
||||
$types = [TransactionType::WITHDRAWAL, TransactionType::TRANSFER];
|
||||
/** @var JournalCollectorInterface $collector */
|
||||
$collector = app(JournalCollectorInterface::class, [auth()->user()]);
|
||||
$collector = app(JournalCollectorInterface::class);
|
||||
$collector->setUser(auth()->user());
|
||||
$collector->setAccounts(new Collection([$account]))->setRange($attributes['startDate'], $attributes['endDate'])->setTypes($types);
|
||||
$journals = $collector->getJournals();
|
||||
$report = $attributes['accounts']->pluck('id')->toArray(); // accounts used in this report
|
||||
@@ -266,7 +272,8 @@ class ReportController extends Controller
|
||||
$account = $repository->find(intval($attributes['accountId']));
|
||||
$types = [TransactionType::DEPOSIT, TransactionType::TRANSFER];
|
||||
/** @var JournalCollectorInterface $collector */
|
||||
$collector = app(JournalCollectorInterface::class, [auth()->user()]);
|
||||
$collector = app(JournalCollectorInterface::class);
|
||||
$collector->setUser(auth()->user());
|
||||
$collector->setAccounts(new Collection([$account]))->setRange($attributes['startDate'], $attributes['endDate'])->setTypes($types);
|
||||
$journals = $collector->getJournals();
|
||||
$report = $attributes['accounts']->pluck('id')->toArray(); // accounts used in this report
|
||||
|
@@ -289,7 +289,7 @@ class RuleController extends Controller
|
||||
$range = config('firefly.test-triggers.range');
|
||||
|
||||
/** @var TransactionMatcher $matcher */
|
||||
$matcher = app('FireflyIII\Rules\TransactionMatcher');
|
||||
$matcher = app(TransactionMatcher::class);
|
||||
$matcher->setLimit($limit);
|
||||
$matcher->setRange($range);
|
||||
$matcher->setTriggers($triggers);
|
||||
@@ -352,7 +352,7 @@ class RuleController extends Controller
|
||||
private function createDefaultRule()
|
||||
{
|
||||
/** @var RuleRepositoryInterface $repository */
|
||||
$repository = app('FireflyIII\Repositories\Rule\RuleRepositoryInterface');
|
||||
$repository = app(RuleRepositoryInterface::class);
|
||||
|
||||
if ($repository->count() === 0) {
|
||||
$data = [
|
||||
|
@@ -72,7 +72,8 @@ class TransactionController extends Controller
|
||||
$end = session('end', Navigation::endOfPeriod(new Carbon, $range));
|
||||
|
||||
/** @var JournalCollectorInterface $collector */
|
||||
$collector = app(JournalCollectorInterface::class, [auth()->user()]);
|
||||
$collector = app(JournalCollectorInterface::class);
|
||||
$collector->setUser(auth()->user());
|
||||
$collector->setTypes($types)->setLimit($pageSize)->setPage($page)->setAllAssetAccounts();
|
||||
$collector->setRange($start, $end)->withBudgetInformation()->withCategoryInformation();
|
||||
|
||||
@@ -122,7 +123,8 @@ class TransactionController extends Controller
|
||||
$subTitle = sprintf('%s (%s)', trans('firefly.title_' . $what), strtolower(trans('firefly.everything')));
|
||||
$page = intval($request->get('page')) === 0 ? 1 : intval($request->get('page'));
|
||||
|
||||
$collector = app(JournalCollectorInterface::class, [auth()->user()]);
|
||||
$collector = app(JournalCollectorInterface::class);
|
||||
$collector->setUser(auth()->user());
|
||||
$collector->setTypes($types)->setLimit($pageSize)->setPage($page)->setAllAssetAccounts()->withBudgetInformation()->withCategoryInformation();
|
||||
|
||||
// do not filter transfers if $what = transfer.
|
||||
@@ -161,7 +163,8 @@ class TransactionController extends Controller
|
||||
Log::debug(sprintf('Transaction index by date will show between %s and %s', $start->format('Y-m-d'), $end->format('Y-m-d')));
|
||||
|
||||
/** @var JournalCollectorInterface $collector */
|
||||
$collector = app(JournalCollectorInterface::class, [auth()->user()]);
|
||||
$collector = app(JournalCollectorInterface::class);
|
||||
$collector->setUser(auth()->user());
|
||||
$collector->setTypes($types)->setLimit($pageSize)->setPage($page)->setAllAssetAccounts();
|
||||
$collector->setRange($start, $end)->withBudgetInformation()->withCategoryInformation();
|
||||
|
||||
|
@@ -49,9 +49,9 @@ class Kernel extends HttpKernel
|
||||
*/
|
||||
protected $bootstrappers
|
||||
= [
|
||||
'Illuminate\Foundation\Bootstrap\DetectEnvironment',
|
||||
'Illuminate\Foundation\Bootstrap\LoadEnvironmentVariables',
|
||||
'Illuminate\Foundation\Bootstrap\LoadConfiguration',
|
||||
'FireflyIII\Bootstrap\ConfigureLogging',
|
||||
//'FireflyIII\Bootstrap\ConfigureLogging',
|
||||
'Illuminate\Foundation\Bootstrap\HandleExceptions',
|
||||
'Illuminate\Foundation\Bootstrap\RegisterFacades',
|
||||
'Illuminate\Foundation\Bootstrap\RegisterProviders',
|
||||
|
@@ -49,7 +49,8 @@ class RuleGroupFormRequest extends Request
|
||||
public function rules()
|
||||
{
|
||||
/** @var RuleGroupRepositoryInterface $repository */
|
||||
$repository = app(RuleGroupRepositoryInterface::class, [auth()->user()]);
|
||||
$repository = app(RuleGroupRepositoryInterface::class);
|
||||
$repository->setUser(auth()->user());
|
||||
$titleRule = 'required|between:1,100|uniqueObjectForUser:rule_groups,title';
|
||||
if (!is_null($repository->find(intval($this->get('id')))->id)) {
|
||||
$titleRule = 'required|between:1,100|uniqueObjectForUser:rule_groups,title,' . intval($this->get('id'));
|
||||
|
@@ -40,7 +40,8 @@ class AccountId extends BasicConverter implements ConverterInterface
|
||||
return new Account;
|
||||
}
|
||||
/** @var AccountRepositoryInterface $repository */
|
||||
$repository = app(AccountRepositoryInterface::class, [$this->user]);
|
||||
$repository = app(AccountRepositoryInterface::class);
|
||||
$repository->setUser($this->user);
|
||||
|
||||
if (isset($this->mapping[$value])) {
|
||||
Log::debug('Found account in mapping. Should exist.', ['value' => $value, 'map' => $this->mapping[$value]]);
|
||||
|
@@ -43,7 +43,8 @@ class AssetAccountIban extends BasicConverter implements ConverterInterface
|
||||
}
|
||||
|
||||
/** @var AccountRepositoryInterface $repository */
|
||||
$repository = app(AccountRepositoryInterface::class, [$this->user]);
|
||||
$repository = app(AccountRepositoryInterface::class);
|
||||
$repository->setUser($this->user);
|
||||
|
||||
|
||||
if (isset($this->mapping[$value])) {
|
||||
|
@@ -43,7 +43,8 @@ class AssetAccountName extends BasicConverter implements ConverterInterface
|
||||
}
|
||||
|
||||
/** @var AccountRepositoryInterface $repository */
|
||||
$repository = app(AccountRepositoryInterface::class, [$this->user]);
|
||||
$repository = app(AccountRepositoryInterface::class);
|
||||
$repository->setUser($this->user);
|
||||
|
||||
|
||||
if (isset($this->mapping[$value])) {
|
||||
|
@@ -41,7 +41,8 @@ class AssetAccountNumber extends BasicConverter implements ConverterInterface
|
||||
}
|
||||
|
||||
/** @var AccountRepositoryInterface $repository */
|
||||
$repository = app(AccountRepositoryInterface::class, [$this->user]);
|
||||
$repository = app(AccountRepositoryInterface::class);
|
||||
$repository->setUser($this->user);
|
||||
|
||||
|
||||
if (isset($this->mapping[$value])) {
|
||||
|
@@ -42,7 +42,8 @@ class BillId extends BasicConverter implements ConverterInterface
|
||||
}
|
||||
|
||||
/** @var BillRepositoryInterface $repository */
|
||||
$repository = app(BillRepositoryInterface::class, [$this->user]);
|
||||
$repository = app(BillRepositoryInterface::class);
|
||||
$repository->setUser($this->user);
|
||||
|
||||
if (isset($this->mapping[$value])) {
|
||||
Log::debug('Found bill in mapping. Should exist.', ['value' => $value, 'map' => $this->mapping[$value]]);
|
||||
|
@@ -44,7 +44,8 @@ class BillName extends BasicConverter implements ConverterInterface
|
||||
}
|
||||
|
||||
/** @var BillRepositoryInterface $repository */
|
||||
$repository = app(BillRepositoryInterface::class, [$this->user]);
|
||||
$repository = app(BillRepositoryInterface::class);
|
||||
$repository->setUser($this->user);
|
||||
|
||||
if (isset($this->mapping[$value])) {
|
||||
Log::debug('Found bill in mapping. Should exist.', ['value' => $value, 'map' => $this->mapping[$value]]);
|
||||
|
@@ -42,7 +42,8 @@ class BudgetId extends BasicConverter implements ConverterInterface
|
||||
}
|
||||
|
||||
/** @var BudgetRepositoryInterface $repository */
|
||||
$repository = app(BudgetRepositoryInterface::class, [$this->user]);
|
||||
$repository = app(BudgetRepositoryInterface::class);
|
||||
$repository->setUser($this->user);
|
||||
|
||||
if (isset($this->mapping[$value])) {
|
||||
Log::debug('Found budget in mapping. Should exist.', ['value' => $value, 'map' => $this->mapping[$value]]);
|
||||
|
@@ -42,7 +42,8 @@ class BudgetName extends BasicConverter implements ConverterInterface
|
||||
}
|
||||
|
||||
/** @var BudgetRepositoryInterface $repository */
|
||||
$repository = app(BudgetRepositoryInterface::class, [$this->user]);
|
||||
$repository = app(BudgetRepositoryInterface::class);
|
||||
$repository->setUser($this->user);
|
||||
|
||||
if (isset($this->mapping[$value])) {
|
||||
Log::debug('Found budget in mapping. Should exist.', ['value' => $value, 'map' => $this->mapping[$value]]);
|
||||
|
@@ -42,7 +42,8 @@ class CategoryId extends BasicConverter implements ConverterInterface
|
||||
}
|
||||
|
||||
/** @var CategoryRepositoryInterface $repository */
|
||||
$repository = app(CategoryRepositoryInterface::class, [$this->user]);
|
||||
$repository = app(CategoryRepositoryInterface::class);
|
||||
$repository->setUser($this->user);
|
||||
|
||||
if (isset($this->mapping[$value])) {
|
||||
Log::debug('Found category in mapping. Should exist.', ['value' => $value, 'map' => $this->mapping[$value]]);
|
||||
|
@@ -42,7 +42,8 @@ class CategoryName extends BasicConverter implements ConverterInterface
|
||||
}
|
||||
|
||||
/** @var CategoryRepositoryInterface $repository */
|
||||
$repository = app(CategoryRepositoryInterface::class, [$this->user]);
|
||||
$repository = app(CategoryRepositoryInterface::class);
|
||||
$repository->setUser($this->user);
|
||||
|
||||
if (isset($this->mapping[$value])) {
|
||||
Log::debug('Found category in mapping. Should exist.', ['value' => $value, 'map' => $this->mapping[$value]]);
|
||||
|
@@ -36,6 +36,7 @@ class CurrencyCode extends BasicConverter implements ConverterInterface
|
||||
|
||||
/** @var CurrencyRepositoryInterface $repository */
|
||||
$repository = app(CurrencyRepositoryInterface::class);
|
||||
$repository->setUser($this->user);
|
||||
|
||||
if (isset($this->mapping[$value])) {
|
||||
Log::debug('Found currency in mapping. Should exist.', ['value' => $value, 'map' => $this->mapping[$value]]);
|
||||
|
@@ -42,7 +42,8 @@ class CurrencyId extends BasicConverter implements ConverterInterface
|
||||
}
|
||||
|
||||
/** @var CurrencyRepositoryInterface $repository */
|
||||
$repository = app(CurrencyRepositoryInterface::class, [$this->user]);
|
||||
$repository = app(CurrencyRepositoryInterface::class);
|
||||
$repository->setUser($this->user);
|
||||
|
||||
if (isset($this->mapping[$value])) {
|
||||
Log::debug('Found currency in mapping. Should exist.', ['value' => $value, 'map' => $this->mapping[$value]]);
|
||||
|
@@ -42,7 +42,8 @@ class CurrencyName extends BasicConverter implements ConverterInterface
|
||||
}
|
||||
|
||||
/** @var CurrencyRepositoryInterface $repository */
|
||||
$repository = app(CurrencyRepositoryInterface::class, [$this->user]);
|
||||
$repository = app(CurrencyRepositoryInterface::class);
|
||||
$repository->setUser($this->user);
|
||||
|
||||
if (isset($this->mapping[$value])) {
|
||||
Log::debug('Found currency in mapping. Should exist.', ['value' => $value, 'map' => $this->mapping[$value]]);
|
||||
|
@@ -42,7 +42,8 @@ class CurrencySymbol extends BasicConverter implements ConverterInterface
|
||||
}
|
||||
|
||||
/** @var CurrencyRepositoryInterface $repository */
|
||||
$repository = app(CurrencyRepositoryInterface::class, [$this->user]);
|
||||
$repository = app(CurrencyRepositoryInterface::class);
|
||||
$repository->setUser($this->user);
|
||||
|
||||
if (isset($this->mapping[$value])) {
|
||||
Log::debug('Found currency in mapping. Should exist.', ['value' => $value, 'map' => $this->mapping[$value]]);
|
||||
|
@@ -43,7 +43,8 @@ class OpposingAccountIban extends BasicConverter implements ConverterInterface
|
||||
}
|
||||
|
||||
/** @var AccountRepositoryInterface $repository */
|
||||
$repository = app(AccountRepositoryInterface::class, [$this->user]);
|
||||
$repository = app(AccountRepositoryInterface::class);
|
||||
$repository->setUser($this->user);
|
||||
|
||||
|
||||
if (isset($this->mapping[$value])) {
|
||||
|
@@ -42,7 +42,8 @@ class OpposingAccountName extends BasicConverter implements ConverterInterface
|
||||
}
|
||||
|
||||
/** @var AccountRepositoryInterface $repository */
|
||||
$repository = app(AccountRepositoryInterface::class, [$this->user]);
|
||||
$repository = app(AccountRepositoryInterface::class);
|
||||
$repository->setUser($this->user);
|
||||
|
||||
|
||||
if (isset($this->mapping[$value])) {
|
||||
|
@@ -43,7 +43,8 @@ class OpposingAccountNumber extends BasicConverter implements ConverterInterface
|
||||
}
|
||||
|
||||
/** @var AccountRepositoryInterface $repository */
|
||||
$repository = app(AccountRepositoryInterface::class, [$this->user]);
|
||||
$repository = app(AccountRepositoryInterface::class);
|
||||
$repository->setUser($this->user);
|
||||
|
||||
|
||||
if (isset($this->mapping[$value])) {
|
||||
|
@@ -39,7 +39,8 @@ class TagSplit
|
||||
Log::debug('Exploded parts.', $parts);
|
||||
|
||||
/** @var TagRepositoryInterface $repository */
|
||||
$repository = app(TagRepositoryInterface::class, [$user]);
|
||||
$repository = app(TagRepositoryInterface::class);
|
||||
$repository->setUser($user);
|
||||
|
||||
|
||||
/** @var string $part */
|
||||
|
@@ -58,7 +58,8 @@ class ImportProcedure implements ImportProcedureInterface
|
||||
if ($job->configuration['import-account'] != 0) {
|
||||
|
||||
/** @var AccountRepositoryInterface $repository */
|
||||
$repository = app(AccountRepositoryInterface::class, [$job->user]);
|
||||
$repository = app(AccountRepositoryInterface::class);
|
||||
$repository->setUser($job->user);
|
||||
$validator->setDefaultImportAccount($repository->find($job->configuration['import-account']));
|
||||
}
|
||||
|
||||
|
@@ -159,7 +159,8 @@ class ImportStorage
|
||||
private function createImportTag(): Tag
|
||||
{
|
||||
/** @var TagRepositoryInterface $repository */
|
||||
$repository = app(TagRepositoryInterface::class, [$this->user]);
|
||||
$repository = app(TagRepositoryInterface::class);
|
||||
$repository->setUser($this->user);
|
||||
$data = [
|
||||
'tag' => trans('firefly.import_with_key', ['key' => $this->job->key]),
|
||||
'date' => new Carbon,
|
||||
|
@@ -177,7 +177,8 @@ class ImportValidator
|
||||
// find it first by new type:
|
||||
|
||||
/** @var AccountRepositoryInterface $repository */
|
||||
$repository = app(AccountRepositoryInterface::class, [$this->user]);
|
||||
$repository = app(AccountRepositoryInterface::class);
|
||||
$repository->setUser($this->user);
|
||||
|
||||
$result = $repository->findByName($account->name, [$type]);
|
||||
if (is_null($result->id)) {
|
||||
@@ -214,7 +215,8 @@ class ImportValidator
|
||||
{
|
||||
|
||||
/** @var AccountRepositoryInterface $repository */
|
||||
$repository = app(AccountRepositoryInterface::class, [$this->user]);
|
||||
$repository = app(AccountRepositoryInterface::class);
|
||||
$repository->setUser($this->user);
|
||||
|
||||
$name = 'Unknown expense account';
|
||||
$result = $repository->findByName($name, [AccountType::EXPENSE]);
|
||||
@@ -235,7 +237,8 @@ class ImportValidator
|
||||
{
|
||||
|
||||
/** @var AccountRepositoryInterface $repository */
|
||||
$repository = app(AccountRepositoryInterface::class, [$this->user]);
|
||||
$repository = app(AccountRepositoryInterface::class);
|
||||
$repository->setUser($this->user);
|
||||
|
||||
$name = 'Unknown revenue account';
|
||||
$result = $repository->findByName($name, [AccountType::REVENUE]);
|
||||
@@ -382,7 +385,8 @@ class ImportValidator
|
||||
{
|
||||
if (is_null($entry->fields['currency'])) {
|
||||
/** @var CurrencyRepositoryInterface $repository */
|
||||
$repository = app(CurrencyRepositoryInterface::class, [$this->user]);
|
||||
$repository = app(CurrencyRepositoryInterface::class);
|
||||
$repository->setUser($this->user);
|
||||
// is the default currency for the user or the system
|
||||
$defaultCode = Preferences::getForUser($this->user, 'currencyPreference', config('firefly.default_currency', 'EUR'))->data;
|
||||
|
||||
|
@@ -181,7 +181,8 @@ class CsvSetup implements SetupInterface
|
||||
public function saveImportConfiguration(array $data, FileBag $files): bool
|
||||
{
|
||||
/** @var AccountRepositoryInterface $repository */
|
||||
$repository = app(AccountRepositoryInterface::class, [auth()->user()]);
|
||||
$repository = app(AccountRepositoryInterface::class);
|
||||
$repository->setUser(auth()->user());
|
||||
|
||||
$importId = $data['csv_import_account'] ?? 0;
|
||||
$account = $repository->find(intval($importId));
|
||||
|
@@ -156,7 +156,8 @@ class ExecuteRuleGroupOnExistingTransactions extends Job implements ShouldQueue
|
||||
protected function collectJournals()
|
||||
{
|
||||
/** @var JournalCollectorInterface $collector */
|
||||
$collector = app(JournalCollectorInterface::class, [auth()->user()]);
|
||||
$collector = app(JournalCollectorInterface::class);
|
||||
$collector->setUser(auth()->user());
|
||||
$collector->setAccounts($this->accounts)->setRange($this->startDate, $this->endDate);
|
||||
|
||||
return $collector->getJournals();
|
||||
|
@@ -14,7 +14,10 @@ declare(strict_types = 1);
|
||||
|
||||
namespace FireflyIII\Providers;
|
||||
|
||||
use FireflyIII\Exceptions\FireflyException;
|
||||
use FireflyIII\Repositories\Account\AccountRepository;
|
||||
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
|
||||
use FireflyIII\Repositories\Account\AccountTasker;
|
||||
use FireflyIII\Repositories\Account\AccountTaskerInterface;
|
||||
use Illuminate\Foundation\Application;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
|
||||
@@ -44,8 +47,6 @@ class AccountServiceProvider extends ServiceProvider
|
||||
{
|
||||
$this->registerRepository();
|
||||
$this->registerTasker();
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -54,16 +55,16 @@ class AccountServiceProvider extends ServiceProvider
|
||||
private function registerRepository()
|
||||
{
|
||||
$this->app->bind(
|
||||
'FireflyIII\Repositories\Account\AccountRepositoryInterface',
|
||||
function (Application $app, array $arguments) {
|
||||
if (!isset($arguments[0]) && $app->auth->check()) {
|
||||
return app('FireflyIII\Repositories\Account\AccountRepository', [auth()->user()]);
|
||||
}
|
||||
if (!isset($arguments[0]) && !$app->auth->check()) {
|
||||
throw new FireflyException('There is no user present.');
|
||||
AccountRepositoryInterface::class,
|
||||
function (Application $app) {
|
||||
/** @var AccountRepositoryInterface $repository */
|
||||
$repository = app(AccountRepository::class);
|
||||
|
||||
if ($app->auth->check()) {
|
||||
$repository->setUser(auth()->user());
|
||||
}
|
||||
|
||||
return app('FireflyIII\Repositories\Account\AccountRepository', $arguments);
|
||||
return $repository;
|
||||
}
|
||||
);
|
||||
}
|
||||
@@ -74,16 +75,16 @@ class AccountServiceProvider extends ServiceProvider
|
||||
private function registerTasker()
|
||||
{
|
||||
$this->app->bind(
|
||||
'FireflyIII\Repositories\Account\AccountTaskerInterface',
|
||||
function (Application $app, array $arguments) {
|
||||
if (!isset($arguments[0]) && $app->auth->check()) {
|
||||
return app('FireflyIII\Repositories\Account\AccountTasker', [auth()->user()]);
|
||||
}
|
||||
if (!isset($arguments[0]) && !$app->auth->check()) {
|
||||
throw new FireflyException('There is no user present.');
|
||||
AccountTaskerInterface::class,
|
||||
function (Application $app) {
|
||||
/** @var AccountTaskerInterface $tasker */
|
||||
$tasker = app(AccountTasker::class);
|
||||
|
||||
if ($app->auth->check()) {
|
||||
$tasker->setUser(auth()->user());
|
||||
}
|
||||
|
||||
return app('FireflyIII\Repositories\Account\AccountTasker', $arguments);
|
||||
return $tasker;
|
||||
}
|
||||
);
|
||||
}
|
||||
|
@@ -14,7 +14,8 @@ declare(strict_types = 1);
|
||||
|
||||
namespace FireflyIII\Providers;
|
||||
|
||||
use FireflyIII\Exceptions\FireflyException;
|
||||
use FireflyIII\Repositories\Attachment\AttachmentRepository;
|
||||
use FireflyIII\Repositories\Attachment\AttachmentRepositoryInterface;
|
||||
use Illuminate\Foundation\Application;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
|
||||
@@ -43,16 +44,15 @@ class AttachmentServiceProvider extends ServiceProvider
|
||||
public function register()
|
||||
{
|
||||
$this->app->bind(
|
||||
'FireflyIII\Repositories\Attachment\AttachmentRepositoryInterface',
|
||||
function (Application $app, array $arguments) {
|
||||
if (!isset($arguments[0]) && $app->auth->check()) {
|
||||
return app('FireflyIII\Repositories\Attachment\AttachmentRepository', [auth()->user()]);
|
||||
}
|
||||
if (!isset($arguments[0]) && !$app->auth->check()) {
|
||||
throw new FireflyException('There is no user present.');
|
||||
AttachmentRepositoryInterface::class,
|
||||
function (Application $app) {
|
||||
/** @var AttachmentRepositoryInterface $repository */
|
||||
$repository = app(AttachmentRepository::class);
|
||||
if ($app->auth->check()) {
|
||||
$repository->setUser(auth()->user());
|
||||
}
|
||||
|
||||
return app('FireflyIII\Repositories\Attachment\AttachmentRepository', $arguments);
|
||||
return $repository;
|
||||
}
|
||||
);
|
||||
}
|
||||
|
@@ -14,7 +14,8 @@ declare(strict_types = 1);
|
||||
|
||||
namespace FireflyIII\Providers;
|
||||
|
||||
use FireflyIII\Exceptions\FireflyException;
|
||||
use FireflyIII\Repositories\Bill\BillRepository;
|
||||
use FireflyIII\Repositories\Bill\BillRepositoryInterface;
|
||||
use Illuminate\Foundation\Application;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
|
||||
@@ -43,16 +44,16 @@ class BillServiceProvider extends ServiceProvider
|
||||
public function register()
|
||||
{
|
||||
$this->app->bind(
|
||||
'FireflyIII\Repositories\Bill\BillRepositoryInterface',
|
||||
function (Application $app, array $arguments) {
|
||||
if (!isset($arguments[0]) && $app->auth->check()) {
|
||||
return app('FireflyIII\Repositories\Bill\BillRepository', [auth()->user()]);
|
||||
}
|
||||
if (!isset($arguments[0]) && !$app->auth->check()) {
|
||||
throw new FireflyException('There is no user present.');
|
||||
BillRepositoryInterface::class,
|
||||
function (Application $app) {
|
||||
/** @var BillRepositoryInterface $repository */
|
||||
$repository = app(BillRepository::class);
|
||||
|
||||
if ($app->auth->check()) {
|
||||
$repository->setUser(auth()->user());
|
||||
}
|
||||
|
||||
return app('FireflyIII\Repositories\Bill\BillRepository', $arguments);
|
||||
return $repository;
|
||||
}
|
||||
);
|
||||
}
|
||||
|
@@ -14,7 +14,8 @@ declare(strict_types = 1);
|
||||
|
||||
namespace FireflyIII\Providers;
|
||||
|
||||
use FireflyIII\Exceptions\FireflyException;
|
||||
use FireflyIII\Repositories\Budget\BudgetRepository;
|
||||
use FireflyIII\Repositories\Budget\BudgetRepositoryInterface;
|
||||
use Illuminate\Foundation\Application;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
|
||||
@@ -43,16 +44,15 @@ class BudgetServiceProvider extends ServiceProvider
|
||||
public function register()
|
||||
{
|
||||
$this->app->bind(
|
||||
'FireflyIII\Repositories\Budget\BudgetRepositoryInterface',
|
||||
function (Application $app, array $arguments) {
|
||||
if (!isset($arguments[0]) && $app->auth->check()) {
|
||||
return app('FireflyIII\Repositories\Budget\BudgetRepository', [auth()->user()]);
|
||||
}
|
||||
if (!isset($arguments[0]) && !$app->auth->check()) {
|
||||
throw new FireflyException('There is no user present.');
|
||||
BudgetRepositoryInterface::class,
|
||||
function (Application $app) {
|
||||
/** @var BudgetRepositoryInterface $repository */
|
||||
$repository = app(BudgetRepository::class);
|
||||
if ($app->auth->check()) {
|
||||
$repository->setUser(auth()->user());
|
||||
}
|
||||
|
||||
return app('FireflyIII\Repositories\Budget\BudgetRepository', $arguments);
|
||||
return $repository;
|
||||
}
|
||||
);
|
||||
}
|
||||
|
@@ -14,7 +14,8 @@ declare(strict_types = 1);
|
||||
|
||||
namespace FireflyIII\Providers;
|
||||
|
||||
use FireflyIII\Exceptions\FireflyException;
|
||||
use FireflyIII\Repositories\Category\CategoryRepository;
|
||||
use FireflyIII\Repositories\Category\CategoryRepositoryInterface;
|
||||
use Illuminate\Foundation\Application;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
|
||||
@@ -43,16 +44,15 @@ class CategoryServiceProvider extends ServiceProvider
|
||||
public function register()
|
||||
{
|
||||
$this->app->bind(
|
||||
'FireflyIII\Repositories\Category\CategoryRepositoryInterface',
|
||||
function (Application $app, array $arguments) {
|
||||
if (!isset($arguments[0]) && $app->auth->check()) {
|
||||
return app('FireflyIII\Repositories\Category\CategoryRepository', [auth()->user()]);
|
||||
}
|
||||
if (!isset($arguments[0]) && !$app->auth->check()) {
|
||||
throw new FireflyException('There is no user present.');
|
||||
CategoryRepositoryInterface::class,
|
||||
function (Application $app) {
|
||||
/** @var CategoryRepository $repository */
|
||||
$repository = app(CategoryRepository::class);
|
||||
if ($app->auth->check()) {
|
||||
$repository->setUser(auth()->user());
|
||||
}
|
||||
|
||||
return app('FireflyIII\Repositories\Category\CategoryRepository', $arguments);
|
||||
return $repository;
|
||||
}
|
||||
);
|
||||
|
||||
|
@@ -1,64 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* CrudServiceProvider.php
|
||||
* Copyright (C) 2016 thegrumpydictator@gmail.com
|
||||
*
|
||||
* This software may be modified and distributed under the terms of the
|
||||
* Creative Commons Attribution-ShareAlike 4.0 International License.
|
||||
*
|
||||
* See the LICENSE file for details.
|
||||
*/
|
||||
|
||||
declare(strict_types = 1);
|
||||
|
||||
namespace FireflyIII\Providers;
|
||||
|
||||
use FireflyIII\Exceptions\FireflyException;
|
||||
use Illuminate\Foundation\Application;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
|
||||
/**
|
||||
* Class CrudServiceProvider
|
||||
*
|
||||
* @package FireflyIII\Providers
|
||||
*/
|
||||
class CrudServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* Bootstrap the application services.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function boot()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Register the application services.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function register()
|
||||
{
|
||||
$this->registerJournal();
|
||||
}
|
||||
|
||||
private function registerJournal()
|
||||
{
|
||||
$this->app->bind(
|
||||
'FireflyIII\Crud\Split\JournalInterface',
|
||||
function (Application $app, array $arguments) {
|
||||
if (!isset($arguments[0]) && $app->auth->check()) {
|
||||
return app('FireflyIII\Crud\Split\Journal', [auth()->user()]);
|
||||
}
|
||||
if (!isset($arguments[0]) && !$app->auth->check()) {
|
||||
throw new FireflyException('There is no user present.');
|
||||
}
|
||||
|
||||
return app('FireflyIII\Crud\Split\Journal', $arguments);
|
||||
}
|
||||
);
|
||||
|
||||
}
|
||||
}
|
@@ -14,7 +14,8 @@ declare(strict_types = 1);
|
||||
|
||||
namespace FireflyIII\Providers;
|
||||
|
||||
use FireflyIII\Exceptions\FireflyException;
|
||||
use FireflyIII\Repositories\Currency\CurrencyRepository;
|
||||
use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface;
|
||||
use Illuminate\Foundation\Application;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
|
||||
@@ -43,16 +44,15 @@ class CurrencyServiceProvider extends ServiceProvider
|
||||
public function register()
|
||||
{
|
||||
$this->app->bind(
|
||||
'FireflyIII\Repositories\Currency\CurrencyRepositoryInterface',
|
||||
function (Application $app, array $arguments) {
|
||||
if (!isset($arguments[0]) && $app->auth->check()) {
|
||||
return app('FireflyIII\Repositories\Currency\CurrencyRepository', [auth()->user()]);
|
||||
}
|
||||
if (!isset($arguments[0]) && !$app->auth->check()) {
|
||||
throw new FireflyException('There is no user present.');
|
||||
CurrencyRepositoryInterface::class,
|
||||
function (Application $app) {
|
||||
/** @var CurrencyRepository $repository */
|
||||
$repository = app(CurrencyRepository::class);
|
||||
if ($app->auth->check()) {
|
||||
$repository->setUser(auth()->user());
|
||||
}
|
||||
|
||||
return app('FireflyIII\Repositories\Currency\CurrencyRepository', $arguments);
|
||||
return $repository;
|
||||
}
|
||||
);
|
||||
}
|
||||
|
@@ -14,7 +14,10 @@ declare(strict_types = 1);
|
||||
|
||||
namespace FireflyIII\Providers;
|
||||
|
||||
use FireflyIII\Exceptions\FireflyException;
|
||||
use FireflyIII\Repositories\ExportJob\ExportJobRepository;
|
||||
use FireflyIII\Repositories\ExportJob\ExportJobRepositoryInterface;
|
||||
use FireflyIII\Repositories\ImportJob\ImportJobRepository;
|
||||
use FireflyIII\Repositories\ImportJob\ImportJobRepositoryInterface;
|
||||
use Illuminate\Foundation\Application;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
|
||||
@@ -33,8 +36,7 @@ class ExportJobServiceProvider extends ServiceProvider
|
||||
*/
|
||||
public function boot()
|
||||
{
|
||||
$this->exportJob();
|
||||
$this->importJob();
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -45,7 +47,8 @@ class ExportJobServiceProvider extends ServiceProvider
|
||||
*/
|
||||
public function register()
|
||||
{
|
||||
//
|
||||
$this->exportJob();
|
||||
$this->importJob();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -53,18 +56,16 @@ class ExportJobServiceProvider extends ServiceProvider
|
||||
*/
|
||||
private function exportJob()
|
||||
{
|
||||
|
||||
$this->app->bind(
|
||||
'FireflyIII\Repositories\ExportJob\ExportJobRepositoryInterface',
|
||||
function (Application $app, array $arguments) {
|
||||
if (!isset($arguments[0]) && $app->auth->check()) {
|
||||
return app('FireflyIII\Repositories\ExportJob\ExportJobRepository', [auth()->user()]);
|
||||
}
|
||||
if (!isset($arguments[0]) && !$app->auth->check()) {
|
||||
throw new FireflyException('There is no user present.');
|
||||
ExportJobRepositoryInterface::class,
|
||||
function (Application $app) {
|
||||
/** @var ExportJobRepository $repository */
|
||||
$repository = app(ExportJobRepository::class);
|
||||
if ($app->auth->check()) {
|
||||
$repository->setUser(auth()->user());
|
||||
}
|
||||
|
||||
return app('FireflyIII\Repositories\ExportJob\ExportJobRepository', $arguments);
|
||||
return $repository;
|
||||
}
|
||||
);
|
||||
}
|
||||
@@ -72,16 +73,15 @@ class ExportJobServiceProvider extends ServiceProvider
|
||||
private function importJob()
|
||||
{
|
||||
$this->app->bind(
|
||||
'FireflyIII\Repositories\ImportJob\ImportJobRepositoryInterface',
|
||||
function (Application $app, array $arguments) {
|
||||
if (!isset($arguments[0]) && $app->auth->check()) {
|
||||
return app('FireflyIII\Repositories\ImportJob\ImportJobRepository', [auth()->user()]);
|
||||
}
|
||||
if (!isset($arguments[0]) && !$app->auth->check()) {
|
||||
throw new FireflyException('There is no user present.');
|
||||
ImportJobRepositoryInterface::class,
|
||||
function (Application $app) {
|
||||
/** @var ImportJobRepository $repository */
|
||||
$repository = app(ImportJobRepository::class);
|
||||
if ($app->auth->check()) {
|
||||
$repository->setUser(auth()->user());
|
||||
}
|
||||
|
||||
return app('FireflyIII\Repositories\ImportJob\ImportJobRepository', $arguments);
|
||||
return $repository;
|
||||
}
|
||||
);
|
||||
}
|
||||
|
@@ -13,6 +13,28 @@ declare(strict_types = 1);
|
||||
|
||||
namespace FireflyIII\Providers;
|
||||
|
||||
use FireflyIII\Export\Processor;
|
||||
use FireflyIII\Export\ProcessorInterface;
|
||||
use FireflyIII\Generator\Chart\Basic\ChartJsGenerator;
|
||||
use FireflyIII\Generator\Chart\Basic\GeneratorInterface;
|
||||
use FireflyIII\Helpers\Attachments\AttachmentHelper;
|
||||
use FireflyIII\Helpers\Attachments\AttachmentHelperInterface;
|
||||
use FireflyIII\Helpers\Chart\MetaPieChart;
|
||||
use FireflyIII\Helpers\Chart\MetaPieChartInterface;
|
||||
use FireflyIII\Helpers\FiscalHelper;
|
||||
use FireflyIII\Helpers\FiscalHelperInterface;
|
||||
use FireflyIII\Helpers\Help\Help;
|
||||
use FireflyIII\Helpers\Help\HelpInterface;
|
||||
use FireflyIII\Helpers\Report\BalanceReportHelper;
|
||||
use FireflyIII\Helpers\Report\BalanceReportHelperInterface;
|
||||
use FireflyIII\Helpers\Report\BudgetReportHelper;
|
||||
use FireflyIII\Helpers\Report\BudgetReportHelperInterface;
|
||||
use FireflyIII\Helpers\Report\ReportHelper;
|
||||
use FireflyIII\Helpers\Report\ReportHelperInterface;
|
||||
use FireflyIII\Import\ImportProcedure;
|
||||
use FireflyIII\Import\ImportProcedureInterface;
|
||||
use FireflyIII\Repositories\User\UserRepository;
|
||||
use FireflyIII\Repositories\User\UserRepositoryInterface;
|
||||
use FireflyIII\Support\Amount;
|
||||
use FireflyIII\Support\ExpandedForm;
|
||||
use FireflyIII\Support\FireflyConfig;
|
||||
@@ -94,22 +116,22 @@ class FireflyServiceProvider extends ServiceProvider
|
||||
);
|
||||
|
||||
// chart generator:
|
||||
$this->app->bind('FireflyIII\Generator\Chart\Basic\GeneratorInterface', 'FireflyIII\Generator\Chart\Basic\ChartJsGenerator');
|
||||
$this->app->bind(GeneratorInterface::class, ChartJsGenerator::class);
|
||||
|
||||
// chart builder
|
||||
$this->app->bind('FireflyIII\Helpers\Chart\MetaPieChartInterface', 'FireflyIII\Helpers\Chart\MetaPieChart');
|
||||
$this->app->bind(MetaPieChartInterface::class, MetaPieChart::class);
|
||||
|
||||
// other generators
|
||||
$this->app->bind('FireflyIII\Export\ProcessorInterface', 'FireflyIII\Export\Processor');
|
||||
$this->app->bind('FireflyIII\Import\ImportProcedureInterface', 'FireflyIII\Import\ImportProcedure');
|
||||
$this->app->bind('FireflyIII\Repositories\User\UserRepositoryInterface', 'FireflyIII\Repositories\User\UserRepository');
|
||||
$this->app->bind('FireflyIII\Helpers\Attachments\AttachmentHelperInterface', 'FireflyIII\Helpers\Attachments\AttachmentHelper');
|
||||
$this->app->bind(ProcessorInterface::class,Processor::class);
|
||||
$this->app->bind(ImportProcedureInterface::class,ImportProcedure::class);
|
||||
$this->app->bind(UserRepositoryInterface::class, UserRepository::class);
|
||||
$this->app->bind(AttachmentHelperInterface::class, AttachmentHelper::class);
|
||||
|
||||
$this->app->bind('FireflyIII\Helpers\Help\HelpInterface', 'FireflyIII\Helpers\Help\Help');
|
||||
$this->app->bind('FireflyIII\Helpers\Report\ReportHelperInterface', 'FireflyIII\Helpers\Report\ReportHelper');
|
||||
$this->app->bind('FireflyIII\Helpers\FiscalHelperInterface', 'FireflyIII\Helpers\FiscalHelper');
|
||||
$this->app->bind('FireflyIII\Helpers\Report\BalanceReportHelperInterface', 'FireflyIII\Helpers\Report\BalanceReportHelper');
|
||||
$this->app->bind('FireflyIII\Helpers\Report\BudgetReportHelperInterface', 'FireflyIII\Helpers\Report\BudgetReportHelper');
|
||||
$this->app->bind(HelpInterface::class, Help::class);
|
||||
$this->app->bind(ReportHelperInterface::class, ReportHelper::class);
|
||||
$this->app->bind(FiscalHelperInterface::class,FiscalHelper::class);
|
||||
$this->app->bind(BalanceReportHelperInterface::class, BalanceReportHelper::class);
|
||||
$this->app->bind(BudgetReportHelperInterface::class, BudgetReportHelper::class);
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -14,7 +14,12 @@ declare(strict_types = 1);
|
||||
|
||||
namespace FireflyIII\Providers;
|
||||
|
||||
use FireflyIII\Exceptions\FireflyException;
|
||||
use FireflyIII\Helpers\Collector\JournalCollector;
|
||||
use FireflyIII\Helpers\Collector\JournalCollectorInterface;
|
||||
use FireflyIII\Repositories\Journal\JournalRepository;
|
||||
use FireflyIII\Repositories\Journal\JournalRepositoryInterface;
|
||||
use FireflyIII\Repositories\Journal\JournalTasker;
|
||||
use FireflyIII\Repositories\Journal\JournalTaskerInterface;
|
||||
use Illuminate\Foundation\Application;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
|
||||
@@ -50,16 +55,16 @@ class JournalServiceProvider extends ServiceProvider
|
||||
private function registerCollector()
|
||||
{
|
||||
$this->app->bind(
|
||||
'FireflyIII\Helpers\Collector\JournalCollectorInterface',
|
||||
function (Application $app, array $arguments) {
|
||||
if (!isset($arguments[0]) && $app->auth->check()) {
|
||||
return app('FireflyIII\Helpers\Collector\JournalCollector', [auth()->user()]);
|
||||
}
|
||||
if (!isset($arguments[0]) && !$app->auth->check()) {
|
||||
throw new FireflyException('There is no user present.');
|
||||
JournalCollectorInterface::class,
|
||||
function (Application $app) {
|
||||
/** @var JournalCollectorInterface $collector */
|
||||
$collector = app(JournalCollector::class);
|
||||
if ($app->auth->check()) {
|
||||
$collector->setUser(auth()->user());
|
||||
}
|
||||
$collector->startQuery();
|
||||
|
||||
return app('FireflyIII\Helpers\Collector\JournalCollector', $arguments);
|
||||
return $collector;
|
||||
}
|
||||
);
|
||||
}
|
||||
@@ -67,16 +72,16 @@ class JournalServiceProvider extends ServiceProvider
|
||||
private function registerRepository()
|
||||
{
|
||||
$this->app->bind(
|
||||
'FireflyIII\Repositories\Journal\JournalRepositoryInterface',
|
||||
function (Application $app, array $arguments) {
|
||||
if (!isset($arguments[0]) && $app->auth->check()) {
|
||||
return app('FireflyIII\Repositories\Journal\JournalRepository', [auth()->user()]);
|
||||
}
|
||||
if (!isset($arguments[0]) && !$app->auth->check()) {
|
||||
throw new FireflyException('There is no user present.');
|
||||
JournalRepositoryInterface::class,
|
||||
function (Application $app) {
|
||||
/** @var JournalRepositoryInterface $repository */
|
||||
$repository = app(JournalRepository::class);
|
||||
if ($app->auth->check()) {
|
||||
|
||||
$repository->setUser(auth()->user());
|
||||
}
|
||||
|
||||
return app('FireflyIII\Repositories\Journal\JournalRepository', $arguments);
|
||||
return $repository;
|
||||
}
|
||||
);
|
||||
}
|
||||
@@ -84,16 +89,16 @@ class JournalServiceProvider extends ServiceProvider
|
||||
private function registerTasker()
|
||||
{
|
||||
$this->app->bind(
|
||||
'FireflyIII\Repositories\Journal\JournalTaskerInterface',
|
||||
function (Application $app, array $arguments) {
|
||||
if (!isset($arguments[0]) && $app->auth->check()) {
|
||||
return app('FireflyIII\Repositories\Journal\JournalTasker', [auth()->user()]);
|
||||
}
|
||||
if (!isset($arguments[0]) && !$app->auth->check()) {
|
||||
throw new FireflyException('There is no user present.');
|
||||
JournalTaskerInterface::class,
|
||||
function (Application $app) {
|
||||
/** @var JournalTaskerInterface $tasker */
|
||||
$tasker = app(JournalTasker::class);
|
||||
|
||||
if ($app->auth->check()) {
|
||||
$tasker->setUser(auth()->user());
|
||||
}
|
||||
|
||||
return app('FireflyIII\Repositories\Journal\JournalTasker', $arguments);
|
||||
return $tasker;
|
||||
}
|
||||
);
|
||||
}
|
||||
|
53
app/Providers/LogServiceProvider.php
Normal file
53
app/Providers/LogServiceProvider.php
Normal file
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
/**
|
||||
* LogServiceProvider.php
|
||||
* Copyright (c) 2017 thegrumpydictator@gmail.com
|
||||
* This software may be modified and distributed under the terms of the Creative Commons Attribution-ShareAlike 4.0 International License.
|
||||
*
|
||||
* See the LICENSE file for details.
|
||||
*/
|
||||
|
||||
declare(strict_types = 1);
|
||||
|
||||
namespace FireflyIII\Providers;
|
||||
|
||||
use Illuminate\Log\LogServiceProvider as LaravelLogServiceProvider;
|
||||
use Illuminate\Log\Writer;
|
||||
|
||||
/**
|
||||
* Class LogServiceProvider
|
||||
*
|
||||
* @package FireflyIII\Providers
|
||||
*/
|
||||
class LogServiceProvider extends LaravelLogServiceProvider
|
||||
{
|
||||
/**
|
||||
* Configure the Monolog handlers for the application.
|
||||
*
|
||||
* @param \Illuminate\Log\Writer $log
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function configureDailyHandler(Writer $log)
|
||||
{
|
||||
$log->useDailyFiles(
|
||||
$this->app->storagePath() . '/logs/firefly-iii.log', $this->maxFiles(),
|
||||
$this->logLevel()
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Configure the Monolog handlers for the application.
|
||||
*
|
||||
* @param \Illuminate\Log\Writer $log
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function configureSingleHandler(Writer $log)
|
||||
{
|
||||
$log->useFiles(
|
||||
$this->app->storagePath() . '/logs/firefly-iii.log',
|
||||
$this->logLevel()
|
||||
);
|
||||
}
|
||||
}
|
@@ -15,6 +15,8 @@ declare(strict_types = 1);
|
||||
namespace FireflyIII\Providers;
|
||||
|
||||
use FireflyIII\Exceptions\FireflyException;
|
||||
use FireflyIII\Repositories\PiggyBank\PiggyBankRepository;
|
||||
use FireflyIII\Repositories\PiggyBank\PiggyBankRepositoryInterface;
|
||||
use Illuminate\Foundation\Application;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
|
||||
@@ -44,16 +46,14 @@ class PiggyBankServiceProvider extends ServiceProvider
|
||||
public function register()
|
||||
{
|
||||
$this->app->bind(
|
||||
'FireflyIII\Repositories\PiggyBank\PiggyBankRepositoryInterface',
|
||||
function (Application $app, array $arguments) {
|
||||
if (!isset($arguments[0]) && $app->auth->check()) {
|
||||
return app('FireflyIII\Repositories\PiggyBank\PiggyBankRepository', [auth()->user()]);
|
||||
PiggyBankRepositoryInterface::class,
|
||||
function (Application $app) {
|
||||
/** @var PiggyBankRepository $repository */
|
||||
$repository = app(PiggyBankRepository::class);
|
||||
if ($app->auth->check()) {
|
||||
$repository->setUser(auth()->user());
|
||||
}
|
||||
if (!isset($arguments[0]) && !$app->auth->check()) {
|
||||
throw new FireflyException('There is no user present.');
|
||||
}
|
||||
|
||||
return app('FireflyIII\Repositories\PiggyBank\PiggyBankRepository', $arguments);
|
||||
return $repository;
|
||||
}
|
||||
);
|
||||
}
|
||||
|
@@ -14,7 +14,8 @@ declare(strict_types = 1);
|
||||
|
||||
namespace FireflyIII\Providers;
|
||||
|
||||
use FireflyIII\Exceptions\FireflyException;
|
||||
use FireflyIII\Repositories\RuleGroup\RuleGroupRepository;
|
||||
use FireflyIII\Repositories\RuleGroup\RuleGroupRepositoryInterface;
|
||||
use Illuminate\Foundation\Application;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
|
||||
@@ -44,16 +45,15 @@ class RuleGroupServiceProvider extends ServiceProvider
|
||||
public function register()
|
||||
{
|
||||
$this->app->bind(
|
||||
'FireflyIII\Repositories\RuleGroup\RuleGroupRepositoryInterface',
|
||||
function (Application $app, array $arguments) {
|
||||
if (!isset($arguments[0]) && $app->auth->check()) {
|
||||
return app('FireflyIII\Repositories\RuleGroup\RuleGroupRepository', [auth()->user()]);
|
||||
}
|
||||
if (!isset($arguments[0]) && !$app->auth->check()) {
|
||||
throw new FireflyException('There is no user present.');
|
||||
RuleGroupRepositoryInterface::class,
|
||||
function (Application $app) {
|
||||
/** @var RuleGroupRepository $repository */
|
||||
$repository = app(RuleGroupRepository::class);
|
||||
if ($app->auth->check()) {
|
||||
$repository->setUser(auth()->user());
|
||||
}
|
||||
|
||||
return app('FireflyIII\Repositories\RuleGroup\RuleGroupRepository', $arguments);
|
||||
return $repository;
|
||||
}
|
||||
);
|
||||
}
|
||||
|
@@ -14,7 +14,8 @@ declare(strict_types = 1);
|
||||
|
||||
namespace FireflyIII\Providers;
|
||||
|
||||
use FireflyIII\Exceptions\FireflyException;
|
||||
use FireflyIII\Repositories\Rule\RuleRepository;
|
||||
use FireflyIII\Repositories\Rule\RuleRepositoryInterface;
|
||||
use Illuminate\Foundation\Application;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
|
||||
@@ -43,16 +44,14 @@ class RuleServiceProvider extends ServiceProvider
|
||||
public function register()
|
||||
{
|
||||
$this->app->bind(
|
||||
'FireflyIII\Repositories\Rule\RuleRepositoryInterface',
|
||||
function (Application $app, array $arguments) {
|
||||
if (!isset($arguments[0]) && $app->auth->check()) {
|
||||
return app('FireflyIII\Repositories\Rule\RuleRepository', [auth()->user()]);
|
||||
RuleRepositoryInterface::class,
|
||||
function (Application $app) {
|
||||
/** @var RuleRepository $repository */
|
||||
$repository = app(RuleRepository::class);
|
||||
if ($app->auth->check()) {
|
||||
$repository->setUser(auth()->user());
|
||||
}
|
||||
if (!isset($arguments[0]) && !$app->auth->check()) {
|
||||
throw new FireflyException('There is no user present.');
|
||||
}
|
||||
|
||||
return app('FireflyIII\Repositories\Rule\RuleRepository', $arguments);
|
||||
return $repository;
|
||||
}
|
||||
);
|
||||
}
|
||||
|
@@ -14,7 +14,8 @@ declare(strict_types = 1);
|
||||
|
||||
namespace FireflyIII\Providers;
|
||||
|
||||
use FireflyIII\Exceptions\FireflyException;
|
||||
use FireflyIII\Support\Search\Search;
|
||||
use FireflyIII\Support\Search\SearchInterface;
|
||||
use Illuminate\Foundation\Application;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
|
||||
@@ -43,16 +44,15 @@ class SearchServiceProvider extends ServiceProvider
|
||||
public function register()
|
||||
{
|
||||
$this->app->bind(
|
||||
'FireflyIII\Support\Search\SearchInterface',
|
||||
function (Application $app, array $arguments) {
|
||||
if (!isset($arguments[0]) && $app->auth->check()) {
|
||||
return app('FireflyIII\Support\Search\Search', [auth()->user()]);
|
||||
}
|
||||
if (!isset($arguments[0]) && !$app->auth->check()) {
|
||||
throw new FireflyException('There is no user present.');
|
||||
SearchInterface::class,
|
||||
function (Application $app) {
|
||||
/** @var Search $search */
|
||||
$search = app(Search::class);
|
||||
if ($app->auth->check()) {
|
||||
$search->setUser(auth()->user());
|
||||
}
|
||||
|
||||
return app('FireflyIII\Support\Search\Search', $arguments);
|
||||
return $search;
|
||||
}
|
||||
);
|
||||
}
|
||||
|
@@ -14,7 +14,8 @@ declare(strict_types = 1);
|
||||
|
||||
namespace FireflyIII\Providers;
|
||||
|
||||
use FireflyIII\Exceptions\FireflyException;
|
||||
use FireflyIII\Repositories\Tag\TagRepository;
|
||||
use FireflyIII\Repositories\Tag\TagRepositoryInterface;
|
||||
use Illuminate\Foundation\Application;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
|
||||
@@ -43,16 +44,16 @@ class TagServiceProvider extends ServiceProvider
|
||||
public function register()
|
||||
{
|
||||
$this->app->bind(
|
||||
'FireflyIII\Repositories\Tag\TagRepositoryInterface',
|
||||
function (Application $app, array $arguments) {
|
||||
if (!isset($arguments[0]) && $app->auth->check()) {
|
||||
return app('FireflyIII\Repositories\Tag\TagRepository', [auth()->user()]);
|
||||
}
|
||||
if (!isset($arguments[0]) && !$app->auth->check()) {
|
||||
throw new FireflyException('There is no user present.');
|
||||
TagRepositoryInterface::class,
|
||||
function (Application $app) {
|
||||
/** @var TagRepository $repository */
|
||||
$repository = app(TagRepository::class);
|
||||
|
||||
if ($app->auth->check()) {
|
||||
$repository->setUser(auth()->user());
|
||||
}
|
||||
|
||||
return app('FireflyIII\Repositories\Tag\TagRepository', $arguments);
|
||||
return $repository;
|
||||
}
|
||||
);
|
||||
}
|
||||
|
@@ -43,16 +43,6 @@ class AccountRepository implements AccountRepositoryInterface
|
||||
/** @var array */
|
||||
private $validFields = ['accountRole', 'ccMonthlyPaymentDate', 'ccType', 'accountNumber', 'currency_id', 'BIC'];
|
||||
|
||||
/**
|
||||
* AttachmentRepository constructor.
|
||||
*
|
||||
* @param User $user
|
||||
*/
|
||||
public function __construct(User $user)
|
||||
{
|
||||
$this->user = $user;
|
||||
}
|
||||
|
||||
/**
|
||||
* Moved here from account CRUD
|
||||
*
|
||||
@@ -323,6 +313,14 @@ class AccountRepository implements AccountRepositoryInterface
|
||||
return $journal->date;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param User $user
|
||||
*/
|
||||
public function setUser(User $user)
|
||||
{
|
||||
$this->user = $user;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $data
|
||||
*
|
||||
|
@@ -16,6 +16,7 @@ namespace FireflyIII\Repositories\Account;
|
||||
use Carbon\Carbon;
|
||||
use FireflyIII\Models\Account;
|
||||
use FireflyIII\Models\TransactionJournal;
|
||||
use FireflyIII\User;
|
||||
use Illuminate\Support\Collection;
|
||||
|
||||
/**
|
||||
@@ -124,6 +125,11 @@ interface AccountRepositoryInterface
|
||||
*/
|
||||
public function oldestJournalDate(Account $account): Carbon;
|
||||
|
||||
/**
|
||||
* @param User $user
|
||||
*/
|
||||
public function setUser(User $user);
|
||||
|
||||
/**
|
||||
* @param array $data
|
||||
*
|
||||
|
@@ -31,16 +31,6 @@ class AccountTasker implements AccountTaskerInterface
|
||||
/** @var User */
|
||||
private $user;
|
||||
|
||||
/**
|
||||
* AttachmentRepository constructor.
|
||||
*
|
||||
* @param User $user
|
||||
*/
|
||||
public function __construct(User $user)
|
||||
{
|
||||
$this->user = $user;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see self::amountInPeriod
|
||||
*
|
||||
@@ -108,8 +98,8 @@ class AccountTasker implements AccountTaskerInterface
|
||||
*/
|
||||
public function getAccountReport(Collection $accounts, Carbon $start, Carbon $end): array
|
||||
{
|
||||
$ids = $accounts->pluck('id')->toArray();
|
||||
$yesterday = clone $start;
|
||||
$ids = $accounts->pluck('id')->toArray();
|
||||
$yesterday = clone $start;
|
||||
$yesterday->subDay();
|
||||
$startSet = Steam::balancesById($ids, $yesterday);
|
||||
$endSet = Steam::balancesById($ids, $end);
|
||||
@@ -155,6 +145,14 @@ class AccountTasker implements AccountTaskerInterface
|
||||
return $return;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param User $user
|
||||
*/
|
||||
public function setUser(User $user)
|
||||
{
|
||||
$this->user = $user;
|
||||
}
|
||||
|
||||
/**
|
||||
* Will return how much money has been going out (ie. spent) by the given account(s).
|
||||
* Alternatively, will return how much money has been coming in (ie. earned) by the given accounts.
|
||||
|
@@ -14,6 +14,7 @@ declare(strict_types = 1);
|
||||
namespace FireflyIII\Repositories\Account;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use FireflyIII\User;
|
||||
use Illuminate\Support\Collection;
|
||||
|
||||
/**
|
||||
@@ -23,7 +24,6 @@ use Illuminate\Support\Collection;
|
||||
*/
|
||||
interface AccountTaskerInterface
|
||||
{
|
||||
|
||||
/**
|
||||
* @param Collection $accounts
|
||||
* @param Collection $excluded
|
||||
@@ -57,4 +57,9 @@ interface AccountTaskerInterface
|
||||
*/
|
||||
public function getAccountReport(Collection $accounts, Carbon $start, Carbon $end): array;
|
||||
|
||||
/**
|
||||
* @param User $user
|
||||
*/
|
||||
public function setUser(User $user);
|
||||
|
||||
}
|
||||
|
@@ -14,12 +14,12 @@ declare(strict_types = 1);
|
||||
namespace FireflyIII\Repositories\Attachment;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Crypt;
|
||||
use FireflyIII\Helpers\Attachments\AttachmentHelperInterface;
|
||||
use FireflyIII\Models\Attachment;
|
||||
use FireflyIII\User;
|
||||
use Illuminate\Support\Collection;
|
||||
use Storage;
|
||||
use Crypt;
|
||||
|
||||
/**
|
||||
* Class AttachmentRepository
|
||||
@@ -31,16 +31,6 @@ class AttachmentRepository implements AttachmentRepositoryInterface
|
||||
/** @var User */
|
||||
private $user;
|
||||
|
||||
/**
|
||||
* AttachmentRepository constructor.
|
||||
*
|
||||
* @param User $user
|
||||
*/
|
||||
public function __construct(User $user)
|
||||
{
|
||||
$this->user = $user;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Attachment $attachment
|
||||
*
|
||||
@@ -117,6 +107,14 @@ class AttachmentRepository implements AttachmentRepositoryInterface
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* @param User $user
|
||||
*/
|
||||
public function setUser(User $user)
|
||||
{
|
||||
$this->user = $user;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Attachment $attachment
|
||||
* @param array $data
|
||||
|
@@ -15,6 +15,7 @@ namespace FireflyIII\Repositories\Attachment;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use FireflyIII\Models\Attachment;
|
||||
use FireflyIII\User;
|
||||
use Illuminate\Support\Collection;
|
||||
|
||||
/**
|
||||
@@ -59,6 +60,11 @@ interface AttachmentRepositoryInterface
|
||||
*/
|
||||
public function getContent(Attachment $attachment): string;
|
||||
|
||||
/**
|
||||
* @param User $user
|
||||
*/
|
||||
public function setUser(User $user);
|
||||
|
||||
/**
|
||||
* @param Attachment $attachment
|
||||
* @param array $attachmentData
|
||||
|
@@ -37,16 +37,6 @@ class BillRepository implements BillRepositoryInterface
|
||||
/** @var User */
|
||||
private $user;
|
||||
|
||||
/**
|
||||
* BillRepository constructor.
|
||||
*
|
||||
* @param User $user
|
||||
*/
|
||||
public function __construct(User $user)
|
||||
{
|
||||
$this->user = $user;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Bill $bill
|
||||
*
|
||||
@@ -520,6 +510,14 @@ class BillRepository implements BillRepositoryInterface
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @param User $user
|
||||
*/
|
||||
public function setUser(User $user)
|
||||
{
|
||||
$this->user = $user;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $data
|
||||
*
|
||||
|
@@ -16,6 +16,7 @@ namespace FireflyIII\Repositories\Bill;
|
||||
use Carbon\Carbon;
|
||||
use FireflyIII\Models\Bill;
|
||||
use FireflyIII\Models\TransactionJournal;
|
||||
use FireflyIII\User;
|
||||
use Illuminate\Support\Collection;
|
||||
|
||||
/**
|
||||
@@ -25,7 +26,6 @@ use Illuminate\Support\Collection;
|
||||
*/
|
||||
interface BillRepositoryInterface
|
||||
{
|
||||
|
||||
/**
|
||||
* @param Bill $bill
|
||||
*
|
||||
@@ -159,6 +159,11 @@ interface BillRepositoryInterface
|
||||
*/
|
||||
public function scan(Bill $bill, TransactionJournal $journal): bool;
|
||||
|
||||
/**
|
||||
* @param User $user
|
||||
*/
|
||||
public function setUser(User $user);
|
||||
|
||||
/**
|
||||
* @param array $data
|
||||
*
|
||||
|
@@ -38,16 +38,6 @@ class BudgetRepository implements BudgetRepositoryInterface
|
||||
/** @var User */
|
||||
private $user;
|
||||
|
||||
/**
|
||||
* BudgetRepository constructor.
|
||||
*
|
||||
* @param User $user
|
||||
*/
|
||||
public function __construct(User $user)
|
||||
{
|
||||
$this->user = $user;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
@@ -433,6 +423,14 @@ class BudgetRepository implements BudgetRepositoryInterface
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param User $user
|
||||
*/
|
||||
public function setUser(User $user)
|
||||
{
|
||||
$this->user = $user;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Collection $budgets
|
||||
* @param Collection $accounts
|
||||
@@ -444,7 +442,8 @@ class BudgetRepository implements BudgetRepositoryInterface
|
||||
public function spentInPeriod(Collection $budgets, Collection $accounts, Carbon $start, Carbon $end): string
|
||||
{
|
||||
/** @var JournalCollectorInterface $collector */
|
||||
$collector = app(JournalCollectorInterface::class, [$this->user]);
|
||||
$collector = app(JournalCollectorInterface::class);
|
||||
$collector->setUser($this->user);
|
||||
$collector->setRange($start, $end)->setTypes([TransactionType::WITHDRAWAL])->setBudgets($budgets);
|
||||
|
||||
if ($accounts->count() > 0) {
|
||||
@@ -470,7 +469,8 @@ class BudgetRepository implements BudgetRepositoryInterface
|
||||
public function spentInPeriodWoBudget(Collection $accounts, Carbon $start, Carbon $end): string
|
||||
{
|
||||
/** @var JournalCollectorInterface $collector */
|
||||
$collector = app(JournalCollectorInterface::class, [$this->user]);
|
||||
$collector = app(JournalCollectorInterface::class);
|
||||
$collector->setUser($this->user);
|
||||
$collector->setRange($start, $end)->setTypes([TransactionType::WITHDRAWAL])->withoutBudget();
|
||||
|
||||
if ($accounts->count() > 0) {
|
||||
|
@@ -17,6 +17,7 @@ use Carbon\Carbon;
|
||||
use FireflyIII\Models\Budget;
|
||||
use FireflyIII\Models\BudgetLimit;
|
||||
use FireflyIII\Models\TransactionCurrency;
|
||||
use FireflyIII\User;
|
||||
use Illuminate\Support\Collection;
|
||||
|
||||
/**
|
||||
@@ -26,7 +27,6 @@ use Illuminate\Support\Collection;
|
||||
*/
|
||||
interface BudgetRepositoryInterface
|
||||
{
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
@@ -149,6 +149,11 @@ interface BudgetRepositoryInterface
|
||||
*/
|
||||
public function setAvailableBudget(TransactionCurrency $currency, Carbon $start, Carbon $end, string $amount): bool;
|
||||
|
||||
/**
|
||||
* @param User $user
|
||||
*/
|
||||
public function setUser(User $user);
|
||||
|
||||
/**
|
||||
* @param Collection $budgets
|
||||
* @param Collection $accounts
|
||||
|
@@ -34,16 +34,6 @@ class CategoryRepository implements CategoryRepositoryInterface
|
||||
/** @var User */
|
||||
private $user;
|
||||
|
||||
/**
|
||||
* CategoryRepository constructor.
|
||||
*
|
||||
* @param User $user
|
||||
*/
|
||||
public function __construct(User $user)
|
||||
{
|
||||
$this->user = $user;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Category $category
|
||||
*
|
||||
@@ -67,7 +57,8 @@ class CategoryRepository implements CategoryRepositoryInterface
|
||||
public function earnedInPeriod(Collection $categories, Collection $accounts, Carbon $start, Carbon $end): string
|
||||
{
|
||||
/** @var JournalCollectorInterface $collector */
|
||||
$collector = app(JournalCollectorInterface::class, [$this->user]);
|
||||
$collector = app(JournalCollectorInterface::class);
|
||||
$collector->setUser($this->user);
|
||||
$collector->setRange($start, $end)->setTypes([TransactionType::DEPOSIT])->setAccounts($accounts)->setCategories($categories);
|
||||
$set = $collector->getJournals();
|
||||
$sum = strval($set->sum('transaction_amount'));
|
||||
@@ -384,6 +375,14 @@ class CategoryRepository implements CategoryRepositoryInterface
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param User $user
|
||||
*/
|
||||
public function setUser(User $user)
|
||||
{
|
||||
$this->user = $user;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Collection $categories
|
||||
* @param Collection $accounts
|
||||
@@ -395,7 +394,8 @@ class CategoryRepository implements CategoryRepositoryInterface
|
||||
public function spentInPeriod(Collection $categories, Collection $accounts, Carbon $start, Carbon $end): string
|
||||
{
|
||||
/** @var JournalCollectorInterface $collector */
|
||||
$collector = app(JournalCollectorInterface::class, [$this->user]);
|
||||
$collector = app(JournalCollectorInterface::class);
|
||||
$collector->setUser($this->user);
|
||||
$collector->setRange($start, $end)->setTypes([TransactionType::WITHDRAWAL])->setCategories($categories);
|
||||
|
||||
|
||||
@@ -423,7 +423,8 @@ class CategoryRepository implements CategoryRepositoryInterface
|
||||
public function spentInPeriodWithoutCategory(Collection $accounts, Carbon $start, Carbon $end): string
|
||||
{
|
||||
/** @var JournalCollectorInterface $collector */
|
||||
$collector = app(JournalCollectorInterface::class, [$this->user]);
|
||||
$collector = app(JournalCollectorInterface::class);
|
||||
$collector->setUser($this->user);
|
||||
$collector->setRange($start, $end)->setTypes([TransactionType::WITHDRAWAL])->withoutCategory();
|
||||
|
||||
if ($accounts->count() > 0) {
|
||||
|
@@ -15,6 +15,7 @@ namespace FireflyIII\Repositories\Category;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use FireflyIII\Models\Category;
|
||||
use FireflyIII\User;
|
||||
use Illuminate\Support\Collection;
|
||||
|
||||
/**
|
||||
@@ -121,6 +122,11 @@ interface CategoryRepositoryInterface
|
||||
*/
|
||||
public function periodIncomeNoCategory(Collection $accounts, Carbon $start, Carbon $end): array;
|
||||
|
||||
/**
|
||||
* @param User $user
|
||||
*/
|
||||
public function setUser(User $user);
|
||||
|
||||
/**
|
||||
* @param Collection $categories
|
||||
* @param Collection $accounts
|
||||
|
@@ -31,11 +31,9 @@ class CurrencyRepository implements CurrencyRepositoryInterface
|
||||
private $user;
|
||||
|
||||
/**
|
||||
* CategoryRepository constructor.
|
||||
*
|
||||
* @param User $user
|
||||
*/
|
||||
public function __construct(User $user)
|
||||
public function setUser(User $user)
|
||||
{
|
||||
$this->user = $user;
|
||||
}
|
||||
|
@@ -16,6 +16,7 @@ namespace FireflyIII\Repositories\Currency;
|
||||
|
||||
use FireflyIII\Models\Preference;
|
||||
use FireflyIII\Models\TransactionCurrency;
|
||||
use FireflyIII\User;
|
||||
use Illuminate\Support\Collection;
|
||||
|
||||
/**
|
||||
@@ -94,6 +95,11 @@ interface CurrencyRepositoryInterface
|
||||
*/
|
||||
public function getCurrencyByPreference(Preference $preference): TransactionCurrency;
|
||||
|
||||
/**
|
||||
* @param User $user
|
||||
*/
|
||||
public function setUser(User $user);
|
||||
|
||||
/**
|
||||
* @param array $data
|
||||
*
|
||||
|
@@ -29,16 +29,6 @@ class ExportJobRepository implements ExportJobRepositoryInterface
|
||||
/** @var User */
|
||||
private $user;
|
||||
|
||||
/**
|
||||
* ExportJobRepository constructor.
|
||||
*
|
||||
* @param User $user
|
||||
*/
|
||||
public function __construct(User $user)
|
||||
{
|
||||
$this->user = $user;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param ExportJob $job
|
||||
* @param string $status
|
||||
@@ -149,4 +139,12 @@ class ExportJobRepository implements ExportJobRepositoryInterface
|
||||
|
||||
return $content;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param User $user
|
||||
*/
|
||||
public function setUser(User $user)
|
||||
{
|
||||
$this->user = $user;
|
||||
}
|
||||
}
|
||||
|
@@ -14,6 +14,7 @@ declare(strict_types = 1);
|
||||
namespace FireflyIII\Repositories\ExportJob;
|
||||
|
||||
use FireflyIII\Models\ExportJob;
|
||||
use FireflyIII\User;
|
||||
|
||||
/**
|
||||
* Interface ExportJobRepositoryInterface
|
||||
@@ -61,4 +62,9 @@ interface ExportJobRepositoryInterface
|
||||
*/
|
||||
public function getContent(ExportJob $job): string;
|
||||
|
||||
/**
|
||||
* @param User $user
|
||||
*/
|
||||
public function setUser(User $user);
|
||||
|
||||
}
|
||||
|
@@ -28,16 +28,6 @@ class ImportJobRepository implements ImportJobRepositoryInterface
|
||||
/** @var User */
|
||||
private $user;
|
||||
|
||||
/**
|
||||
* ExportJobRepository constructor.
|
||||
*
|
||||
* @param User $user
|
||||
*/
|
||||
public function __construct(User $user)
|
||||
{
|
||||
$this->user = $user;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $fileType
|
||||
*
|
||||
@@ -95,4 +85,12 @@ class ImportJobRepository implements ImportJobRepositoryInterface
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param User $user
|
||||
*/
|
||||
public function setUser(User $user)
|
||||
{
|
||||
$this->user = $user;
|
||||
}
|
||||
}
|
||||
|
@@ -14,6 +14,7 @@ declare(strict_types = 1);
|
||||
namespace FireflyIII\Repositories\ImportJob;
|
||||
|
||||
use FireflyIII\Models\ImportJob;
|
||||
use FireflyIII\User;
|
||||
|
||||
/**
|
||||
* Interface ImportJobRepositoryInterface
|
||||
@@ -35,4 +36,9 @@ interface ImportJobRepositoryInterface
|
||||
* @return ImportJob
|
||||
*/
|
||||
public function findByKey(string $key): ImportJob;
|
||||
|
||||
/**
|
||||
* @param User $user
|
||||
*/
|
||||
public function setUser(User $user);
|
||||
}
|
||||
|
@@ -44,11 +44,9 @@ class JournalRepository implements JournalRepositoryInterface
|
||||
private $validMetaFields = ['interest_date', 'book_date', 'process_date', 'due_date', 'payment_date', 'invoice_date', 'internal_reference', 'notes'];
|
||||
|
||||
/**
|
||||
* JournalRepository constructor.
|
||||
*
|
||||
* @param User $user
|
||||
*/
|
||||
public function __construct(User $user)
|
||||
public function setUser(User $user)
|
||||
{
|
||||
$this->user = $user;
|
||||
}
|
||||
|
@@ -16,6 +16,7 @@ namespace FireflyIII\Repositories\Journal;
|
||||
use FireflyIII\Models\Account;
|
||||
use FireflyIII\Models\TransactionJournal;
|
||||
use FireflyIII\Models\TransactionType;
|
||||
use FireflyIII\User;
|
||||
use Illuminate\Support\Collection;
|
||||
use Illuminate\Support\MessageBag;
|
||||
|
||||
@@ -26,7 +27,6 @@ use Illuminate\Support\MessageBag;
|
||||
*/
|
||||
interface JournalRepositoryInterface
|
||||
{
|
||||
|
||||
/**
|
||||
* @param TransactionJournal $journal
|
||||
* @param TransactionType $type
|
||||
@@ -37,11 +37,6 @@ interface JournalRepositoryInterface
|
||||
*/
|
||||
public function convert(TransactionJournal $journal, TransactionType $type, Account $source, Account $destination): MessageBag;
|
||||
|
||||
/**
|
||||
* @return Collection
|
||||
*/
|
||||
public function getTransactionTypes(): Collection;
|
||||
|
||||
/**
|
||||
* Deletes a journal.
|
||||
*
|
||||
@@ -67,6 +62,15 @@ interface JournalRepositoryInterface
|
||||
*/
|
||||
public function first(): TransactionJournal;
|
||||
|
||||
/**
|
||||
* @return Collection
|
||||
*/
|
||||
public function getTransactionTypes(): Collection;
|
||||
|
||||
/**
|
||||
* @param User $user
|
||||
*/
|
||||
public function setUser(User $user);
|
||||
|
||||
/**
|
||||
* @param array $data
|
||||
|
@@ -35,15 +35,6 @@ class JournalTasker implements JournalTaskerInterface
|
||||
/** @var User */
|
||||
private $user;
|
||||
|
||||
/**
|
||||
* JournalRepository constructor.
|
||||
*
|
||||
* @param User $user
|
||||
*/
|
||||
public function __construct(User $user)
|
||||
{
|
||||
$this->user = $user;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param TransactionJournal $journal
|
||||
@@ -152,6 +143,14 @@ class JournalTasker implements JournalTaskerInterface
|
||||
return $transactions;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param User $user
|
||||
*/
|
||||
public function setUser(User $user)
|
||||
{
|
||||
$this->user = $user;
|
||||
}
|
||||
|
||||
/**
|
||||
* Collect the balance of an account before the given transaction has hit. This is tricky, because
|
||||
* the balance does not depend on the transaction itself but the journal it's part of. And of course
|
||||
|
@@ -15,6 +15,7 @@ namespace FireflyIII\Repositories\Journal;
|
||||
|
||||
|
||||
use FireflyIII\Models\TransactionJournal;
|
||||
use FireflyIII\User;
|
||||
use Illuminate\Support\Collection;
|
||||
|
||||
/**
|
||||
@@ -24,7 +25,6 @@ use Illuminate\Support\Collection;
|
||||
*/
|
||||
interface JournalTaskerInterface
|
||||
{
|
||||
|
||||
/**
|
||||
* @param TransactionJournal $journal
|
||||
*
|
||||
@@ -41,4 +41,9 @@ interface JournalTaskerInterface
|
||||
* @return array
|
||||
*/
|
||||
public function getTransactionsOverview(TransactionJournal $journal): array;
|
||||
|
||||
/**
|
||||
* @param User $user
|
||||
*/
|
||||
public function setUser(User $user);
|
||||
}
|
||||
|
@@ -32,16 +32,6 @@ class PiggyBankRepository implements PiggyBankRepositoryInterface
|
||||
/** @var User */
|
||||
private $user;
|
||||
|
||||
/**
|
||||
* PiggyBankRepository constructor.
|
||||
*
|
||||
* @param User $user
|
||||
*/
|
||||
public function __construct(User $user)
|
||||
{
|
||||
$this->user = $user;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param PiggyBank $piggyBank
|
||||
* @param string $amount
|
||||
@@ -167,6 +157,14 @@ class PiggyBankRepository implements PiggyBankRepositoryInterface
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param User $user
|
||||
*/
|
||||
public function setUser(User $user)
|
||||
{
|
||||
$this->user = $user;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $data
|
||||
*
|
||||
|
@@ -15,6 +15,7 @@ namespace FireflyIII\Repositories\PiggyBank;
|
||||
|
||||
use FireflyIII\Models\PiggyBank;
|
||||
use FireflyIII\Models\PiggyBankEvent;
|
||||
use FireflyIII\User;
|
||||
use Illuminate\Support\Collection;
|
||||
|
||||
/**
|
||||
@@ -98,6 +99,10 @@ interface PiggyBankRepositoryInterface
|
||||
*/
|
||||
public function setOrder(int $piggyBankId, int $order): bool;
|
||||
|
||||
/**
|
||||
* @param User $user
|
||||
*/
|
||||
public function setUser(User $user);
|
||||
|
||||
/**
|
||||
* Store new piggy bank.
|
||||
|
@@ -30,16 +30,6 @@ class RuleRepository implements RuleRepositoryInterface
|
||||
/** @var User */
|
||||
private $user;
|
||||
|
||||
/**
|
||||
* BillRepository constructor.
|
||||
*
|
||||
* @param User $user
|
||||
*/
|
||||
public function __construct(User $user)
|
||||
{
|
||||
$this->user = $user;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
@@ -218,6 +208,14 @@ class RuleRepository implements RuleRepositoryInterface
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @param User $user
|
||||
*/
|
||||
public function setUser(User $user)
|
||||
{
|
||||
$this->user = $user;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $data
|
||||
*
|
||||
|
@@ -17,6 +17,7 @@ use FireflyIII\Models\Rule;
|
||||
use FireflyIII\Models\RuleAction;
|
||||
use FireflyIII\Models\RuleGroup;
|
||||
use FireflyIII\Models\RuleTrigger;
|
||||
use FireflyIII\User;
|
||||
|
||||
/**
|
||||
* Interface RuleRepositoryInterface
|
||||
@@ -25,7 +26,6 @@ use FireflyIII\Models\RuleTrigger;
|
||||
*/
|
||||
interface RuleRepositoryInterface
|
||||
{
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
@@ -94,6 +94,11 @@ interface RuleRepositoryInterface
|
||||
*/
|
||||
public function resetRulesInGroupOrder(RuleGroup $ruleGroup): bool;
|
||||
|
||||
/**
|
||||
* @param User $user
|
||||
*/
|
||||
public function setUser(User $user);
|
||||
|
||||
/**
|
||||
* @param array $data
|
||||
*
|
||||
|
@@ -31,11 +31,9 @@ class RuleGroupRepository implements RuleGroupRepositoryInterface
|
||||
private $user;
|
||||
|
||||
/**
|
||||
* BillRepository constructor.
|
||||
*
|
||||
* @param User $user
|
||||
*/
|
||||
public function __construct(User $user)
|
||||
public function setUser(User $user)
|
||||
{
|
||||
$this->user = $user;
|
||||
}
|
||||
|
@@ -26,7 +26,6 @@ use Illuminate\Support\Collection;
|
||||
interface RuleGroupRepositoryInterface
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
@@ -92,6 +91,11 @@ interface RuleGroupRepositoryInterface
|
||||
*/
|
||||
public function resetRulesInGroupOrder(RuleGroup $ruleGroup): bool;
|
||||
|
||||
/**
|
||||
* @param User $user
|
||||
*/
|
||||
public function setUser(User $user);
|
||||
|
||||
/**
|
||||
* @param array $data
|
||||
*
|
||||
|
@@ -35,11 +35,9 @@ class TagRepository implements TagRepositoryInterface
|
||||
private $user;
|
||||
|
||||
/**
|
||||
* TagRepository constructor.
|
||||
*
|
||||
* @param User $user
|
||||
*/
|
||||
public function __construct(User $user)
|
||||
public function setUser(User $user)
|
||||
{
|
||||
$this->user = $user;
|
||||
}
|
||||
@@ -396,7 +394,8 @@ class TagRepository implements TagRepositoryInterface
|
||||
public function earnedInPeriod(Tag $tag, Carbon $start, Carbon $end): string
|
||||
{
|
||||
/** @var JournalCollectorInterface $collector */
|
||||
$collector = app(JournalCollectorInterface::class, [$this->user]);
|
||||
$collector = app(JournalCollectorInterface::class);
|
||||
$collector->setUser($this->user);
|
||||
$collector->setRange($start, $end)->setTypes([TransactionType::DEPOSIT])->setAllAssetAccounts()->setTag($tag);
|
||||
$set = $collector->getJournals();
|
||||
$sum = strval($set->sum('transaction_amount'));
|
||||
@@ -414,7 +413,8 @@ class TagRepository implements TagRepositoryInterface
|
||||
public function spentInPeriod(Tag $tag, Carbon $start, Carbon $end): string
|
||||
{
|
||||
/** @var JournalCollectorInterface $collector */
|
||||
$collector = app(JournalCollectorInterface::class, [$this->user]);
|
||||
$collector = app(JournalCollectorInterface::class);
|
||||
$collector->setUser($this->user);
|
||||
$collector->setRange($start, $end)->setTypes([TransactionType::WITHDRAWAL])->setAllAssetAccounts()->setTag($tag);
|
||||
$set = $collector->getJournals();
|
||||
$sum = strval($set->sum('transaction_amount'));
|
||||
|
@@ -16,6 +16,7 @@ namespace FireflyIII\Repositories\Tag;
|
||||
use Carbon\Carbon;
|
||||
use FireflyIII\Models\Tag;
|
||||
use FireflyIII\Models\TransactionJournal;
|
||||
use FireflyIII\User;
|
||||
use Illuminate\Support\Collection;
|
||||
|
||||
|
||||
@@ -89,6 +90,11 @@ interface TagRepositoryInterface
|
||||
*/
|
||||
public function lastUseDate(Tag $tag): Carbon;
|
||||
|
||||
/**
|
||||
* @param User $user
|
||||
*/
|
||||
public function setUser(User $user);
|
||||
|
||||
/**
|
||||
* @param Tag $tag
|
||||
* @param Carbon $start
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user