snipe-it icon indicating copy to clipboard operation
snipe-it copied to clipboard

Feature Request: Show deleted user name in asset history

Open ghost opened this issue 10 years ago • 7 comments

It comes handy to see who was using the asset through time, but when I delete the user (an employee that doesn't work anymore) it shows "Deleted User".

I would like to see exactly who was using it because the asset below was used by two users who are deleted now, so I will loose track of who used it. This is required for our accounting company to know who was financially responsible for the equipment during a certain period of time.

screen shot 2016-11-18 at 11 09 07

ghost avatar Nov 18 '16 09:11 ghost

@ernestasen That already happens, assuming you haven't purged data.

@if ($log->target->deleted_at=='')
        <a href="{{ route('view/user', $log->target_id) }}">
         {{ $log->target->fullName() }}
       </a>
@else
     <del>{{ $log->target->fullName() }}</del>
@endif

If you've purged data, there is no way to show the name of the deleted user, since they've been hard-deleted.

snipe avatar Nov 23 '16 04:11 snipe

It happens immediatly after I delete the user. It just disappears from all asset logs. No need to purge.

ghost avatar Dec 30 '16 13:12 ghost

Which place are you looking at the history? The code has been different for a while depending on where you look at it--we're working to centralize it now.

mnemonicly avatar Dec 30 '16 13:12 mnemonicly

I select the asset and then History tab: screen shot 2017-01-03 at 15 32 17

ghost avatar Jan 03 '17 13:01 ghost

I'm pretty sure this is now fixed on develop.

mnemonicly avatar Jan 04 '17 01:01 mnemonicly

That said, develop is not currently stable, so please don't use it on a production system.

snipe avatar Jan 04 '17 01:01 snipe

This appears to not yet be fixed in 3.6.6. It looks like there's a lot of development activity for a new version that includes the fix. In the meantime, if it helps anyone, I found the issue to be resolved by changing line 81 of app/Models/Actionlog.php from return $this->morphTo('target'); to return $this->morphTo('target')->withTrashed();

rocketnova avatar Sep 18 '17 21:09 rocketnova