A free open source IT asset/license management system
Only send inventory report to users if they have things checked out to them
snipe827a86b2efef
diff --git a/app/Console/Commands/SendCurrentInventoryToUsers.php b/app/Console/Commands/SendCurrentInventoryToUsers.phpindex 2ea8ac3782..be267e73e4 100644--- a/app/Console/Commands/SendCurrentInventoryToUsers.php+++ b/app/Console/Commands/SendCurrentInventoryToUsers.php@@ -41,13 +41,21 @@ class SendCurrentInventoryToUsers extends Commandpublic function handle(){- $users = User::whereNull('deleted_at')->whereNotNull('email')->with('assets', 'accessories', 'consumables', 'licenses')->get();+ $users = User::whereNull('deleted_at')->whereNotNull('email')->with('assets', 'accessories', 'licenses')->get();+ $count = 0;foreach ($users as $user) {- $this->info($user->email);- $user->notify((new CurrentInventory($user)));++ if (($user->assets->count() > 0) || ($user->accessories->count() > 0) || ($user->licenses->count() > 0))+ {+ $count++;+ $user->notify((new CurrentInventory($user)));+ }+}+ $this->info($count.' users notified.');+}}