Compare commits

..

82 Commits
3.8.1 ... 3.8.3

Author SHA1 Message Date
James Cole
345766f387 Merge branch 'release/3.8.3' 2016-04-17 12:13:00 +02:00
James Cole
3fa659632c Updated composer.lock [skip ci] 2016-04-17 12:12:35 +02:00
James Cole
95b92b7d1e Should fix test. 2016-04-17 11:43:07 +02:00
James Cole
466e988627 Correct date [skip ci] 2016-04-17 11:32:36 +02:00
James Cole
dc3c967c9f Update stuff in anticipation of new release. 2016-04-17 11:32:18 +02:00
James Cole
1fc31b4d8f Fixed a bug courtesy of Johan. 2016-04-17 11:28:44 +02:00
James Cole
e4a4b0a4eb Config update [skip ci] 2016-04-16 08:41:55 +02:00
James Cole
a9c026884d Fix null pointer. 2016-04-10 21:31:00 +02:00
James Cole
e893000ce9 Fix pie chart. 2016-04-10 20:28:32 +02:00
James Cole
32eeb3424d Code cleanup. 2016-04-10 17:51:51 +02:00
James Cole
ab523b6102 Make chart pretty 2016-04-10 17:03:36 +02:00
James Cole
b062222c45 Update chart options. 2016-04-10 11:28:55 +02:00
James Cole
2dddc843ce Fix chart heights. 2016-04-10 10:20:15 +02:00
James Cole
b74c1c8cf9 Upgrade chart library. 2016-04-10 10:05:50 +02:00
James Cole
d5d4bb2c4b Some javascript upgrades. 2016-04-10 08:23:31 +02:00
James Cole
89ac27ad10 Some code cleanup [skip ci] 2016-04-10 08:18:14 +02:00
James Cole
48b169c026 Fix comma thing [skip ci] 2016-04-09 21:07:43 +02:00
James Cole
0715b7406e Add language in cache as well. 2016-04-09 09:27:04 +02:00
James Cole
6e4991a34b Make help more reliable. 2016-04-09 09:24:17 +02:00
James Cole
8730af59bc Fix help text and debug. 2016-04-09 09:20:16 +02:00
James Cole
bdcc2c6c9f Prep for new report. 2016-04-09 09:16:51 +02:00
James Cole
6f0f6e86a1 Small bug fixes. 2016-04-09 09:10:11 +02:00
James Cole
3962d9da92 Text for error. 2016-04-09 06:02:30 +02:00
James Cole
5ed53d5f04 Some new code for CSV. 2016-04-08 20:36:11 +02:00
James Cole
ddb28b78c3 Some new translations and stuff. 2016-04-08 17:54:25 +02:00
James Cole
7699b6b4ea Update composer lock file. [skip ci] 2016-04-08 15:16:13 +02:00
James Cole
d783d05462 Some query optimisations for the audit report 2016-04-08 15:10:07 +02:00
James Cole
33bf373151 First attempt at audit report (uses lots of queries). 2016-04-08 14:50:18 +02:00
James Cole
8116644526 Some log fine tuning. 2016-04-08 14:44:53 +02:00
James Cole
dc4665e82a Add debug messages. 2016-04-08 11:59:44 +02:00
James Cole
732a85e51d Fix null call 2016-04-06 21:07:03 +02:00
James Cole
32190db8bb Fixed tests. 2016-04-06 21:05:43 +02:00
James Cole
25d3a115e0 Amounts better divided. 2016-04-06 20:59:09 +02:00
James Cole
30e3ed6410 Fix more tests. 2016-04-06 20:52:22 +02:00
James Cole
8b5a775dc5 Nonsense commit to test signing.
Signed-off-by: James Cole <thegrumpydictator@gmail.com>
2016-04-06 20:16:28 +02:00
James Cole
2942c3a4be Nonsense commit to test signing.
Signed-off-by: James Cole <thegrumpydictator@gmail.com>
2016-04-06 19:45:58 +02:00
James Cole
768d3bb3e8 Fix some tests. Won't fix all. 2016-04-06 19:44:42 +02:00
James Cole
250b2c2f53 PHP7 compatible function definitions. 2016-04-06 16:37:28 +02:00
James Cole
c8440af9a5 PHP7 compatible function definitions. 2016-04-06 09:27:45 +02:00
James Cole
37fe2d22b0 PHP7 compatible function definitions. 2016-04-05 22:00:03 +02:00
James Cole
b0b5d90976 Fixes the travis run. 2016-04-05 21:12:50 +02:00
James Cole
27b0c7f425 Moved a lot of files outside of the root. 2016-04-05 21:08:36 +02:00
James Cole
7c23571806 Missing translation. 2016-04-04 19:54:15 +02:00
James Cole
ea378c8d82 Fix search. [skip-ci] 2016-04-04 19:49:11 +02:00
James Cole
0fb45974ef Fix title. 2016-04-04 19:48:07 +02:00
James Cole
6490f9c128 Fix search. 2016-04-04 19:48:00 +02:00
James Cole
2d7f1af52c Add clear cache, for issue #237 2016-04-04 19:47:55 +02:00
James Cole
ac27659a59 Merge pull request #238 from nhaarman/fix_active-bill-expected-amount
Fixed incorrect average of expectedAmount in active bills.
2016-04-04 18:58:42 +02:00
Niek Haarman
11d59c8bd1 Fixed incorrect average of expectedAmount in active bills. 2016-04-04 18:15:38 +02:00
James Cole
a6936cbd02 Merge branch 'release/3.8.2' 2016-04-03 16:47:54 +02:00
James Cole
3be84d76ef Updated composer.lock and other files. [skip ci] 2016-04-03 16:47:27 +02:00
James Cole
9aed1f344f Code cleanup. 2016-04-03 15:47:00 +02:00
James Cole
4fff264630 New translations. 2016-04-03 15:45:41 +02:00
James Cole
2e444da2a3 Better titles. 2016-04-03 14:55:56 +02:00
James Cole
7a216f95ca Add sum. 2016-04-03 14:38:12 +02:00
James Cole
f22a9799a1 Hide some fields. 2016-04-03 14:01:27 +02:00
James Cole
90bdc40393 Fixed balance list. 2016-04-03 13:56:06 +02:00
James Cole
622a97c8d8 Category information. #159 2016-04-03 11:20:55 +02:00
James Cole
03691c81c2 More code for #159 [skip ci] 2016-04-03 11:14:36 +02:00
James Cole
885b56c465 More code for #159 2016-04-03 11:07:51 +02:00
James Cole
23cc7be231 More things [skip ci] 2016-04-03 10:51:37 +02:00
James Cole
bb82b0eb79 Better view for admin [skip ci] 2016-04-03 10:42:46 +02:00
James Cole
2e05f640b8 Title in guest view [skip ci] 2016-04-03 10:35:54 +02:00
James Cole
697a02ffee Page titles. 2016-04-03 10:34:42 +02:00
James Cole
ad402021ed Basic user admin. 2016-04-03 07:07:17 +02:00
James Cole
67caf6ef1f Code cleanup [skip ci] 2016-04-01 16:46:11 +02:00
James Cole
3277858c5a Code cleanup. [skip ci] 2016-04-01 16:44:46 +02:00
James Cole
3fbedf323f Fix list for no budget #159 2016-04-01 16:23:12 +02:00
James Cole
144a6130f2 First code for #159 popups 2016-04-01 16:06:55 +02:00
James Cole
fa38c975b6 New converters for #180 (Tag and accounts) 2016-04-01 14:17:12 +02:00
James Cole
c14fa1021c New converters for #180 (Currency) 2016-04-01 14:10:08 +02:00
James Cole
5e78cc02bd New converters for #180 (Category and some other stuff) 2016-04-01 13:23:12 +02:00
James Cole
429ef80fb9 New converters for #180 (Budget) 2016-04-01 13:17:07 +02:00
James Cole
e4d93cad27 New converters for #180 (Bill) 2016-04-01 13:07:19 +02:00
James Cole
d9a4840e37 New converters for #180 2016-04-01 13:03:38 +02:00
James Cole
a93070b98d Fixes #234. 2016-04-01 09:13:50 +02:00
James Cole
c05a942862 This fixes a null pointer exception. [skip ci] 2016-04-01 05:36:29 +02:00
James Cole
f9a7879c1e Damn git. 2016-03-30 17:51:40 +02:00
James Cole
bdfbc6d6a7 Merge branch 'develop' of https://github.com/JC5/firefly-iii into develop
* 'develop' of https://github.com/JC5/firefly-iii:
  New activation message
2016-03-30 17:48:59 +02:00
James Cole
21181d8d8e Fixes for #233 2016-03-30 17:47:13 +02:00
James Cole
1c7a27b816 New activation message 2016-03-30 12:46:51 +02:00
James Cole
e953f58c74 Merge branch 'release/3.8.1' into develop 2016-03-29 17:42:45 +02:00
478 changed files with 4146 additions and 2452 deletions

View File

@@ -1,7 +1,7 @@
APP_ENV=production
APP_DEBUG=false
APP_KEY=SomeRandomStringOf32CharsExactly
LOG_LEVEL=warning
DB_CONNECTION=mysql
DB_HOST=localhost

View File

@@ -1,7 +1,7 @@
APP_ENV=testing
APP_DEBUG=true
APP_KEY=SomeRandomStringOf32CharsExactly
LOG_LEVEL=debug
DB_CONNECTION=sqlite
DB_HOST=localhost

View File

@@ -4,6 +4,7 @@ php:
- 7
install:
- cp _development/phpunit.xml ./phpunit.xml
- phpenv config-rm xdebug.ini
- composer selfupdate
- rm composer.lock

View File

@@ -5,6 +5,32 @@ 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.
- Informational popups are working in reports.
### Changed
- User activation emails are better
### Fixed
- Some bugs related to accounts and rules.
## [3.8.1] - 2016-03-29
### Added
- More translations
@@ -15,21 +41,11 @@ This project adheres to [Semantic Versioning](http://semver.org/).
### Changed
- The pages related to rules have new URL's.
### Deprecated
- Initial release.
### Removed
- Initial release.
### Fixed
- Spelling errors.
- Problems related to the "account repository".
- Some views showed empty (0.0) amounts.
### Security
- Initial release.
## [3.8.0] - 2016-03-20
### Added
- Two factor authentication, thanks to the excellent work of [zjean](https://github.com/zjean).

View File

@@ -1,4 +1,4 @@
Copyright (C) 2016 Sander Dorigo
Copyright (C) 2016 thegrumpydictator@gmail.com
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

View File

@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ phpunit.cover.xml
~ Copyright (C) 2016 Sander Dorigo
~ 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.

View 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)
);
}
}

View File

@@ -3,7 +3,7 @@ declare(strict_types = 1);
/**
* Kernel.php
* Copyright (C) 2016 Sander Dorigo
* 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.
@@ -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.
*

View File

@@ -1,7 +1,8 @@
<?php
declare(strict_types = 1);
/**
* ResendConfirmation.php
* Copyright (C) 2016 Sander Dorigo
* 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.

View File

@@ -2,7 +2,7 @@
declare(strict_types = 1);
/**
* TransactionJournalStored.php
* Copyright (C) 2016 Sander Dorigo
* 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.
@@ -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;

View File

@@ -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;
}

View File

@@ -1,7 +1,8 @@
<?php
declare(strict_types = 1);
/**
* UserRegistration.php
* Copyright (C) 2016 Sander Dorigo
* 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.

View File

@@ -6,7 +6,6 @@ namespace FireflyIII\Exceptions;
/**
* Class FireflyException
*
* @codeCoverageIgnore
* @package FireflyIII\Exceptions
*/
class FireflyException extends \Exception

View File

@@ -6,7 +6,6 @@ namespace FireflyIII\Exceptions;
/**
* Class NotImplementedException
*
* @codeCoverageIgnore
* @package FireflyIII\Exceptions
*/
class NotImplementedException extends \Exception

View File

@@ -5,7 +5,6 @@ namespace FireflyIII\Exceptions;
/**
* Class ValidationExceptions
*
* @codeCoverageIgnore
* @package FireflyIII\Exception
*/
class ValidationException extends \Exception

View File

@@ -2,7 +2,7 @@
declare(strict_types = 1);
/**
* AttachmentCollector.php
* Copyright (C) 2016 Sander Dorigo
* 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.
@@ -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;
}
/**

View File

@@ -2,7 +2,7 @@
declare(strict_types = 1);
/**
* BasicCollector.php
* Copyright (C) 2016 Sander Dorigo
* 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.
@@ -40,7 +40,7 @@ class BasicCollector
/**
* @return Collection
*/
public function getFiles()
public function getFiles(): Collection
{
return $this->files;
}

View File

@@ -2,7 +2,7 @@
declare(strict_types = 1);
/**
* CollectorInterface.php
* Copyright (C) 2016 Sander Dorigo
* 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.
@@ -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

View File

@@ -2,7 +2,7 @@
declare(strict_types = 1);
/**
* UploadCollector.php
* Copyright (C) 2016 Sander Dorigo
* 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.
@@ -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;
}
/**

View File

@@ -2,7 +2,7 @@
declare(strict_types = 1);
/**
* ConfigurationFile.php
* Copyright (C) 2016 Sander Dorigo
* 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.
@@ -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();

View File

@@ -2,7 +2,7 @@
declare(strict_types = 1);
/**
* Entry.php
* Copyright (C) 2016 Sander Dorigo
* 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.
@@ -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;
}

View File

@@ -2,7 +2,7 @@
declare(strict_types = 1);
/**
* BasicExporter.php
* Copyright (C) 2016 Sander Dorigo
* 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.
@@ -39,7 +39,7 @@ class BasicExporter
/**
* @return Collection
*/
public function getEntries()
public function getEntries(): Collection
{
return $this->entries;
}

View File

@@ -2,7 +2,7 @@
declare(strict_types = 1);
/**
* CsvExporter.php
* Copyright (C) 2016 Sander Dorigo
* 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.
@@ -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()

View File

@@ -2,7 +2,7 @@
declare(strict_types = 1);
/**
* ExporterInterface.php
* Copyright (C) 2016 Sander Dorigo
* 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.
@@ -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

View File

@@ -2,7 +2,7 @@
declare(strict_types = 1);
/**
* Processor.php
* Copyright (C) 2016 Sander Dorigo
* 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.
@@ -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;
}

View File

@@ -2,7 +2,7 @@
declare(strict_types = 1);
/**
* AccountChartGeneratorInterface.php
* Copyright (C) 2016 Sander Dorigo
* 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.

View File

@@ -2,7 +2,7 @@
declare(strict_types = 1);
/**
* BillChartGeneratorInterface.php
* Copyright (C) 2016 Sander Dorigo
* 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.

View File

@@ -2,7 +2,7 @@
declare(strict_types = 1);
/**
* ChartJsBillChartGenerator.php
* Copyright (C) 2016 Sander Dorigo
* 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.
@@ -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,
];

View File

@@ -2,7 +2,7 @@
declare(strict_types = 1);
/**
* BudgetChartGeneratorInterface.php
* Copyright (C) 2016 Sander Dorigo
* 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.

View File

@@ -50,7 +50,6 @@ class ChartJsBudgetChartGenerator implements BudgetChartGeneratorInterface
}
/**
* @codeCoverageIgnore
*
* @param Collection $entries
*

View File

@@ -2,7 +2,7 @@
declare(strict_types = 1);
/**
* CategoryChartGeneratorInterface.php
* Copyright (C) 2016 Sander Dorigo
* 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.
@@ -25,7 +25,7 @@ interface CategoryChartGeneratorInterface
*
* @return array
*/
public function all(Collection $entries);
public function all(Collection $entries): array;
/**
* @param Collection $categories

View File

@@ -148,7 +148,6 @@ class ChartJsCategoryChartGenerator implements CategoryChartGeneratorInterface
}
/**
* @codeCoverageIgnore
*
* @param Collection $entries
*

View File

@@ -2,7 +2,7 @@
declare(strict_types = 1);
/**
* PiggyBankChartGenerator.php
* Copyright (C) 2016 Sander Dorigo
* 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.

View File

@@ -89,7 +89,7 @@ class ChartJsReportChartGenerator implements ReportChartGeneratorInterface
'labels' => [],
'datasets' => [
[
'label' => trans('firefly.net-worth'),
'label' => trans('firefly.net_worth'),
'data' => [],
],
],

View File

@@ -2,7 +2,7 @@
declare(strict_types = 1);
/**
* ReportChartGenerator.php
* Copyright (C) 2016 Sander Dorigo
* 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.

View File

@@ -1,7 +1,8 @@
<?php
declare(strict_types = 1);
/**
* AttachUserRole.php
* Copyright (C) 2016 Sander Dorigo
* 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.

View File

@@ -2,7 +2,7 @@
declare(strict_types = 1);
/**
* FireRulesForStore.php
* Copyright (C) 2016 Sander Dorigo
* 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.
@@ -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();

View File

@@ -2,7 +2,7 @@
declare(strict_types = 1);
/**
* FireRulesForUpdate.php
* Copyright (C) 2016 Sander Dorigo
* 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.
@@ -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();

View File

@@ -2,7 +2,7 @@
declare(strict_types = 1);
/**
* RescanJournalAfterStore.php
* Copyright (C) 2016 Sander Dorigo
* 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.
@@ -16,7 +16,6 @@ use FireflyIII\Support\Events\BillScanner;
/**
* Class RescanJournal
*
* @codeCoverageIgnore
* @package FireflyIII\Handlers\Events
*/
class ScanForBillsAfterStore

View File

@@ -2,7 +2,7 @@
declare(strict_types = 1);
/**
* ScanForBillsAfterUpdate.php
* Copyright (C) 2016 Sander Dorigo
* 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.
@@ -16,7 +16,6 @@ use FireflyIII\Support\Events\BillScanner;
/**
* Class RescanJournal
*
* @codeCoverageIgnore
* @package FireflyIII\Handlers\Events
*/
class ScanForBillsAfterUpdate

View File

@@ -1,7 +1,8 @@
<?php
declare(strict_types = 1);
/**
* SendRegistrationMail.php
* Copyright (C) 2016 Sander Dorigo
* 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.
@@ -37,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;
@@ -59,5 +60,6 @@ class SendRegistrationMail
} catch (Swift_TransportException $e) {
Log::error($e->getMessage());
}
return true;
}
}

View File

@@ -10,7 +10,6 @@ use FireflyIII\Models\TransactionJournal;
/**
* Class UpdateJournalConnection
*
* @codeCoverageIgnore
* @package FireflyIII\Handlers\Events
*/
class UpdateJournalConnection

View File

@@ -1,7 +1,8 @@
<?php
declare(strict_types = 1);
/**
* UserConfirmation.php
* Copyright (C) 2016 Sander Dorigo
* 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.
@@ -38,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;
}
/**

View File

@@ -1,7 +1,8 @@
<?php
declare(strict_types = 1);
/**
* UserEventListener.php
* Copyright (C) 2016 Sander Dorigo
* 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.
@@ -20,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');

View File

@@ -5,7 +5,6 @@ namespace FireflyIII\Helpers\Collection;
use Illuminate\Support\Collection;
/**
* @codeCoverageIgnore
* Class Account
*
* @package FireflyIII\Helpers\Collection

View File

@@ -5,7 +5,6 @@ namespace FireflyIII\Helpers\Collection;
use Illuminate\Support\Collection;
/**
* @codeCoverageIgnore
*
* Class Balance
*

View File

@@ -5,7 +5,6 @@ namespace FireflyIII\Helpers\Collection;
use FireflyIII\Models\Account as AccountModel;
/**
* @codeCoverageIgnore
*
* Class BalanceEntry
*

View File

@@ -6,7 +6,6 @@ use FireflyIII\Models\Account as AccountModel;
use Illuminate\Support\Collection;
/**
* @codeCoverageIgnore
*
* Class BalanceHeader
*

View File

@@ -6,7 +6,6 @@ use FireflyIII\Models\Budget as BudgetModel;
use Illuminate\Support\Collection;
/**
* @codeCoverageIgnore
*
* Class BalanceLine
*

View File

@@ -6,7 +6,6 @@ namespace FireflyIII\Helpers\Collection;
use Illuminate\Support\Collection;
/**
* @codeCoverageIgnore
* Class Bill
*
* @package FireflyIII\Helpers\Collection

View File

@@ -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
{

View File

@@ -5,7 +5,6 @@ namespace FireflyIII\Helpers\Collection;
use Illuminate\Support\Collection;
/**
* @codeCoverageIgnore
*
* Class Budget
*

View File

@@ -6,7 +6,6 @@ use FireflyIII\Models\Budget as BudgetModel;
use FireflyIII\Models\LimitRepetition;
/**
* @codeCoverageIgnore
*
* Class BudgetLine
*

View File

@@ -7,7 +7,6 @@ use Illuminate\Support\Collection;
/**
* @codeCoverageIgnore
*
* Class Category
*

View File

@@ -8,7 +8,6 @@ use Illuminate\Support\Collection;
use stdClass;
/**
* @codeCoverageIgnore
*
* Class Expense
*

View File

@@ -8,7 +8,6 @@ use Illuminate\Support\Collection;
use stdClass;
/**
* @codeCoverageIgnore
*
* Class Income
*

View File

@@ -2,9 +2,8 @@
declare(strict_types = 1);
namespace FireflyIII\Helpers\Csv\Converter;
use Auth;
use FireflyIII\Models\Account;
use Log;
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
/**
* Class AccountId
@@ -19,22 +18,16 @@ class AccountId extends BasicConverter implements ConverterInterface
*/
public function convert(): Account
{
/** @var AccountRepositoryInterface $repository */
$repository = app('FireflyIII\Repositories\Account\AccountRepositoryInterface');
// is mapped? Then it's easy!
if (isset($this->mapped[$this->index][$this->value])) {
/** @var Account $account */
$account = Auth::user()->accounts()->find($this->mapped[$this->index][$this->value]);
$account = $repository->find($this->mapped[$this->index][$this->value]);
} else {
/** @var Account $account */
$account = Auth::user()->accounts()->find($this->value);
if (!is_null($account)) {
Log::debug('Found ' . $account->accountType->type . ' named "******" with ID: ' . $this->value . ' (not mapped) ');
} else {
// new account to prevent TypeErrors.
$account = new Account;
}
$account = $repository->find($this->value);
}
return $account;

View File

@@ -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));

View File

@@ -5,6 +5,8 @@ namespace FireflyIII\Helpers\Csv\Converter;
use Auth;
use Carbon\Carbon;
use FireflyIII\Models\Account;
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
use Log;
/**
* Class AssetAccountIban
@@ -19,60 +21,52 @@ class AssetAccountIban extends BasicConverter implements ConverterInterface
*/
public function convert(): Account
{
/** @var AccountRepositoryInterface $repository */
$repository = app('FireflyIII\Repositories\Account\AccountRepositoryInterface');
// is mapped? Then it's easy!
if (isset($this->mapped[$this->index][$this->value])) {
$account = Auth::user()->accounts()->find($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;
}
if (strlen($this->value) > 0) {
// find or create new account:
$account = $this->findAccount();
$set = $repository->getAccounts(['Default account', 'Asset account']);
/** @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);
if (is_null($account->id)) {
// create it if doesn't exist.
$repository = app('FireflyIII\Repositories\Account\AccountRepositoryInterface');
$accountData = [
'name' => $this->value,
'accountType' => 'asset',
'virtualBalance' => 0,
'virtualBalanceCurrency' => 1, // hard coded.
'active' => true,
'user' => Auth::user()->id,
'iban' => null,
'accountNumber' => $this->value,
'accountRole' => null,
'openingBalance' => 0,
'openingBalanceDate' => new Carbon,
'openingBalanceCurrency' => 1, // hard coded.
];
$account = $repository->store($accountData);
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,
'accountType' => 'asset',
'virtualBalance' => 0,
'virtualBalanceCurrency' => 1, // hard coded.
'active' => true,
'user' => Auth::user()->id,
'iban' => $this->value,
'accountNumber' => $this->value,
'accountRole' => null,
'openingBalance' => 0,
'openingBalanceDate' => new Carbon,
'openingBalanceCurrency' => 1, // hard coded.
];
$account = $repository->store($accountData);
return $account;
}
return new Account;
}
/**
* @return Account
*/
protected function findAccount(): Account
{
$set = Auth::user()->accounts()->accountTypeIn(['Default account', 'Asset account'])->get(['accounts.*']);
/** @var Account $entry */
foreach ($set as $entry) {
if ($entry->iban == $this->value) {
return $entry;
}
}
return new Account;
}
}

View File

@@ -5,6 +5,7 @@ namespace FireflyIII\Helpers\Csv\Converter;
use Auth;
use Carbon\Carbon;
use FireflyIII\Models\Account;
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
/**
* Class AssetAccountName
@@ -17,16 +18,21 @@ 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');
// is mapped? Then it's easy!
if (isset($this->mapped[$this->index][$this->value])) {
$account = Auth::user()->accounts()->find($this->mapped[$this->index][$this->value]);
$account = $repository->find($this->mapped[$this->index][$this->value]);
return $account;
}
// find or create new account:
$set = Auth::user()->accounts()->accountTypeIn(['Asset account', 'Default account'])->get();
$set = $repository->getAccounts(['Default account', 'Asset account']);
/** @var Account $entry */
foreach ($set as $entry) {
if ($entry->name == $this->value) {
@@ -35,8 +41,6 @@ class AssetAccountName extends BasicConverter implements ConverterInterface
}
// create it if doesnt exist.
$repository = app('FireflyIII\Repositories\Account\AccountRepositoryInterface');
$accountData = [
'name' => $this->value,
'accountType' => 'asset',

View File

@@ -1,7 +1,8 @@
<?php
declare(strict_types = 1);
/**
* AssetAccountNumber.php
* Copyright (C) 2016 Sander Dorigo
* 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.
@@ -13,6 +14,7 @@ namespace FireflyIII\Helpers\Csv\Converter;
use Auth;
use Carbon\Carbon;
use FireflyIII\Models\Account;
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
/**
* Class AssetAccountNumber
@@ -25,11 +27,14 @@ 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');
// is mapped? Then it's easy!
if (isset($this->mapped[$this->index][$this->value])) {
$account = Auth::user()->accounts()->find($this->mapped[$this->index][$this->value]);
$account = $repository->find($this->mapped[$this->index][$this->value]);
return $account;
}
@@ -37,53 +42,38 @@ class AssetAccountNumber extends BasicConverter implements ConverterInterface
$value = $this->value ?? '';
if (strlen($value) > 0) {
// find or create new account:
$account = $this->findAccount();
$set = $repository->getAccounts(['Default account', 'Asset account']);
/** @var Account $entry */
foreach ($set as $entry) {
$accountNumber = $entry->getMeta('accountNumber');
if ($accountNumber == $this->value) {
if (is_null($account->id)) {
// create it if doesn't exist.
$repository = app('FireflyIII\Repositories\Account\AccountRepositoryInterface');
$accountData = [
'name' => $this->value,
'accountType' => 'asset',
'virtualBalance' => 0,
'virtualBalanceCurrency' => 1, // hard coded.
'active' => true,
'user' => Auth::user()->id,
'iban' => null,
'accountNumber' => $this->value,
'accountRole' => null,
'openingBalance' => 0,
'openingBalanceDate' => new Carbon,
'openingBalanceCurrency' => 1, // hard coded.
];
$account = $repository->store($accountData);
return $entry;
}
}
$accountData = [
'name' => $this->value,
'accountType' => 'asset',
'virtualBalance' => 0,
'virtualBalanceCurrency' => 1, // hard coded.
'active' => true,
'user' => Auth::user()->id,
'iban' => null,
'accountNumber' => $this->value,
'accountRole' => null,
'openingBalance' => 0,
'openingBalanceDate' => new Carbon,
'openingBalanceCurrency' => 1, // hard coded.
];
$account = $repository->store($accountData);
return $account;
}
return null;
return null; // is this accepted?
}
/**
* @return Account
*/
protected function findAccount(): Account
{
$set = Auth::user()->accounts()->with(['accountmeta'])->accountTypeIn(['Default account', 'Asset account'])->get(['accounts.*']);
/** @var Account $entry */
foreach ($set as $entry) {
$accountNumber = $entry->getMeta('accountNumber');
if ($accountNumber == $this->value) {
return $entry;
}
}
return new Account;
}
}

View File

@@ -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;
}

View File

@@ -2,8 +2,8 @@
declare(strict_types = 1);
namespace FireflyIII\Helpers\Csv\Converter;
use Auth;
use FireflyIII\Models\Bill;
use FireflyIII\Repositories\Bill\BillRepositoryInterface;
/**
* Class BillId
@@ -16,13 +16,16 @@ class BillId extends BasicConverter implements ConverterInterface
/**
* @return Bill
*/
public function convert()
public function convert(): Bill
{
/** @var BillRepositoryInterface $repository */
$repository = app('FireflyIII\Repositories\Bill\BillRepositoryInterface');
// is mapped? Then it's easy!
if (isset($this->mapped[$this->index][$this->value])) {
$bill = Auth::user()->bills()->find($this->mapped[$this->index][$this->value]);
$bill = $repository->find($this->mapped[$this->index][$this->value]);
} else {
$bill = Auth::user()->bills()->find($this->value);
$bill = $repository->find($this->value);
}
return $bill;

View File

@@ -2,8 +2,8 @@
declare(strict_types = 1);
namespace FireflyIII\Helpers\Csv\Converter;
use Auth;
use FireflyIII\Models\Bill;
use FireflyIII\Repositories\Bill\BillRepositoryInterface;
/**
* Class BillName
@@ -16,15 +16,17 @@ class BillName extends BasicConverter implements ConverterInterface
/**
* @return Bill
*/
public function convert()
public function convert(): Bill
{
/** @var BillRepositoryInterface $repository */
$repository = app('FireflyIII\Repositories\Bill\BillRepositoryInterface');
$bill = null;
// is mapped? Then it's easy!
if (isset($this->mapped[$this->index][$this->value])) {
$bill = Auth::user()->bills()->find($this->mapped[$this->index][$this->value]);
$bill = $repository->find($this->mapped[$this->index][$this->value]);
} else {
$bills = Auth::user()->bills()->get();
$bills = $repository->getBills();
/** @var Bill $bill */
foreach ($bills as $bill) {
if ($bill->name == $this->value) {

View File

@@ -2,8 +2,8 @@
declare(strict_types = 1);
namespace FireflyIII\Helpers\Csv\Converter;
use Auth;
use FireflyIII\Models\Budget;
use FireflyIII\Repositories\Budget\BudgetRepositoryInterface;
/**
* Class BudgetId
@@ -16,13 +16,17 @@ class BudgetId extends BasicConverter implements ConverterInterface
/**
* @return Budget
*/
public function convert()
public function convert(): Budget
{
/** @var BudgetRepositoryInterface $repository */
$repository = app('FireflyIII\Repositories\Budget\BudgetRepositoryInterface');
// is mapped? Then it's easy!
if (isset($this->mapped[$this->index][$this->value])) {
$budget = Auth::user()->budgets()->find($this->mapped[$this->index][$this->value]);
$budget = $repository->find($this->mapped[$this->index][$this->value]);
} else {
$budget = Auth::user()->budgets()->find($this->value);
$budget = $repository->find($this->value);
}
return $budget;

View File

@@ -4,6 +4,7 @@ namespace FireflyIII\Helpers\Csv\Converter;
use Auth;
use FireflyIII\Models\Budget;
use FireflyIII\Repositories\Budget\BudgetRepositoryInterface;
/**
* Class BudgetName
@@ -16,14 +17,16 @@ class BudgetName extends BasicConverter implements ConverterInterface
/**
* @return Budget
*/
public function convert()
public function convert(): Budget
{
/** @var BudgetRepositoryInterface $repository */
$repository = app('FireflyIII\Repositories\Budget\BudgetRepositoryInterface');
// is mapped? Then it's easy!
if (isset($this->mapped[$this->index][$this->value])) {
$budget = Auth::user()->budgets()->find($this->mapped[$this->index][$this->value]); // see issue #180
$budget = $repository->find($this->mapped[$this->index][$this->value]);
} else {
$repository = app('FireflyIII\Repositories\Budget\BudgetRepositoryInterface');
$budget = $repository->store(['name' => $this->value, 'user' => Auth::user()->id]);
$budget = $repository->store(['name' => $this->value, 'user' => Auth::user()->id]);
}
return $budget;

View File

@@ -2,8 +2,8 @@
declare(strict_types = 1);
namespace FireflyIII\Helpers\Csv\Converter;
use Auth;
use FireflyIII\Models\Category;
use FireflyIII\Repositories\Category\SingleCategoryRepositoryInterface;
/**
* Class CategoryId
@@ -16,13 +16,16 @@ class CategoryId extends BasicConverter implements ConverterInterface
/**
* @return Category
*/
public function convert()
public function convert(): Budget
{
/** @var SingleCategoryRepositoryInterface $repository */
$repository = app('FireflyIII\Repositories\Category\SingleCategoryRepositoryInterface');
// is mapped? Then it's easy!
if (isset($this->mapped[$this->index][$this->value])) {
$category = Auth::user()->categories()->find($this->mapped[$this->index][$this->value]);
$category = $repository->find($this->mapped[$this->index][$this->value]);
} else {
$category = Auth::user()->categories()->find($this->value);
$category = $repository->find($this->value);
}
return $category;

View File

@@ -4,6 +4,7 @@ namespace FireflyIII\Helpers\Csv\Converter;
use Auth;
use FireflyIII\Models\Category;
use FireflyIII\Repositories\Category\SingleCategoryRepositoryInterface;
/**
* Class CategoryName
@@ -16,18 +17,22 @@ class CategoryName extends BasicConverter implements ConverterInterface
/**
* @return Category
*/
public function convert()
public function convert(): Budget
{
/** @var SingleCategoryRepositoryInterface $repository */
$repository = app('FireflyIII\Repositories\Category\SingleCategoryRepositoryInterface');
// is mapped? Then it's easy!
if (isset($this->mapped[$this->index][$this->value])) {
$category = Auth::user()->categories()->find($this->mapped[$this->index][$this->value]);
$category = $repository->find($this->mapped[$this->index][$this->value]);
} else {
$category = Category::firstOrCreateEncrypted( // See issue #180
[
'name' => $this->value,
'user_id' => Auth::user()->id,
]
);
$data = [
'name' => $this->value,
'user' => Auth::user()->id,
];
$category = $repository->store($data);
}
return $category;

View File

@@ -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);
}

View File

@@ -3,6 +3,7 @@ declare(strict_types = 1);
namespace FireflyIII\Helpers\Csv\Converter;
use FireflyIII\Models\TransactionCurrency;
use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface;
/**
* Class CurrencyCode
@@ -15,12 +16,16 @@ class CurrencyCode extends BasicConverter implements ConverterInterface
/**
* @return TransactionCurrency
*/
public function convert()
public function convert(): TransactionCurrency
{
/** @var CurrencyRepositoryInterface $repository */
$repository = app('FireflyIII\Repositories\Currency\CurrencyRepositoryInterface');
if (isset($this->mapped[$this->index][$this->value])) {
$currency = TransactionCurrency::find($this->mapped[$this->index][$this->value]);
$currency = $repository->find($this->mapped[$this->index][$this->value]);
} else {
$currency = TransactionCurrency::whereCode($this->value)->first();
$currency = $repository->findByCode($this->value);
}
return $currency;

View File

@@ -3,6 +3,7 @@ declare(strict_types = 1);
namespace FireflyIII\Helpers\Csv\Converter;
use FireflyIII\Models\TransactionCurrency;
use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface;
/**
* Class CurrencyId
@@ -15,12 +16,15 @@ class CurrencyId extends BasicConverter implements ConverterInterface
/**
* @return TransactionCurrency
*/
public function convert()
public function convert(): TransactionCurrency
{
/** @var CurrencyRepositoryInterface $repository */
$repository = app('FireflyIII\Repositories\Currency\CurrencyRepositoryInterface');
if (isset($this->mapped[$this->index][$this->value])) {
$currency = TransactionCurrency::find($this->mapped[$this->index][$this->value]);
$currency = $repository->find($this->mapped[$this->index][$this->value]);
} else {
$currency = TransactionCurrency::find($this->value);
$currency = $repository->find($this->value);
}
return $currency;

View File

@@ -3,6 +3,7 @@ declare(strict_types = 1);
namespace FireflyIII\Helpers\Csv\Converter;
use FireflyIII\Models\TransactionCurrency;
use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface;
/**
* Class CurrencyName
@@ -15,12 +16,16 @@ class CurrencyName extends BasicConverter implements ConverterInterface
/**
* @return TransactionCurrency
*/
public function convert()
public function convert(): TransactionCurrency
{
/** @var CurrencyRepositoryInterface $repository */
$repository = app('FireflyIII\Repositories\Currency\CurrencyRepositoryInterface');
if (isset($this->mapped[$this->index][$this->value])) {
$currency = TransactionCurrency::find($this->mapped[$this->index][$this->value]);
$currency = $repository->find($this->mapped[$this->index][$this->value]);
} else {
$currency = TransactionCurrency::whereName($this->value)->first();
$currency = $repository->findByName($this->value);
}
return $currency;

View File

@@ -3,6 +3,7 @@ declare(strict_types = 1);
namespace FireflyIII\Helpers\Csv\Converter;
use FireflyIII\Models\TransactionCurrency;
use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface;
/**
* Class CurrencySymbol
@@ -15,12 +16,15 @@ class CurrencySymbol extends BasicConverter implements ConverterInterface
/**
* @return TransactionCurrency
*/
public function convert()
public function convert(): TransactionCurrency
{
/** @var CurrencyRepositoryInterface $repository */
$repository = app('FireflyIII\Repositories\Currency\CurrencyRepositoryInterface');
if (isset($this->mapped[$this->index][$this->value])) {
$currency = TransactionCurrency::find($this->mapped[$this->index][$this->value]);
$currency = $repository->find($this->mapped[$this->index][$this->value]);
} else {
$currency = TransactionCurrency::whereSymbol($this->value)->first();
$currency = $repository->findBySymbol($this->value);
}
return $currency;

View File

@@ -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 {

View File

@@ -14,7 +14,7 @@ class Description extends BasicConverter implements ConverterInterface
/**
* @return string
*/
public function convert()
public function convert(): string
{
$description = $this->data['description'] ?? '';

View File

@@ -1,7 +1,8 @@
<?php
declare(strict_types = 1);
/**
* INGDebetCredit.php
* Copyright (C) 2016 Sander Dorigo
* 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.
@@ -23,7 +24,7 @@ class INGDebetCredit extends BasicConverter implements ConverterInterface
/**
* @return int
*/
public function convert()
public function convert(): int
{
if ($this->value === 'Af') {
return -1;

View File

@@ -2,9 +2,8 @@
declare(strict_types = 1);
namespace FireflyIII\Helpers\Csv\Converter;
use Auth;
use FireflyIII\Models\Account;
use Log;
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
/**
* Class OpposingAccountIban
@@ -21,15 +20,23 @@ class OpposingAccountIban extends BasicConverter implements ConverterInterface
*/
public function convert()
{
/** @var AccountRepositoryInterface $repository */
$repository = app('FireflyIII\Repositories\Account\AccountRepositoryInterface');
if (isset($this->mapped[$this->index][$this->value])) {
$account = Auth::user()->accounts()->find($this->mapped[$this->index][$this->value]);
$account = $repository->find($this->mapped[$this->index][$this->value]);
return $account;
} else {
if (strlen($this->value) > 0) {
$account = $this->findAccount();
if (!is_null($account)) {
return $account;
$set = $repository->getAccounts([]);
/** @var Account $account */
foreach ($set as $account) {
if ($account->iban == $this->value) {
return $account;
}
}
}
@@ -37,21 +44,4 @@ class OpposingAccountIban extends BasicConverter implements ConverterInterface
}
}
/**
* @return Account|null
*/
protected function findAccount()
{
$set = Auth::user()->accounts()->get();
/** @var Account $account */
foreach ($set as $account) {
if ($account->iban == $this->value) {
Log::debug('OpposingAccountIban::convert found an Account (#' . $account->id . ': ******) with IBAN ******');
return $account;
}
}
return null;
}
}

View File

@@ -2,8 +2,8 @@
declare(strict_types = 1);
namespace FireflyIII\Helpers\Csv\Converter;
use Auth;
use FireflyIII\Models\Account;
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
/**
* Class OpposingAccountId
@@ -17,13 +17,16 @@ class OpposingAccountId extends BasicConverter implements ConverterInterface
/**
* @return Account
*/
public function convert()
public function convert(): Account
{
/** @var AccountRepositoryInterface $repository */
$repository = app('FireflyIII\Repositories\Account\AccountRepositoryInterface');
if (isset($this->mapped[$this->index][$this->value])) {
$account = Auth::user()->accounts()->find($this->mapped[$this->index][$this->value]);
$account = $repository->find($this->mapped[$this->index][$this->value]);
} else {
$account = Auth::user()->accounts()->find($this->value);
$account = $repository->find($this->value);
}
return $account;

View File

@@ -2,8 +2,8 @@
declare(strict_types = 1);
namespace FireflyIII\Helpers\Csv\Converter;
use Auth;
use FireflyIII\Models\Account;
use FireflyIII\Repositories\Account\AccountRepositoryInterface;
/**
* Class OpposingAccountName
@@ -20,8 +20,11 @@ class OpposingAccountName extends BasicConverter implements ConverterInterface
*/
public function convert()
{
/** @var AccountRepositoryInterface $repository */
$repository = app('FireflyIII\Repositories\Account\AccountRepositoryInterface');
if (isset($this->mapped[$this->index][$this->value])) {
$account = Auth::user()->accounts()->find($this->mapped[$this->index][$this->value]);
$account = $repository->find($this->mapped[$this->index][$this->value]);
return $account;
} else {

View File

@@ -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;

View File

@@ -2,8 +2,7 @@
declare(strict_types = 1);
namespace FireflyIII\Helpers\Csv\Converter;
use Auth;
use FireflyIII\Models\Tag;
use FireflyIII\Repositories\Tag\TagRepositoryInterface;
use Illuminate\Support\Collection;
/**
@@ -17,19 +16,24 @@ class TagsComma extends BasicConverter implements ConverterInterface
/**
* @return Collection
*/
public function convert()
public function convert(): Collection
{
$tags = new Collection;
/** @var TagRepositoryInterface $repository */
$repository = app('FireflyIII\Repositories\Tag\TagRepositoryInterface');
$tags = new Collection;
$strings = explode(',', $this->value);
foreach ($strings as $string) {
$tag = Tag::firstOrCreateEncrypted( // See issue #180
[
'tag' => $string,
'tagMode' => 'nothing',
'user_id' => Auth::user()->id,
]
);
$data = [
'tag' => $string,
'date' => null,
'description' => null,
'latitude' => null,
'longitude' => null,
'zoomLevel' => null,
'tagMode' => 'nothing',
];
$tag = $repository->store($data); // should validate first?
$tags->push($tag);
}
$tags = $tags->merge($this->data['tags']);

View File

@@ -2,8 +2,7 @@
declare(strict_types = 1);
namespace FireflyIII\Helpers\Csv\Converter;
use Auth;
use FireflyIII\Models\Tag;
use FireflyIII\Repositories\Tag\TagRepositoryInterface;
use Illuminate\Support\Collection;
/**
@@ -17,19 +16,25 @@ class TagsSpace extends BasicConverter implements ConverterInterface
/**
* @return Collection
*/
public function convert()
public function convert(): Collection
{
/** @var TagRepositoryInterface $repository */
$repository = app('FireflyIII\Repositories\Tag\TagRepositoryInterface');
$tags = new Collection;
$strings = explode(' ', $this->value);
foreach ($strings as $string) {
$tag = Tag::firstOrCreateEncrypted( // See issue #180
[
'tag' => $string,
'tagMode' => 'nothing',
'user_id' => Auth::user()->id,
]
);
$data = [
'tag' => $string,
'date' => null,
'description' => null,
'latitude' => null,
'longitude' => null,
'zoomLevel' => null,
'tagMode' => 'nothing',
];
$tag = $repository->store($data); // should validate first?
$tags->push($tag);
}
$tags = $tags->merge($this->data['tags']);

View File

@@ -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;
}

View File

@@ -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 : [];
}
@@ -122,15 +118,11 @@ class Importer
} 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();
}
/**
@@ -142,7 +134,6 @@ class Importer
}
/**
*
* @return TransactionJournal|string
*/
protected function createTransactionJournal()
@@ -359,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
*/

View File

@@ -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.*']);

View File

@@ -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) {

View File

@@ -16,7 +16,7 @@ class Bill implements MapperInterface
/**
* @return array
*/
public function getMap()
public function getMap(): array
{
$result = Auth::user()->bills()->get(['bills.*']);
$list = [];

View File

@@ -16,7 +16,7 @@ class Budget implements MapperInterface
/**
* @return array
*/
public function getMap()
public function getMap(): array
{
$result = Auth::user()->budgets()->get(['budgets.*']);
$list = [];

Some files were not shown because too many files have changed in this diff Show More