Bug 23202 - Problems when adding multiple items to an order in acquisitions
Summary: Problems when adding multiple items to an order in acquisitions
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Acquisitions (show other bugs)
Version: master
Hardware: All All
: P5 - low normal (vote)
Assignee: Johanna Räisä
QA Contact: Testopia
URL:
Keywords:
: 32175 (view as bug list)
Depends on: 29239
Blocks:
  Show dependency treegraph
 
Reported: 2019-06-25 11:25 UTC by Nick Clemens
Modified: 2023-06-08 22:26 UTC (History)
5 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,21.11, 22.05.05


Attachments
Bug 23202: Problems when adding multiple items to an order in acquisitions (1.62 KB, patch)
2022-07-26 09:14 UTC, Johanna Räisä
Details | Diff | Splinter Review
Bug 23202: Problems when adding multiple items to an order in acquisitions (1.67 KB, patch)
2022-07-30 20:55 UTC, Katrin Fischer
Details | Diff | Splinter Review
Bug 23202: Fix screen freeze when ordereing several items (1.85 KB, patch)
2022-08-17 09:45 UTC, Jonathan Druart
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Nick Clemens 2019-06-25 11:25:46 UTC
We have had reports of problems when adding multiple items to an order

The problem is like:
1 - Add to a basket with AcqCreateItems set to 'ordering'
2 - Scroll to bottom of item section and click 'Add multiple items'
3 - Add 40+ items
4 - Screen freezes on 'Processing multiple items'

This cannot be recreated consistently, but we have had recurring reports from an institution that orders many copies of items often
Comment 1 Jonathan Druart 2019-06-29 15:35:06 UTC
Nothing in the logs? What is their barcode settings?
Comment 2 Johanna Räisä 2022-06-21 07:59:55 UTC
We got this problem too. Seems that the dateaccessioned.pl plugin in items dateaccessioned field is creating this. It is a javascript problem the flatpickr structure prevents items to be cloned in additem.js file.

I can take this bug and fix it.
Comment 3 Katrin Fischer 2022-06-21 08:09:21 UTC
Hi Johanna, thx for this! Could it be related to bug 30975 somehow?
Comment 4 Johanna Räisä 2022-06-21 08:32:33 UTC
(In reply to Katrin Fischer from comment #3)
> Hi Johanna, thx for this! Could it be related to bug 30975 somehow?

I think that is a different problem, more of Jquery behavior. In this bug the browser console gives this error: 
Uncaught TypeError: $(...).parent(...).attr(...) is undefined

So with flatpickr datefield it doesn't find correct attribute to continue.
Comment 5 Katrin Fischer 2022-07-16 18:12:39 UTC
I can replicate the issue, when the 'date acquired' is filled in. This gives the error every time on adding multiple items:

Uncaught TypeError: $(...).parent(...).attr(...) is undefined

Johanna, are you still working on a fix?
Comment 6 Johanna Räisä 2022-07-25 05:52:01 UTC
(In reply to Katrin Fischer from comment #5)
> I can replicate the issue, when the 'date acquired' is filled in. This gives
> the error every time on adding multiple items:
> 
> Uncaught TypeError: $(...).parent(...).attr(...) is undefined
> 
> Johanna, are you still working on a fix?

I'm on to it. Just came from summer vacation.
Comment 7 Katrin Fischer 2022-07-25 07:30:37 UTC
(In reply to Johanna Räisä from comment #6)
> (In reply to Katrin Fischer from comment #5)
> > I can replicate the issue, when the 'date acquired' is filled in. This gives
> > the error every time on adding multiple items:
> > 
> > Uncaught TypeError: $(...).parent(...).attr(...) is undefined
> > 
> > Johanna, are you still working on a fix?
> 
> I'm on to it. Just came from summer vacation.

Thx! Will try to test.
Comment 8 Johanna Räisä 2022-07-26 09:14:35 UTC
Created attachment 138120 [details] [review]
Bug 23202: Problems when adding multiple items to an order in acquisitions

This patch fixes adding multiple items on order acquisitions

1) Set dateaccessioned.pl plugin to ACQ framework's 952$d field.
2) Create basket to a vendor and add order from a new empty record.
3) Add date acquired value from calendar.
4) Add multiple items and see that the view freezes.
5) Apply the patch
6) Reload the page and repeat the steps 3 and 4.
7) See that the items are added.
Comment 9 Johanna Räisä 2022-07-28 08:58:29 UTC
Ahh, forgot to change the status. Here you go!
Comment 10 Katrin Fischer 2022-07-30 20:55:51 UTC
Created attachment 138395 [details] [review]
Bug 23202: Problems when adding multiple items to an order in acquisitions

This patch fixes adding multiple items on order acquisitions

1) Set dateaccessioned.pl plugin to ACQ framework's 952$d field.
2) Create basket to a vendor and add order from a new empty record.
3) Add date acquired value from calendar.
4) Add multiple items and see that the view freezes.
5) Apply the patch
6) Reload the page and repeat the steps 3 and 4.
7) See that the items are added.

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 11 Jonathan Druart 2022-08-17 09:43:01 UTC
Tried add multi when ordering, receiving and cataloguing, all good.

Johanna, please have a look at https://wiki.koha-community.org/wiki/Commit_messages#Examples
Most of the time the bug report title and the commit title must be different (what the bug is vs what the patch does).
Comment 12 Jonathan Druart 2022-08-17 09:45:32 UTC
Created attachment 139244 [details] [review]
Bug 23202: Fix screen freeze when ordereing several items

This patch fixes adding multiple items on order acquisitions

The error is: Uncaught TypeError: $(...).parent(...).attr(...) is undefined

Test plan:
1) Set dateaccessioned.pl plugin to ACQ framework's 952$d field.
2) Create basket to a vendor and add order from a new empty record.
3) Add date acquired value from calendar.
4) Add multiple items and see that the view freezes.
5) Apply the patch
6) Reload the page and repeat the steps 3 and 4.
7) See that the items are added.

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

JD Amended patch: adjust commit title
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 13 Jonathan Druart 2022-08-17 09:45:50 UTC
This patch does not make the code more robust but it fixes the problem without introducing new regressions (hopefully!).
Comment 14 Tomás Cohen Arazi 2022-08-17 12:25:59 UTC
Pushed to master for 22.11.

Nice work everyone, thanks!
Comment 15 Lucas Gass 2022-09-08 14:47:21 UTC
Backported to 22.05.x for 22.05.05
Comment 16 Arthur Suzuki 2022-09-14 12:58:18 UTC
Thanks!

Pushed to 21.11 for 21.11.12
Comment 17 Victor Grousset/tuxayo 2022-09-20 20:06:22 UTC
Not backported to oldoldstable (21.05.x). Feel free to ask if it's needed.

Nothing to document it seems, marking resolved.
Comment 18 Jonathan Druart 2022-11-18 06:00:16 UTC
*** Bug 32175 has been marked as a duplicate of this bug. ***