From 4b6ba6cb30b202e3da5ef890b21a112a82377fc9 Mon Sep 17 00:00:00 2001 From: Matthias Frei Date: Wed, 12 Oct 2016 21:05:49 +0200 Subject: [PATCH] BugFix: Asset name was not included in custom report (#2733) * BugFix: Asset name was not included in custom report * BugFix: Custom Asset Report did not escape commas in custom fields. So the csv file is inconsistent, if a custom field containes a comma. Added an escape function which escapes the commas with a backslash. A csvreader can be configured to handle the escape character. --- app/Http/Controllers/ReportsController.php | 2 +- resources/views/reports/custom.blade.php | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/app/Http/Controllers/ReportsController.php b/app/Http/Controllers/ReportsController.php index a024b17042..a996f52539 100644 --- a/app/Http/Controllers/ReportsController.php +++ b/app/Http/Controllers/ReportsController.php @@ -681,7 +681,7 @@ class ReportsController extends Controller foreach ($customfields as $customfield) { $column_name = $customfield->db_column_name(); if (e(Input::get($customfield->db_column_name())) == '1') { - $row[] = $asset->$column_name; + $row[] = str_replace(",", "\,", $asset->$column_name); } } diff --git a/resources/views/reports/custom.blade.php b/resources/views/reports/custom.blade.php index 38d47ee60f..bd854e1e16 100644 --- a/resources/views/reports/custom.blade.php +++ b/resources/views/reports/custom.blade.php @@ -61,6 +61,12 @@ {{ trans('general.asset_tag') }} +
+ +