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.
This commit is contained in:
Matthias Frei 2016-10-12 21:05:49 +02:00 committed by snipe
parent fe5e813970
commit 4b6ba6cb30
2 changed files with 7 additions and 1 deletions

View file

@ -681,7 +681,7 @@ class ReportsController extends Controller
foreach ($customfields as $customfield) { foreach ($customfields as $customfield) {
$column_name = $customfield->db_column_name(); $column_name = $customfield->db_column_name();
if (e(Input::get($customfield->db_column_name())) == '1') { if (e(Input::get($customfield->db_column_name())) == '1') {
$row[] = $asset->$column_name; $row[] = str_replace(",", "\,", $asset->$column_name);
} }
} }

View file

@ -61,6 +61,12 @@
{{ trans('general.asset_tag') }} {{ trans('general.asset_tag') }}
</label> </label>
</div> </div>
<div class="checkbox col-md-12">
<label>
{{ Form::checkbox('asset_name', '1') }}
{{ trans('admin/hardware/form.name') }}
</label>
</div>
<div class="checkbox col-md-12"> <div class="checkbox col-md-12">
<label> <label>
{{ Form::checkbox('manufacturer', '1') }} {{ Form::checkbox('manufacturer', '1') }}