Merge branch 'release/3.10.4'

This commit is contained in:
James Cole 2016-09-14 20:40:52 +02:00
commit b9e2ee7af3
13 changed files with 162 additions and 72 deletions

View File

@ -5,6 +5,14 @@ This project adheres to [Semantic Versioning](http://semver.org/).
## [Unreleased]
- No unreleased changes yet.
## [3.10.4] - 2015-05-25
### Fixed
- Migration fix by @sandermulders
- Tricky import bug fix thanks to @vissert
- Currency preference will be correctly pulled from user settings, thanks to @fuf
- Simplified code for upgrade instructions.
## [3.10.3] - 2016-08-29
### Added
- More fields for mass-edit, thanks to @Vissert (#282)
@ -74,13 +82,6 @@ This project adheres to [Semantic Versioning](http://semver.org/).
- The date picker now supports more ranges and periods.
- Rewrote all migrations. #272
### Deprecated
- Initial release.
### Removed
- Initial release.
### Fixed
- Issue #264
- Issue #265
@ -95,10 +96,6 @@ This project adheres to [Semantic Versioning](http://semver.org/).
- Bulk update problems, #280, thanks @stickgrinder
- Fixed various problems with amount reporting of split transactions.
### Security
- Initial release.
[3.9.1]
### Fixed
- Fixed a bug where removing money from a piggy bank would not work. See issue #265 and #269

View File

@ -51,15 +51,22 @@ class UpgradeFireflyInstructions extends Command
/** @var string $version */
$version = config('firefly.version');
$config = config('upgrade.text');
$text = $config[$version] ?? null;
$text = null;
foreach (array_keys($config) as $compare) {
// if string starts with:
$len = strlen($compare);
if (substr($version, 0, $len) === $compare) {
$text = $config[$compare];
}
}
$this->line('+------------------------------------------------------------------------------+');
$this->line('');
if (is_null($text)) {
$this->line('Thank you for installing Firefly III, v' . $version);
$this->line('If you are upgrading from a previous version,');
$this->info('there are no extra upgrade instructions.');
$this->info('There are no extra upgrade instructions.');
$this->line('Firefly III should be ready for use.');
} else {
$this->line('Thank you for installing Firefly III, v' . $version);

View File

@ -21,6 +21,7 @@ use FireflyIII\Repositories\Currency\CurrencyRepositoryInterface;
use FireflyIII\User;
use Illuminate\Support\Collection;
use Log;
use Preferences;
/**
* Class ImportValidator
@ -357,13 +358,16 @@ class ImportValidator
{
if (is_null($entry->fields['currency'])) {
/** @var CurrencyRepositoryInterface $repository */
$repository = app(CurrencyRepositoryInterface::class);
$entry->fields['currency'] = $repository->findByCode(env('DEFAULT_CURRENCY', 'EUR'));
Log::debug('Set currency to EUR');
$repository = app(CurrencyRepositoryInterface::class, [$this->user]);
// is the default currency for the user or the system
$defaultCode = Preferences::getForUser($this->user, 'currencyPreference', env('DEFAULT_CURRENCY', 'EUR'))->data;
$entry->fields['currency'] = $repository->findByCode($defaultCode);
Log::debug(sprintf('Set currency to %s', $defaultCode));
return $entry;
}
Log::debug('Currency is OK');
Log::debug(sprintf('Currency is OK: %s', $entry->fields['currency']->code));
return $entry;
}

View File

@ -16,6 +16,7 @@ use FireflyIII\Models\RuleTrigger;
use FireflyIII\Rules\Triggers\AbstractTrigger;
use FireflyIII\Rules\Triggers\TriggerInterface;
use FireflyIII\Support\Domain;
use Log;
/**
* Interface TriggerInterface
@ -68,6 +69,7 @@ class TriggerFactory
/** @var AbstractTrigger $class */
$class = self::getTriggerClass($triggerType);
$obj = $class::makeFromStrings($triggerValue, $stopProcessing);
Log::debug('Created trigger from string', ['type' => $triggerType, 'value' => $triggerValue, 'stopProcessing' => $stopProcessing, 'class' => $class]);
return $obj;
}

View File

@ -20,6 +20,7 @@ use FireflyIII\Rules\Factory\ActionFactory;
use FireflyIII\Rules\Factory\TriggerFactory;
use FireflyIII\Rules\Triggers\AbstractTrigger;
use Illuminate\Support\Collection;
use Log;
/**
* Class Processor
@ -37,6 +38,8 @@ final class Processor
/** @var Collection */
public $triggers;
protected $foundTriggers = 0;
/**
* Processor constructor.
*
@ -57,9 +60,17 @@ final class Processor
*/
public static function make(Rule $rule)
{
Log::debug(sprintf('Making new rule from Rule %d', $rule->id));
$self = new self;
$self->rule = $rule;
/*
* The number of "found triggers" must start at -1, because the first
* trigger is "create-journal" or "update-journal" when this Processor
* is called from a Rule.
*/
$self->setFoundTriggers(-1);
$triggerSet = $rule->ruleTriggers()->orderBy('order', 'ASC')->get();
/** @var RuleTrigger $trigger */
foreach ($triggerSet as $trigger) {
@ -113,6 +124,22 @@ final class Processor
return $self;
}
/**
* @return int
*/
public function getFoundTriggers(): int
{
return $this->foundTriggers;
}
/**
* @param int $foundTriggers
*/
public function setFoundTriggers(int $foundTriggers)
{
$this->foundTriggers = $foundTriggers;
}
/**
*
* @return \FireflyIII\Models\Rule
@ -176,25 +203,30 @@ final class Processor
*
* @return bool
*/
private function triggered()
private function triggered(): bool
{
$foundTriggers = 0;
Log::debug('start of Processor::triggered()');
$foundTriggers = $this->getFoundTriggers();
$hitTriggers = 0;
/** @var RuleTrigger $trigger */
/** @var AbstractTrigger $trigger */
foreach ($this->triggers as $trigger) {
$foundTriggers++;
Log::debug(sprintf('Now checking trigger %s with value %s', get_class($trigger), $trigger->getTriggerValue()));
/** @var AbstractTrigger $trigger */
if ($trigger->triggered($this->journal)) {
Log::debug('Is a match!');
$hitTriggers++;
}
if ($trigger->stopProcessing) {
Log::debug('Stop processing this trigger and break.');
break;
}
}
$result = ($hitTriggers == $foundTriggers && $foundTriggers > 0);
Log::debug('Result of triggered()', ['hitTriggers' => $hitTriggers, 'foundTriggers' => $foundTriggers, 'result' => $result]);
return ($hitTriggers == $foundTriggers && $foundTriggers > 0);
return $result;
}

View File

@ -15,6 +15,7 @@ use FireflyIII\Models\TransactionJournal;
use FireflyIII\Models\TransactionType;
use FireflyIII\Repositories\Journal\JournalRepositoryInterface;
use Illuminate\Support\Collection;
use Log;
/**
* Class TransactionMatcher is used to find a list of
@ -80,6 +81,8 @@ class TransactionMatcher
// Filter transactions that match the given triggers.
$filtered = $set->filter(
function (TransactionJournal $journal) use ($processor) {
Log::debug(sprintf('Test these triggers on #%d', $journal->id));
return $processor->handleTransactionJournal($journal);
}
);

View File

@ -98,5 +98,23 @@ class AbstractTrigger
return $self;
}
/**
* @return RuleTrigger
*/
public function getTrigger(): RuleTrigger
{
return $this->trigger;
}
/**
* @return string
*/
public function getTriggerValue(): string
{
return $this->triggerValue;
}
}

View File

@ -171,7 +171,7 @@ class Amount
}
/**
* @return TransactionCurrency
* @return \FireflyIII\Models\TransactionCurrency
*/
public function getDefaultCurrency(): TransactionCurrency
{
@ -180,7 +180,7 @@ class Amount
if ($cache->has()) {
return $cache->get();
}
$currencyPreference = Prefs::get('currencyPreference', 'EUR');
$currencyPreference = Prefs::get('currencyPreference', env('DEFAULT_CURRENCY', 'EUR'));
$currency = TransactionCurrency::whereCode($currencyPreference->data)->first();
$cache->store($currency);

View File

@ -57,11 +57,11 @@ class Preferences
}
/**
* @param User $user
* @param string $name
* @param string $default
* @param \FireflyIII\User $user
* @param string $name
* @param string $default
*
* @return Preference|null
* @return \FireflyIII\Models\Preference|null
*/
public function getForUser(User $user, $name, $default = null)
{

48
composer.lock generated
View File

@ -518,16 +518,16 @@
},
{
"name": "doctrine/dbal",
"version": "v2.5.4",
"version": "v2.5.5",
"source": {
"type": "git",
"url": "https://github.com/doctrine/dbal.git",
"reference": "abbdfd1cff43a7b99d027af3be709bc8fc7d4769"
"reference": "9f8c05cd5225a320d56d4bfdb4772f10d045a0c9"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/doctrine/dbal/zipball/abbdfd1cff43a7b99d027af3be709bc8fc7d4769",
"reference": "abbdfd1cff43a7b99d027af3be709bc8fc7d4769",
"url": "https://api.github.com/repos/doctrine/dbal/zipball/9f8c05cd5225a320d56d4bfdb4772f10d045a0c9",
"reference": "9f8c05cd5225a320d56d4bfdb4772f10d045a0c9",
"shasum": ""
},
"require": {
@ -536,7 +536,7 @@
},
"require-dev": {
"phpunit/phpunit": "4.*",
"symfony/console": "2.*"
"symfony/console": "2.*||^3.0"
},
"suggest": {
"symfony/console": "For helpful console commands such as SQL execution and import of files."
@ -585,7 +585,7 @@
"persistence",
"queryobject"
],
"time": "2016-01-05 22:11:12"
"time": "2016-09-09 19:13:33"
},
{
"name": "doctrine/inflector",
@ -1039,16 +1039,16 @@
},
{
"name": "league/commonmark",
"version": "0.14.0",
"version": "0.15.0",
"source": {
"type": "git",
"url": "https://github.com/thephpleague/commonmark.git",
"reference": "b73c0b7288bd0e6f9f56bd0b20d0657214b91838"
"reference": "19fb96643beba24e681c371dc133e25409742664"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/thephpleague/commonmark/zipball/b73c0b7288bd0e6f9f56bd0b20d0657214b91838",
"reference": "b73c0b7288bd0e6f9f56bd0b20d0657214b91838",
"url": "https://api.github.com/repos/thephpleague/commonmark/zipball/19fb96643beba24e681c371dc133e25409742664",
"reference": "19fb96643beba24e681c371dc133e25409742664",
"shasum": ""
},
"require": {
@ -1061,7 +1061,7 @@
"require-dev": {
"cebe/markdown": "~1.0",
"erusev/parsedown": "~1.0",
"jgm/commonmark": "0.25",
"jgm/commonmark": "0.26",
"michelf/php-markdown": "~1.4",
"mikehaertl/php-shellcommand": "~1.2.0",
"phpunit/phpunit": "~4.3|~5.0",
@ -1077,7 +1077,7 @@
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "0.15-dev"
"dev-master": "0.16-dev"
}
},
"autoload": {
@ -1104,7 +1104,7 @@
"markdown",
"parser"
],
"time": "2016-07-02 18:48:39"
"time": "2016-09-14 15:44:35"
},
{
"name": "league/csv",
@ -2014,7 +2014,7 @@
},
{
"name": "symfony/event-dispatcher",
"version": "v3.1.3",
"version": "v3.1.4",
"source": {
"type": "git",
"url": "https://github.com/symfony/event-dispatcher.git",
@ -4240,16 +4240,16 @@
},
{
"name": "symfony/class-loader",
"version": "v3.1.3",
"version": "v3.1.4",
"source": {
"type": "git",
"url": "https://github.com/symfony/class-loader.git",
"reference": "817f09b4c37b7688fa4342cb4642d8f2d81c1097"
"reference": "2d0ba77c46ecc96a6641009a98f72632216811ba"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/class-loader/zipball/817f09b4c37b7688fa4342cb4642d8f2d81c1097",
"reference": "817f09b4c37b7688fa4342cb4642d8f2d81c1097",
"url": "https://api.github.com/repos/symfony/class-loader/zipball/2d0ba77c46ecc96a6641009a98f72632216811ba",
"reference": "2d0ba77c46ecc96a6641009a98f72632216811ba",
"shasum": ""
},
"require": {
@ -4292,7 +4292,7 @@
],
"description": "Symfony ClassLoader Component",
"homepage": "https://symfony.com",
"time": "2016-07-10 08:05:47"
"time": "2016-08-23 13:39:15"
},
{
"name": "symfony/css-selector",
@ -4405,16 +4405,16 @@
},
{
"name": "symfony/yaml",
"version": "v3.1.3",
"version": "v3.1.4",
"source": {
"type": "git",
"url": "https://github.com/symfony/yaml.git",
"reference": "1819adf2066880c7967df7180f4f662b6f0567ac"
"reference": "f291ed25eb1435bddbe8a96caaef16469c2a092d"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/symfony/yaml/zipball/1819adf2066880c7967df7180f4f662b6f0567ac",
"reference": "1819adf2066880c7967df7180f4f662b6f0567ac",
"url": "https://api.github.com/repos/symfony/yaml/zipball/f291ed25eb1435bddbe8a96caaef16469c2a092d",
"reference": "f291ed25eb1435bddbe8a96caaef16469c2a092d",
"shasum": ""
},
"require": {
@ -4450,7 +4450,7 @@
],
"description": "Symfony Yaml Component",
"homepage": "https://symfony.com",
"time": "2016-07-17 14:02:08"
"time": "2016-09-02 02:12:52"
},
{
"name": "webmozart/assert",

View File

@ -10,7 +10,7 @@ return [
],
'chart' => 'chartjs',
'version' => '3.10.3',
'version' => '3.10.4',
'csv_import_enabled' => true,
'maxUploadSize' => 5242880,
'allowedMimes' => ['image/png', 'image/jpeg', 'application/pdf'],

View File

@ -13,23 +13,9 @@ declare(strict_types = 1);
return [
'text' => [
'3.7.0' => 'Because of the upgrade to Laravel 5.2, several manual changes must be made to your Firefly III installation. ' .
'Please follow the instructions on the following page: https://github.com/JC5/firefly-iii/wiki/Upgrade-to-3.7.0',
'3.7.1' => 'Because of the upgrade to Laravel 5.2, several manual changes must be made to your Firefly III installation. ' .
'Please follow the instructions on the following page: https://github.com/JC5/firefly-iii/wiki/Upgrade-to-3.7.0',
'3.7.2' => 'Because of the upgrade to Laravel 5.2, several manual changes must be made to your Firefly III installation. ' .
'Please follow the instructions on the following page: https://github.com/JC5/firefly-iii/wiki/Upgrade-to-3.7.0',
'3.7.2.1' => 'Because of the upgrade to Laravel 5.2, several manual changes must be made to your Firefly III installation. ' .
'Please follow the instructions on the following page: https://github.com/JC5/firefly-iii/wiki/Upgrade-to-3.7.0',
'3.7.2.2' => 'Because of the upgrade to Laravel 5.2, several manual changes must be made to your Firefly III installation. ' .
'Please follow the instructions on the following page: https://github.com/JC5/firefly-iii/wiki/Upgrade-to-3.7.0',
'3.7.2.3' => 'Because of the upgrade to Laravel 5.2, several manual changes must be made to your Firefly III installation. ' .
'Please follow the instructions on the following page: https://github.com/JC5/firefly-iii/wiki/Upgrade-to-3.7.0',
'3.8.0' => 'This version of Firefly III requires PHP 7.0.',
'3.8.1' => 'This version of Firefly III requires PHP 7.0.',
'3.10' => 'Please find the full upgrade instructions here: https://github.com/JC5/firefly-iii/wiki/Upgrade-to-3.10',
'3.10.1' => 'Please find the full upgrade instructions here: https://github.com/JC5/firefly-iii/wiki/Upgrade-to-3.10',
'3.10.2' => 'Please find the full upgrade instructions here: https://github.com/JC5/firefly-iii/wiki/Upgrade-to-3.10',
'3.10.3' => 'Please find the full upgrade instructions here: https://github.com/JC5/firefly-iii/wiki/Upgrade-to-3.10',
'3.7' => 'Because of the upgrade to Laravel 5.2, several manual changes must be made to your Firefly III installation. ' .
'Please follow the instructions on the following page: https://github.com/JC5/firefly-iii/wiki/Upgrade-to-3.7.0',
'3.8' => 'This version of Firefly III requires PHP 7.0.',
'3.10' => 'Please find the full upgrade instructions here: https://github.com/JC5/firefly-iii/wiki/Upgrade-to-3.10',
],
];

View File

@ -0,0 +1,41 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
/**
* Class FixNullables
*/
class FixNullables extends Migration
{
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
}
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table(
'rule_groups', function (Blueprint $table) {
$table->text('description')->nullable()->change();
}
);
Schema::table(
'rules', function (Blueprint $table) {
$table->text('description')->nullable()->change();
}
);
}
}