Bug 29895

Summary: Button [Add multiple items] stops responding when it's pressed and some multiple items added to basket
Product: Koha Reporter: Andrii Nugged <nugged>
Component: AcquisitionsAssignee: Jonathan Druart <jonathan.druart>
Status: CLOSED FIXED QA Contact: Testopia <testopia>
Severity: trivial    
Priority: P5 - low CC: andrewfh, kyle, victor
Version: Main   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: Small patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
22.05.00,21.11.03,21.05.11
Attachments: Bug 29895: Fix 'add multiple items' button on neworderempty
Bug 29895: Fix 'add multiple items' button on neworderempty
Bug 29895: Fix 'add multiple items' button on neworderempty

Description Andrii Nugged 2022-01-17 14:10:48 UTC
To reproduce:

1. get into basket, go find some biblio (i.e. press the "🧺 Add order" button on some biblio) and get into adding items to basket interface, smth /cgi-bin/koha/acqui/neworderempty.pl?booksellerid=1&basketno=1&biblionumber=233
2. press [Add multiple items] button st get the next interface elements with input for the number of items and the [Add] button.
3. add a few, 2 items, by pressing the [Add] button.
4. the modal will blink and 2 items added.
5. Extra interface with "number of items to add" and [Add] button gone, only three buttons again:   [Add item] [Clear] [Add multiple items] .
6. but now if to press [Add multiple items] - nothing happens.

Looks like the item lost its listener or not mapped to listener when recreated (if so).

It seems the issue in koha-tmpl/intranet-tmpl/prog/js/additem.js.

One side observation:
- if after this to press "Add item" button and add single item, then "Add multiple items" starts to work for one time again.
Comment 1 Andrii Nugged 2022-01-17 14:13:03 UTC
Also there typo with quoting in the same additem.js file, notice:

    name=buttonAddMulti"

in line 187:

                 +     '<input type="button" class="addItemControl" name=buttonAddMulti" style="cursor:pointer; margin:0 1em;" onclick="checkCount( this ,\'' + unique_item_fields + '\')" value="' + __("Add") + '" />'
Comment 2 Jonathan Druart 2022-01-17 14:22:08 UTC
Created attachment 129533 [details] [review]
Bug 29895: Fix 'add multiple items' button on neworderempty

Button [Add multiple items] stops responding when it's pressed and some multiple items added to basket

It has a "visibility: hidden" we are trying to remove setting "display:
inline"

This is pretty ugly and certainly does not clean the code, but it's too
messy and this patch fixes the problem easily.

Test plan:
Add a new order
Click "Add multiple items", enter "2", click "Add".
Confirm that you can use the "Add multiple items" again.
Comment 3 Samu Heiskanen 2022-01-18 14:28:02 UTC
Created attachment 129572 [details] [review]
Bug 29895: Fix 'add multiple items' button on neworderempty

Button [Add multiple items] stops responding when it's pressed and some multiple items added to basket

It has a "visibility: hidden" we are trying to remove setting "display:
inline"

This is pretty ugly and certainly does not clean the code, but it's too
messy and this patch fixes the problem easily.

Test plan:
Add a new order
Click "Add multiple items", enter "2", click "Add".
Confirm that you can use the "Add multiple items" again.

Signed-off-by: Samu Heiskanen <samu.heiskanen@hypernova.fi>
Comment 4 Katrin Fischer 2022-01-31 20:33:58 UTC
Created attachment 130023 [details] [review]
Bug 29895: Fix 'add multiple items' button on neworderempty

Button [Add multiple items] stops responding when it's pressed and some multiple items added to basket

It has a "visibility: hidden" we are trying to remove setting "display:
inline"

This is pretty ugly and certainly does not clean the code, but it's too
messy and this patch fixes the problem easily.

Test plan:
Add a new order
Click "Add multiple items", enter "2", click "Add".
Confirm that you can use the "Add multiple items" again.

Signed-off-by: Samu Heiskanen <samu.heiskanen@hypernova.fi>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 5 Fridolin Somers 2022-02-01 07:57:23 UTC
Pushed to master for 22.05, thanks to everybody involved 🦄
Comment 6 Kyle M Hall 2022-02-07 16:51:46 UTC
Pushed to 21.11.x for 21.11.03
Comment 7 Andrew Fuerste-Henry 2022-02-21 15:50:55 UTC
Pushed to 21.05.x for 21.05.11
Comment 8 Victor Grousset/tuxayo 2022-02-24 22:36:10 UTC
Not backported to oldoldstable (20.11.x). Feel free to ask if it's needed.