Bug 32045 - Cannot order multiple from staged file
Summary: Cannot order multiple from staged file
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Acquisitions (show other bugs)
Version: Main
Hardware: All All
: P5 - low major
Assignee: Nick Clemens (kidclamp)
QA Contact: Marcel de Rooy
URL:
Keywords: rel_22_11_candidate
Depends on:
Blocks:
 
Reported: 2022-10-30 12:30 UTC by Katrin Fischer
Modified: 2024-07-04 20:37 UTC (History)
2 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Trivial patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
22.11.00
Circulation function:


Attachments
Bug 32045: Use bootstrap tabs to select item tab (1.99 KB, patch)
2022-11-15 14:19 UTC, Nick Clemens (kidclamp)
Details | Diff | Splinter Review
Bug 32045: Use bootstrap tabs to select item tab (2.05 KB, patch)
2022-11-15 15:16 UTC, Katrin Fischer
Details | Diff | Splinter Review
Bug 32045: Use bootstrap tabs to select item tab (2.15 KB, patch)
2022-11-18 10:00 UTC, Marcel de Rooy
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Katrin Fischer 2022-10-30 12:30:58 UTC
To test:
* Create order
* Stage file of MARC records
* Order from staged file
* Select file 
* Select one or more records for ordering using the checkbox
* Set the fund on the Accounting page
* Save

Nothing happens, there is JavaScript error in the console:

Uncaught Error: cannot call methods on tabs prior to initialization; attempted to call method 'option'
Comment 1 Katrin Fischer 2022-11-02 23:20:04 UTC
To test:
* Create order
* Stage file of MARC records
* Order from staged file
* Select file 
* Select one or more records for ordering using the checkbox
* Save: You get: Some budgets are not defined in item records
* IMPORTANT: Set the funds on the "Default accounting details" tab
* Save again: nothing happens


New bug: that error is actually wrong too.... budgets should be funds.
Comment 2 Andrew Fuerste-Henry 2022-11-14 21:39:08 UTC
I think this might actually be due to the item type from the staged file not being correctly used to meet the itype requirement on the Item Information tab. I was getting the same error you pasted on trying to add one of three records from a MARC file before I touched anything on the accounting tab (following the test plan on bug 32166). When I selected an item type, the error cleared and the order saved.
Comment 3 Nick Clemens (kidclamp) 2022-11-15 14:19:11 UTC
Created attachment 143905 [details] [review]
Bug 32045: Use bootstrap tabs to select item tab

When the form to add orders from a staged file is validated, we use
toptabs functionality to switch to the item tab if there are missing fields.

The display now uses bootstrap tabs, so the JS is throwing an error:
Uncaught Error: cannot call methods on tabs prior to initialization; attempted to call method 'option'

This patch simply switches the call to switch tabs

To test:
1 - Stage a file for import
2 - Either use Marc(Item)FieldsToOrder to populate the orders
    or select a budget on the third tab
3 - View the second tab, items info, confirm itemtype is required, but don't populate it
4 - Attempt to save order, nothing happens
5 - Check the JS console (F12)
6 - Note the error:
    Uncaught Error: cannot call methods on tabs prior to initialization; attempted to call method 'option'
7 - Apply patch
8 - Cancel and add from staged file again
9 - Select a budget and save
10 - You now get an error popup: Some required item subfields are not set
11 - Confirm after the error you are shown the items tab
12 - Select itemtype
13 - Save
14 - Confirm orders added successfully
Comment 4 Katrin Fischer 2022-11-15 15:16:19 UTC
Created attachment 143909 [details] [review]
Bug 32045: Use bootstrap tabs to select item tab

When the form to add orders from a staged file is validated, we use
toptabs functionality to switch to the item tab if there are missing fields.

The display now uses bootstrap tabs, so the JS is throwing an error:
Uncaught Error: cannot call methods on tabs prior to initialization; attempted to call method 'option'

This patch simply switches the call to switch tabs

To test:
1 - Stage a file for import
2 - Either use Marc(Item)FieldsToOrder to populate the orders
    or select a budget on the third tab
3 - View the second tab, items info, confirm itemtype is required, but don't populate it
4 - Attempt to save order, nothing happens
5 - Check the JS console (F12)
6 - Note the error:
    Uncaught Error: cannot call methods on tabs prior to initialization; attempted to call method 'option'
7 - Apply patch
8 - Cancel and add from staged file again
9 - Select a budget and save
10 - You now get an error popup: Some required item subfields are not set
11 - Confirm after the error you are shown the items tab
12 - Select itemtype
13 - Save
14 - Confirm orders added successfully

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 5 Katrin Fischer 2022-11-15 15:16:46 UTC
Thx for investigating!
Comment 6 Andrew Fuerste-Henry 2022-11-15 15:40:35 UTC
(In reply to Katrin Fischer from comment #5)
> Thx for investigating!

Thank you for filing a bug that helped explain why the test plan for something else was giving me trouble :)
Comment 7 Marcel de Rooy 2022-11-18 09:50:23 UTC
QAing
Comment 8 Marcel de Rooy 2022-11-18 10:00:48 UTC
Created attachment 144051 [details] [review]
Bug 32045: Use bootstrap tabs to select item tab

When the form to add orders from a staged file is validated, we use
toptabs functionality to switch to the item tab if there are missing fields.

The display now uses bootstrap tabs, so the JS is throwing an error:
Uncaught Error: cannot call methods on tabs prior to initialization; attempted to call method 'option'

This patch simply switches the call to switch tabs

To test:
1 - Stage a file for import
2 - Either use Marc(Item)FieldsToOrder to populate the orders
    or select a budget on the third tab
3 - View the second tab, items info, confirm itemtype is required, but don't populate it
4 - Attempt to save order, nothing happens
5 - Check the JS console (F12)
6 - Note the error:
    Uncaught Error: cannot call methods on tabs prior to initialization; attempted to call method 'option'
7 - Apply patch
8 - Cancel and add from staged file again
9 - Select a budget and save
10 - You now get an error popup: Some required item subfields are not set
11 - Confirm after the error you are shown the items tab
12 - Select itemtype
13 - Save
14 - Confirm orders added successfully

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Comment 9 Tomás Cohen Arazi (tcohen) 2022-11-22 12:31:15 UTC
Pushed to master for 22.11.

Nice work everyone, thanks!