| Summary: | Cancelling transfer on returns.pl is subject to a race condition | ||
|---|---|---|---|
| Product: | Koha | Reporter: | Nick Clemens (kidclamp) <nick> |
| Component: | Circulation | Assignee: | Nick Clemens (kidclamp) <nick> |
| Status: | CLOSED FIXED | QA Contact: | Josef Moravec <josef.moravec> |
| Severity: | normal | ||
| Priority: | P5 - low | CC: | fridolin.somers, gmcharlt, josef.moravec, kyle, lucas |
| Version: | Main | ||
| Hardware: | All | ||
| OS: | All | ||
| GIT URL: | Initiative type: | --- | |
| Sponsorship status: | --- | Comma delimited list of Sponsors: | |
| Crowdfunding goal: | 0 | Patch complexity: | Trivial patch |
| Documentation contact: | Documentation submission: | ||
| Text to go in the release notes: | Version(s) released in: |
19.11.00,19.05.03
|
|
| Circulation function: | |||
| Attachments: |
Bug 23220: Prevent form submission before redirect
Bug 23220: Prevent form submission before redirect Bug 23220: Prevent form submission before redirect |
||
The problem here is that the modal form is sill submitted on closing the modal, and if we aren't fast enough the redirect doesn't happen Created attachment 91017 [details] [review] Bug 23220: Prevent form submission before redirect To test: 1 - Check in an item to generate a transfer (form another library, no floating) 2 - Check it in again, click 'Cancel transfer' 3 - It may or may not work 4 - To highlight the issue edit return.tt to add the delay line as below: $('.cancel-transfer').on("click",function(e){ delay(5000); window.location.href='/cgi-bin/koha/circ/returns.pl?itemnumber=[% itemnumber | html %]&canceltransfer=1' }); 5 - Check in the item repeatedly, click 'Cancel transfer' 6 - View the item in the staff or opac and verify it remains in transit 7 - Undo changes above, apply patch 8 - Test 'Cancel transfer', note it works 9 - Add the delay back in, confirm it still works Created attachment 91021 [details] [review] Bug 23220: Prevent form submission before redirect To test: 1 - Check in an item to generate a transfer (form another library, no floating) 2 - Check it in again, click 'Cancel transfer' 3 - It may or may not work 4 - To highlight the issue edit return.tt to add the delay line as below: $('.cancel-transfer').on("click",function(e){ delay(5000); window.location.href='/cgi-bin/koha/circ/returns.pl?itemnumber=[% itemnumber | html %]&canceltransfer=1' }); 5 - Check in the item repeatedly, click 'Cancel transfer' 6 - View the item in the staff or opac and verify it remains in transit 7 - Undo changes above, apply patch 8 - Test 'Cancel transfer', note it works 9 - Add the delay back in, confirm it still works Signed-off-by: Owen Leonard <oleonard@myacpl.org> Created attachment 91034 [details] [review] Bug 23220: Prevent form submission before redirect To test: 1 - Check in an item to generate a transfer (form another library, no floating) 2 - Check it in again, click 'Cancel transfer' 3 - It may or may not work 4 - To highlight the issue edit return.tt to add the delay line as below: $('.cancel-transfer').on("click",function(e){ delay(5000); window.location.href='/cgi-bin/koha/circ/returns.pl?itemnumber=[% itemnumber | html %]&canceltransfer=1' }); 5 - Check in the item repeatedly, click 'Cancel transfer' 6 - View the item in the staff or opac and verify it remains in transit 7 - Undo changes above, apply patch 8 - Test 'Cancel transfer', note it works 9 - Add the delay back in, confirm it still works Signed-off-by: Owen Leonard <oleonard@myacpl.org> Signed-off-by: Josef Moravec <josef.moravec@gmail.com> Nice work! Pushed to master for 19.11.00 Pushed to 19.05.x for 19.05.03 backported to 18.11.x for 18.11.09 |
To recreate: 1 - Check in an item 2 - If AutomaticItemReturn = Do it will generate a transfer, otherwise accept the transfer 3 - Check the item in again - your modal should now have a 'Cancel transfer' button 4 - Click it 5 - It may or may not work, depending on system speed 6 - edit return.tt, find the cancel transfer JS and edit it: $('.cancel-transfer').on("click",function(e){ delay(5000); window.location.href='/cgi-bin/koha/circ/returns.pl?itemnumber=[% itemnumber | html %]&canceltransfer=1' }); 7 - Now check in item and hit cancel transfer 8 - Repeat and note the 'Cancel transfer' button remains 9 - Click it and then view the item, it is in transit