Merge branch 'hotfix/4.6.3.1' into develop

This commit is contained in:
James Cole 2017-07-23 20:02:46 +02:00
commit 650f0ee752
9 changed files with 82 additions and 45 deletions

View File

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

View File

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

View File

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

View File

@ -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.
*

View File

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

View File

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

View File

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

View File

@ -11,24 +11,23 @@
<div class="{{ boxClasses }}" id="box_out_holder">
<div class="info-box">
<span class="info-box-icon bg-red">
<i class="fa fa-upload fa-fw"></i>
<a href="{{ route('transactions.index',['withdrawal']) }}"><i class="fa fa-upload fa-fw"></i></a>
</span>
<div class="info-box-content">
<span class="info-box-text">{{ 'moneyOut'|_ }}</span>
<span class="info-box-number" id="box-out"></span>
<span class="info-box-text"><a href="{{ route('transactions.index',['withdrawal']) }}">{{ 'moneyOut'|_ }}</a></span>
<span class="info-box-number"><a href="{{ route('transactions.index',['withdrawal']) }}" id="box-out"></a></span>
</div>
</div>
</div>
<div class="{{ boxClasses }}">
<div class="info-box">
<span class="info-box-icon bg-green">
<i class="fa fa-download faw-fw"></i>
<a href="{{ route('transactions.index',['deposit']) }}"><i class="fa fa-download faw-fw"></i></a>
</span>
<div class="info-box-content">
<span class="info-box-text">{{ 'moneyIn'|_ }}</span>
<span class="info-box-number" id="box-in"></span>
<span class="info-box-text"><a href="{{ route('transactions.index',['deposit']) }}">{{ 'moneyIn'|_ }}</a></span>
<span class="info-box-number"><a href="{{ route('transactions.index',['deposit']) }}" id="box-in"></a></span>
</div>
</div>
</div>
@ -38,24 +37,24 @@
<div class="{{ boxClasses }}">
<div class="info-box">
<span class="info-box-icon bg-blue">
<i class="fa fa-calendar fa-fw"></i>
<a href="{{ route('bills.index') }}"><i class="fa fa-calendar fa-fw"></i></a>
</span>
<div class="info-box-content">
<span class="info-box-text">{{ 'billsToPay'|_ }}</span>
<span class="info-box-number" id="box-bills-unpaid"></span>
<span class="info-box-text"><a href="{{ route('bills.index') }}">{{ 'billsToPay'|_ }}</a></span>
<span class="info-box-number"><a id="box-bills-unpaid" href="{{ route('bills.index') }}"></a></span>
</div>
</div>
</div>
<div class="{{ boxClasses }}">
<div class="info-box">
<span class="info-box-icon bg-aqua">
<i class="fa fa-line-chart fa-fw"></i>
<a href="{{ route('bills.index') }}"><i class="fa fa-line-chart fa-fw"></i></a>
</span>
<div class="info-box-content">
<span class="info-box-text">{{ 'billsPaid'|_ }}</span>
<span class="info-box-number" id="box-bills-paid"></span>
<span class="info-box-text"><a href="{{ route('bills.index') }}">{{ 'billsPaid'|_ }}</a></span>
<span class="info-box-number"><a id="box-bills-paid" href="{{ route('bills.index') }}"></a></span>
</div>
</div>
</div>

View File

@ -111,7 +111,7 @@
title="{{ 'test_rule_triggers'|_ }}"><i data-id="{{ rule.id }}" class="fa fa-fw fa-flask"></i></a>
{# actually execute rule #}
<a href="{{ route('rules.select-transactions',ruleGroup.id) }}" class="btn btn-default"
<a href="{{ route('rules.select-transactions',rule.id) }}" class="btn btn-default"
title=" {{ trans('firefly.apply_rule_selection', {title: rule.title}) }}">
<i class="fa fa-fw fa-power-off "></i></a>
</div>