Skip to content

A free open source IT asset/license management system

Fixed #14812 - added consumables to individual inventory report

snipe871255f28cb0
diff --git a/app/Console/Commands/SendCurrentInventoryToUsers.php b/app/Console/Commands/SendCurrentInventoryToUsers.php
index 74acc9cc0f..c5180203e6 100644
--- a/app/Console/Commands/SendCurrentInventoryToUsers.php
+++ b/app/Console/Commands/SendCurrentInventoryToUsers.php
@@ -43,7 +43,7 @@ class SendCurrentInventoryToUsers extends Command
$count = 0;
foreach ($users as $user) {
- if (($user->assets->count() > 0) || ($user->accessories->count() > 0) || ($user->licenses->count() > 0)) {
+ if (($user->assets->count() > 0) || ($user->accessories->count() > 0) || ($user->licenses->count() > 0) || ($user->consumables->count() > 0)) {
$count++;
$user->notify((new CurrentInventory($user)));
}
diff --git a/app/Notifications/CurrentInventory.php b/app/Notifications/CurrentInventory.php
index 158955b273..ae64b188cd 100644
--- a/app/Notifications/CurrentInventory.php
+++ b/app/Notifications/CurrentInventory.php
@@ -43,6 +43,7 @@ class CurrentInventory extends Notification
'assets' => $this->user->assets,
'accessories' => $this->user->accessories,
'licenses' => $this->user->licenses,
+ 'consumables' => $this->user->consumables,
])
->subject(trans('mail.inventory_report'));
diff --git a/resources/views/notifications/markdown/user-inventory.blade.php b/resources/views/notifications/markdown/user-inventory.blade.php
index 7b298dbc32..f1b329ec8d 100644
--- a/resources/views/notifications/markdown/user-inventory.blade.php
+++ b/resources/views/notifications/markdown/user-inventory.blade.php
@@ -56,6 +56,19 @@
</table>
@endif
+@if ($consumables->count() > 0)
+## {{ $consumables->count() }} {{ trans('general.consumables') }}
+
+<table width="100%">
+<tr><th align="left">{{ trans('mail.name') }} </th> <th></th> </tr>
+@foreach($consumables as $consumable)
+<tr>
+<td>{{ $consumable->name }}</td>
+</tr>
+@endforeach
+</table>
+@endif
+
@endcomponent