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

Handle case where value is deleted in history #13749

Merged
merged 3 commits into from
Oct 13, 2023
Merged

Handle case where value is deleted in history #13749

merged 3 commits into from
Oct 13, 2023

Conversation

snipe
Copy link
Owner

@snipe snipe commented Oct 13, 2023

This is a sort of stopgap for #13710, which handles a few different cases

EOL Date will not show as changed if it was not actually changed anymore. It was being cast as a date which was really turning it into a date time

Encrypted fields will not show as changed if they're not really changed. We're still storing the change in history, since the encrypted value does change. This really needs to be handled in the controllers where we don't "save" those fields to the asset itself if nothing was changed.

And finally - the real reason I started this - this fixes an error where if a certain set of circumstances have occurred, an asset's history will look empty with an ErrorException: Attempt to read property "name" on null error. This would happen when the following happens:

  1. Asset ABC had a location of 123.
  2. Asset ABC gets edited to have a location of XYZ
  3. Location 123 gets soft-deleted AND purged
  4. Asset history is now broken

I'd really like to handle this better by actually capturing the "at that time" value when the asset is saved, to prevent people from sidestepping the history by editing Location 123 to be XYZ, without ever touching the asset. If the asset was changed, the location name/id at the time should be what we're logging, so we know that at that time, the location was named 123. But alas, that's an issue for a different PR.

Screenshot 2023-10-13 at 7 51 59 PM

@shortcut-integration
Copy link

@what-the-diff
Copy link

what-the-diff bot commented Oct 13, 2023

PR Summary

  • Enhancement to Decryption Process in ActionlogsTransformer
    Changes have been made to the ActionlogsTransformer.php file where a new functionality has been added to decrypt and compare encrypted fields. To safeguard the process, a try/catch block is included to manage potential decryption exceptions. The system can now handle changes in custom encrypted fields and display the old and new values accordingly. Updates have also been made to handle changes in rtd_location_id and location_id.

  • Data Type Update in Asset Model
    In Asset.php, the casts array, which is responsible for defining the data types of the model's attributes, has been updated. A boolean cast for eol_explicit has been added meaning this attribute will now be returned as a boolean value in the model. This offers a more accurate representation and easier handling of this data.

Copy link
Collaborator

@uberbrady uberbrady left a comment

Choose a reason for hiding this comment

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

I think some small cleanups and this should help clean up a lot of the display-side of this problem - but I agree, it should probably be fixed on the creation-side, more thoroughly.

@snipe snipe merged commit b1f158b into develop Oct 13, 2023
@snipe snipe deleted the bug/sc-23473 branch October 13, 2023 18:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants