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

Fix for Unique Serial #13887

Merged
merged 3 commits into from Nov 16, 2023
Merged

Fix for Unique Serial #13887

merged 3 commits into from Nov 16, 2023

Conversation

spencerrlongg
Copy link
Collaborator

Description

This is a fix for the unique_serial rollbar, the problem was unique_serial is not a defined validation rule, so FormRequests didn't know what it was and was throwing an exception when a serial was included in the request. Unique Serial was basically just a trait that returned a modified version of unique_undeleted.

This PR makes unique_serial a defined validation rule, and removes the UniqueSerialTrait as it was only used on asset and could be re-written as a static rule, meaning it can also be used in FormRequests.

Type of change

Please delete options that are not relevant.

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

How Has This Been Tested?

Tested API and GUI

Test Configuration:

  • PHP version: 8.1
  • MySQL version 8.1

Copy link

what-the-diff bot commented Nov 15, 2023

PR Summary

  • Removal of Redundant File
    The file UniqueSerialTrait.php was deleted from the app/Http/Traits directory. This was a cleanup operation to remove an obsolete piece of code.

  • Asset.php Modifications
    Adjustments were made in Asset.php within the app/Models directory. These changes consisted of the removal of various use statements associated with a deprecated trait (UniqueSerialTrait) and the elimination of a now-unused validation rule (unique_serial) for the asset_tag field.

  • ValidationServiceProvider.php Enhancements
    Changes made in ValidationServiceProvider.php (found in the app/Providers directory) introduced a newly designed validation rule named unique_serial. This rule is responsible for confirming the uniqueness of a serial value within the assets table. It operates based on specific settings, delivering dynamic validation behavior.

  • Addition of Translation String
    To cater to localization and understanding, we added a new string in validation.php (found in resources/lang/en directory) to provide a meaningful message for the newly created unique_serial validation rule.

@snipe snipe merged commit 8158320 into snipe:develop Nov 16, 2023
7 checks passed
@snipe snipe mentioned this pull request Nov 20, 2023
2 tasks
@snipe
Copy link
Owner

snipe commented Nov 21, 2023

This seems to have caused a regression that prevents assets from being checked in - working on a fix now.

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