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

Last Checkin Date added to Hardware View and Index

Open akemidx opened this issue 5 months ago • 4 comments

Description

We were not showing the last_checkin date on the hardware view or index. This is a field in the hardware table and this PR adds in being able to see that data.

  • [x] Bug fix (non-breaking change which fixes an issue)

How Has This Been Tested?

tested locally via test instance

Checklist:

  • [x] I have read the Contributing documentation available here: https://snipe-it.readme.io/docs/contributing-overview
  • [x] I have formatted this PR according to the project guidelines: https://snipe-it.readme.io/docs/contributing-overview#pull-request-guidelines
  • [x] My code follows the style guidelines of this project
  • [x] I have performed a self-review of my own code
  • [ ] I have commented my code, particularly in hard-to-understand areas
  • [ ] I have made corresponding changes to the documentation
  • [ ] My changes generate no new warnings
  • [ ] I have added tests that prove my fix is effective or that my feature works
  • [ ] New and existing unit tests pass locally with my changes

akemidx avatar Feb 13 '24 22:02 akemidx

PR Summary

  • Change in 'AssetsController.php' & 'AssetCheckinController.php' The last check-out date is no longer cleared upon performing actions in these files. This is due to the commenting out of the line that previously cleared it.

  • Update in 'ReportsController.php' The system now processes the start and end dates using a more efficient approach ('Carbon'). It then applies the updated condition for filtering assets based on their last check-in dates.

  • Addition in 'AssetsTransformer.php' There's an addition of a new line responsible for managing the last check-in date of the asset objects in the data transformation process.

  • New Feature in 'AssetPresenter.php' In the data table layout, there is a new column for showcasing the date of the last check-ins.

  • Enhancement in 'view.blade.php' Now it includes an additional row displaying the last check-in date, provided that the date exists. This makes tracking last check-ins easier.

what-the-diff[bot] avatar Feb 13 '24 22:02 what-the-diff[bot]

I commented out the nulling out of thelast_checkout date. But I can revert that easy for this PR.

akemidx avatar Feb 13 '24 22:02 akemidx

@akemidx can you resolve those conflicts for me?

snipe avatar Feb 28 '24 12:02 snipe

@akemidx Make sure you test the sorting and searching in the UI and API on changes like this.

Screenshot 2024-03-27 at 8 28 43 PM

Sorting isn't working currently. I'll fix it, but it's something to keep in mind while testing changes moving forward.

snipe avatar Mar 27 '24 20:03 snipe

@akemidx see #14516 for the fix. If we want to allow sorting on a DB field that's actually on the table itself (not a relation), it needs to be added to the $allowed_columns array so we know it's a straightforward sort with no complicated relationships going on. That $allowed_columns array exists to "allow list" known columns so people can't cause 500s by trying to sort on an asset table field that doesn't exist.

snipe avatar Mar 27 '24 20:03 snipe