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

Licenses assigned to Assets do not show up at users license overview #5940

Open
2 tasks done
L3nny5 opened this issue Jul 24, 2018 · 6 comments
Open
2 tasks done

Licenses assigned to Assets do not show up at users license overview #5940

L3nny5 opened this issue Jul 24, 2018 · 6 comments

Comments

@L3nny5
Copy link

L3nny5 commented Jul 24, 2018

Please confirm you have done the following before posting your bug report:

Describe the bug
Since a couple of versions we do not see the licenses assigned to a device under the users license overview. Also when you check the license itself, it only shows the Device to which the license is assigned to. If I check a license in and check it out to the same device, it suddenly shows the correct information. So it seems it is "just" some old data entries of the database which do not get set correctly. Is there any workaround to get this fixed?� I don't like to check in and check out all licenses to the same device again.

image

Expected behavior
New checked out licenses are displayed correctly. I want to correct the old data.

Server (please complete the following information):

  • Snipe-IT Version 4.6.2
  • OS: Ubuntu 14.04
  • Web Server: Apache
  • PHP Version PHP 7.0.30-1

Desktop (please complete the following information):

  • OS: All OS
  • Browser All Browser
  • Version All versions

Error Messages

  • no error messages
@snipe snipe modified the milestones: v4.6.0, v5.0 Jul 25, 2018
@snipe
Copy link
Owner

snipe commented Jul 25, 2018

Duplicate of #5155

@snipe snipe marked this as a duplicate of #5524 Jul 25, 2018
@snipe snipe closed this as completed Jul 25, 2018
@snipe snipe marked this as a duplicate of #5155 Jul 25, 2018
@L3nny5
Copy link
Author

L3nny5 commented Jul 26, 2018

I'm not sure, but I think this is a different issue. The function works fine for new checkouts. But old checkouts which were done a year or longer ago do not show correctly. If I checkin a license from a device and check it out to the same device it gets shown correctly.
So basically what I need is a repair of the database or a "script" which checks in licenses and checks them out to the same devices again. Than the issue would be fixed.

@snipe snipe reopened this Oct 3, 2018
@jwhulette
Copy link
Contributor

@snipe Here is a query that fixes the user empty user field when a license is check out to an asset.
I'm not sure the best way to implement.

UPDATE
    license_seats AS t1, (
        SELECT
           LS.id AS 'license_id',
            AST.assigned_to AS 'asset_assigned_to'
        FROM
            `license_seats` AS LS
        LEFT JOIN assets AS AST ON LS.asset_id = AST.id
    WHERE
        LS. `deleted_at` IS NULL
        AND LS.assigned_to IS NULL
        AND LS.asset_id IS NOT NULL) AS t2
SET
    t1.assigned_to = t2.asset_assigned_to
WHERE
    t1.id = t2.license_id;

@uberbrady uberbrady modified the milestones: v5.0, Next Minor Jan 2, 2019
@snipe snipe removed this from the Next Minor milestone Oct 26, 2020
@stale
Copy link

stale bot commented Dec 25, 2020

Is this still relevant? We haven't heard from anyone in a bit. If so, please comment with any updates or additional detail.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Don't take it personally, we just need to keep a handle on things. Thank you for your contributions!

@stale stale bot added the stale label Dec 25, 2020
@p1n7o
Copy link

p1n7o commented May 19, 2021

@jwhulette Thanks! We used your query and it works great when you have a license check out to an asset, but only when you check out. We needed also this when you check in. So we decide to do 2 triggers (before and after) in assets tabel to work also when you check in. Hope that will help someone ^^

UPDATE license_seats AS t1,(        
        SELECT
           LSs.id AS 'license_id',
            ASTt.assigned_to AS 'asset_assigned_to'
        FROM
            `license_seats` AS LSs
        LEFT JOIN assets AS ASTt ON LSs.asset_id = ASTt.id
    WHERE
        LSs. `deleted_at` IS NULL
        AND ASTt.assigned_to IS NULL
        AND LSs.assigned_to IS NOT NULL
        AND LSs.asset_id IS NOT NULL ) as t3
SET
    t1.assigned_to = t3.asset_assigned_to
WHERE
    t1.id = t3.license_id

@stale
Copy link

stale bot commented May 19, 2021

Okay, it looks like this issue or feature request might still be important. We'll re-open it for now. Thank you for letting us know!

@stale stale bot removed the stale label May 19, 2021
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

5 participants