mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-10-18 10:16:49 +00:00
Merge branch 'release/3.8.3'
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
APP_ENV=production
|
||||
APP_DEBUG=false
|
||||
APP_KEY=SomeRandomStringOf32CharsExactly
|
||||
|
||||
LOG_LEVEL=warning
|
||||
|
||||
DB_CONNECTION=mysql
|
||||
DB_HOST=localhost
|
||||
|
@@ -1,7 +1,7 @@
|
||||
APP_ENV=testing
|
||||
APP_DEBUG=true
|
||||
APP_KEY=SomeRandomStringOf32CharsExactly
|
||||
|
||||
LOG_LEVEL=debug
|
||||
|
||||
DB_CONNECTION=sqlite
|
||||
DB_HOST=localhost
|
||||
|
@@ -4,6 +4,7 @@ php:
|
||||
- 7
|
||||
|
||||
install:
|
||||
- cp _development/phpunit.xml ./phpunit.xml
|
||||
- phpenv config-rm xdebug.ini
|
||||
- composer selfupdate
|
||||
- rm composer.lock
|
||||
|
14
CHANGELOG.md
14
CHANGELOG.md
@@ -5,6 +5,20 @@ This project adheres to [Semantic Versioning](http://semver.org/).
|
||||
## [Unreleased]
|
||||
- No unreleased changes yet.
|
||||
|
||||
## [3.8.3] - 2016-04-17
|
||||
### Added
|
||||
- New audit report to see what happened.
|
||||
|
||||
### Changed
|
||||
- New Chart JS release used.
|
||||
- Help function is more reliable.
|
||||
|
||||
### Fixed
|
||||
- Expected bill amount is now correct.
|
||||
- Upgrade will now invalidate cache.
|
||||
- Search was broken.
|
||||
- Queries run better
|
||||
|
||||
## [3.8.2] - 2016-04-03
|
||||
### Added
|
||||
- Small user administration at /admin.
|
||||
|
43
app/Bootstrap/ConfigureLogging.php
Normal file
43
app/Bootstrap/ConfigureLogging.php
Normal file
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
/**
|
||||
* ConfigureLogging.php
|
||||
* Copyright (C) 2016 thegrumpydictator@gmail.com
|
||||
*
|
||||
* This software may be modified and distributed under the terms
|
||||
* of the MIT license. See the LICENSE file for details.
|
||||
*/
|
||||
|
||||
namespace FireflyIII\Bootstrap;
|
||||
|
||||
use Illuminate\Log\Writer;
|
||||
use Illuminate\Contracts\Foundation\Application;
|
||||
use Illuminate\Foundation\Bootstrap\ConfigureLogging as IlluminateConfigureLogging;
|
||||
|
||||
/**
|
||||
* Class ConfigureLogging
|
||||
*
|
||||
* @package FireflyIII\Bootstrap
|
||||
*/
|
||||
class ConfigureLogging extends IlluminateConfigureLogging
|
||||
{
|
||||
/**
|
||||
* @param Application $app
|
||||
* @param Writer $log
|
||||
*/
|
||||
protected function configureSingleHandler(Application $app, Writer $log)
|
||||
{
|
||||
$log->useFiles($app->storagePath().'/logs/firefly-iii.log');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Application $app
|
||||
* @param Writer $log
|
||||
*/
|
||||
protected function configureDailyHandler(Application $app, Writer $log)
|
||||
{
|
||||
$log->useDailyFiles(
|
||||
$app->storagePath().'/logs/firefly-iii.log',
|
||||
$app->make('config')->get('app.log_max_files', 5)
|
||||
);
|
||||
}
|
||||
}
|
@@ -22,6 +22,25 @@ use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
|
||||
*/
|
||||
class Kernel extends ConsoleKernel
|
||||
{
|
||||
|
||||
/**
|
||||
* The bootstrap classes for the application.
|
||||
*
|
||||
* This needs to be for with the next upgrade.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $bootstrappers = [
|
||||
'Illuminate\Foundation\Bootstrap\DetectEnvironment',
|
||||
'Illuminate\Foundation\Bootstrap\LoadConfiguration',
|
||||
'FireflyIII\Bootstrap\ConfigureLogging',
|
||||
'Illuminate\Foundation\Bootstrap\HandleExceptions',
|
||||
'Illuminate\Foundation\Bootstrap\RegisterFacades',
|
||||
'Illuminate\Foundation\Bootstrap\SetRequestForConsole',
|
||||
'Illuminate\Foundation\Bootstrap\RegisterProviders',
|
||||
'Illuminate\Foundation\Bootstrap\BootProviders',
|
||||
];
|
||||
|
||||
/**
|
||||
* The Artisan commands provided by your application.
|
||||
*
|
||||
|
@@ -12,11 +12,11 @@ namespace FireflyIII\Events;
|
||||
|
||||
use FireflyIII\Models\TransactionJournal;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
use Log;
|
||||
|
||||
/**
|
||||
* Class TransactionJournalStored
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
* @package FireflyIII\Events
|
||||
*/
|
||||
class TransactionJournalStored extends Event
|
||||
@@ -35,6 +35,7 @@ class TransactionJournalStored extends Event
|
||||
*/
|
||||
public function __construct(TransactionJournal $journal, int $piggyBankId)
|
||||
{
|
||||
Log::debug('Created new TransactionJournalStored.');
|
||||
//
|
||||
$this->journal = $journal;
|
||||
$this->piggyBankId = $piggyBankId;
|
||||
|
@@ -5,11 +5,11 @@ namespace FireflyIII\Events;
|
||||
|
||||
use FireflyIII\Models\TransactionJournal;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
use Log;
|
||||
|
||||
/**
|
||||
* Class TransactionJournalUpdated
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
* @package FireflyIII\Events
|
||||
*/
|
||||
class TransactionJournalUpdated extends Event
|
||||
@@ -26,6 +26,7 @@ class TransactionJournalUpdated extends Event
|
||||
*/
|
||||
public function __construct(TransactionJournal $journal)
|
||||
{
|
||||
Log::debug('Created new TransactionJournalUpdated');
|
||||
//
|
||||
$this->journal = $journal;
|
||||
}
|
||||
|
@@ -6,7 +6,6 @@ namespace FireflyIII\Exceptions;
|
||||
/**
|
||||
* Class FireflyException
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
* @package FireflyIII\Exceptions
|
||||
*/
|
||||
class FireflyException extends \Exception
|
||||
|
@@ -6,7 +6,6 @@ namespace FireflyIII\Exceptions;
|
||||
/**
|
||||
* Class NotImplementedException
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
* @package FireflyIII\Exceptions
|
||||
*/
|
||||
class NotImplementedException extends \Exception
|
||||
|
@@ -5,7 +5,6 @@ namespace FireflyIII\Exceptions;
|
||||
/**
|
||||
* Class ValidationExceptions
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
* @package FireflyIII\Exception
|
||||
*/
|
||||
class ValidationException extends \Exception
|
||||
|
@@ -53,9 +53,9 @@ class AttachmentCollector extends BasicCollector implements CollectorInterface
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function run()
|
||||
public function run(): bool
|
||||
{
|
||||
// grab all the users attachments:
|
||||
$attachments = $this->getAttachments();
|
||||
@@ -70,6 +70,7 @@ class AttachmentCollector extends BasicCollector implements CollectorInterface
|
||||
$this->exportDisk->put($file, $this->explanationString);
|
||||
Log::debug('Also put explanation file "' . $file . '" in the zip.');
|
||||
$this->getFiles()->push($file);
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -40,7 +40,7 @@ class BasicCollector
|
||||
/**
|
||||
* @return Collection
|
||||
*/
|
||||
public function getFiles()
|
||||
public function getFiles(): Collection
|
||||
{
|
||||
return $this->files;
|
||||
}
|
||||
|
@@ -22,12 +22,12 @@ interface CollectorInterface
|
||||
/**
|
||||
* @return Collection
|
||||
*/
|
||||
public function getFiles();
|
||||
public function getFiles(): Collection;
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function run();
|
||||
public function run(): bool;
|
||||
|
||||
/**
|
||||
* @param Collection $files
|
||||
|
@@ -47,9 +47,9 @@ class UploadCollector extends BasicCollector implements CollectorInterface
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function run()
|
||||
public function run(): bool
|
||||
{
|
||||
// grab upload directory.
|
||||
$files = $this->uploadDisk->files();
|
||||
@@ -58,6 +58,7 @@ class UploadCollector extends BasicCollector implements CollectorInterface
|
||||
foreach ($files as $entry) {
|
||||
$this->processOldUpload($entry);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -38,9 +38,9 @@ class ConfigurationFile
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
* @return string
|
||||
*/
|
||||
public function make()
|
||||
public function make(): string
|
||||
{
|
||||
$fields = array_keys(get_class_vars(Entry::class));
|
||||
$types = Entry::getTypes();
|
||||
|
@@ -171,7 +171,7 @@ class Entry
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getBillId()
|
||||
public function getBillId(): int
|
||||
{
|
||||
return $this->billId;
|
||||
}
|
||||
@@ -179,7 +179,7 @@ class Entry
|
||||
/**
|
||||
* @param int $billId
|
||||
*/
|
||||
public function setBillId($billId)
|
||||
public function setBillId(int $billId)
|
||||
{
|
||||
$this->billId = $billId;
|
||||
}
|
||||
@@ -187,7 +187,7 @@ class Entry
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getBillName()
|
||||
public function getBillName(): string
|
||||
{
|
||||
return $this->billName;
|
||||
}
|
||||
@@ -195,7 +195,7 @@ class Entry
|
||||
/**
|
||||
* @param string $billName
|
||||
*/
|
||||
public function setBillName($billName)
|
||||
public function setBillName(string $billName)
|
||||
{
|
||||
$this->billName = $billName;
|
||||
}
|
||||
@@ -203,7 +203,7 @@ class Entry
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getBudgetId()
|
||||
public function getBudgetId(): int
|
||||
{
|
||||
return $this->budgetId;
|
||||
}
|
||||
@@ -211,7 +211,7 @@ class Entry
|
||||
/**
|
||||
* @param int $budgetId
|
||||
*/
|
||||
public function setBudgetId($budgetId)
|
||||
public function setBudgetId(int $budgetId)
|
||||
{
|
||||
$this->budgetId = $budgetId;
|
||||
}
|
||||
@@ -219,7 +219,7 @@ class Entry
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getBudgetName()
|
||||
public function getBudgetName(): string
|
||||
{
|
||||
return $this->budgetName;
|
||||
}
|
||||
@@ -227,7 +227,7 @@ class Entry
|
||||
/**
|
||||
* @param string $budgetName
|
||||
*/
|
||||
public function setBudgetName($budgetName)
|
||||
public function setBudgetName(string $budgetName)
|
||||
{
|
||||
$this->budgetName = $budgetName;
|
||||
}
|
||||
@@ -235,7 +235,7 @@ class Entry
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getCategoryId()
|
||||
public function getCategoryId(): int
|
||||
{
|
||||
return $this->categoryId;
|
||||
}
|
||||
@@ -243,7 +243,7 @@ class Entry
|
||||
/**
|
||||
* @param int $categoryId
|
||||
*/
|
||||
public function setCategoryId($categoryId)
|
||||
public function setCategoryId(int $categoryId)
|
||||
{
|
||||
$this->categoryId = $categoryId;
|
||||
}
|
||||
@@ -251,7 +251,7 @@ class Entry
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getCategoryName()
|
||||
public function getCategoryName(): string
|
||||
{
|
||||
return $this->categoryName;
|
||||
}
|
||||
@@ -259,7 +259,7 @@ class Entry
|
||||
/**
|
||||
* @param string $categoryName
|
||||
*/
|
||||
public function setCategoryName($categoryName)
|
||||
public function setCategoryName(string $categoryName)
|
||||
{
|
||||
$this->categoryName = $categoryName;
|
||||
}
|
||||
@@ -267,7 +267,7 @@ class Entry
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getDate()
|
||||
public function getDate(): string
|
||||
{
|
||||
return $this->date;
|
||||
}
|
||||
@@ -283,7 +283,7 @@ class Entry
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getDescription()
|
||||
public function getDescription(): string
|
||||
{
|
||||
return $this->description;
|
||||
}
|
||||
@@ -299,7 +299,7 @@ class Entry
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getFromAccountIban()
|
||||
public function getFromAccountIban(): string
|
||||
{
|
||||
return $this->fromAccountIban;
|
||||
}
|
||||
@@ -307,7 +307,7 @@ class Entry
|
||||
/**
|
||||
* @param string $fromAccountIban
|
||||
*/
|
||||
public function setFromAccountIban($fromAccountIban)
|
||||
public function setFromAccountIban(string $fromAccountIban)
|
||||
{
|
||||
$this->fromAccountIban = $fromAccountIban;
|
||||
}
|
||||
@@ -315,7 +315,7 @@ class Entry
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getFromAccountId()
|
||||
public function getFromAccountId():int
|
||||
{
|
||||
return $this->fromAccountId;
|
||||
}
|
||||
@@ -323,7 +323,7 @@ class Entry
|
||||
/**
|
||||
* @param int $fromAccountId
|
||||
*/
|
||||
public function setFromAccountId($fromAccountId)
|
||||
public function setFromAccountId(int $fromAccountId)
|
||||
{
|
||||
$this->fromAccountId = $fromAccountId;
|
||||
}
|
||||
@@ -331,7 +331,7 @@ class Entry
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getFromAccountName()
|
||||
public function getFromAccountName(): string
|
||||
{
|
||||
return $this->fromAccountName;
|
||||
}
|
||||
@@ -339,23 +339,23 @@ class Entry
|
||||
/**
|
||||
* @param string $fromAccountName
|
||||
*/
|
||||
public function setFromAccountName($fromAccountName)
|
||||
public function setFromAccountName(string $fromAccountName)
|
||||
{
|
||||
$this->fromAccountName = $fromAccountName;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
* @return string
|
||||
*/
|
||||
public function getFromAccountNumber()
|
||||
public function getFromAccountNumber(): string
|
||||
{
|
||||
return $this->fromAccountNumber;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $fromAccountNumber
|
||||
* @param string $fromAccountNumber
|
||||
*/
|
||||
public function setFromAccountNumber($fromAccountNumber)
|
||||
public function setFromAccountNumber(string $fromAccountNumber)
|
||||
{
|
||||
$this->fromAccountNumber = $fromAccountNumber;
|
||||
}
|
||||
@@ -363,7 +363,7 @@ class Entry
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getFromAccountType()
|
||||
public function getFromAccountType(): string
|
||||
{
|
||||
return $this->fromAccountType;
|
||||
}
|
||||
@@ -371,7 +371,7 @@ class Entry
|
||||
/**
|
||||
* @param string $fromAccountType
|
||||
*/
|
||||
public function setFromAccountType($fromAccountType)
|
||||
public function setFromAccountType(string $fromAccountType)
|
||||
{
|
||||
$this->fromAccountType = $fromAccountType;
|
||||
}
|
||||
@@ -379,7 +379,7 @@ class Entry
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getToAccountIban()
|
||||
public function getToAccountIban(): string
|
||||
{
|
||||
return $this->toAccountIban;
|
||||
}
|
||||
@@ -387,7 +387,7 @@ class Entry
|
||||
/**
|
||||
* @param string $toAccountIban
|
||||
*/
|
||||
public function setToAccountIban($toAccountIban)
|
||||
public function setToAccountIban(string $toAccountIban)
|
||||
{
|
||||
$this->toAccountIban = $toAccountIban;
|
||||
}
|
||||
@@ -395,7 +395,7 @@ class Entry
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getToAccountId()
|
||||
public function getToAccountId(): int
|
||||
{
|
||||
return $this->toAccountId;
|
||||
}
|
||||
@@ -403,7 +403,7 @@ class Entry
|
||||
/**
|
||||
* @param int $toAccountId
|
||||
*/
|
||||
public function setToAccountId($toAccountId)
|
||||
public function setToAccountId(int $toAccountId)
|
||||
{
|
||||
$this->toAccountId = $toAccountId;
|
||||
}
|
||||
@@ -411,7 +411,7 @@ class Entry
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getToAccountName()
|
||||
public function getToAccountName(): string
|
||||
{
|
||||
return $this->toAccountName;
|
||||
}
|
||||
@@ -419,23 +419,23 @@ class Entry
|
||||
/**
|
||||
* @param string $toAccountName
|
||||
*/
|
||||
public function setToAccountName($toAccountName)
|
||||
public function setToAccountName(string $toAccountName)
|
||||
{
|
||||
$this->toAccountName = $toAccountName;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
* @return string
|
||||
*/
|
||||
public function getToAccountNumber()
|
||||
public function getToAccountNumber(): string
|
||||
{
|
||||
return $this->toAccountNumber;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param mixed $toAccountNumber
|
||||
* @param string $toAccountNumber
|
||||
*/
|
||||
public function setToAccountNumber($toAccountNumber)
|
||||
public function setToAccountNumber(string $toAccountNumber)
|
||||
{
|
||||
$this->toAccountNumber = $toAccountNumber;
|
||||
}
|
||||
@@ -443,7 +443,7 @@ class Entry
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getToAccountType()
|
||||
public function getToAccountType(): string
|
||||
{
|
||||
return $this->toAccountType;
|
||||
}
|
||||
@@ -451,7 +451,7 @@ class Entry
|
||||
/**
|
||||
* @param string $toAccountType
|
||||
*/
|
||||
public function setToAccountType($toAccountType)
|
||||
public function setToAccountType(string $toAccountType)
|
||||
{
|
||||
$this->toAccountType = $toAccountType;
|
||||
}
|
||||
|
@@ -39,7 +39,7 @@ class BasicExporter
|
||||
/**
|
||||
* @return Collection
|
||||
*/
|
||||
public function getEntries()
|
||||
public function getEntries(): Collection
|
||||
{
|
||||
return $this->entries;
|
||||
}
|
||||
|
@@ -39,15 +39,15 @@ class CsvExporter extends BasicExporter implements ExporterInterface
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getFileName()
|
||||
public function getFileName(): string
|
||||
{
|
||||
return $this->fileName;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function run()
|
||||
public function run(): bool
|
||||
{
|
||||
// create temporary file:
|
||||
$this->tempFile();
|
||||
@@ -72,6 +72,7 @@ class CsvExporter extends BasicExporter implements ExporterInterface
|
||||
|
||||
}
|
||||
$writer->insertAll($rows);
|
||||
return true;
|
||||
}
|
||||
|
||||
private function tempFile()
|
||||
|
@@ -22,17 +22,17 @@ interface ExporterInterface
|
||||
/**
|
||||
* @return Collection
|
||||
*/
|
||||
public function getEntries();
|
||||
public function getEntries(): Collection;
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getFileName();
|
||||
public function getFileName(): string;
|
||||
|
||||
/**
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function run();
|
||||
public function run(): bool;
|
||||
|
||||
/**
|
||||
* @param Collection $entries
|
||||
|
@@ -73,19 +73,20 @@ class Processor
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function collectAttachments()
|
||||
public function collectAttachments(): bool
|
||||
{
|
||||
$attachmentCollector = app('FireflyIII\Export\Collector\AttachmentCollector', [$this->job]);
|
||||
$attachmentCollector->run();
|
||||
$this->files = $this->files->merge($attachmentCollector->getFiles());
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function collectJournals()
|
||||
public function collectJournals(): bool
|
||||
{
|
||||
$args = [$this->accounts, Auth::user(), $this->settings['startDate'], $this->settings['endDate']];
|
||||
$journalCollector = app('FireflyIII\Repositories\Journal\JournalCollector', $args);
|
||||
@@ -97,20 +98,25 @@ class Processor
|
||||
$this->settings['endDate']->format('Y-m-d')
|
||||
. ').'
|
||||
);
|
||||
return true;
|
||||
}
|
||||
|
||||
public function collectOldUploads()
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function collectOldUploads(): bool
|
||||
{
|
||||
$uploadCollector = app('FireflyIII\Export\Collector\UploadCollector', [$this->job]);
|
||||
$uploadCollector->run();
|
||||
|
||||
$this->files = $this->files->merge($uploadCollector->getFiles());
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function convertJournals()
|
||||
public function convertJournals(): bool
|
||||
{
|
||||
$count = 0;
|
||||
/** @var TransactionJournal $journal */
|
||||
@@ -119,15 +125,24 @@ class Processor
|
||||
$count++;
|
||||
}
|
||||
Log::debug('Converted ' . $count . ' journals to "Entry" objects.');
|
||||
return true;
|
||||
}
|
||||
|
||||
public function createConfigFile()
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function createConfigFile(): bool
|
||||
{
|
||||
$this->configurationMaker = app('FireflyIII\Export\ConfigurationFile', [$this->job]);
|
||||
$this->files->push($this->configurationMaker->make());
|
||||
return true;
|
||||
}
|
||||
|
||||
public function createZipFile()
|
||||
/**
|
||||
* @return bool
|
||||
* @throws FireflyException
|
||||
*/
|
||||
public function createZipFile(): bool
|
||||
{
|
||||
$zip = new ZipArchive;
|
||||
$file = $this->job->key . '.zip';
|
||||
@@ -156,12 +171,13 @@ class Processor
|
||||
$disk->delete($file);
|
||||
}
|
||||
Log::debug('Done!');
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function exportJournals()
|
||||
public function exportJournals(): bool
|
||||
{
|
||||
$exporterClass = Config::get('firefly.export_formats.' . $this->exportFormat);
|
||||
$exporter = app($exporterClass, [$this->job]);
|
||||
@@ -170,12 +186,13 @@ class Processor
|
||||
$exporter->run();
|
||||
$this->files->push($exporter->getFileName());
|
||||
Log::debug('Added "' . $exporter->getFileName() . '" to the list of files to include in the zip.');
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Collection
|
||||
*/
|
||||
public function getFiles()
|
||||
public function getFiles(): Collection
|
||||
{
|
||||
return $this->files;
|
||||
}
|
||||
|
@@ -31,18 +31,15 @@ class ChartJsBillChartGenerator implements BillChartGeneratorInterface
|
||||
public function frontpage(string $paid, string $unpaid): array
|
||||
{
|
||||
$data = [
|
||||
[
|
||||
'value' => round($unpaid, 2),
|
||||
'color' => 'rgba(53, 124, 165,0.7)',
|
||||
'highlight' => 'rgba(53, 124, 165,0.9)',
|
||||
'label' => trans('firefly.unpaid'),
|
||||
],
|
||||
[
|
||||
'value' => round(bcmul($paid, '-1'), 2), // paid is negative, must be positive.
|
||||
'color' => 'rgba(0, 141, 76, 0.7)',
|
||||
'highlight' => 'rgba(0, 141, 76, 0.9)',
|
||||
'label' => trans('firefly.paid'),
|
||||
'datasets' => [
|
||||
[
|
||||
'data' => [round($unpaid, 2), round(bcmul($paid, '-1'), 2)],
|
||||
'backgroundColor' => ['rgba(53, 124, 165,0.7)', 'rgba(0, 141, 76, 0.7)',],
|
||||
],
|
||||
|
||||
],
|
||||
'labels' => [strval(trans('firefly.unpaid')), strval(trans('firefly.paid'))],
|
||||
|
||||
];
|
||||
|
||||
return $data;
|
||||
@@ -77,14 +74,17 @@ class ChartJsBillChartGenerator implements BillChartGeneratorInterface
|
||||
}
|
||||
|
||||
$data['datasets'][] = [
|
||||
'type' => 'bar',
|
||||
'label' => trans('firefly.minAmount'),
|
||||
'data' => $minAmount,
|
||||
];
|
||||
$data['datasets'][] = [
|
||||
'type' => 'line',
|
||||
'label' => trans('firefly.billEntry'),
|
||||
'data' => $actualAmount,
|
||||
];
|
||||
$data['datasets'][] = [
|
||||
'type' => 'bar',
|
||||
'label' => trans('firefly.maxAmount'),
|
||||
'data' => $maxAmount,
|
||||
];
|
||||
|
@@ -50,7 +50,6 @@ class ChartJsBudgetChartGenerator implements BudgetChartGeneratorInterface
|
||||
}
|
||||
|
||||
/**
|
||||
* @codeCoverageIgnore
|
||||
*
|
||||
* @param Collection $entries
|
||||
*
|
||||
|
@@ -25,7 +25,7 @@ interface CategoryChartGeneratorInterface
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function all(Collection $entries);
|
||||
public function all(Collection $entries): array;
|
||||
|
||||
/**
|
||||
* @param Collection $categories
|
||||
|
@@ -148,7 +148,6 @@ class ChartJsCategoryChartGenerator implements CategoryChartGeneratorInterface
|
||||
}
|
||||
|
||||
/**
|
||||
* @codeCoverageIgnore
|
||||
*
|
||||
* @param Collection $entries
|
||||
*
|
||||
|
@@ -89,7 +89,7 @@ class ChartJsReportChartGenerator implements ReportChartGeneratorInterface
|
||||
'labels' => [],
|
||||
'datasets' => [
|
||||
[
|
||||
'label' => trans('firefly.net-worth'),
|
||||
'label' => trans('firefly.net_worth'),
|
||||
'data' => [],
|
||||
],
|
||||
],
|
||||
|
@@ -36,6 +36,7 @@ class FireRulesForStore
|
||||
*/
|
||||
public function handle(TransactionJournalStored $event): bool
|
||||
{
|
||||
Log::debug('Now running FireRulesForStore because TransactionJournalStored fired.');
|
||||
// get all the user's rule groups, with the rules, order by 'order'.
|
||||
/** @var User $user */
|
||||
$user = Auth::user();
|
||||
|
@@ -34,6 +34,7 @@ class FireRulesForUpdate
|
||||
*/
|
||||
public function handle(TransactionJournalUpdated $event): bool
|
||||
{
|
||||
Log::debug('Now running FireRulesForUpdate because TransactionJournalUpdated fired.');
|
||||
// get all the user's rule groups, with the rules, order by 'order'.
|
||||
/** @var User $user */
|
||||
$user = Auth::user();
|
||||
|
@@ -16,7 +16,6 @@ use FireflyIII\Support\Events\BillScanner;
|
||||
/**
|
||||
* Class RescanJournal
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
* @package FireflyIII\Handlers\Events
|
||||
*/
|
||||
class ScanForBillsAfterStore
|
||||
|
@@ -16,7 +16,6 @@ use FireflyIII\Support\Events\BillScanner;
|
||||
/**
|
||||
* Class RescanJournal
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
* @package FireflyIII\Handlers\Events
|
||||
*/
|
||||
class ScanForBillsAfterUpdate
|
||||
|
@@ -38,13 +38,13 @@ class SendRegistrationMail
|
||||
*
|
||||
* @param UserRegistration $event
|
||||
*
|
||||
* @return void
|
||||
* @return bool
|
||||
*/
|
||||
public function handle(UserRegistration $event)
|
||||
public function handle(UserRegistration $event): bool
|
||||
{
|
||||
$sendMail = env('SEND_REGISTRATION_MAIL', true);
|
||||
if (!$sendMail) {
|
||||
return;
|
||||
return true;
|
||||
}
|
||||
// get the email address
|
||||
$email = $event->user->email;
|
||||
@@ -60,5 +60,6 @@ class SendRegistrationMail
|
||||
} catch (Swift_TransportException $e) {
|
||||
Log::error($e->getMessage());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@@ -10,7 +10,6 @@ use FireflyIII\Models\TransactionJournal;
|
||||
/**
|
||||
* Class UpdateJournalConnection
|
||||
*
|
||||
* @codeCoverageIgnore
|
||||
* @package FireflyIII\Handlers\Events
|
||||
*/
|
||||
class UpdateJournalConnection
|
||||
|
@@ -39,24 +39,30 @@ class UserConfirmation
|
||||
|
||||
/**
|
||||
* @param ResendConfirmation $event
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function resendConfirmation(ResendConfirmation $event)
|
||||
public function resendConfirmation(ResendConfirmation $event): bool
|
||||
{
|
||||
$user = $event->user;
|
||||
$ipAddress = $event->ipAddress;
|
||||
$this->doConfirm($user, $ipAddress);
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle the event.
|
||||
*
|
||||
* @param UserRegistration $event
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function sendConfirmation(UserRegistration $event)
|
||||
public function sendConfirmation(UserRegistration $event): bool
|
||||
{
|
||||
$user = $event->user;
|
||||
$ipAddress = $event->ipAddress;
|
||||
$this->doConfirm($user, $ipAddress);
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -21,8 +21,10 @@ class UserEventListener
|
||||
{
|
||||
/**
|
||||
* Handle user logout events.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function onUserLogout()
|
||||
public function onUserLogout(): bool
|
||||
{
|
||||
// dump stuff from the session:
|
||||
Session::forget('twofactor-authenticated');
|
||||
|
@@ -5,7 +5,6 @@ namespace FireflyIII\Helpers\Collection;
|
||||
use Illuminate\Support\Collection;
|
||||
|
||||
/**
|
||||
* @codeCoverageIgnore
|
||||
* Class Account
|
||||
*
|
||||
* @package FireflyIII\Helpers\Collection
|
||||
|
@@ -5,7 +5,6 @@ namespace FireflyIII\Helpers\Collection;
|
||||
use Illuminate\Support\Collection;
|
||||
|
||||
/**
|
||||
* @codeCoverageIgnore
|
||||
*
|
||||
* Class Balance
|
||||
*
|
||||
|
@@ -5,7 +5,6 @@ namespace FireflyIII\Helpers\Collection;
|
||||
use FireflyIII\Models\Account as AccountModel;
|
||||
|
||||
/**
|
||||
* @codeCoverageIgnore
|
||||
*
|
||||
* Class BalanceEntry
|
||||
*
|
||||
|
@@ -6,7 +6,6 @@ use FireflyIII\Models\Account as AccountModel;
|
||||
use Illuminate\Support\Collection;
|
||||
|
||||
/**
|
||||
* @codeCoverageIgnore
|
||||
*
|
||||
* Class BalanceHeader
|
||||
*
|
||||
|
@@ -6,7 +6,6 @@ use FireflyIII\Models\Budget as BudgetModel;
|
||||
use Illuminate\Support\Collection;
|
||||
|
||||
/**
|
||||
* @codeCoverageIgnore
|
||||
*
|
||||
* Class BalanceLine
|
||||
*
|
||||
|
@@ -6,7 +6,6 @@ namespace FireflyIII\Helpers\Collection;
|
||||
use Illuminate\Support\Collection;
|
||||
|
||||
/**
|
||||
* @codeCoverageIgnore
|
||||
* Class Bill
|
||||
*
|
||||
* @package FireflyIII\Helpers\Collection
|
||||
|
@@ -5,7 +5,6 @@ namespace FireflyIII\Helpers\Collection;
|
||||
use FireflyIII\Models\Bill as BillModel;
|
||||
|
||||
/**
|
||||
* @codeCoverageIgnore
|
||||
*
|
||||
* Class BillLine
|
||||
*
|
||||
@@ -111,7 +110,7 @@ class BillLine
|
||||
}
|
||||
|
||||
/**
|
||||
* @return boolean
|
||||
* @return bool
|
||||
*/
|
||||
public function isActive(): bool
|
||||
{
|
||||
@@ -127,7 +126,7 @@ class BillLine
|
||||
}
|
||||
|
||||
/**
|
||||
* @return boolean
|
||||
* @return bool
|
||||
*/
|
||||
public function isHit(): bool
|
||||
{
|
||||
|
@@ -5,7 +5,6 @@ namespace FireflyIII\Helpers\Collection;
|
||||
use Illuminate\Support\Collection;
|
||||
|
||||
/**
|
||||
* @codeCoverageIgnore
|
||||
*
|
||||
* Class Budget
|
||||
*
|
||||
|
@@ -6,7 +6,6 @@ use FireflyIII\Models\Budget as BudgetModel;
|
||||
use FireflyIII\Models\LimitRepetition;
|
||||
|
||||
/**
|
||||
* @codeCoverageIgnore
|
||||
*
|
||||
* Class BudgetLine
|
||||
*
|
||||
|
@@ -7,7 +7,6 @@ use Illuminate\Support\Collection;
|
||||
|
||||
|
||||
/**
|
||||
* @codeCoverageIgnore
|
||||
*
|
||||
* Class Category
|
||||
*
|
||||
|
@@ -8,7 +8,6 @@ use Illuminate\Support\Collection;
|
||||
use stdClass;
|
||||
|
||||
/**
|
||||
* @codeCoverageIgnore
|
||||
*
|
||||
* Class Expense
|
||||
*
|
||||
|
@@ -8,7 +8,6 @@ use Illuminate\Support\Collection;
|
||||
use stdClass;
|
||||
|
||||
/**
|
||||
* @codeCoverageIgnore
|
||||
*
|
||||
* Class Income
|
||||
*
|
||||
|
@@ -15,7 +15,7 @@ class AmountComma extends BasicConverter implements ConverterInterface
|
||||
/**
|
||||
* @return float|int
|
||||
*/
|
||||
public function convert()
|
||||
public function convert(): string
|
||||
{
|
||||
$value = str_replace(',', '.', strval($this->value));
|
||||
|
||||
|
@@ -6,6 +6,7 @@ use Auth;
|
||||
use Carbon\Carbon;
|
||||
use FireflyIII\Models\Account;
|
||||
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
|
||||
use Log;
|
||||
|
||||
/**
|
||||
* Class AssetAccountIban
|
||||
@@ -26,6 +27,7 @@ class AssetAccountIban extends BasicConverter implements ConverterInterface
|
||||
// is mapped? Then it's easy!
|
||||
if (isset($this->mapped[$this->index][$this->value])) {
|
||||
$account = $repository->find($this->mapped[$this->index][$this->value]);
|
||||
Log::debug('Found mapped account for value "' . $this->value . '". It is account #' . $account->id);
|
||||
|
||||
return $account;
|
||||
}
|
||||
@@ -36,10 +38,14 @@ class AssetAccountIban extends BasicConverter implements ConverterInterface
|
||||
/** @var Account $entry */
|
||||
foreach ($set as $entry) {
|
||||
if ($entry->iban == $this->value) {
|
||||
Log::debug('Found an account with the same IBAN ("' . $this->value . '"). It is account #' . $entry->id);
|
||||
|
||||
return $entry;
|
||||
}
|
||||
}
|
||||
|
||||
Log::debug('Found no account with the same IBAN ("' . $this->value . '"), so will create a new one.');
|
||||
|
||||
// create it if doesn't exist.
|
||||
$accountData = [
|
||||
'name' => $this->value,
|
||||
@@ -48,13 +54,12 @@ class AssetAccountIban extends BasicConverter implements ConverterInterface
|
||||
'virtualBalanceCurrency' => 1, // hard coded.
|
||||
'active' => true,
|
||||
'user' => Auth::user()->id,
|
||||
'iban' => null,
|
||||
'iban' => $this->value,
|
||||
'accountNumber' => $this->value,
|
||||
'accountRole' => null,
|
||||
'openingBalance' => 0,
|
||||
'openingBalanceDate' => new Carbon,
|
||||
'openingBalanceCurrency' => 1, // hard coded.
|
||||
|
||||
];
|
||||
|
||||
$account = $repository->store($accountData);
|
||||
|
@@ -18,7 +18,7 @@ class AssetAccountName extends BasicConverter implements ConverterInterface
|
||||
/**
|
||||
* @return Account|null
|
||||
*/
|
||||
public function convert()
|
||||
public function convert(): Account
|
||||
{
|
||||
/** @var AccountRepositoryInterface $repository */
|
||||
$repository = app('FireflyIII\Repositories\Account\AccountRepositoryInterface');
|
||||
|
@@ -27,7 +27,7 @@ class AssetAccountNumber extends BasicConverter implements ConverterInterface
|
||||
/**
|
||||
* @return Account|null
|
||||
*/
|
||||
public function convert()
|
||||
public function convert(): Account
|
||||
{
|
||||
/** @var AccountRepositoryInterface $repository */
|
||||
$repository = app('FireflyIII\Repositories\Account\AccountRepositoryInterface');
|
||||
|
@@ -23,7 +23,7 @@ class BasicConverter
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getData()
|
||||
public function getData(): array
|
||||
{
|
||||
return $this->data;
|
||||
}
|
||||
@@ -39,7 +39,7 @@ class BasicConverter
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getField()
|
||||
public function getField(): string
|
||||
{
|
||||
return $this->field;
|
||||
}
|
||||
@@ -47,7 +47,7 @@ class BasicConverter
|
||||
/**
|
||||
* @param string $field
|
||||
*/
|
||||
public function setField($field)
|
||||
public function setField(string $field)
|
||||
{
|
||||
$this->field = $field;
|
||||
}
|
||||
@@ -55,7 +55,7 @@ class BasicConverter
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getIndex()
|
||||
public function getIndex(): int
|
||||
{
|
||||
return $this->index;
|
||||
}
|
||||
@@ -63,7 +63,7 @@ class BasicConverter
|
||||
/**
|
||||
* @param int $index
|
||||
*/
|
||||
public function setIndex($index)
|
||||
public function setIndex(int $index)
|
||||
{
|
||||
$this->index = $index;
|
||||
}
|
||||
@@ -71,7 +71,7 @@ class BasicConverter
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getMapped()
|
||||
public function getMapped(): array
|
||||
{
|
||||
return $this->mapped;
|
||||
}
|
||||
@@ -79,7 +79,7 @@ class BasicConverter
|
||||
/**
|
||||
* @param array $mapped
|
||||
*/
|
||||
public function setMapped($mapped)
|
||||
public function setMapped(array $mapped)
|
||||
{
|
||||
$this->mapped = $mapped;
|
||||
}
|
||||
@@ -87,7 +87,7 @@ class BasicConverter
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getValue()
|
||||
public function getValue(): string
|
||||
{
|
||||
return $this->value;
|
||||
}
|
||||
@@ -95,7 +95,7 @@ class BasicConverter
|
||||
/**
|
||||
* @param string $value
|
||||
*/
|
||||
public function setValue($value)
|
||||
public function setValue(string $value)
|
||||
{
|
||||
$this->value = $value;
|
||||
}
|
||||
|
@@ -16,7 +16,7 @@ class BillId extends BasicConverter implements ConverterInterface
|
||||
/**
|
||||
* @return Bill
|
||||
*/
|
||||
public function convert()
|
||||
public function convert(): Bill
|
||||
{
|
||||
/** @var BillRepositoryInterface $repository */
|
||||
$repository = app('FireflyIII\Repositories\Bill\BillRepositoryInterface');
|
||||
|
@@ -16,7 +16,7 @@ class BillName extends BasicConverter implements ConverterInterface
|
||||
/**
|
||||
* @return Bill
|
||||
*/
|
||||
public function convert()
|
||||
public function convert(): Bill
|
||||
{
|
||||
/** @var BillRepositoryInterface $repository */
|
||||
$repository = app('FireflyIII\Repositories\Bill\BillRepositoryInterface');
|
||||
|
@@ -16,7 +16,7 @@ class BudgetId extends BasicConverter implements ConverterInterface
|
||||
/**
|
||||
* @return Budget
|
||||
*/
|
||||
public function convert()
|
||||
public function convert(): Budget
|
||||
{
|
||||
/** @var BudgetRepositoryInterface $repository */
|
||||
$repository = app('FireflyIII\Repositories\Budget\BudgetRepositoryInterface');
|
||||
|
@@ -17,7 +17,7 @@ class BudgetName extends BasicConverter implements ConverterInterface
|
||||
/**
|
||||
* @return Budget
|
||||
*/
|
||||
public function convert()
|
||||
public function convert(): Budget
|
||||
{
|
||||
/** @var BudgetRepositoryInterface $repository */
|
||||
$repository = app('FireflyIII\Repositories\Budget\BudgetRepositoryInterface');
|
||||
|
@@ -16,7 +16,7 @@ class CategoryId extends BasicConverter implements ConverterInterface
|
||||
/**
|
||||
* @return Category
|
||||
*/
|
||||
public function convert()
|
||||
public function convert(): Budget
|
||||
{
|
||||
/** @var SingleCategoryRepositoryInterface $repository */
|
||||
$repository = app('FireflyIII\Repositories\Category\SingleCategoryRepositoryInterface');
|
||||
|
@@ -17,7 +17,7 @@ class CategoryName extends BasicConverter implements ConverterInterface
|
||||
/**
|
||||
* @return Category
|
||||
*/
|
||||
public function convert()
|
||||
public function convert(): Budget
|
||||
{
|
||||
/** @var SingleCategoryRepositoryInterface $repository */
|
||||
$repository = app('FireflyIII\Repositories\Category\SingleCategoryRepositoryInterface');
|
||||
|
@@ -24,21 +24,21 @@ interface ConverterInterface
|
||||
* @param string $field
|
||||
*
|
||||
*/
|
||||
public function setField($field);
|
||||
public function setField(string $field);
|
||||
|
||||
/**
|
||||
* @param int $index
|
||||
*/
|
||||
public function setIndex($index);
|
||||
public function setIndex(int $index);
|
||||
|
||||
/**
|
||||
* @param array $mapped
|
||||
*/
|
||||
public function setMapped($mapped);
|
||||
public function setMapped(array $mapped);
|
||||
|
||||
/**
|
||||
* @param string $value
|
||||
*/
|
||||
public function setValue($value);
|
||||
public function setValue(string $value);
|
||||
|
||||
}
|
||||
|
@@ -16,7 +16,7 @@ class CurrencyCode extends BasicConverter implements ConverterInterface
|
||||
/**
|
||||
* @return TransactionCurrency
|
||||
*/
|
||||
public function convert()
|
||||
public function convert(): TransactionCurrency
|
||||
{
|
||||
/** @var CurrencyRepositoryInterface $repository */
|
||||
$repository = app('FireflyIII\Repositories\Currency\CurrencyRepositoryInterface');
|
||||
|
@@ -16,7 +16,7 @@ class CurrencyId extends BasicConverter implements ConverterInterface
|
||||
/**
|
||||
* @return TransactionCurrency
|
||||
*/
|
||||
public function convert()
|
||||
public function convert(): TransactionCurrency
|
||||
{
|
||||
/** @var CurrencyRepositoryInterface $repository */
|
||||
$repository = app('FireflyIII\Repositories\Currency\CurrencyRepositoryInterface');
|
||||
|
@@ -16,7 +16,7 @@ class CurrencyName extends BasicConverter implements ConverterInterface
|
||||
/**
|
||||
* @return TransactionCurrency
|
||||
*/
|
||||
public function convert()
|
||||
public function convert(): TransactionCurrency
|
||||
{
|
||||
/** @var CurrencyRepositoryInterface $repository */
|
||||
$repository = app('FireflyIII\Repositories\Currency\CurrencyRepositoryInterface');
|
||||
|
@@ -16,7 +16,7 @@ class CurrencySymbol extends BasicConverter implements ConverterInterface
|
||||
/**
|
||||
* @return TransactionCurrency
|
||||
*/
|
||||
public function convert()
|
||||
public function convert(): TransactionCurrency
|
||||
{
|
||||
/** @var CurrencyRepositoryInterface $repository */
|
||||
$repository = app('FireflyIII\Repositories\Currency\CurrencyRepositoryInterface');
|
||||
|
@@ -19,7 +19,7 @@ class Date extends BasicConverter implements ConverterInterface
|
||||
* @return Carbon
|
||||
* @throws FireflyException
|
||||
*/
|
||||
public function convert()
|
||||
public function convert(): Carbon
|
||||
{
|
||||
$format = session('csv-date-format');
|
||||
try {
|
||||
|
@@ -14,7 +14,7 @@ class Description extends BasicConverter implements ConverterInterface
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function convert()
|
||||
public function convert(): string
|
||||
{
|
||||
$description = $this->data['description'] ?? '';
|
||||
|
||||
|
@@ -24,7 +24,7 @@ class INGDebetCredit extends BasicConverter implements ConverterInterface
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function convert()
|
||||
public function convert(): int
|
||||
{
|
||||
if ($this->value === 'Af') {
|
||||
return -1;
|
||||
|
@@ -17,7 +17,7 @@ class OpposingAccountId extends BasicConverter implements ConverterInterface
|
||||
/**
|
||||
* @return Account
|
||||
*/
|
||||
public function convert()
|
||||
public function convert(): Account
|
||||
{
|
||||
/** @var AccountRepositoryInterface $repository */
|
||||
$repository = app('FireflyIII\Repositories\Account\AccountRepositoryInterface');
|
||||
|
@@ -15,7 +15,7 @@ class RabobankDebetCredit extends BasicConverter implements ConverterInterface
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function convert()
|
||||
public function convert(): int
|
||||
{
|
||||
if ($this->value == 'D') {
|
||||
return -1;
|
||||
|
@@ -16,7 +16,7 @@ class TagsComma extends BasicConverter implements ConverterInterface
|
||||
/**
|
||||
* @return Collection
|
||||
*/
|
||||
public function convert()
|
||||
public function convert(): Collection
|
||||
{
|
||||
/** @var TagRepositoryInterface $repository */
|
||||
$repository = app('FireflyIII\Repositories\Tag\TagRepositoryInterface');
|
||||
|
@@ -16,7 +16,7 @@ class TagsSpace extends BasicConverter implements ConverterInterface
|
||||
/**
|
||||
* @return Collection
|
||||
*/
|
||||
public function convert()
|
||||
public function convert(): Collection
|
||||
{
|
||||
/** @var TagRepositoryInterface $repository */
|
||||
$repository = app('FireflyIII\Repositories\Tag\TagRepositoryInterface');
|
||||
|
@@ -57,7 +57,7 @@ class Data
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getCsvFileContent()
|
||||
public function getCsvFileContent(): string
|
||||
{
|
||||
return $this->csvFileContent ?? '';
|
||||
}
|
||||
@@ -72,10 +72,10 @@ class Data
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* FIXME may return null
|
||||
* @return string
|
||||
*/
|
||||
public function getCsvFileLocation()
|
||||
public function getCsvFileLocation(): string
|
||||
{
|
||||
return $this->csvFileLocation;
|
||||
}
|
||||
@@ -91,10 +91,10 @@ class Data
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* FIXME may return null
|
||||
* @return string
|
||||
*/
|
||||
public function getDateFormat()
|
||||
public function getDateFormat(): string
|
||||
{
|
||||
return $this->dateFormat;
|
||||
}
|
||||
@@ -110,10 +110,10 @@ class Data
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* FIXME may return null
|
||||
* @return string
|
||||
*/
|
||||
public function getDelimiter()
|
||||
public function getDelimiter(): string
|
||||
{
|
||||
return $this->delimiter;
|
||||
}
|
||||
@@ -132,7 +132,7 @@ class Data
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getMap()
|
||||
public function getMap(): array
|
||||
{
|
||||
return $this->map;
|
||||
}
|
||||
@@ -151,7 +151,7 @@ class Data
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getMapped()
|
||||
public function getMapped(): array
|
||||
{
|
||||
return $this->mapped;
|
||||
}
|
||||
@@ -170,7 +170,7 @@ class Data
|
||||
*
|
||||
* @return Reader
|
||||
*/
|
||||
public function getReader()
|
||||
public function getReader(): Reader
|
||||
{
|
||||
if (!is_null($this->csvFileContent) && strlen($this->csvFileContent) === 0) {
|
||||
$this->loadCsvFile();
|
||||
@@ -188,7 +188,7 @@ class Data
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getRoles()
|
||||
public function getRoles(): array
|
||||
{
|
||||
return $this->roles;
|
||||
}
|
||||
@@ -207,7 +207,7 @@ class Data
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getSpecifix()
|
||||
public function getSpecifix(): array
|
||||
{
|
||||
return is_array($this->specifix) ? $this->specifix : [];
|
||||
}
|
||||
@@ -226,7 +226,7 @@ class Data
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function hasHeaders()
|
||||
public function hasHeaders(): bool
|
||||
{
|
||||
return $this->hasHeaders;
|
||||
}
|
||||
|
@@ -4,19 +4,15 @@ namespace FireflyIII\Helpers\Csv;
|
||||
|
||||
use Auth;
|
||||
use Config;
|
||||
use FireflyIII\Events\TransactionJournalStored;
|
||||
use FireflyIII\Exceptions\FireflyException;
|
||||
use FireflyIII\Helpers\Csv\Converter\ConverterInterface;
|
||||
use FireflyIII\Helpers\Csv\PostProcessing\PostProcessorInterface;
|
||||
use FireflyIII\Helpers\Csv\Specifix\SpecifixInterface;
|
||||
use FireflyIII\Models\Account;
|
||||
use FireflyIII\Models\Rule;
|
||||
use FireflyIII\Models\RuleGroup;
|
||||
use FireflyIII\Models\Transaction;
|
||||
use FireflyIII\Models\TransactionJournal;
|
||||
use FireflyIII\Models\TransactionType;
|
||||
use FireflyIII\Rules\Processor;
|
||||
use FireflyIII\User;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
use Illuminate\Support\Collection;
|
||||
use Illuminate\Support\MessageBag;
|
||||
use Log;
|
||||
@@ -57,7 +53,7 @@ class Importer
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getErrors()
|
||||
public function getErrors(): array
|
||||
{
|
||||
return $this->errors;
|
||||
}
|
||||
@@ -67,7 +63,7 @@ class Importer
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getImported()
|
||||
public function getImported(): int
|
||||
{
|
||||
return $this->imported;
|
||||
}
|
||||
@@ -75,7 +71,7 @@ class Importer
|
||||
/**
|
||||
* @return Collection
|
||||
*/
|
||||
public function getJournals()
|
||||
public function getJournals(): Collection
|
||||
{
|
||||
return $this->journals;
|
||||
}
|
||||
@@ -85,7 +81,7 @@ class Importer
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function getRows()
|
||||
public function getRows(): int
|
||||
{
|
||||
return $this->rows;
|
||||
}
|
||||
@@ -93,7 +89,7 @@ class Importer
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getSpecifix()
|
||||
public function getSpecifix(): array
|
||||
{
|
||||
return is_array($this->specifix) ? $this->specifix : [];
|
||||
}
|
||||
@@ -120,19 +116,13 @@ class Importer
|
||||
Log::error('Caught error at row #' . $index . ': ' . $result);
|
||||
$this->errors[$index] = $result;
|
||||
} else {
|
||||
|
||||
|
||||
$this->imported++;
|
||||
$this->journals->push($result);
|
||||
event(new TransactionJournalStored($result, 0));
|
||||
}
|
||||
Log::debug('---');
|
||||
}
|
||||
}
|
||||
|
||||
// once all journals have been imported (or not)
|
||||
// fire the rules.
|
||||
$this->fireRules();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -144,7 +134,6 @@ class Importer
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return TransactionJournal|string
|
||||
*/
|
||||
protected function createTransactionJournal()
|
||||
@@ -361,55 +350,6 @@ class Importer
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Collection $groups
|
||||
* @param TransactionJournal $journal
|
||||
*/
|
||||
private function fireRule(Collection $groups, TransactionJournal $journal)
|
||||
{
|
||||
/** @var RuleGroup $group */
|
||||
foreach ($groups as $group) {
|
||||
|
||||
/** @var Rule $rule */
|
||||
foreach ($group->rules as $rule) {
|
||||
$processor = Processor::make($rule);
|
||||
$processor->handleTransactionJournal($journal);
|
||||
if ($rule->stop_processing) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private function fireRules()
|
||||
{
|
||||
// get all users rules.
|
||||
/** @var User $user */
|
||||
$user = Auth::user();
|
||||
$groups = $user
|
||||
->ruleGroups()
|
||||
->where('rule_groups.active', 1)
|
||||
->orderBy('order', 'ASC')
|
||||
->with(
|
||||
[
|
||||
'rules' => function (HasMany $q) {
|
||||
$q->leftJoin('rule_triggers', 'rules.id', '=', 'rule_triggers.rule_id')
|
||||
->where('rule_triggers.trigger_type', 'user_action')
|
||||
->where('rule_triggers.trigger_value', 'store-journal')
|
||||
->where('rules.active', 1)
|
||||
->orderBy('rules.order', 'ASC');
|
||||
},
|
||||
]
|
||||
)
|
||||
->get();
|
||||
|
||||
/** @var TransactionJournal $journal */
|
||||
foreach ($this->journals as $journal) {
|
||||
$this->fireRule($groups, $journal);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
|
@@ -16,7 +16,7 @@ class AnyAccount implements MapperInterface
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getMap()
|
||||
public function getMap(): array
|
||||
{
|
||||
$result = Auth::user()->accounts()->with('accountType')->orderBy('accounts.name', 'ASC')->get(['accounts.*']);
|
||||
|
||||
|
@@ -17,7 +17,7 @@ class AssetAccount implements MapperInterface
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getMap()
|
||||
public function getMap(): array
|
||||
{
|
||||
$result = Auth::user()->accounts()->with(
|
||||
['accountmeta' => function (HasMany $query) {
|
||||
|
@@ -16,7 +16,7 @@ class Bill implements MapperInterface
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getMap()
|
||||
public function getMap(): array
|
||||
{
|
||||
$result = Auth::user()->bills()->get(['bills.*']);
|
||||
$list = [];
|
||||
|
@@ -16,7 +16,7 @@ class Budget implements MapperInterface
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getMap()
|
||||
public function getMap(): array
|
||||
{
|
||||
$result = Auth::user()->budgets()->get(['budgets.*']);
|
||||
$list = [];
|
||||
|
@@ -16,7 +16,7 @@ class Category implements MapperInterface
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getMap()
|
||||
public function getMap(): array
|
||||
{
|
||||
$result = Auth::user()->categories()->get(['categories.*']);
|
||||
$list = [];
|
||||
|
@@ -12,5 +12,5 @@ interface MapperInterface
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getMap();
|
||||
public function getMap(): array;
|
||||
}
|
||||
|
@@ -16,7 +16,7 @@ class Tag implements MapperInterface
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getMap()
|
||||
public function getMap(): array
|
||||
{
|
||||
$result = Auth::user()->budgets()->get(['tags.*']);
|
||||
$list = [];
|
||||
|
@@ -15,7 +15,7 @@ class TransactionCurrency implements MapperInterface
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getMap()
|
||||
public function getMap(): array
|
||||
{
|
||||
$currencies = TC::get();
|
||||
$list = [];
|
||||
|
@@ -17,7 +17,7 @@ class Amount implements PostProcessorInterface
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function process()
|
||||
public function process(): array
|
||||
{
|
||||
$amount = $this->data['amount'] ?? '0';
|
||||
$modifier = strval($this->data['amount-modifier']);
|
||||
|
@@ -23,7 +23,7 @@ class AssetAccount implements PostProcessorInterface
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function process()
|
||||
public function process(): array
|
||||
{
|
||||
$result = $this->checkIdNameObject(); // has object in ID or Name?
|
||||
if (!is_null($result)) {
|
||||
|
@@ -16,7 +16,7 @@ class Bill implements PostProcessorInterface
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function process()
|
||||
public function process(): array
|
||||
{
|
||||
|
||||
// get bill id.
|
||||
|
@@ -19,7 +19,7 @@ class Currency implements PostProcessorInterface
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function process()
|
||||
public function process(): array
|
||||
{
|
||||
|
||||
// fix currency
|
||||
|
@@ -16,7 +16,7 @@ class Description implements PostProcessorInterface
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function process()
|
||||
public function process(): array
|
||||
{
|
||||
$description = $this->data['description'] ?? '';
|
||||
$this->data['description'] = trim($description);
|
||||
|
@@ -22,7 +22,7 @@ class OpposingAccount implements PostProcessorInterface
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function process()
|
||||
public function process(): array
|
||||
{
|
||||
// three values:
|
||||
// opposing-account-id, opposing-account-iban, opposing-account-name
|
||||
|
@@ -14,7 +14,7 @@ interface PostProcessorInterface
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function process();
|
||||
public function process(): array;
|
||||
|
||||
/**
|
||||
* @param array $data
|
||||
|
@@ -32,7 +32,7 @@ class AbnAmroDescription extends Specifix implements SpecifixInterface
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function fix()
|
||||
public function fix(): array
|
||||
{
|
||||
// Try to parse the description in known formats.
|
||||
$parsed = $this->parseSepaDescription() || $this->parseTRTPDescription() || $this->parseGEABEADescription() || $this->parseABNAMRODescription();
|
||||
@@ -65,7 +65,7 @@ class AbnAmroDescription extends Specifix implements SpecifixInterface
|
||||
/**
|
||||
* Parses the current description with costs from ABN AMRO itself
|
||||
*
|
||||
* @return boolean true if the description is GEA/BEA-format, false otherwise
|
||||
* @return bool true if the description is GEA/BEA-format, false otherwise
|
||||
*/
|
||||
protected function parseABNAMRODescription()
|
||||
{
|
||||
@@ -85,7 +85,7 @@ class AbnAmroDescription extends Specifix implements SpecifixInterface
|
||||
/**
|
||||
* Parses the current description in GEA/BEA format
|
||||
*
|
||||
* @return boolean true if the description is GEA/BEAformat, false otherwise
|
||||
* @return bool true if the description is GEA/BEAformat, false otherwise
|
||||
*/
|
||||
protected function parseGEABEADescription()
|
||||
{
|
||||
@@ -111,7 +111,7 @@ class AbnAmroDescription extends Specifix implements SpecifixInterface
|
||||
/**
|
||||
* Parses the current description in SEPA format
|
||||
*
|
||||
* @return boolean true if the description is SEPA format, false otherwise
|
||||
* @return bool true if the description is SEPA format, false otherwise
|
||||
*/
|
||||
protected function parseSepaDescription()
|
||||
{
|
||||
@@ -168,7 +168,7 @@ class AbnAmroDescription extends Specifix implements SpecifixInterface
|
||||
/**
|
||||
* Parses the current description in TRTP format
|
||||
*
|
||||
* @return boolean true if the description is TRTP format, false otherwise
|
||||
* @return bool true if the description is TRTP format, false otherwise
|
||||
*/
|
||||
protected function parseTRTPDescription()
|
||||
{
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user