From 0d4e9c183b0d2e1532f3cda416d2e2e7682198b6 Mon Sep 17 00:00:00 2001 From: Ivan Nieto Vivanco Date: Thu, 25 Aug 2022 19:16:48 -0500 Subject: [PATCH] Save correct id in action log if the bulk-checkin is of type license --- app/Http/Controllers/Users/BulkUsersController.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/app/Http/Controllers/Users/BulkUsersController.php b/app/Http/Controllers/Users/BulkUsersController.php index d07d25f543..49dd67de2a 100644 --- a/app/Http/Controllers/Users/BulkUsersController.php +++ b/app/Http/Controllers/Users/BulkUsersController.php @@ -231,8 +231,14 @@ class BulkUsersController extends Controller protected function logItemCheckinAndDelete($items, $itemType) { foreach ($items as $item) { + $item_id = $item->id; $logAction = new Actionlog(); - $logAction->item_id = $item->id; + + if($itemType == License::class){ + $item_id = $item->license_id; + } + + $logAction->item_id = $item_id; // We can't rely on get_class here because the licenses/accessories fetched above are not eloquent models, but simply arrays. $logAction->item_type = $itemType; $logAction->target_id = $item->assigned_to;