Skip to content

A free open source IT asset/license management system

Fixed #4589 - Licence deployed to asset issue

snipeaff93d8f2b5a
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 @@
<td>Seat {{ $count }} </td>
<td>
@if (($licensedto->user) && ($licensedto->deleted_at == NULL))
+
@can('users.view')
<a href="{{ route('users.show', $licensedto->assigned_to) }}">
+ <i class="fa fa-user"></i>
{{ $licensedto->user->present()->fullName() }}
</a>
@else
+ <i class="fa fa-user"></i>
{{ $licensedto->user->present()->fullName() }}
@endcan
+
@elseif (($licensedto->user) && ($licensedto->deleted_at != NULL))
+
<del>{{ $licensedto->user->present()->fullName() }}</del>
- @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
</td>
<td>
@if ($licensedto->asset)
+
@can('view', $licensedto->asset)
<a href="{{ route('hardware.show', $licensedto->asset_id) }}">
+ <i class="fa fa-barcode"></i>
{{ $licensedto->asset->name }} {{ $licensedto->asset->asset_tag }}
</a>
@else
+ <i class="fa fa-barcode"></i>
{{ $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
</td>
<td>