From 6d4956b5748818c06b7f01e4aacd1b829e83469a Mon Sep 17 00:00:00 2001 From: James Cole Date: Sat, 28 Jul 2018 12:10:25 +0200 Subject: [PATCH] Updated files for 4.7.5.2 --- .sandstorm/changelog.md | 14 +++++ .sandstorm/sandstorm-pkgdef.capnp | 4 +- app/Support/Amount.php | 2 +- changelog.md | 18 +++++- composer.lock | 39 ++++++------- config/firefly.php | 4 +- resources/lang/fr_FR/firefly.php | 2 +- tests/Unit/Middleware/BinderTest.php | 57 +++++++++++++++---- .../Triggers/BudgetIsTest.php | 3 + .../Triggers/CategoryIsTest.php | 6 +- 10 files changed, 109 insertions(+), 40 deletions(-) diff --git a/.sandstorm/changelog.md b/.sandstorm/changelog.md index 0019fa8391..1da400992f 100644 --- a/.sandstorm/changelog.md +++ b/.sandstorm/changelog.md @@ -1,3 +1,17 @@ +# 4.7.5.2 +- [Issue 1527](https://github.com/firefly-iii/firefly-iii/issues/1527), fixed views for transactions without a budget. +- [Issue 1553](https://github.com/firefly-iii/firefly-iii/issues/1553), report could not handle transactions before the first one in the system. +- [Issue 1549](https://github.com/firefly-iii/firefly-iii/issues/1549) update a budget will also update any rules that refer to that budget. +- [Issue 1530](https://github.com/firefly-iii/firefly-iii/issues/1530), fix issue with bill chart. +- [Issue 1563](https://github.com/firefly-iii/firefly-iii/issues/1563), fix piggy bank suggested amount +- [Issue 1571](https://github.com/firefly-iii/firefly-iii/issues/1571), fix OAuth in Sandstorm +- [Issue 1568](https://github.com/firefly-iii/firefly-iii/issues/1568), bug in Sandstorm user code. +- [Issue 1569](https://github.com/firefly-iii/firefly-iii/issues/1569), optimized Sandstorm build by [ocdtrekkie](https://github.com/ocdtrekkie) +- Fixed a bug where transfers would be stored inversely when using the CSV import. +- Retired the "Rabobank description"-fix, because it is no longer necessary. +- Fixed a bug where users could not delete budget limits in the API. +- Piggy bank notes are visible again. + # 4.7.5.1 - [Issue 1531](https://github.com/firefly-iii/firefly-iii/issues/1531), the database routine incorrectly reports empty categories. - [Issue 1532](https://github.com/firefly-iii/firefly-iii/issues/1532), broken dropdown for autosuggest things. diff --git a/.sandstorm/sandstorm-pkgdef.capnp b/.sandstorm/sandstorm-pkgdef.capnp index 211be58c8a..f91c2a0734 100644 --- a/.sandstorm/sandstorm-pkgdef.capnp +++ b/.sandstorm/sandstorm-pkgdef.capnp @@ -15,8 +15,8 @@ const pkgdef :Spk.PackageDefinition = ( manifest = ( appTitle = (defaultText = "Firefly III"), - appVersion = 14, - appMarketingVersion = (defaultText = "4.7.5.1"), + appVersion = 15, + appMarketingVersion = (defaultText = "4.7.5.2"), actions = [ # Define your "new document" handlers here. diff --git a/app/Support/Amount.php b/app/Support/Amount.php index 3f25d0f567..48c98cc177 100644 --- a/app/Support/Amount.php +++ b/app/Support/Amount.php @@ -135,7 +135,7 @@ class Amount $precedes = $amount < 0 ? $info['n_cs_precedes'] : $info['p_cs_precedes']; $separated = $amount < 0 ? $info['n_sep_by_space'] : $info['p_sep_by_space']; $space = $separated === true ? ' ' : ''; - $result = $precedes === true ? $format->symbol . $space . $formatted : $formatted . $space . $format->symbol; + $result = $precedes === false ? $formatted . $space . $format->symbol : $format->symbol . $space . $formatted; if (true === $coloured) { if ($amount > 0) { diff --git a/changelog.md b/changelog.md index 2428f80323..b9c69958c7 100644 --- a/changelog.md +++ b/changelog.md @@ -2,9 +2,23 @@ All notable changes to this project will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org/). -Many updated French translations thanks to https://crowdin.com/profile/bubka - +## [4.7.5.2] - 2017-07-28 +### Added +- Many updated French translations thanks to [@bubka](https://crowdin.com/profile/bubka). +### Fixed +- [Issue 1527](https://github.com/firefly-iii/firefly-iii/issues/1527), fixed views for transactions without a budget. +- [Issue 1553](https://github.com/firefly-iii/firefly-iii/issues/1553), report could not handle transactions before the first one in the system. +- [Issue 1549](https://github.com/firefly-iii/firefly-iii/issues/1549) update a budget will also update any rules that refer to that budget. +- [Issue 1530](https://github.com/firefly-iii/firefly-iii/issues/1530), fix issue with bill chart. +- [Issue 1563](https://github.com/firefly-iii/firefly-iii/issues/1563), fix piggy bank suggested amount +- [Issue 1571](https://github.com/firefly-iii/firefly-iii/issues/1571), fix OAuth in Sandstorm +- [Issue 1568](https://github.com/firefly-iii/firefly-iii/issues/1568), bug in Sandstorm user code. +- [Issue 1569](https://github.com/firefly-iii/firefly-iii/issues/1569), optimized Sandstorm build by [ocdtrekkie](https://github.com/ocdtrekkie) +- Fixed a bug where transfers would be stored inversely when using the CSV import. +- Retired the "Rabobank description"-fix, because it is no longer necessary. +- Fixed a bug where users could not delete budget limits in the API. +- Piggy bank notes are visible again. ## [4.7.5.1] - 2018-07-14 ### Fixed diff --git a/composer.lock b/composer.lock index acd955e4ec..7ecd5c1198 100644 --- a/composer.lock +++ b/composer.lock @@ -74,11 +74,12 @@ "php": "^7.0.13" }, "require-dev": { + "brianium/paratest": "^1.1", "friendsofphp/php-cs-fixer": "^2.4", "jakub-onderka/php-parallel-lint": "^0.9.2", "phpro/grumphp": "^0.11.6", "phpstan/phpstan": "^0.8", - "phpunit/phpunit": "^5.7", + "phpunit/phpunit": "^6.0.13", "sebastian/phpcpd": "^3.0", "sensiolabs/security-checker": "^4.1" }, @@ -113,7 +114,7 @@ "payment", "sepa" ], - "time": "2018-05-30T09:01:50+00:00" + "time": "2018-07-24T18:37:12+00:00" }, { "name": "davejamesmiller/laravel-breadcrumbs", @@ -176,21 +177,21 @@ }, { "name": "defuse/php-encryption", - "version": "v2.2.0", + "version": "v2.2.1", "source": { "type": "git", "url": "https://github.com/defuse/php-encryption.git", - "reference": "0d4d27c368ca6798bc162469e43248c363c73495" + "reference": "0f407c43b953d571421e0020ba92082ed5fb7620" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/defuse/php-encryption/zipball/0d4d27c368ca6798bc162469e43248c363c73495", - "reference": "0d4d27c368ca6798bc162469e43248c363c73495", + "url": "https://api.github.com/repos/defuse/php-encryption/zipball/0f407c43b953d571421e0020ba92082ed5fb7620", + "reference": "0f407c43b953d571421e0020ba92082ed5fb7620", "shasum": "" }, "require": { "ext-openssl": "*", - "paragonie/random_compat": "~2.0", + "paragonie/random_compat": ">= 2", "php": ">=5.4.0" }, "require-dev": { @@ -235,7 +236,7 @@ "security", "symmetric key cryptography" ], - "time": "2018-04-23T19:33:40+00:00" + "time": "2018-07-24T23:27:56+00:00" }, { "name": "doctrine/cache", @@ -1020,16 +1021,16 @@ }, { "name": "laravel/framework", - "version": "v5.6.28", + "version": "v5.6.29", "source": { "type": "git", "url": "https://github.com/laravel/framework.git", - "reference": "40ba2ee0e61cb4bc3c9f1dab04908e6acf06b86f" + "reference": "acc6b5c54ab196d3358f60acc5f55d9ebaaccc02" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/framework/zipball/40ba2ee0e61cb4bc3c9f1dab04908e6acf06b86f", - "reference": "40ba2ee0e61cb4bc3c9f1dab04908e6acf06b86f", + "url": "https://api.github.com/repos/laravel/framework/zipball/acc6b5c54ab196d3358f60acc5f55d9ebaaccc02", + "reference": "acc6b5c54ab196d3358f60acc5f55d9ebaaccc02", "shasum": "" }, "require": { @@ -1155,7 +1156,7 @@ "framework", "laravel" ], - "time": "2018-07-17T14:15:36+00:00" + "time": "2018-07-26T16:01:26+00:00" }, { "name": "laravel/passport", @@ -3829,16 +3830,16 @@ }, { "name": "zendframework/zend-diactoros", - "version": "1.8.2", + "version": "1.8.3", "source": { "type": "git", "url": "https://github.com/zendframework/zend-diactoros.git", - "reference": "273c18bf6aaab20be9667a3aa4e7702e1e4e7ced" + "reference": "72c13834fb3db2a962e913758b384ff2e6425d6e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/zendframework/zend-diactoros/zipball/273c18bf6aaab20be9667a3aa4e7702e1e4e7ced", - "reference": "273c18bf6aaab20be9667a3aa4e7702e1e4e7ced", + "url": "https://api.github.com/repos/zendframework/zend-diactoros/zipball/72c13834fb3db2a962e913758b384ff2e6425d6e", + "reference": "72c13834fb3db2a962e913758b384ff2e6425d6e", "shasum": "" }, "require": { @@ -3851,7 +3852,7 @@ "require-dev": { "ext-dom": "*", "ext-libxml": "*", - "phpunit/phpunit": "^5.7.16 || ^6.0.8", + "phpunit/phpunit": "^5.7.16 || ^6.0.8 || ^7.2.7", "zendframework/zend-coding-standard": "~1.0" }, "type": "library", @@ -3888,7 +3889,7 @@ "psr", "psr-7" ], - "time": "2018-07-19T18:38:31+00:00" + "time": "2018-07-24T21:54:38+00:00" } ], "packages-dev": [ diff --git a/config/firefly.php b/config/firefly.php index d4b52be4a5..11a2c6aa22 100644 --- a/config/firefly.php +++ b/config/firefly.php @@ -88,8 +88,8 @@ return [ 'is_demo_site' => false, ], 'encryption' => null === env('USE_ENCRYPTION') || env('USE_ENCRYPTION') === true, - 'version' => '4.7.5.1', - 'api_version' => '0.5', + 'version' => '4.7.5.2', + 'api_version' => '0.6', 'db_version' => 4, 'maxUploadSize' => 15242880, 'allowedMimes' => [ diff --git a/resources/lang/fr_FR/firefly.php b/resources/lang/fr_FR/firefly.php index c48142c504..9a812d40da 100644 --- a/resources/lang/fr_FR/firefly.php +++ b/resources/lang/fr_FR/firefly.php @@ -1014,7 +1014,7 @@ return [ 'sum_of_piggy_banks' => 'Somme des tirelires', 'saved_so_far' => 'Mis de côté jusqu\'à présent', 'left_to_save' => 'Reste à mettre de côté', - 'suggested_amount' => 'Montant mensuel suggéré à enregistrer', + 'suggested_amount' => 'Montant mensuel suggéré à économiser', 'add_money_to_piggy_title' => 'Ajouter de l’argent à la tirelire ":name"', 'remove_money_from_piggy_title' => 'Retirer l’argent de la tirelire ":name"', 'add' => 'Ajouter', diff --git a/tests/Unit/Middleware/BinderTest.php b/tests/Unit/Middleware/BinderTest.php index 9f4c796af8..1558a05b9c 100644 --- a/tests/Unit/Middleware/BinderTest.php +++ b/tests/Unit/Middleware/BinderTest.php @@ -532,6 +532,13 @@ class BinderTest extends TestCase return 'date: ' . $date->format('Y-m-d'); } ); + + // mock fiscal helper: + $date = new Carbon; + $helper = $this->mock(FiscalHelperInterface::class); + $helper->shouldReceive('endOfFiscalYear')->andReturn($date)->once(); + $helper->shouldReceive('startOfFiscalYear')->andReturn($date)->once(); + $this->be($this->user()); $response = $this->get('/_test/binder/20170917'); $this->assertEquals(Response::HTTP_OK, $response->getStatusCode()); @@ -549,11 +556,17 @@ class BinderTest extends TestCase return 'date: ' . $date->format('Y-m-d'); } ); + $date = new Carbon; + $date->endOfMonth(); + + // mock fiscal helper: + $helper = $this->mock(FiscalHelperInterface::class); + $helper->shouldReceive('endOfFiscalYear')->andReturn($date)->once(); + $helper->shouldReceive('startOfFiscalYear')->andReturn($date)->once(); + $this->be($this->user()); $response = $this->get('/_test/binder/currentMonthEnd'); $this->assertEquals(Response::HTTP_OK, $response->getStatusCode()); - $date = new Carbon; - $date->endOfMonth(); $response->assertSee('date: ' . $date->format('Y-m-d')); } @@ -568,11 +581,17 @@ class BinderTest extends TestCase return 'date: ' . $date->format('Y-m-d'); } ); + $date = new Carbon; + $date->startOfMonth(); + + // mock fiscal helper: + $helper = $this->mock(FiscalHelperInterface::class); + $helper->shouldReceive('endOfFiscalYear')->andReturn($date)->once(); + $helper->shouldReceive('startOfFiscalYear')->andReturn($date)->once(); + $this->be($this->user()); $response = $this->get('/_test/binder/currentMonthStart'); $this->assertEquals(Response::HTTP_OK, $response->getStatusCode()); - $date = new Carbon; - $date->startOfMonth(); $response->assertSee('date: ' . $date->format('Y-m-d')); } @@ -587,11 +606,17 @@ class BinderTest extends TestCase return 'date: ' . $date->format('Y-m-d'); } ); + $date = new Carbon; + $date->endOfYear(); + + // mock fiscal helper: + $helper = $this->mock(FiscalHelperInterface::class); + $helper->shouldReceive('endOfFiscalYear')->andReturn($date)->once(); + $helper->shouldReceive('startOfFiscalYear')->andReturn($date)->once(); + $this->be($this->user()); $response = $this->get('/_test/binder/currentYearEnd'); $this->assertEquals(Response::HTTP_OK, $response->getStatusCode()); - $date = new Carbon; - $date->endOfYear(); $response->assertSee('date: ' . $date->format('Y-m-d')); } @@ -601,16 +626,22 @@ class BinderTest extends TestCase */ public function testDateCurrentYearStart(): void { + $date = new Carbon; + $date->startOfYear(); Route::middleware(Binder::class)->any( '/_test/binder/{date}', function (Carbon $date) { return 'date: ' . $date->format('Y-m-d'); } ); + + // mock fiscal helper: + $helper = $this->mock(FiscalHelperInterface::class); + $helper->shouldReceive('endOfFiscalYear')->andReturn($date)->once(); + $helper->shouldReceive('startOfFiscalYear')->andReturn($date)->once(); + $this->be($this->user()); $response = $this->get('/_test/binder/currentYearStart'); $this->assertEquals(Response::HTTP_OK, $response->getStatusCode()); - $date = new Carbon; - $date->startOfYear(); $response->assertSee('date: ' . $date->format('Y-m-d')); } @@ -632,11 +663,11 @@ class BinderTest extends TestCase // mock fiscal helper: $helper = $this->mock(FiscalHelperInterface::class); $helper->shouldReceive('endOfFiscalYear')->andReturn($date)->once(); + $helper->shouldReceive('startOfFiscalYear')->andReturn($date)->once(); $this->be($this->user()); $response = $this->get('/_test/binder/currentFiscalYearEnd'); $this->assertEquals(Response::HTTP_OK, $response->getStatusCode()); - $response->assertSee('date: ' . $date->format('Y-m-d')); } @@ -657,12 +688,12 @@ class BinderTest extends TestCase // mock fiscal helper: $helper = $this->mock(FiscalHelperInterface::class); + $helper->shouldReceive('endOfFiscalYear')->andReturn($date)->once(); $helper->shouldReceive('startOfFiscalYear')->andReturn($date)->once(); $this->be($this->user()); $response = $this->get('/_test/binder/currentFiscalYearStart'); $this->assertEquals(Response::HTTP_OK, $response->getStatusCode()); - $response->assertSee('date: ' . $date->format('Y-m-d')); } @@ -677,6 +708,12 @@ class BinderTest extends TestCase return 'date: ' . $date->format('Y-m-d'); } ); + $date = new Carbon; + // mock fiscal helper: + $helper = $this->mock(FiscalHelperInterface::class); + $helper->shouldReceive('endOfFiscalYear')->andReturn($date)->once(); + $helper->shouldReceive('startOfFiscalYear')->andReturn($date)->once(); + $this->be($this->user()); $response = $this->get('/_test/binder/fakedate'); $this->assertEquals(Response::HTTP_NOT_FOUND, $response->getStatusCode()); diff --git a/tests/Unit/TransactionRules/Triggers/BudgetIsTest.php b/tests/Unit/TransactionRules/Triggers/BudgetIsTest.php index 871d608ada..54380e8da4 100644 --- a/tests/Unit/TransactionRules/Triggers/BudgetIsTest.php +++ b/tests/Unit/TransactionRules/Triggers/BudgetIsTest.php @@ -22,6 +22,7 @@ declare(strict_types=1); namespace Tests\Unit\TransactionRules\Triggers; +use FireflyIII\Models\Transaction; use FireflyIII\Models\TransactionJournal; use FireflyIII\TransactionRules\Triggers\BudgetIs; use Illuminate\Support\Collection; @@ -88,7 +89,9 @@ class BudgetIsTest extends TestCase $budget = $journal->user->budgets()->first(); $journal->budgets()->detach(); + /** @var Transaction $transaction */ foreach($transactions as $transaction) { + $transaction->budgets()->detach(); $transaction->budgets()->save($budget); $this->assertEquals(1, $transaction->budgets()->count()); } diff --git a/tests/Unit/TransactionRules/Triggers/CategoryIsTest.php b/tests/Unit/TransactionRules/Triggers/CategoryIsTest.php index 2fa9dad4ab..c5b7c5a086 100644 --- a/tests/Unit/TransactionRules/Triggers/CategoryIsTest.php +++ b/tests/Unit/TransactionRules/Triggers/CategoryIsTest.php @@ -39,7 +39,7 @@ class CategoryIsTest extends TestCase do { $journal = TransactionJournal::inRandomOrder()->whereNull('deleted_at')->first(); $transactions = $journal->transactions()->count(); - } while ($transactions === 0); + } while ($transactions !== 2); $category = $journal->user->categories()->first(); $journal->categories()->detach(); @@ -59,7 +59,7 @@ class CategoryIsTest extends TestCase do { $journal = TransactionJournal::inRandomOrder()->whereNull('deleted_at')->first(); $transactions = $journal->transactions()->count(); - } while ($transactions === 0); + } while ($transactions !== 2); $category = $journal->user->categories()->first(); $otherCategory = $journal->user->categories()->where('id', '!=', $category->id)->first(); @@ -80,7 +80,7 @@ class CategoryIsTest extends TestCase do { $journal = TransactionJournal::inRandomOrder()->whereNull('deleted_at')->first(); $transactions = $journal->transactions()->count(); - } while ($transactions === 0); + } while ($transactions !== 2); $transaction = $journal->transactions()->first(); $category = $journal->user->categories()->first();