Summary: | Triggering slip print with enter key collides with 'barcode submitted' message | ||
---|---|---|---|
Product: | Koha | Reporter: | Katrin Fischer <katrin.fischer> |
Component: | Circulation | Assignee: | Bugs List <koha-bugs> |
Status: | CLOSED FIXED | QA Contact: | Testopia <testopia> |
Severity: | major | ||
Priority: | P5 - low | CC: | gmcharlt, jonathan.druart, kyle.m.hall, kyle, tomascohen, veron |
Version: | Main | ||
Hardware: | All | ||
OS: | All | ||
See Also: | http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=13415 | ||
Change sponsored?: | --- | Patch complexity: | Trivial patch |
Documentation contact: | Documentation submission: | ||
Text to go in the release notes: | Version(s) released in: | ||
Circulation function: | |||
Attachments: |
Bug 14011 - Triggering slip print with enter key collides with 'barcode submitted'
Bug 14011 - Triggering slip print with enter key collides with 'barcode submitted' Bug 14011 - Triggering slip print with enter key collides with 'barcode submitted' Bug 14011: Make the jQuery selector explicit |
Description
Katrin Fischer
2015-04-17 21:20:05 UTC
Created attachment 38138 [details] [review] Bug 14011 - Triggering slip print with enter key collides with 'barcode submitted' To reproduce: - submit empty checkout for triggering a slip print - print the slip or cancel - notice you can't read a new barcode into the field now, instead, the 'barcode submitted' message will be triggered each time you try To test: - apply patch - try to reproduce issue Created attachment 38148 [details] [review] Bug 14011 - Triggering slip print with enter key collides with 'barcode submitted' To reproduce: - Log into staff client - Find a client with 0 checkouts - Print a slip (or cancel printing it) - Attempt to type in a barcode to checkout -- annoying modal screen pops up 'barcode submitted' message will be triggered each time you try To test: - apply patch - try to reproduce issue Signed-off-by: Mark Tompsett <mtompset@hotmail.com> Comment on attachment 38148 [details] [review] Bug 14011 - Triggering slip print with enter key collides with 'barcode submitted' Review of attachment 38148 [details] [review]: ----------------------------------------------------------------- ::: koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt @@ +64,4 @@ > > $(document).ready(function() { > $('#mainform').on('submit',function() { > + if (barcode && barcode.value) { What is the barcode variable? This variable is never defined, and you will never pass this condition. Hi Jonathan, Add following alerts after line 66 in circulation.tt: $(document).ready(function() { $('#mainform').on('submit',function() { alert(barcode); alert(barcode.value); $('#barcode').on('keypress',function(event) { $('#barcodeSubmittedModal').modal(); event.preventDefault(); } ); }); (...) ...and then do checkout with a barcode e.g. 123456789 Result: With the first alert you will get [object HTMLInputELement] and with the second the barcode 123456789 While testing I detected errors because there seem to be cases where the object barcode does not (yet?) exist. That's why I test first for the existence of barcode and then for it's value. Created attachment 38185 [details] [review] Bug 14011 - Triggering slip print with enter key collides with 'barcode submitted' To reproduce: - Log into staff client - Find a client with 0 checkouts - Print a slip (or cancel printing it) - Attempt to type in a barcode to checkout -- annoying modal screen pops up 'barcode submitted' message will be triggered each time you try To test: - apply patch - try to reproduce issue Signed-off-by: Mark Tompsett <mtompset@hotmail.com> Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com> Created attachment 38186 [details] [review] Bug 14011: Make the jQuery selector explicit Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com> (In reply to Marc Véron from comment #4) > Hi Jonathan, > > Add following alerts after line 66 in circulation.tt: > > $(document).ready(function() { > $('#mainform').on('submit',function() { > alert(barcode); > alert(barcode.value); > $('#barcode').on('keypress',function(event) { > $('#barcodeSubmittedModal').modal(); > event.preventDefault(); } > ); > }); > (...) It's seem that barcode and $("#barcode") is the same, I was not aware of that. Thanks Jonathan for passing QA. BTW: I did some tests with $('#barcode') instead of barcode (see #4). The first alert showed [object Object] instead of [object HTMLInputELement] and the second 'undefined' instead of the value (and the patch did not work). Re-tested with second patch, works as expected. Patches pushed to master. Thanks Marc! |