Bug 25563 - Cannot submit "add order from MARC file" form after alert
Summary: Cannot submit "add order from MARC file" form after alert
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Acquisitions (show other bugs)
Version: unspecified
Hardware: All All
: P5 - low major (vote)
Assignee: Jonathan Druart
QA Contact: Testopia
URL:
Keywords:
Depends on: 24386
Blocks:
  Show dependency treegraph
 
Reported: 2020-05-21 09:43 UTC by Jonathan Druart
Modified: 2021-12-13 21:08 UTC (History)
4 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Small patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
20.05.00, 19.11.07, 19.05.12


Attachments
Bug 25563: (bug 24386 follow-up) Don't disable submit button if form has not been submitted yet (3.32 KB, patch)
2020-05-21 10:08 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 25563: Only submit form after is it checked (2.07 KB, patch)
2020-05-21 10:10 UTC, Nick Clemens
Details | Diff | Splinter Review
Bug 25563: (bug 24386 follow-up) Don't disable submit button if form has not been submitted yet (3.39 KB, patch)
2020-05-21 10:17 UTC, Nick Clemens
Details | Diff | Splinter Review
Bug 25563: (bug 24386 follow-up) Don't disable submit button if form has not been submitted yet (3.44 KB, patch)
2020-05-21 12:53 UTC, Katrin Fischer
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Jonathan Druart 2020-05-21 09:43:43 UTC
If you get an alert about "no fund selected" you won't be able to submit the form.

To recreate (test plan from bug 25473)
- stage a marc record
- acquisitions: have a basket
- click on "Add to basket"
- "From a staged file"
- Don't tick the record
- Save
- You should see an expected error message
- Tick the record
- Choose a fund
- Save (at least try)
- Nothing happens :<
Comment 1 Jonathan Druart 2020-05-21 09:44:38 UTC
Caused by
  commit 01551437c0c99b9e6308e109ceeef5bc3f7b5cec
  Bug 24386: Prevent double form submission on adding orders to basket from a file
Comment 2 Jonathan Druart 2020-05-21 10:08:10 UTC
Created attachment 105171 [details] [review]
Bug 25563: (bug 24386 follow-up) Don't disable submit button if form has not been submitted yet

On bug 24386 we prevent double form submission using the our own preventDoubleFormSubmit JS function.

The problem is that we are checking some conditions, and prevent the
form submission if something is not filled (for instance no checkbox
checked, or no fund selected).

Technically it means that:
- click the submit button
- it submits the form
- we disable the submit button
- we prevent the form to be submitted before something is wrong
At this stage the button is disabled and the form cannot be longer be
submitted.

This patch replaces the "on submit" event of the form with the "on click" event of the submit button.
Which means we are going to:
- click the submit button
- we prevent the form to be submitted before something is wrong
=> The button will only be disabled if the form is really submitted

Test plan:
- stage a marc record
- acquisitions: have a basket
- click on "Add to basket"
- "From a staged file"
- Don't tick the record
- Save
- You should see an expected error message
- Tick the record
- Save
- You should see an expected error message
- Choose a fund
- Click the "Save" button as many times as you can, to try double submit
it.
=> The order is saved
Comment 3 Nick Clemens 2020-05-21 10:10:40 UTC
Created attachment 105172 [details] [review]
Bug 25563: Only submit form after is it checked
Comment 4 Nick Clemens 2020-05-21 10:17:39 UTC
Created attachment 105173 [details] [review]
Bug 25563: (bug 24386 follow-up) Don't disable submit button if form has not been submitted yet

On bug 24386 we prevent double form submission using the our own preventDoubleFormSubmit JS function.

The problem is that we are checking some conditions, and prevent the
form submission if something is not filled (for instance no checkbox
checked, or no fund selected).

Technically it means that:
- click the submit button
- it submits the form
- we disable the submit button
- we prevent the form to be submitted before something is wrong
At this stage the button is disabled and the form cannot be longer be
submitted.

This patch replaces the "on submit" event of the form with the "on click" event of the submit button.
Which means we are going to:
- click the submit button
- we prevent the form to be submitted before something is wrong
=> The button will only be disabled if the form is really submitted

Test plan:
- stage a marc record
- acquisitions: have a basket
- click on "Add to basket"
- "From a staged file"
- Don't tick the record
- Save
- You should see an expected error message
- Tick the record
- Save
- You should see an expected error message
- Choose a fund
- Click the "Save" button as many times as you can, to try double submit
it.
=> The order is saved

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Comment 5 Katrin Fischer 2020-05-21 12:53:01 UTC
Created attachment 105183 [details] [review]
Bug 25563: (bug 24386 follow-up) Don't disable submit button if form has not been submitted yet

On bug 24386 we prevent double form submission using the our own preventDoubleFormSubmit JS function.

The problem is that we are checking some conditions, and prevent the
form submission if something is not filled (for instance no checkbox
checked, or no fund selected).

Technically it means that:
- click the submit button
- it submits the form
- we disable the submit button
- we prevent the form to be submitted before something is wrong
At this stage the button is disabled and the form cannot be longer be
submitted.

This patch replaces the "on submit" event of the form with the "on click" event of the submit button.
Which means we are going to:
- click the submit button
- we prevent the form to be submitted before something is wrong
=> The button will only be disabled if the form is really submitted

Test plan:
- stage a marc record
- acquisitions: have a basket
- click on "Add to basket"
- "From a staged file"
- Don't tick the record
- Save
- You should see an expected error message
- Tick the record
- Save
- You should see an expected error message
- Choose a fund
- Click the "Save" button as many times as you can, to try double submit
it.
=> The order is saved

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 6 Martin Renvoize 2020-05-22 08:34:13 UTC
Nice work everyone!

Pushed to master for 20.05
Comment 7 Aleisha Amohia 2020-06-09 02:30:19 UTC
backported to 19.11.x for 19.11.07
Comment 8 Victor Grousset/tuxayo 2020-06-11 17:33:21 UTC
Backported to 19.05.x branch for 19.05.12