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

Checkbox values with spaces do not stay checked when editing #12137

Closed
2 tasks done
mcarras8 opened this issue Nov 17, 2022 · 3 comments
Closed
2 tasks done

Checkbox values with spaces do not stay checked when editing #12137

mcarras8 opened this issue Nov 17, 2022 · 3 comments
Assignees

Comments

@mcarras8
Copy link

mcarras8 commented Nov 17, 2022

Debug mode

Describe the bug

Custom field checkbox values that contain spaces always default to unchecked when editing an asset. This can be easily reproduced on the current demo.

Any checkbox values that do not contain spaces will still work correctly when mixed with values that do contain spaces (IE, they stay checked).

Reproduction steps

  1. Create a new custom field containing a checkbox value that has at least one space in it.
  2. Assign the custom field to a model.
  3. Create a new asset with the model containing the checkbox custom field, checking one of the values that contains a space.
  4. Edit the newly created asset, observing the value changes back to being unchecked.
    ...

Expected behavior

Checkbox values with spaces should behave the same as checkbox values without spaces.

Screenshots

No response

Snipe-IT Version

6.0.13

Operating System

Whatever the demo uses

Web Server

Whatever the demo uses

PHP Version

Whatever the demo uses

Operating System

No response

Browser

No response

Version

No response

Device

No response

Operating System

No response

Browser

No response

Version

No response

Error messages

No response

Additional context

This may have been introduced in a recent update; I don't remember encountering the issue before October or so.

Edit: Could not reproduce on my test docker instance running v6.0.8 (build 8409).

@welcome
Copy link

welcome bot commented Nov 17, 2022

👋 Thanks for opening your first issue here! If you're reporting a 🐞 bug, please make sure you include steps to reproduce it. We get a lot of issues on this repo, so please be patient and we will get back to you as soon as we can.

@snipe
Copy link
Owner

snipe commented Nov 17, 2022

@inietov i thought we had already fixed this - can you take a look?

@mcarras8
Copy link
Author

mcarras8 commented Nov 17, 2022

@inietov i thought we had already fixed this - can you take a look?

I confirmed it today on the demo and our snipe-it.io hosted instance before submitting the report. I just updated a snipeit:develop docker instance with v6.0.13 (build 8923) and it's happening there too. But it's not happening on an older docker instance still running v6.0.8 (build 8409), so I suspect it's a regression.

Edit: Looks like it may have been #11710. I think the brackets define a set and it's splitting on a space. Either preg_split(', |,') or preg_split(',\s?') should work.

snipe added a commit that referenced this issue Nov 23, 2022
Fixed #12046 #12137 Custom field checkboxes not holding value
snipe added a commit that referenced this issue Nov 24, 2022
…elop

Fixed #12046 #12137 Custom field checkboxes not holding value for develop
@inietov inietov closed this as completed Nov 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants