Merge pull request #13509 from marcusmoore/bug/sc-23636

Fixed asset model query in action log transformer
This commit is contained in:
snipe 2023-08-23 06:58:41 +01:00 committed by GitHub
commit 31a7758ab1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -159,8 +159,8 @@ class ActionlogsTransformer
unset($clean_meta['location_id']); unset($clean_meta['location_id']);
} }
if(array_key_exists('model_id', $clean_meta)) { if(array_key_exists('model_id', $clean_meta)) {
$clean_meta['model_id']['old'] = "[id: ".$clean_meta['model_id']['old']."] ".AssetModel::find($clean_meta['model_id']['old'])->name; $clean_meta['model_id']['old'] = "[id: ".$clean_meta['model_id']['old']."] ".AssetModel::withTrashed()->find($clean_meta['model_id']['old'])->name;
$clean_meta['model_id']['new'] = "[id: ".$clean_meta['model_id']['new']."] ".AssetModel::find($clean_meta['model_id']['new'])->name; /* model is required at asset creation */ $clean_meta['model_id']['new'] = "[id: ".$clean_meta['model_id']['new']."] ".AssetModel::withTrashed()->find($clean_meta['model_id']['new'])->name; /* model is required at asset creation */
$clean_meta['Model'] = $clean_meta['model_id']; $clean_meta['Model'] = $clean_meta['model_id'];
unset($clean_meta['model_id']); unset($clean_meta['model_id']);
} }
@ -183,4 +183,4 @@ class ActionlogsTransformer
} }