Skip to content

Firefly III: a personal finances manager

Fix problem with type of transaction.

James Colecc56a981cd80
diff --git a/app/Http/Controllers/Transaction/ShowController.php b/app/Http/Controllers/Transaction/ShowController.php
index a8ef038532..246ac0c8ba 100644
--- a/app/Http/Controllers/Transaction/ShowController.php
+++ b/app/Http/Controllers/Transaction/ShowController.php
@@ -70,7 +70,7 @@ class ShowController extends Controller
/** @var TransactionJournal $first */
$first = $transactionGroup->transactionJournals->first();
$splits = $transactionGroup->transactionJournals->count();
- $type = (string)trans(sprintf('firefly.%s', strtolower($first->transactionType->type)));
+ $type = $first->transactionType->type;
$title = 1 === $splits ? $first->description : $transactionGroup->title;
$subTitle = sprintf('%s: "%s"', $type, $title);
$message = $request->get('message');
diff --git a/resources/views/v1/transactions/show.twig b/resources/views/v1/transactions/show.twig
index bd3e40fff7..cd579124df 100644
--- a/resources/views/v1/transactions/show.twig
+++ b/resources/views/v1/transactions/show.twig
@@ -201,6 +201,7 @@
<table class="table">
<tr>
<td colspan="2">
+ <!-- type is: "{{ type }}" -->
<a href="{{ route('accounts.show', journal.source_id) }}"
title="{{ journal.source_iban|default(journal.source_name) }}">{{ journal.source_name }}</a> &rarr;
{% if type == 'Withdrawal' or type == 'Deposit' %}
@@ -429,177 +430,3 @@
<script type="text/javascript" src="v1/js/ff/transactions/show.js?v={{ FF_VERSION }}"></script>
{% endblock %}
-{#
-
- {% if links.count > 0 %}
- <div class="box">
- <div class="box-header with-border">
- <h3 class="box-title">{{ 'journal_links'|_ }}</h3>
- </div>
- <div class="box-body table-responsive no-padding">
- <table class="table table-hover">
- {% for link in links %}
- <tr>
- <td>
- <div class="btn-group btn-group-xs">
- <a href="{{ route('transactions.link.delete', [link.id]) }}" class="btn btn-danger"><i class="fa fa-trash"></i></a>
- <a href="{{ route('transactions.link.switch', [link.id]) }}" class="btn btn-default"><i
- class="fa fa-fw fa-arrows-h"></i></a>
- </div>
- </td>
- <td>
- {{ ('this_'~(what|lower))|_ }}
- {% if link.source.id == journal.id %}
- {{ journalLinkTranslation('outward', link.linkType.outward) }}
- <a href="{{ route('transactions.show',link.destination.id) }}">
- #{{ link.destination.id }}: {{ link.destination.description }}
- </a>
- ({{ link.destination|journalTotalAmount }})
- {% else %}
- {{ journalLinkTranslation('inward', link.linkType.inward) }}
- <a href="{{ route('transactions.show',link.source.id) }}">
- #{{ link.source.id }}: {{ link.source.description }}</a>
- ({{ link.source|journalTotalAmount }})
- {% endif %}
- {% if link.notes.count == 1 %}
- <br/>
- {{ link.notes.first.text|markdown }}
- {% endif %}
- </td>
- </tr>
- {% endfor %}
- </table>
- </div>
- </div>
- <p>
-
- </p>
- {% endif %}
- </div>
-</div>
-<div class="row">
- <div class="col-lg-12 col-md-12 col-sm-12">
- <div class="box">
- <div class="box-header with-border">
- <h3 class="box-title">{{ 'transactions'|_ }}</h3>
- </div>
- <div class="box-body no-padding">
- <table class="table table-bordered table-striped">
- <thead>
- <tr>
- <th class="hidden-md hidden-sm hidden-xs">{{ trans('list.description') }}</th>
- <th>{{ trans('list.source_account') }}</th>
- <th>{{ trans('list.destination_account') }}</th>
- <th>{{ trans('list.amount') }}</th>
- <th class="hidden-md hidden-xs">{{ trans('list.budget') }}</th>
- <th class="hidden-md hidden-xs">{{ trans('list.category') }}</th>
- </tr>
- </thead>
- <tbody>
-
- {% set maxIdentifier = ((transactions|length) / 2) -1 %}
- {% for x in 0..maxIdentifier %}
- <tr>
- {% for transaction in transactions %}
- {% if
- ((transaction.type == 'Withdrawal') and transaction.identifier == x and transaction.amount < 0)
- or
- ((transaction.type == 'Deposit' or transaction.type == 'Transfer') and transaction.identifier == x and transaction.amount > 0) %}
- <td class="hidden-md hidden-sm hidden-xs">
- {% if transaction.description == "" %}
- {{ journal.description }}
- {% else %}
- {{ transaction.description }}
- {% endif %}
- </td>
- <td>
- {% if transaction.source_type == 'Cash account' %}
- <span class="text-success">({{ 'cash'|_ }})</span>
- {% else %}
- <a href="{{ route('accounts.show', transaction.source_id) }}">{{ transaction.source_name }}</a>
- {% endif %}
- </td>
- <td>
- {% if transaction.destination_type == 'Cash account' %}
- <span class="text-success">({{ 'cash'|_ }})</span>
- {% else %}
- <a href="{{ route('accounts.show', transaction.destination_id) }}">{{ transaction.destination_name }}</a>
- {% endif %}
-
- </td>
- <td>
- {{ transaction|transactionXArrayAmount }}
- </td>
- <td class="hidden-md hidden-xs">
- {% if transaction.budget_id %}
- <a href="{{ route('budgets.show', transaction.budget_id) }}"
- title="{{ transaction.budget_name }}">{{ transaction.budget_name }}</a>
- {% endif %}
- </td>
- <td class="hidden-md hidden-xs">
- {% if transaction.category_id %}
- <a href="{{ route('categories.show', transaction.category_id) }}"
- title="{{ transaction.category_name }}">{{ transaction.category_name }}</a>
- {% endif %}
- </td>
- {% endif %}
- {% endfor %}
-
- </tr>
- {% endfor %}
- </tbody>
- </table>
- </div>
- </div>
- </div>
-</div>
-
-<div class="modal fade" tabindex="-1" role="dialog" id="linkJournalModal">
- <form action="{{ route('transactions.link.store', [journal.id]) }}" method="post" class="form-horizontal">
- <input type="hidden" name="_token" value="{{ csrf_token() }}">
- <div class="modal-dialog modal-lg">
- <div class="modal-content">
- <div class="modal-header">
- <h4 class="modal-title">{{ 'link_to_other_transaction'|_ }}</h4>
- </div>
- <div class="modal-body" id="helpBody">
- <p>{{ 'select_transaction_to_link'|_ }}</p>
- <div class="form-group">
- <label for="link_type" class="col-sm-2 control-label">{{ 'this_transaction'|_ }}</label>
- <div class="col-sm-10">
- <select id="link_type" class="form-control" name="link_type">
- {% for linkType in linkTypes %}
- <option label="{{ journalLinkTranslation('inward', linkType.inward) }}"
- value="{{ linkType.id }}_inward">{{ journalLinkTranslation('inward', linkType.inward) }}</option>
- <option label="{{ journalLinkTranslation('outward', linkType.outward) }}"
- value="{{ linkType.id }}_outward">{{ journalLinkTranslation('outward', linkType.outward) }}</option>
- {% endfor %}
- </select>
- </div>
- </div>
- <div class="form-group">
- <label for="link_other" class="col-sm-2 control-label">{{ 'transaction'|_ }}</label>
- <div class="col-sm-10">
- <input type="text" name="link_other" autocomplete="off" id="link_other" value="" class="form-control">
- <p class="help-block">{{ 'to_link_not_found'|_ }}</p>
- <input type="hidden" name="link_journal_id" value="0">
- </div>
- </div>
- <div class="form-group">
- <label for="notes" class="col-sm-2 control-label">{{ 'notes'|_ }}</label>
- <div class="col-sm-10">
- <textarea id="notes" name="notes" class="form-control"></textarea>
- </div>
- </div>
-
-
- </div>
- <div class="modal-footer">
- <button type="button" class="btn btn-default" data-dismiss="modal">{{ 'close'|_ }}</button>
- <button type="submit" class="btn btn-primary">{{ 'submit'|_ }}</button>
- </div>
- </div>
- </div>
- </form>
-</div>
-#}