Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Manage EOL date by checkbox of eol_explicit #13846

Conversation

Robert-Azelis
Copy link
Contributor

@Robert-Azelis Robert-Azelis commented Nov 7, 2023

Description

[ It's re-created PR #13806 as I made mistake and updated my branch by master, sorry for confusion ]
This improvement allow setup EOL date manually by user on damand by set eol_explicit checkbox.

BEFORE:
image

AFTER:
If checkbox is not checked then EOL date is hiden and calculation of date is on the base Model EOL rate
image

If checkbox is checked then EOL date is showed and user can input EOL Date manually.
Status of checkbox is saved as eol_explicit value
image

In this way is much easier to manage EOL date and explicit marker status instead of build complex rules :)

Type of change

  • New feature (non-breaking change which adds functionality)

How Has This Been Tested?

Test Configuration:

  • PHP version: 8.1
  • MySQL version 10.6.5-MariaDB
  • Webserver version IIS
  • Web browser: MS Edge, Chrome

Checklist:

user take decision if want to set manually eol_date or leave it for calculation on the base model_eol
no sure if this function is still requried, as eol_explicit status is managed directly by user on asset form
Copy link

what-the-diff bot commented Nov 7, 2023

PR Summary

  • Added Controls for End of Life (EOL) Decision
    An enhancement has been added to the AssetsController.php file to allow users to store choices on whether assets have reached their end of life (EOL). This feature takes the form of a checkbox, named eol_explicit.

  • Improved System Response to EOL Status
    The process of storing and updating information has seen changes to accommodate the new eol_explicit checkbox. Now, when this box is checked, the end of life date (asset_eol_date) for a certain asset will be set accordingly.

  • Introducing Translated Help Text for EOL Date
    To help users around the globe, the general.php has been updated to include translations for eol_date_help.

  • Automated Visibility of Field Based on EOL Status
    A new feature has been added in the edit.blade.php file. Now, depending on whether the eol_explicit checkbox has been selected, the display of the eol_date field will be automated - visible or hidden.

  • Form Updates and EOL Date Field Addition in eol_date.blade.php
    Changes have been made to the form in eol_date.blade.php, adding a field for eol_date to better track the end of life dates for assets.

  • Added Help Text for End of Life (EOL) Date Field
    To assist users in understanding what the eol_date field represents, a descriptive help text has been included in eol_date.blade.php.

  • Code Cleaning in AssetObserver.php
    Maintenance has been performed on the AssetObserver.php file, removing unnecessary comments and unused code, enhancing the overall quality of the code.

Copy link
Collaborator

@spencerrlongg spencerrlongg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey Robert,

Removing the logic in the asset observer means that at the very least the logic needs to be added to the API assets controller.

The other option would be to remove the logic completely, but then we'd still need to add eol_explicit to the API asset controller, as well as get that added to the documentation.

@Robert-Azelis
Copy link
Contributor Author

Added also logic for API based on asset_eol_date, rule is easy if asset_eol_date is set, then eol_explicit get true, otherweis asset_eol_date based on asset model rate.

@Robert-Azelis
Copy link
Contributor Author

Hi spencerrlongg, do you think that we can ask for merge this PR?

@spencerrlongg
Copy link
Collaborator

Hey @Robert-Azelis, I'm working on some changes to the asset store method right now and it's going to cause some conflicts. Hopefully that PR is in today, and then we'll be able to revisit this, sorry for the delay on all this.

@spencerrlongg
Copy link
Collaborator

spencerrlongg commented Nov 29, 2023

If you want to take a look at it I've got it drafted here: https://github.com/snipe/snipe-it/pull/13964/files

Not quite done but I'll give you a ping when it is.

GitHub
Description This is fairly large, and just a draft for right now while I continue to test and make sure it's 100% solid. I've started to refactor the controller to just ->fill($request-&...

updated logic for change model of asset
updated manage eol_date when model is changed
updated manage eol_date when purchase date or model changed
updated manage eol_date when purchase date or model changed
@Robert-Azelis
Copy link
Contributor Author

updated AssetsController.php, AssetsControlled.php for API and BulkAssetsController.php to mange eol_date when model changed

@Robert-Azelis
Copy link
Contributor Author

Robert-Azelis commented Jan 30, 2024

Hi @spencerrlongg any news in this case?
I see that new v.6.3.0 has been published, but we still have some work to do ;)

@spencerrlongg
Copy link
Collaborator

Hey @Robert-Azelis - meant to get back to you a while back but the holidays and stuff got in the way. I think I'm fine with the direction you were going, but unfortunately I ended up refactoring the store() method on the API AssetsController so that's created some conflicts, so that'll need to be re-thought.

I'm planning on applying those same changes to the other AssetsController soon, will probably start on that tomorrow.

The BulkAssetsController has also undergone some changes.

I'd be happy to have a look and provide any help if you want to give it another go, though it might be best to wait until I've got the Assets/AssetsController.php refactor done.

@Robert-Azelis
Copy link
Contributor Author

Hey @Robert-Azelis - meant to get back to you a while back but the holidays and stuff got in the way. I think I'm fine with the direction you were going, but unfortunately I ended up refactoring the store() method on the API AssetsController so that's created some conflicts, so that'll need to be re-thought.

I'm planning on applying those same changes to the other AssetsController soon, will probably start on that tomorrow.

The BulkAssetsController has also undergone some changes.

I'd be happy to have a look and provide any help if you want to give it another go, though it might be best to wait until I've got the Assets/AssetsController.php refactor done.

Hi @spencerrlongg, I will update files to new code v6.3.0 (try this week), then we can review once again ;)

@Robert-Azelis
Copy link
Contributor Author

Hi, @spencerrlongg
code has been adapted to new ver. 6.3.0 and created under new PR #14248

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants