snipe-it icon indicating copy to clipboard operation
snipe-it copied to clipboard

License assignments not respecting seat position

Open diekmanu opened this issue 9 years ago • 33 comments

Expected Behavior (or desired behavior if a feature request)

Open the license view / click on a license. Check out a specific license seat number to an asset/user. This assignment should stick to the chosen seat number.


Actual Behavior

Seat 1 will be overwritten, regardless of the seat number which was predefined.


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


Provide answers to these questions:

  • Is this a fresh install or an upgrade?
  • Version of Snipe-IT you're running: Version v4.1.3 build 48 (g74aa562)
  • Version of PHP you're running
  • Version of MySQL/MariaDB you're running
  • What OS and web server you're running Snipe-IT on
  • What method you used to install Snipe-IT (install.sh, manual installation, docker, etc)
  • WITH DEBUG TURNED ON, if you're getting an error in your browser, include that error
  • What specific Snipe-IT page you're on, and what specific element you're interacting with to trigger the error
  • If a stacktrace is provided in the error, include that too.
  • Any errors that appear in your browser's error console.
  • Confirm whether the error is reproduceable on the demo: https://snipeitapp.com/demo.
  • Include any additional information you can find in app/storage/logs and your webserver's logs.
  • Include what you've done so far in the installation, and if you got any error messages along the way.
  • Indicate whether or not you've manually edited any data directly in the database

Please do not post an issue without answering the related questions above. If you have opened a different issue and already answered these questions, answer them again, once for every ticket. It will be next to impossible for us to help you.

https://snipe-it.readme.io/docs/getting-help

diekmanu avatar Nov 09 '17 14:11 diekmanu

But only if the license was added before 4.1.3, new ones are working fine. Here a little demo of the problem: https://files.gitter.im/snipe/snipe-it/d1Rf/snipe.mov

-- This issue is also in v4.1.3 build 94 (gb6a14d2)

yannikp avatar Nov 09 '17 15:11 yannikp

Hi,

I am also facing this problem. I have been added Seat as 4 but when i try to checkout license for other employee it overrides the 1st seat. We are hosted on Snipe-It itself.

Ajaykakde avatar Nov 13 '17 10:11 Ajaykakde

Yes, this is a problem for us as we can't checkout licenses right now. I'm going to try to upgrade to 4.14 and then if not, I'll downgrade.

We can't check out any licenses as it just takes over Seat 1, regardless of whether we do a manual seat selection or try to check out from the main license page.

LawrenceIRL avatar Nov 15 '17 19:11 LawrenceIRL

Not working for us in v4.1.4 build 173 (gba38b84)

diekmanu avatar Nov 16 '17 07:11 diekmanu

is this issue resolved?

On Thu, Nov 16, 2017 at 1:24 PM, diekmanu [email protected] wrote:

Not working for us in v4.1.4 build 173 (gba38b84)

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/snipe/snipe-it/issues/4413#issuecomment-344843142, or mute the thread https://github.com/notifications/unsubscribe-auth/AZYt5xqLnwzZ1oYzJyYphRPp5jEl1codks5s2-oqgaJpZM4QYFtC .

-- “BTW: Take 2 Minutes to learn about Rahi Systems https://vimeo.com/184623096”. Ajay Kakde* |* Sr. Software Engineer O: +91-750 777 2500 | M: +91-997 502 8678 E: [email protected] Skype: rahi.ajay www.rahisystems.com http://www.rahisystems.com <#UNIQUE_ID_SafeHtmlFilter_UNIQUE_ID_SafeHtmlFilter_UNIQUE_ID_SafeHtmlFilter_UNIQUE_ID_SafeHtmlFilter_UNIQUE_ID_SafeHtmlFilter_> https://www.facebook.com/RahiSystems/ https://twitter.com/Rahi_Systems https://www.linkedin.com/company/rahi-systems http://rahisystems.com/blog/

Ajaykakde avatar Nov 16 '17 08:11 Ajaykakde

Sorry but no, just give them a little more time to figure out how to fix it. Just monitor this thread and watch out for a commit ;)

yannikp avatar Nov 16 '17 09:11 yannikp

@uknzaeinozpas - thanks so much. You’re right, we’re working on this - and when it’s fixed, this thread will be updated. It’s weirdly hard to reproduce, but we’re close to a fix

snipe avatar Nov 16 '17 10:11 snipe

Had the same issue, Glad to see yo're already aware of it. One thing I love is when the creators are highly active in fixing bugs and releasing new versions.

Version v4.1.4 build 173 (gba38b84) clean install, same issue, only seat 1 checks out. Thankgs again Snipe admins :)

Loopmail avatar Nov 18 '17 01:11 Loopmail

@snipe Hey, if you need anything to help narrow it down, the issue occurs for me each and every time in my environment (unfortunately).

LawrenceIRL avatar Nov 20 '17 03:11 LawrenceIRL

Hi all,

Can any (or all) of you try try changing this section in app/Models/License.php from:

https://github.com/snipe/snipe-it/blob/98700cab8bf760d150eb4ef96c9ad706413b589c/app/Models/License.php#L348-L355

to:

public function freeSeat()
    {
        return  $this->licenseseats()
                    ->whereNull('deleted_at')
                    ->where(function ($query) {
                        $query->whereNull('assigned_to')
                            ->whereNull('asset_id');
                    })
                    ->first();
    }

And see if that fixes it for you?

snipe avatar Nov 21 '17 02:11 snipe

@snipe Sure, I'll try that now. Do I need to do anything afterwards? cache:clear etc.?

LawrenceIRL avatar Nov 21 '17 02:11 LawrenceIRL

@TheVakman you shouldn't have to, no.

snipe avatar Nov 21 '17 02:11 snipe

All right, that's a negative on that change working.

LawrenceIRL avatar Nov 21 '17 02:11 LawrenceIRL

Can you add a new test license and see if it works with that one? (Checkout multiple seats). Also can you tell me if it matters if you checkout to a user or you checkout to an asset?

snipe avatar Nov 21 '17 02:11 snipe

It seems to be OK with a new license. I assigned five out of thirty seats on a test license, with this modification.

I've only ever assigned to users. I'll try to an asset.

LawrenceIRL avatar Nov 21 '17 03:11 LawrenceIRL

I can checkout to an asset on the new test license, without any issues.

However, the same issue occurs when checking out existing licenses to an asset.

LawrenceIRL avatar Nov 21 '17 03:11 LawrenceIRL

Thanks very much for helping us narrow it down. Hoping have a patch for you tonight.

snipe avatar Nov 21 '17 03:11 snipe

@snipe No, thank you! I'll test it out tonight, if I see it within the next few hours while I'm up!

LawrenceIRL avatar Nov 21 '17 03:11 LawrenceIRL

Can you pull from develop easily? If so, give that a shot.

snipe avatar Nov 21 '17 03:11 snipe

Will do, just fixing something (non-SnipeIT related) and then I'll try it out!

LawrenceIRL avatar Nov 21 '17 03:11 LawrenceIRL