Skip to content

Commit

Permalink
Only log checkin event if the assigned_to property is not empty
Browse files Browse the repository at this point in the history
  • Loading branch information
inietov committed Oct 25, 2023
1 parent 7ed58a1 commit ca1845e
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions app/Importer/AssetImporter.php
Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,10 @@ public function createAssetIfNotExists(array $row)
//-- user_id is a property of the abstract class Importer, which this class inherits from and it's setted by
//-- the class that needs to use it (command importer or GUI importer inside the project).
if (isset($target)) {
if ($asset->assigned_to != $target->id){
event(new CheckoutableCheckedIn($asset, User::find($asset->assigned_to), Auth::user(), $asset->notes, date('Y-m-d H:i:s')));
if (!is_null($asset->assigned_to)){
if ($asset->assigned_to != $target->id){
event(new CheckoutableCheckedIn($asset, User::find($asset->assigned_to), Auth::user(), $asset->notes, date('Y-m-d H:i:s')));
}
}

$asset->fresh()->checkOut($target, $this->user_id, date('Y-m-d H:i:s'), null, $asset->notes, $asset->name);
Expand Down

0 comments on commit ca1845e

Please sign in to comment.