From aff93d8f2b5a4a3d0966dccff2689ae1d3781d38 Mon Sep 17 00:00:00 2001 From: snipe Date: Tue, 12 Dec 2017 05:43:06 -0800 Subject: [PATCH] Fixed #4589 - Licence deployed to asset issue --- app/Http/Controllers/LicensesController.php | 2 +- resources/views/licenses/view.blade.php | 26 ++++++++++++++------- 2 files changed, 19 insertions(+), 9 deletions(-) diff --git a/app/Http/Controllers/LicensesController.php b/app/Http/Controllers/LicensesController.php index 559f979fad..bfbcbb3b69 100755 --- a/app/Http/Controllers/LicensesController.php +++ b/app/Http/Controllers/LicensesController.php @@ -315,7 +315,7 @@ class LicensesController extends Controller $licenseSeat->asset_id = $request->input('asset_id'); // Override asset's assigned user if available - if ($target->assigned_to!='') { + if ($target->checkedOutToUser()) { $licenseSeat->assigned_to = $target->assigned_to; } diff --git a/resources/views/licenses/view.blade.php b/resources/views/licenses/view.blade.php index 6ee5ffc7c9..dc1bee4c88 100755 --- a/resources/views/licenses/view.blade.php +++ b/resources/views/licenses/view.blade.php @@ -56,34 +56,44 @@ Seat {{ $count }} @if (($licensedto->user) && ($licensedto->deleted_at == NULL)) + @can('users.view') + {{ $licensedto->user->present()->fullName() }} @else + {{ $licensedto->user->present()->fullName() }} @endcan + @elseif (($licensedto->user) && ($licensedto->deleted_at != NULL)) + {{ $licensedto->user->present()->fullName() }} - @elseif ($licensedto->asset) - @if ($licensedto->asset->assigned_to != 0) - @can('users.view') - {!! $licensedto->asset->assignedTo->present()->nameUrl() !!} - @else - {{ $licensedto->asset->assignedTo->present()->name() }} - @endcan - @endif + @endif @if ($licensedto->asset) + @can('view', $licensedto->asset) + {{ $licensedto->asset->name }} {{ $licensedto->asset->asset_tag }} @else + {{ $licensedto->asset->name }} {{ $licensedto->asset->asset_tag }} @endcan + + @if ($licensedto->asset->location) + @can('locations.view') + ({!! $licensedto->asset->location->present()->nameUrl() !!}) + @else + ({{ $licensedto->asset->location->present()->name() }}) + @endcan + @endif + @endif