Merge pull request #18476 from marcusmoore/fixes/18475-action-log-checkin-during-import

Fixed #18475 - reference the correct model when checking in an asset via import
This commit is contained in:
snipe
2026-01-23 09:37:50 +00:00
committed by GitHub

View File

@@ -85,9 +85,9 @@ class AssetImporter extends ItemImporter
if ($this->findCsvMatch($row, 'id')!='') {
// Override asset if an ID was given
\Log::debug('Finding asset by ID: '.$this->findCsvMatch($row, 'id'));
$asset = Asset::find($this->findCsvMatch($row, 'id'));
$asset = Asset::with('assignedTo')->find($this->findCsvMatch($row, 'id'));
} else {
$asset = Asset::where(['asset_tag'=> (string) $asset_tag])->first();
$asset = Asset::with('assignedTo')->where(['asset_tag' => (string) $asset_tag])->first();
}
if ($asset) {
@@ -203,7 +203,7 @@ class AssetImporter extends ItemImporter
if (isset($target) && ($target !== false)) {
if (!is_null($asset->assigned_to)){
if ($asset->assigned_to != $target->id) {
event(new CheckoutableCheckedIn($asset, User::find($asset->assigned_to), auth()->user(), 'Checkin from CSV Importer', $checkin_date));
event(new CheckoutableCheckedIn($asset, $asset->assigned, auth()->user(), 'Checkin from CSV Importer', $checkin_date));
}
}