Skip to content

Firefly III: a personal finances manager

Fix for #1617

James Cole219a0cd612a1
diff --git a/app/Http/Controllers/ReportController.php b/app/Http/Controllers/ReportController.php
index 1af1553e60..82339668ff 100644
--- a/app/Http/Controllers/ReportController.php
+++ b/app/Http/Controllers/ReportController.php
@@ -323,7 +323,7 @@ class ReportController extends Controller
$accounts = implode(',', $request->getAccountList()->pluck('id')->toArray());
$categories = implode(',', $request->getCategoryList()->pluck('id')->toArray());
$budgets = implode(',', $request->getBudgetList()->pluck('id')->toArray());
- $tags = implode(',', $request->getTagList()->pluck('tag')->toArray());
+ $tags = implode(',', $request->getTagList()->pluck('id')->toArray());
$expense = implode(',', $request->getExpenseList()->pluck('id')->toArray());
$uri = route('reports.index');
diff --git a/app/Http/Requests/ReportFormRequest.php b/app/Http/Requests/ReportFormRequest.php
index b59e8dbec5..9d9707b4f1 100644
--- a/app/Http/Requests/ReportFormRequest.php
+++ b/app/Http/Requests/ReportFormRequest.php
@@ -213,6 +213,12 @@ class ReportFormRequest extends Request
$tag = $repository->findByTag($tagTag);
if (null !== $tag) {
$collection->push($tag);
+ continue;
+ }
+ $tag = $repository->findNull((int)$tagTag);
+ if (null !== $tag) {
+ $collection->push($tag);
+ continue;
}
}
}
diff --git a/app/Support/Binder/TagList.php b/app/Support/Binder/TagList.php
index 2201eb09b2..6919034293 100644
--- a/app/Support/Binder/TagList.php
+++ b/app/Support/Binder/TagList.php
@@ -45,6 +45,7 @@ class TagList implements BinderInterface
{
if (auth()->check()) {
$list = array_unique(array_map('\strtolower', explode(',', $value)));
+ Log::debug('List of tags is', $list);
if (0 === \count($list)) {
Log::error('Tag list is empty.');
throw new NotFoundHttpException; // @codeCoverageIgnore
@@ -56,7 +57,14 @@ class TagList implements BinderInterface
$collection = $allTags->filter(
function (Tag $tag) use ($list) {
- return \in_array(strtolower($tag->tag), $list, true);
+ if(\in_array(strtolower($tag->tag), $list, true)) {
+ return true;
+ }
+ if(\in_array((string)$tag->id, $list, true)) {
+ return true;
+ }
+
+ return false;
}
);
diff --git a/resources/views/reports/options/tag.twig b/resources/views/reports/options/tag.twig
index 54d4663a0d..bcaec1bf17 100644
--- a/resources/views/reports/options/tag.twig
+++ b/resources/views/reports/options/tag.twig
@@ -3,7 +3,7 @@
<div class="col-sm-9">
<select id="inputTags" name="tag[]" multiple="multiple" class="form-control">
{% for tag in tags %}
- <option value="{{ tag.tag }}" label="{{ tag.tag }}">{{ tag.tag }}</option>
+ <option value="{{ tag.id }}" label="{{ tag.tag|e('html') }}">{{ tag.tag|e('html') }}</option>
{% endfor %}
</select>
</div>