From 8f160a8590b69e4b521a12cb2c447c6358905796 Mon Sep 17 00:00:00 2001 From: snipe Date: Wed, 22 Nov 2017 13:05:48 -0800 Subject: [PATCH] Fixed CSV asset export missing checked out to info --- app/Http/Controllers/ReportsController.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/app/Http/Controllers/ReportsController.php b/app/Http/Controllers/ReportsController.php index 6b4c332f9b..c60b33fcb3 100644 --- a/app/Http/Controllers/ReportsController.php +++ b/app/Http/Controllers/ReportsController.php @@ -156,6 +156,7 @@ class ReportsController extends Controller trans('admin/hardware/form.order'), trans('general.supplier'), trans('admin/hardware/table.checkoutto'), + trans('general.type'), trans('admin/hardware/table.checkout_date'), trans('admin/hardware/table.location'), trans('general.notes'), @@ -166,6 +167,8 @@ class ReportsController extends Controller fputcsv($handle, $headers); foreach ($assets as $asset) { + + // Add a new row with data $values=[ ($asset->company) ? $asset->company->name : '', @@ -175,12 +178,13 @@ class ReportsController extends Controller ($asset->model->model_number) ? $asset->model->model_number : '', ($asset->name) ? $asset->name : '', ($asset->serial) ? $asset->serial : '', - ($asset->assetstatus) ? e($asset->assetstatus->name) : '', + ($asset->assetstatus) ? e($asset->present()->statusText) : '', ($asset->purchase_date) ? e($asset->purchase_date) : '', ($asset->purchase_cost > 0) ? Helper::formatCurrencyOutput($asset->purchase_cost) : '', ($asset->order_number) ? e($asset->order_number) : '', ($asset->supplier) ? e($asset->supplier->name) : '', - ($asset->assignedTo) ? e($asset->assignedTo->present()->name()) : '', + ($asset->checkedOutToUser()) ? e($asset->assigned->getFullNameAttribute()) : ($asset->assigned ? e($asset->assigned->display_name) : ''), + ($asset->checkedOutToUser()) ? 'user' : e($asset->assignedType()), ($asset->last_checkout!='') ? e($asset->last_checkout) : '', ($asset->location) ? e($asset->location->name) : '', ($asset->notes) ? e($asset->notes) : '',