Skip to content

Commit

Permalink
When asset is checked-in the assigned licenses also are taken from th…
Browse files Browse the repository at this point in the history
…e user
  • Loading branch information
inietov committed Jan 31, 2024
1 parent 77fa213 commit 51ae485
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions app/Http/Controllers/Api/AssetsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -906,6 +906,13 @@ public function checkin(Request $request, $asset_id)
$originalValues['action_date'] = $checkin_at;
}

if(!empty($asset->licenseseats->all())){
foreach ($asset->licenseseats as $seat){
$seat->assigned_to = null;
$seat->save();
}
}

if ($asset->save()) {
event(new CheckoutableCheckedIn($asset, $target, Auth::user(), $request->input('note'), $checkin_at, $originalValues));

Expand Down

0 comments on commit 51ae485

Please sign in to comment.