From ef9823035f937ed4f07afd20928572591a8221c4 Mon Sep 17 00:00:00 2001 From: James Cole Date: Tue, 4 Jul 2017 16:03:00 +0200 Subject: [PATCH 1/4] Add if-statement to catch unset POST data. --- app/Support/Import/Configuration/Csv/Map.php | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/app/Support/Import/Configuration/Csv/Map.php b/app/Support/Import/Configuration/Csv/Map.php index eb51c04e4d..f4cb26670b 100644 --- a/app/Support/Import/Configuration/Csv/Map.php +++ b/app/Support/Import/Configuration/Csv/Map.php @@ -126,13 +126,14 @@ class Map implements ConfigurationInterface public function storeConfiguration(array $data): bool { $config = $this->job->configuration; - - foreach ($data['mapping'] as $index => $data) { - $config['column-mapping-config'][$index] = []; - foreach ($data as $value => $mapId) { - $mapId = intval($mapId); - if ($mapId !== 0) { - $config['column-mapping-config'][$index][$value] = intval($mapId); + if (isset($data['mapping'])) { + foreach ($data['mapping'] as $index => $data) { + $config['column-mapping-config'][$index] = []; + foreach ($data as $value => $mapId) { + $mapId = intval($mapId); + if ($mapId !== 0) { + $config['column-mapping-config'][$index][$value] = intval($mapId); + } } } } From a5270662167d27a5dbc381c499efb140cedcea9a Mon Sep 17 00:00:00 2001 From: James Cole Date: Tue, 4 Jul 2017 16:17:05 +0200 Subject: [PATCH 2/4] Add links to boxes for #688 --- public/css/firefly.css | 13 +++++++++++++ resources/views/partials/boxes.twig | 25 ++++++++++++------------- 2 files changed, 25 insertions(+), 13 deletions(-) diff --git a/public/css/firefly.css b/public/css/firefly.css index 80eea37df7..4957efdbfa 100644 --- a/public/css/firefly.css +++ b/public/css/firefly.css @@ -100,3 +100,16 @@ body.waiting * { float: none; display: inline-block; } + +span.info-box-text a, span.info-box-number a { + color: #000; +} + +span.info-box-icon a { + color: #fff; +} + +span.info-box-text a:hover, span.info-box-number a:hover { + color: #000; + text-decoration: underline; +} \ No newline at end of file diff --git a/resources/views/partials/boxes.twig b/resources/views/partials/boxes.twig index 5ec3003595..0e79ab31d0 100644 --- a/resources/views/partials/boxes.twig +++ b/resources/views/partials/boxes.twig @@ -11,24 +11,23 @@
- + -
- {{ 'moneyOut'|_ }} - + {{ 'moneyOut'|_ }} +
- +
- {{ 'moneyIn'|_ }} - + {{ 'moneyIn'|_ }} +
@@ -38,24 +37,24 @@
- +
- {{ 'billsToPay'|_ }} - + {{ 'billsToPay'|_ }} +
- +
- {{ 'billsPaid'|_ }} - + {{ 'billsPaid'|_ }} +
From 3a84591e615b8bf2e34bc906e73d41ee5b61db9c Mon Sep 17 00:00:00 2001 From: James Cole Date: Tue, 4 Jul 2017 16:31:16 +0200 Subject: [PATCH 3/4] Simplify edit transaction routine. --- .../Transaction/SingleController.php | 49 ++++++++++--------- .../Journal/JournalRepository.php | 10 ++++ .../Journal/JournalRepositoryInterface.php | 7 +++ 3 files changed, 43 insertions(+), 23 deletions(-) diff --git a/app/Http/Controllers/Transaction/SingleController.php b/app/Http/Controllers/Transaction/SingleController.php index 71b5bc9430..ca4bcc66f6 100644 --- a/app/Http/Controllers/Transaction/SingleController.php +++ b/app/Http/Controllers/Transaction/SingleController.php @@ -54,6 +54,9 @@ class SingleController extends Controller /** @var PiggyBankRepositoryInterface */ private $piggyBanks; + /** @var JournalRepositoryInterface */ + private $repository; + /** * */ @@ -74,6 +77,7 @@ class SingleController extends Controller $this->piggyBanks = app(PiggyBankRepositoryInterface::class); $this->attachments = app(AttachmentHelperInterface::class); $this->currency = app(CurrencyRepositoryInterface::class); + $this->repository = app(JournalRepositoryInterface::class); View::share('title', trans('firefly.transactions')); View::share('mainTitleIcon', 'fa-repeat'); @@ -196,7 +200,7 @@ class SingleController extends Controller * * @return \Illuminate\Http\RedirectResponse */ - public function destroy(JournalRepositoryInterface $repository, TransactionJournal $transactionJournal) + public function destroy(TransactionJournal $transactionJournal) { // @codeCoverageIgnoreStart if ($this->isOpeningBalance($transactionJournal)) { @@ -206,7 +210,7 @@ class SingleController extends Controller $type = $transactionJournal->transactionTypeStr(); Session::flash('success', strval(trans('firefly.deleted_' . strtolower($type), ['description' => e($transactionJournal->description)]))); - $repository->delete($transactionJournal); + $this->repository->delete($transactionJournal); Preferences::mark(); @@ -225,10 +229,7 @@ class SingleController extends Controller return $this->redirectToAccount($journal); } // @codeCoverageIgnoreEnd - - $count = $journal->transactions()->count(); - - if ($count > 2) { + if ($this->isSplitJournal($journal)) { return redirect(route('transactions.split.edit', [$journal->id])); } @@ -244,6 +245,7 @@ class SingleController extends Controller $destinationAccounts = $journal->destinationAccountList(); $optionalFields = Preferences::get('transaction_journal_optional_fields', [])->data; $pTransaction = $journal->positiveTransaction(); + $foreignCurrency = !is_null($pTransaction->foreignCurrency) ? $pTransaction->foreignCurrency : $pTransaction->transactionCurrency; $preFilled = [ 'date' => $journal->dateAsString(), 'interest_date' => $journal->dateAsString('interest_date'), @@ -272,8 +274,8 @@ class SingleController extends Controller 'currency' => $pTransaction->transactionCurrency, 'source_currency' => $pTransaction->transactionCurrency, 'native_currency' => $pTransaction->transactionCurrency, - 'foreign_currency' => !is_null($pTransaction->foreignCurrency) ? $pTransaction->foreignCurrency : $pTransaction->transactionCurrency, - 'destination_currency' => !is_null($pTransaction->foreignCurrency) ? $pTransaction->foreignCurrency : $pTransaction->transactionCurrency, + 'foreign_currency' => $foreignCurrency, + 'destination_currency' => $foreignCurrency, ]; // amounts for withdrawals and deposits: @@ -283,21 +285,6 @@ class SingleController extends Controller $preFilled['currency'] = $pTransaction->foreignCurrency; } - if ($journal->isTransfer() && !is_null($pTransaction->foreign_amount)) { - $preFilled['destination_amount'] = $pTransaction->foreign_amount; - $preFilled['destination_currency'] = $pTransaction->foreignCurrency; - } - - // fixes for cash accounts: - if ($journal->isWithdrawal() && $destinationAccounts->first()->accountType->type === AccountType::CASH) { - $preFilled['destination_account_name'] = ''; - } - - if ($journal->isDeposit() && $sourceAccounts->first()->accountType->type === AccountType::CASH) { - $preFilled['source_account_name'] = ''; - } - - Session::flash('preFilled', $preFilled); Session::flash('gaEventCategory', 'transactions'); Session::flash('gaEventAction', 'edit-' . $what); @@ -416,4 +403,20 @@ class SingleController extends Controller // redirect to previous URL. return redirect($this->getPreviousUri('transactions.edit.uri')); } + + /** + * @param TransactionJournal $journal + * + * @return bool + */ + private function isSplitJournal(TransactionJournal $journal): bool + { + $count = $this->repository->countTransactions($journal); + + if ($count > 2) { + return true; + } + + return false; + } } diff --git a/app/Repositories/Journal/JournalRepository.php b/app/Repositories/Journal/JournalRepository.php index 774ae77947..58bde274d0 100644 --- a/app/Repositories/Journal/JournalRepository.php +++ b/app/Repositories/Journal/JournalRepository.php @@ -76,6 +76,16 @@ class JournalRepository implements JournalRepositoryInterface return new MessageBag; } + /** + * @param TransactionJournal $journal + * + * @return int + */ + public function countTransactions(TransactionJournal $journal): int + { + return $journal->transactions()->count(); + } + /** * @param TransactionJournal $journal * diff --git a/app/Repositories/Journal/JournalRepositoryInterface.php b/app/Repositories/Journal/JournalRepositoryInterface.php index 028f2d52d7..38cab6f131 100644 --- a/app/Repositories/Journal/JournalRepositoryInterface.php +++ b/app/Repositories/Journal/JournalRepositoryInterface.php @@ -38,6 +38,13 @@ interface JournalRepositoryInterface */ public function convert(TransactionJournal $journal, TransactionType $type, Account $source, Account $destination): MessageBag; + /** + * @param TransactionJournal $journal + * + * @return int + */ + public function countTransactions(TransactionJournal $journal): int; + /** * Deletes a journal. * From d45c74915ca2a968297774c293570438d5f9a787 Mon Sep 17 00:00:00 2001 From: James Cole Date: Sun, 23 Jul 2017 20:02:32 +0200 Subject: [PATCH 4/4] This fixes #715 --- CHANGELOG.md | 4 ++++ config/firefly.php | 2 +- resources/views/rules/index.twig | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9c1e52cae3..84bf414904 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ All notable changes to this project will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org/). +## [4.6.3.1] - 2017-07-23 +### Fixed +- Hotfix to close issue #715 + ## [4.6.3] - 2017-07-23 diff --git a/config/firefly.php b/config/firefly.php index 7176320a68..742edb35be 100644 --- a/config/firefly.php +++ b/config/firefly.php @@ -23,7 +23,7 @@ return [ 'is_demo_site' => false, ], 'encryption' => (is_null(env('USE_ENCRYPTION')) || env('USE_ENCRYPTION') === true), - 'version' => '4.6.3', + 'version' => '4.6.3.1', 'maxUploadSize' => 15242880, 'allowedMimes' => ['image/png', 'image/jpeg', 'application/pdf'], 'list_length' => 10, diff --git a/resources/views/rules/index.twig b/resources/views/rules/index.twig index 72db68f64a..2a4c8c8ffd 100644 --- a/resources/views/rules/index.twig +++ b/resources/views/rules/index.twig @@ -111,7 +111,7 @@ title="{{ 'test_rule_triggers'|_ }}"> {# actually execute rule #} -