Fixed #15651 - admin user now displaying on maintenances page

Signed-off-by: snipe <snipe@snipe.net>
This commit is contained in:
snipe 2024-10-11 11:16:24 +01:00
parent 8aa298f6b0
commit b054017c9f
3 changed files with 2 additions and 8 deletions

View file

@ -66,7 +66,7 @@ class AssetMaintenancesTransformer
'completion_date' => Helper::getFormattedDateObject($assetmaintenance->completion_date, 'date'), 'completion_date' => Helper::getFormattedDateObject($assetmaintenance->completion_date, 'date'),
'user_id' => ($assetmaintenance->adminuser) ? [ 'user_id' => ($assetmaintenance->adminuser) ? [
'id' => $assetmaintenance->adminuser->id, 'id' => $assetmaintenance->adminuser->id,
'name'=> e($assetmaintenance->admin->getFullNameAttribute()) 'name'=> e($assetmaintenance->adminuser->present()->fullName())
] : null, // legacy to not change the shape of the API ] : null, // legacy to not change the shape of the API
'created_by' => ($assetmaintenance->adminuser) ? [ 'created_by' => ($assetmaintenance->adminuser) ? [
'id' => (int) $assetmaintenance->adminuser->id, 'id' => (int) $assetmaintenance->adminuser->id,

View file

@ -176,7 +176,7 @@ class AssetMaintenance extends Model implements ICompanyableChild
*/ */
public function adminuser() public function adminuser()
{ {
return $this->belongsTo(\App\Models\User::class, 'user_id') return $this->belongsTo(\App\Models\User::class, 'created_by')
->withTrashed(); ->withTrashed();
} }

View file

@ -116,12 +116,6 @@ class AssetMaintenancesPresenter extends Presenter
'sortable' => true, 'sortable' => true,
'title' => trans('admin/asset_maintenances/form.cost'), 'title' => trans('admin/asset_maintenances/form.cost'),
'class' => 'text-right', 'class' => 'text-right',
], [
'field' => 'user_id',
'searchable' => true,
'sortable' => true,
'title' => trans('general.admin'),
'formatter' => 'usersLinkObjFormatter',
], [ ], [
'field' => 'created_by', 'field' => 'created_by',
'searchable' => false, 'searchable' => false,