Some more last-minute fixes.

This commit is contained in:
James Cole
2019-08-09 20:33:57 +02:00
parent b09504d0f7
commit a248544641
7 changed files with 20 additions and 41 deletions

View File

@@ -177,7 +177,12 @@ class TransactionFactory
} }
// @codeCoverageIgnoreEnd // @codeCoverageIgnoreEnd
if (null !== $result) { if (null !== $result) {
Log::debug(sprintf('Created transaction #%d (%s %s), part of journal #%d', $result->id, $this->currency->code, $amount, $this->journal->id)); Log::debug(
sprintf(
'Created transaction #%d (%s %s, account %s), part of journal #%d', $result->id, $this->currency->code, $amount, $this->account->name,
$this->journal->id
)
);
// do foreign currency thing: add foreign currency info to $one and $two if necessary. // do foreign currency thing: add foreign currency info to $one and $two if necessary.
if (null !== $this->foreignCurrency && null !== $foreignAmount && $this->foreignCurrency->id !== $this->currency->id) { if (null !== $this->foreignCurrency && null !== $foreignAmount && $this->foreignCurrency->id !== $this->currency->id) {

View File

@@ -287,7 +287,7 @@ class TransactionJournalFactory
$destForeignCurrency = $foreignCurrency; $destForeignCurrency = $foreignCurrency;
} }
if ('Transfer' === $type->type) { if (TransactionType::TRANSFER === $type->type) {
// get currencies // get currencies
$currency = $this->getCurrency($currency, $sourceAccount); $currency = $this->getCurrency($currency, $sourceAccount);
$foreignCurrency = $this->getCurrency($foreignCurrency, $destinationAccount); $foreignCurrency = $this->getCurrency($foreignCurrency, $destinationAccount);
@@ -298,6 +298,11 @@ class TransactionJournalFactory
$destForeignCurrency = $currency; $destForeignCurrency = $currency;
} }
// if transfer, switch accounts:
if (TransactionType::TRANSFER === $type->type) {
[$sourceAccount, $destinationAccount] = [$destinationAccount, $sourceAccount];
}
/** Create a basic journal. */ /** Create a basic journal. */
$journal = TransactionJournal::create( $journal = TransactionJournal::create(
[ [

View File

@@ -73,7 +73,6 @@ class ShowController extends Controller
$type = $first->transactionType->type; $type = $first->transactionType->type;
$title = 1 === $splits ? $first->description : $transactionGroup->title; $title = 1 === $splits ? $first->description : $transactionGroup->title;
$subTitle = sprintf('%s: "%s"', $type, $title); $subTitle = sprintf('%s: "%s"', $type, $title);
$message = $request->get('message');
/** @var TransactionGroupTransformer $transformer */ /** @var TransactionGroupTransformer $transformer */
$transformer = app(TransactionGroupTransformer::class); $transformer = app(TransactionGroupTransformer::class);
@@ -91,7 +90,7 @@ class ShowController extends Controller
return view( return view(
'transactions.show', compact( 'transactions.show', compact(
'transactionGroup', 'amounts', 'first', 'type', 'subTitle', 'splits', 'groupArray', 'transactionGroup', 'amounts', 'first', 'type', 'subTitle', 'splits', 'groupArray',
'events', 'attachments', 'links', 'message' 'events', 'attachments', 'links'
) )
); );
} }

View File

@@ -459,8 +459,9 @@ class ImportArrayStorage
// compare date: // compare date:
$transferDate = $transfer['date']->format('Y-m-d H:i:s'); $transferDate = $transfer['date']->format('Y-m-d H:i:s');
Log::debug(sprintf('Comparing dates "%s" to "%s"', $transaction['date'], $transferDate)); $transactionDate = $transaction['date']->format('Y-m-d H:i:s');
if ($transaction['date'] !== $transferDate) { Log::debug(sprintf('Comparing dates "%s" to "%s"', $transactionDate, $transferDate));
if ($transactionDate !== $transferDate) {
Log::debug('Date is not a match, continue with next transfer.'); Log::debug('Date is not a match, continue with next transfer.');
continue; // @codeCoverageIgnore continue; // @codeCoverageIgnore
} }

View File

@@ -120,7 +120,6 @@ class ImportableConverter
// amount is positive? Then switch: // amount is positive? Then switch:
if (1 === bccomp($amount, '0')) { if (1 === bccomp($amount, '0')) {
[$destination, $source] = [$source, $destination]; [$destination, $source] = [$source, $destination];
Log::debug( Log::debug(
sprintf( sprintf(

View File

@@ -10,7 +10,7 @@
{% if periods|length > 0 %} {% if periods|length > 0 %}
<div class="row"> <div class="row">
<div class="col-lg-offset-10 col-lg-2 col-md-offset-10 col-md-2 col-sm-12 col-xs-12"> <div class="col-lg-offset-10 col-lg-2 col-md-offset-10 col-md-2 col-sm-12 col-xs-12">
<p class="small text-center"><a href="{{ route('transactions.index.all',[transactionType]) }}">{{ 'showEverything'|_ }}</a></p> <p class="small text-center"><a href="{{ route('transactions.index.all',[objectType]) }}">{{ 'showEverything'|_ }}</a></p>
</div> </div>
</div> </div>
{% endif %} {% endif %}
@@ -34,12 +34,12 @@
{% if periods|length > 0 %} {% if periods|length > 0 %}
<p> <p>
<i class="fa fa-calendar"></i> <i class="fa fa-calendar"></i>
<a href="{{ route('transactions.index.all', [transactionType]) }}">{{ 'show_all_no_filter'|_ }}</a> <a href="{{ route('transactions.index.all', [objectType]) }}">{{ 'show_all_no_filter'|_ }}</a>
</p> </p>
{% else %} {% else %}
<p> <p>
<i class="fa fa-calendar"></i> <i class="fa fa-calendar"></i>
<a href="{{ route('transactions.index', [transactionType]) }}">{{ 'show_the_current_period_and_overview'|_ }}</a> <a href="{{ route('transactions.index', [objectType]) }}">{{ 'show_the_current_period_and_overview'|_ }}</a>
</p> </p>
{% endif %} {% endif %}
</div> </div>
@@ -59,7 +59,7 @@
{% if periods|length > 0 %} {% if periods|length > 0 %}
<div class="row"> <div class="row">
<div class="col-lg-offset-10 col-lg-2 col-md-offset-10 col-md-2 col-sm-12 col-xs-12"> <div class="col-lg-offset-10 col-lg-2 col-md-offset-10 col-md-2 col-sm-12 col-xs-12">
<p class="small text-center"><a href="{{ route('transactions.index.all',[transactionType]) }}">{{ 'showEverything'|_ }}</a></p> <p class="small text-center"><a href="{{ route('transactions.index.all', [objectType]) }}">{{ 'showEverything'|_ }}</a></p>
</div> </div>
</div> </div>
{% endif %} {% endif %}

View File

@@ -5,36 +5,6 @@
{% endblock %} {% endblock %}
{% block content %} {% block content %}
{% if message == 'created' %}
<div class="row">
<div class="col-lg-12">
<div class="alert alert-success alert-dismissible" role="alert">
<button type="button" class="close" data-dismiss="alert">
<span>&times;</span><span class="sr-only">{{ 'close'|_ }}</span>
</button>
<strong>{{ 'flash_success'|_ }}</strong>
{{ trans('firefly.stored_journal_no_descr') }}
</div>
</div>
</div>
{% endif %}
{% if message == 'updated' %}
<div class="row">
<div class="col-lg-12">
<div class="alert alert-success alert-dismissible" role="alert">
<button type="button" class="close" data-dismiss="alert">
<span>&times;</span><span class="sr-only">{{ 'close'|_ }}</span>
</button>
<strong>{{ 'flash_success'|_ }}</strong>
{{ trans('firefly.updated_journal_no_descr') }}
</div>
</div>
</div>
{% endif %}
<div class="row"> <div class="row">
<div class="col-lg-6"> <div class="col-lg-6">
<div class="box box-primary"> <div class="box box-primary">