revert unwanted changes

This commit is contained in:
Godfrey M 2023-08-24 10:40:44 -07:00
parent a3b6e0fbe6
commit 18cb514a53

View file

@ -50,12 +50,13 @@ class ActionlogsTransformer
if (($actionlog->log_meta) && ($actionlog->log_meta!='')) { if (($actionlog->log_meta) && ($actionlog->log_meta!='')) {
$meta_array = json_decode($actionlog->log_meta); $meta_array = json_decode($actionlog->log_meta);
$clean_meta = [];
if ($meta_array) { if ($meta_array) {
foreach ($meta_array as $fieldname => $fieldata) { foreach ($meta_array as $fieldname => $fieldata) {
$clean_meta[$fieldname]['old'] = $this->clean_field($fieldata->old); $clean_meta[$fieldname]['old'] = $this->clean_field($fieldata->old);
$clean_meta[$fieldname]['new'] = $this->clean_field($fieldata->new); $clean_meta[$fieldname]['new'] = $this->clean_field($fieldata->new);
} }
} }
$clean_meta= $this->changedInfo($clean_meta); $clean_meta= $this->changedInfo($clean_meta);
} }
@ -159,8 +160,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']);
} }