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

Added #15107: Customizable 2D Barcode Content for Asset Labels #15747

Merged

Conversation

NebelKreis
Copy link
Contributor

Description

This PR introduces a new feature that allows users to customize the content of the 2D barcodes generated for asset labels in Snipe-IT. Currently, the barcodes contain only the Snipe-IT link to the asset, which includes a sequentially generated ID or the asset tag. While this functionality serves its purpose, it limits the usability of the barcodes in various operational contexts.

To enhance this feature, the following changes were made:

  • Added options for users to include the following pieces of asset information in the 2D barcode:

    • Asset Tag
    • Serial Number
  • The user interface for selecting the 2D barcode target now includes 2 more options, now allowing users to select whether they want to include the asset tag or the serial number in the 2D barcode.

Note: This implementation serves as an initial solution. Future enhancements will include options to add more data fields and the ability to arrange the order of the displayed information in the 2D barcode. These improvements aim to provide greater flexibility and meet user requirements more effectively.

Fixes Issue: #15107

By allowing for customizable barcode content, this change enhances the overall functionality of the asset labels. Users can now quickly access critical information such as the asset tag and serial number directly from the barcode, increasing efficiency in asset management processes.

Please delete options that are not relevant.

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

How Has This Been Tested?

  • Manual Testing: The new feature was manually tested to ensure that the customization options for the 2D barcode content are functioning correctly. This included verifying that the selected asset tag and serial number appear accurately in the generated barcodes.

  • Unit Tests: New unit tests have been added to confirm that the customization functionality works as intended. All existing tests were run to ensure that no regressions were introduced by this feature.

Test Configuration:

  • PHP version: 8.1.2
  • MySQL version: 8.0.39
  • Webserver version: Apache 2.4.52
  • OS version: Ubuntu 24.04

Checklist:

Updated the translation function to use the correct path, ensuring that instead of displaying the translation path as plain text, the appropriate translation is now shown as intended.
@NebelKreis NebelKreis requested a review from snipe as a code owner October 29, 2024 13:30
Copy link

what-the-diff bot commented Oct 29, 2024

PR Summary

  • Enhancement of Barcode Target Types
    In the Label.php file, new options - plain_asset_tag and plain_serial_number have been introduced to augment barcode target types.

  • Code Consistency Improvement
    The switch statement in the Label.php file has been reformatted with line breaks, enhancing code readability and maintaining consistency.

  • Addition of More User Choices
    In the labels.blade.php file, the select dropdown menu has been amplified to host new options for plain_asset_tag and plain_serial_number, enhancing user flexibility.

  • Improved Array Alignment
    The arrangement of array elements in the labels.blade.php file has been modified for better readability and easier maintainability.

@snipe
Copy link
Owner

snipe commented Oct 29, 2024

This seems like the same (or similar) to #15721 no?

@NebelKreis
Copy link
Contributor Author

Yes, but I have also included the Serial Number as part of the customizable content.

Additionally, I am working on implementing logic that better separates links and data within the UI.
This will allow users to select and arrange multiple data points to be displayed in the barcode, providing more flexibility and control over the information shown.

@snipe
Copy link
Owner

snipe commented Oct 29, 2024

I feel like maybe before opening a new PR, it might be more courteous to participate on the original PR that has been in progress for weeks to see if it could be a bit more collaborative between you and @Godmartinz who has been working on it. Now I'm supposed to choose between the two, which is not ideal.

@Godmartinz
Copy link
Collaborator

Godmartinz commented Nov 4, 2024

This works, on the select list we would like it if you could distinguish URL from VALUE like so:
image

Good stuff though 👍

@NebelKreis
Copy link
Contributor Author

Thank you for the feedback!
I’ve adjusted the select list to clearly distinguish URLs from direct asset data. The first two options are now labeled with URL: to indicate they link to resources, while Data: prefixes the remaining options to identify direct asset values. Let me know if there are any further adjustments you’d like to see!

@snipe
Copy link
Owner

snipe commented Nov 13, 2024

Looks like we have some failing tests here though.

@NebelKreis
Copy link
Contributor Author

I’m not exactly sure why the tests failed, and I am unable to replicate the errors. Sending any type of emails works as expected, and they are being sent and received without any errors. I tested this on version 7.0.13 and now also on 7.1.14, both on Docker.

@snipe
Copy link
Owner

snipe commented Nov 14, 2024

Hrm, can you try merging/rebasing down from current develop? Maybe that will shed some more light.

@NebelKreis
Copy link
Contributor Author

At least it's a different error now, so I think it wasn't an issue with my code. I'll revert the rebase after review to clean up this mess.

@NebelKreis NebelKreis force-pushed the feature/custom-data-options-for-2d-barcode branch from 8d144de to 52e4414 Compare November 19, 2024 07:57
@NebelKreis NebelKreis marked this pull request as draft November 20, 2024 15:15
@NebelKreis NebelKreis marked this pull request as ready for review November 20, 2024 15:15
@NebelKreis
Copy link
Contributor Author

Looks like everything is passing now after the rebase! Let me know if there’s anything else that needs attention. Would be great to get this merged soon.

@Godmartinz
Copy link
Collaborator

Looks good @snipe

Thanks @NebelKreis 👍

@NebelKreis
Copy link
Contributor Author

@snipe Just wanted to check in and see if there’s any update on when this PR might be merged. Let me know if there’s anything else I can do!

@snipe
Copy link
Owner

snipe commented Jan 13, 2025

@NebelKreis looks like we have some conflicts that need to be resolved

@NebelKreis
Copy link
Contributor Author

@snipe The conflicts have been resolved and everything should be good now.

@snipe snipe merged commit e03ed75 into snipe:develop Jan 13, 2025
9 checks passed
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.

3 participants