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/app/Http/Controllers/Transaction/SingleController.php b/app/Http/Controllers/Transaction/SingleController.php index 936619c393..b3e23c25a8 100644 --- a/app/Http/Controllers/Transaction/SingleController.php +++ b/app/Http/Controllers/Transaction/SingleController.php @@ -55,6 +55,9 @@ class SingleController extends Controller /** @var PiggyBankRepositoryInterface */ private $piggyBanks; + /** @var JournalRepositoryInterface */ + private $repository; + /** * */ @@ -75,6 +78,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'); @@ -200,7 +204,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)) { @@ -210,7 +214,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(); @@ -229,10 +233,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])); } @@ -248,6 +249,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'), @@ -276,8 +278,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: @@ -287,21 +289,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); @@ -420,4 +407,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. * diff --git a/app/Support/Import/Configuration/Csv/Map.php b/app/Support/Import/Configuration/Csv/Map.php index f9cae51a0c..22016210da 100644 --- a/app/Support/Import/Configuration/Csv/Map.php +++ b/app/Support/Import/Configuration/Csv/Map.php @@ -128,13 +128,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); + } } } } 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/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 3dbf703994..d7d27e2a11 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'|_ }} +
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 #} -