snipe / snipe-it

A free open source IT asset/license management system
https://snipeitapp.com
GNU Affero General Public License v3.0
10.52k stars 3.08k forks source link

Duplicate Checkout in Consumables #11061

Open c1thunder opened 2 years ago

c1thunder commented 2 years ago

Debug mode

Describe the bug

Some of the users when checkout the toner in consumables, they always spammed the checkout button and made the system register as double checkout. Then the remaining item is different from the stock that has been left.

image

The picture above shows a negative value

image

Example of one user double checkout the toner

We can fix the remaining stock by adding to the total quantities, but the issue will arise when we are doing a stock count and the total quantities are not tally with the stock that we are ordering.

To fix this, maybe admin can delete the user checkout if the admin detected double checkout occurred.

Sorry for bad english

Reproduction steps

  1. Go to consumable screen

  2. Click on any consumable item and click on checkout button

  3. image

  4. Spam click check out ...

Expected behavior

The remaining quantity will be different from the actual stock, and although the stock only has 1 left and under normal circumstances, the checkout button will be greyed out, it still registered as multiple checkouts and remaining quantities will be a negative value.

Screenshots

No response

Snipe-IT Version

5.4.4

Operating System

Windows Server 2012

Web Server

IIS

PHP Version

7.4

Operating System

Windows 10 Pro

Browser

Chrome, Edge

Version

No response

Device

Android Phone, iPhone

Operating System

No response

Browser

No response

Version

No response

Error messages

No response

Additional context

No response

snipe commented 2 years ago

Hi there - I know this is a pretty old issue, but I wanted to check and see if you ever got this resolved? If so, can you please close the ticket? If not, can you update us on what version of Snipe-IT you're currently using, so we can see if it's still an issue on latest?

:) Thanks!

mikeroq commented 2 years ago

I was able to duplicate this. Probably relies on how fast the request to the web server is. First couple times I tried multiple clicks but only got one checkout. I had to spam my mouse pretty hard but I got 6 at a time. This could happen on any form submission I suspect. image

c1thunder commented 2 years ago

HI @snipe, I did some testing by replicating the steps. And the issue is still there

2022-07-03 21_21_41-Toner Testing Consumable __ PCGroup Asset Management - Work - Microsoft​ Edge

I also replicated this on develop.snipeitapp.com ( our temple for everything related to snipeit ), and the same result was produced

2022-07-03 21_22_50-AnyDesk

Ignore the timing, just me living in another part of the world, yeah i am living in the future

I do not know if it possible to fix it and i believed you guys are professional and geek enough to fix it.

Cheers

rdagger commented 1 year ago

The problem is not limited to consumables. Accidently double-clicking the save button can create duplicate entries. For example, if you create a license and inadvertently double-click save then you will get 2 identical licenses added. Any type of button that interacts with the database should be disabled as soon as it is clicked to prevent multiple fires.