It appears that some librarians will attempt to scan items as fast as they can without checking to make sure the checkout was submitted and the page reloaded properly. This can cause multiple barcodes to be scanned into the barcode field if the person is fast enough.
Created attachment 34202 [details] [review] Bug 13415 - Prevent librarians from scanning multiple items into a single barcode field It appears that some librarians will attempt to scan items as fast as they can without checking to make sure the checkout was submitted and the page reloaded properly. This can cause multiple barcodes to be scanned into the barcode field if the person is fast enough. This causes the checkout of both ( or more! ) items to fail. Test Plan: 1) Apply this patch 2) Attempt to scan two or more items into the barcode field You can emulate this with a keybaord by hitting a few keys, then enter, then a few more keys, then enter again. The barcodes don't need to be valid for this test. 3) Note the dialog stating the barcode has been submitted and to please wait.
Created attachment 34203 [details] [review] Bug 13415 - Prevent librarians from scanning multiple items into a single barcode field It appears that some librarians will attempt to scan items as fast as they can without checking to make sure the checkout was submitted and the page reloaded properly. This can cause multiple barcodes to be scanned into the barcode field if the person is fast enough. This causes the checkout of both ( or more! ) items to fail. Test Plan: 1) Apply this patch 2) Attempt to scan two or more items into the barcode field You can emulate this with a keybaord by hitting a few keys, then enter, then a few more keys, then enter again. The barcodes don't need to be valid for this test. 3) Note the dialog stating the barcode has been submitted and to please wait.
Created attachment 34235 [details] [review] [SIGNED OFF] Bug 13415 - Prevent librarians from scanning multiple items into a single barcode field It appears that some librarians will attempt to scan items as fast as they can without checking to make sure the checkout was submitted and the page reloaded properly. This can cause multiple barcodes to be scanned into the barcode field if the person is fast enough. This causes the checkout of both ( or more! ) items to fail. Test Plan: 1) Apply this patch 2) Attempt to scan two or more items into the barcode field You can emulate this with a keybaord by hitting a few keys, then enter, then a few more keys, then enter again. The barcodes don't need to be valid for this test. 3) Note the dialog stating the barcode has been submitted and to please wait. Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Works well for me, and code looks fine. Signing Off
- [% IF NEEDSCONFIRMATION %] <input type="text" name="barcode" id="barcode" class="barcode focus" size="14" disabled="disabled" /> - [% ELSE %] - <input type="text" name="barcode" id="barcode" class="barcode focus" size="14" /> - [% END %] This change means that all circulation transactions must wait until document.ready() fires. Is this what we want? + $('#mainform').bind('submit',function() { + $('#barcode').on('keypress',function(event) { Is there a reason to use bind() on #mainform instead of on()? "As of jQuery 1.7, the .on() method is the preferred method for attaching event handlers to a document." https://api.jquery.com/bind/
I agree, I think I was a bit too aggressive. There is really no need to prevent a barcode from being scanned before the page loads completely. I'll also change the bind to on, as you are correct about that as well. (In reply to Owen Leonard from comment #5) > - [% IF NEEDSCONFIRMATION %] > <input type="text" name="barcode" id="barcode" class="barcode > focus" size="14" disabled="disabled" /> > - [% ELSE %] > - <input type="text" name="barcode" id="barcode" class="barcode focus" > size="14" /> > - [% END %] > > This change means that all circulation transactions must wait until > document.ready() fires. Is this what we want? > > + $('#mainform').bind('submit',function() { > + $('#barcode').on('keypress',function(event) { > > Is there a reason to use bind() on #mainform instead of on()? "As of jQuery > 1.7, the .on() method is the preferred method for attaching event handlers > to a document." https://api.jquery.com/bind/
Created attachment 34341 [details] [review] Bug 13415 [QA Followup] - Change bind to on, revert barcode disable
Created attachment 34380 [details] [review] [PASSED QA] Bug 13415 - Prevent librarians from scanning multiple items into a single barcode field It appears that some librarians will attempt to scan items as fast as they can without checking to make sure the checkout was submitted and the page reloaded properly. This can cause multiple barcodes to be scanned into the barcode field if the person is fast enough. This causes the checkout of both ( or more! ) items to fail. Test Plan: 1) Apply this patch 2) Attempt to scan two or more items into the barcode field You can emulate this with a keybaord by hitting a few keys, then enter, then a few more keys, then enter again. The barcodes don't need to be valid for this test. 3) Note the dialog stating the barcode has been submitted and to please wait. Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Created attachment 34381 [details] [review] [PASSED QA] Bug 13415 [QA Followup] - Change bind to on, revert barcode disable Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> Tested according to test plan, passes tests and QA script.
Patch pushed to master. Thanks Kyle!
Template changes held for 3.18.3
Pushed to 3.18.x is 3.18.3