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

Deleting a license updates a random seat #13341

Closed
2 tasks done
Loemnk opened this issue Jul 20, 2023 · 1 comment
Closed
2 tasks done

Deleting a license updates a random seat #13341

Loemnk opened this issue Jul 20, 2023 · 1 comment

Comments

@Loemnk
Copy link

Loemnk commented Jul 20, 2023

Debug mode

Describe the bug

When you have two licenses:

  • License A with X seats checked out
  • License B with 0 seats checked out

When you now delete License B, and License A has a seat with the id of License A, then the fields assigned_to and asset_id will be set to NULL.

This happens because in snipe-it/app/Http/Controllers/Licenses/LicensesController.php:210 the query incorrectly checks for id instead of license_id.

Additionally, this does not show up in the activity log.

Reproduction steps

  1. License A with X seats checked out
  2. License B with 0 sets checked out1.
  3. Delete License B
    ...

Expected behaviour

The license B will be deleted and the seats of license A are not modified

Screenshots

No response

Snipe-IT Version

v6.1.2

Operating System

Ubuntu

Web Server

Apache

PHP Version

8.1

Operating System

Mac

Browser

Chrome

Version

114

Device

No response

Operating System

No response

Browser

No response

Version

No response

Error messages

None

Additional context

No response

@welcome
Copy link

welcome bot commented Jul 20, 2023

👋 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.

Loemnk pushed a commit to Loemnk/snipe-it that referenced this issue Jul 20, 2023
Before this, we checked for the `id` collumn in the `license_seats` table, insteasd of
using `license_id` for this.

This way, we ensure that we only alter seats belonging to the correct license.
snipe added a commit that referenced this issue Jul 20, 2023
Fixes #13341: Clean up correct seats on license delete
@snipe snipe closed this as completed in 90a344a Jul 20, 2023
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

1 participant