diff --git a/app/Http/Controllers/Api/LicenseSeatsController.php b/app/Http/Controllers/Api/LicenseSeatsController.php index 0dd1c1fbd6..4d0fe09949 100644 --- a/app/Http/Controllers/Api/LicenseSeatsController.php +++ b/app/Http/Controllers/Api/LicenseSeatsController.php @@ -116,16 +116,20 @@ class LicenseSeatsController extends Controller return response()->json(Helper::formatStandardApiResponse('success', $licenseSeat, trans('admin/licenses/message.update.success'))); } + // the logging functions expect only one "target". if both asset and user are present in the request, + // we simply let assets take precedence over users... + if ($licenseSeat->isDirty('assigned_to')) { + $target = $is_checkin ? $oldUser : User::find($licenseSeat->assigned_to); + } + if ($licenseSeat->isDirty('asset_id')) { + $target = $is_checkin ? $oldAsset : Asset::find($licenseSeat->asset_id); + } + + if (is_null($target)){ + return response()->json(Helper::formatStandardApiResponse('error', null, 'Target not found')); + } + if ($licenseSeat->save()) { - // the logging functions expect only one "target". if both asset and user are present in the request, - // we simply let assets take precedence over users... - $changes = $licenseSeat->getChanges(); - if (array_key_exists('assigned_to', $changes)) { - $target = $is_checkin ? $oldUser : User::find($changes['assigned_to']); - } - if (array_key_exists('asset_id', $changes)) { - $target = $is_checkin ? $oldAsset : Asset::find($changes['asset_id']); - } if ($is_checkin) { $licenseSeat->logCheckin($target, $request->input('note')); diff --git a/index.html b/index.html deleted file mode 100644 index dbd1babcb8..0000000000 --- a/index.html +++ /dev/null @@ -1,50 +0,0 @@ - - -
-public
directory.
-