Skip to content

A free open source IT asset/license management system

One more fix for #6175 (non-accessories)

snipe2cecd5e0566d
diff --git a/resources/views/users/print.blade.php b/resources/views/users/print.blade.php
index c522d9400d..572493efd1 100644
--- a/resources/views/users/print.blade.php
+++ b/resources/views/users/print.blade.php
@@ -113,16 +113,18 @@
@endphp
@foreach ($licenses as $license)
+ @if ($license)
+ <tr>
+ <td>{{ $lcounter }}</td>
+ <td>{{ $license->name }}</td>
+ <td>{{ $license->serial }}</td>
+ <td>{{ $license->assetlog->first()->created_at }}</td>
+ </tr>
+ @php
+ $lcounter++
+ @endphp
- <tr>
- <td>{{ $lcounter }}</td>
- <td>{{ $license->name }}</td>
- <td>{{ $license->serial }}</td>
- <td>{{ $license->assetlog->first()->created_at }}</td>
- </tr>
- @php
- $lcounter++
- @endphp
+ @endif
@endforeach
</table>
@endif
@@ -150,15 +152,15 @@
@foreach ($accessories as $accessory)
@if ($accessory)
- <tr>
- <td>{{ $acounter }}</td>
- <td>{{ ($accessory->manufacturer) ? $accessory->manufacturer->name : '' }} {{ $accessory->name }} {{ $accessory->model_number }}</td>
- <td>{{ $accessory->category->name }}</td>
- <td>{{ $accessory->assetlog->first()->created_at }}</td>
- </tr>
- @php
- $acounter++
- @endphp
+ <tr>
+ <td>{{ $acounter }}</td>
+ <td>{{ ($accessory->manufacturer) ? $accessory->manufacturer->name : '' }} {{ $accessory->name }} {{ $accessory->model_number }}</td>
+ <td>{{ $accessory->category->name }}</td>
+ <td>{{ $accessory->assetlog->first()->created_at }}</td>
+ </tr>
+ @php
+ $acounter++
+ @endphp
@endif
@endforeach
</table>
@@ -185,16 +187,17 @@
@endphp
@foreach ($consumables as $consumable)
-
- <tr>
- <td>{{ $ccounter }}</td>
- <td>{{ ($consumable->manufacturer) ? $consumable->manufacturer->name : '' }} {{ $consumable->name }} {{ $consumable->model_number }}</td>
- <td>{{ $consumable->category->name }}</td>
- <td>{{ $consumable->assetlog->first()->created_at }}</td>
- </tr>
- @php
- $ccounter++
- @endphp
+ @if ($consumable)
+ <tr>
+ <td>{{ $ccounter }}</td>
+ <td>{{ ($consumable->manufacturer) ? $consumable->manufacturer->name : '' }} {{ $consumable->name }} {{ $consumable->model_number }}</td>
+ <td>{{ $consumable->category->name }}</td>
+ <td>{{ $consumable->assetlog->first()->created_at }}</td>
+ </tr>
+ @php
+ $ccounter++
+ @endphp
+ @endif
@endforeach
</table>
@endif