Bug 36233 - Cannot search invoices if too many vendors
Summary: Cannot search invoices if too many vendors
Status: Pushed to oldstable
Alias: None
Product: Koha
Classification: Unclassified
Component: Acquisitions (show other bugs)
Version: Main
Hardware: All All
: P5 - low major (vote)
Assignee: Nick Clemens (kidclamp)
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-03-05 14:52 UTC by Nick Clemens (kidclamp)
Modified: 2024-03-19 21:35 UTC (History)
5 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
24.05.00,23.11.04,23.05.10


Attachments
Bug 36233: Use select2 to load vendors on invoice search (6.94 KB, patch)
2024-03-05 14:55 UTC, Nick Clemens (kidclamp)
Details | Diff | Splinter Review
Bug 36233: Use select2 to load vendors on invoice search (6.93 KB, patch)
2024-03-06 16:09 UTC, Nick Clemens (kidclamp)
Details | Diff | Splinter Review
Attachment to Bug 36233 - Cannot search invoices if too many vendors (6.99 KB, patch)
2024-03-06 18:52 UTC, Lisette Scheer
Details | Diff | Splinter Review
Bug 36233: Use select2 to load vendors on invoice search (6.99 KB, patch)
2024-03-06 18:54 UTC, Lisette Scheer
Details | Diff | Splinter Review
Bug 36233: (follow-up) Fix width and enable clear option (1010 bytes, patch)
2024-03-06 19:24 UTC, Nick Clemens (kidclamp)
Details | Diff | Splinter Review
Bug 36233: Use select2 to load vendors on invoice search (7.04 KB, patch)
2024-03-12 22:44 UTC, Victor Grousset/tuxayo
Details | Diff | Splinter Review
Bug 36233: (follow-up) Fix width and enable clear option (1008 bytes, patch)
2024-03-12 22:44 UTC, Victor Grousset/tuxayo
Details | Diff | Splinter Review
Bug 36233: Set select2 width to 100% (850 bytes, patch)
2024-03-14 10:59 UTC, Nick Clemens (kidclamp)
Details | Diff | Splinter Review
Bug 36233: Use select2 to load vendors on invoice search (7.10 KB, patch)
2024-03-14 20:00 UTC, Victor Grousset/tuxayo
Details | Diff | Splinter Review
Bug 36233: (follow-up) Fix width and enable clear option (1.04 KB, patch)
2024-03-14 20:00 UTC, Victor Grousset/tuxayo
Details | Diff | Splinter Review
Bug 36233: Set select2 width to 100% (906 bytes, patch)
2024-03-14 20:00 UTC, Victor Grousset/tuxayo
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Nick Clemens (kidclamp) 2024-03-05 14:52:10 UTC
When loading invoices.pl we get all vendors and build a dropdown for searching. In a system with many vendors this can cause slowness or crashes.
Comment 1 Nick Clemens (kidclamp) 2024-03-05 14:55:59 UTC
Created attachment 162753 [details] [review]
Bug 36233: Use select2 to load vendors on invoice search

This patch moves the dropdown to use select2 and avoids loading all
vendors at page load.

To test:
 1 - Create some extra vendors in your system, ideally over 20
 2 - Search for a vendor in acquisitions
 3 - Click 'Invoices'
 4 - Note the dropdown of all vendors 'Vendor:' in search bar on left
 5 - The vendor you came from shoudl eb selected
 6 - Apply patch
 7 - Repeat
 8 - Note only a partial list of vendors is loaded, confirm current vendor still selected
 9 - Search in the dropdown and confirm vendors are returned
10 - Select a vendor and search
11 - confirm selection is retained
Comment 2 Nick Clemens (kidclamp) 2024-03-06 16:09:53 UTC
Created attachment 162839 [details] [review]
Bug 36233: Use select2 to load vendors on invoice search

This patch moves the dropdown to use select2 and avoids loading all
vendors at page load.

To test:
 1 - Create some extra vendors in your system, ideally over 20
 2 - Search for a vendor in acquisitions
 3 - Click 'Invoices'
 4 - Note the dropdown of all vendors 'Vendor:' in search bar on left
 5 - The vendor you came from shoudl eb selected
 6 - Apply patch
 7 - Repeat
 8 - Note only a partial list of vendors is loaded, confirm current vendor still selected
 9 - Search in the dropdown and confirm vendors are returned
10 - Select a vendor and search
11 - confirm selection is retained
Comment 3 Lisette Scheer 2024-03-06 18:52:50 UTC Comment hidden (obsolete)
Comment 4 Lisette Scheer 2024-03-06 18:54:13 UTC
Created attachment 162849 [details] [review]
Bug 36233: Use select2 to load vendors on invoice search

This patch moves the dropdown to use select2 and avoids loading all
vendors at page load.

To test:
 1 - Create some extra vendors in your system, ideally over 20
 2 - Search for a vendor in acquisitions
 3 - Click 'Invoices'
 4 - Note the dropdown of all vendors 'Vendor:' in search bar on left
 5 - The vendor you came from shoudl eb selected
 6 - Apply patch
 7 - Repeat
 8 - Note only a partial list of vendors is loaded, confirm current vendor still selected
 9 - Search in the dropdown and confirm vendors are returned
10 - Select a vendor and search
11 - confirm selection is retained

Signed-off-by:  Angela Berrett angela.berrett@familysearch.org
Comment 5 Lisette Scheer 2024-03-06 18:55:57 UTC
This worked as intended. 
We did notice that the drop down is not the same width as the rest of the form and the drop down doesn't have an option to say all libraries/remove the library that's selected.
Comment 6 Nick Clemens (kidclamp) 2024-03-06 19:24:47 UTC
Created attachment 162853 [details] [review]
Bug 36233: (follow-up) Fix width and enable clear option
Comment 7 Victor Grousset/tuxayo 2024-03-12 22:44:04 UTC
Created attachment 163102 [details] [review]
Bug 36233: Use select2 to load vendors on invoice search

This patch moves the dropdown to use select2 and avoids loading all
vendors at page load.

To test:
 1 - Create some extra vendors in your system, ideally over 20
 2 - Search for a vendor in acquisitions
 3 - Click 'Invoices'
 4 - Note the dropdown of all vendors 'Vendor:' in search bar on left
 5 - The vendor you came from shoudl eb selected
 6 - Apply patch
 7 - Repeat
 8 - Note only a partial list of vendors is loaded, confirm current vendor still selected
 9 - Search in the dropdown and confirm vendors are returned
10 - Select a vendor and search
11 - confirm selection is retained

Signed-off-by: Lisette Scheer <lisette@bywatersolutions.com>
Rebased-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Comment 8 Victor Grousset/tuxayo 2024-03-12 22:44:07 UTC
Created attachment 163103 [details] [review]
Bug 36233: (follow-up) Fix width and enable clear option
Comment 9 Victor Grousset/tuxayo 2024-03-12 22:45:11 UTC
Rebased to fix conflict
Comment 10 Victor Grousset/tuxayo 2024-03-13 21:40:45 UTC
commit:
> Fix width and enable clear option

Unfortunately that sets in stone the width at page load.
Any resizing of the width of the page will have the Vendor <select> stay at the same width while the other filter are responsive.

---

>  8 - Note only a partial list of vendors is loaded, confirm current vendor still selected

No, all my 31 vendors are there. Any additional reproduction step?

> In a system with many vendors this can cause slowness or crashes.

Neither a sign of that on my slowass PC 🐌

@Lisette Did you witness any bad behavior without the patch? To confirm it fixes it.

@Nick do you have a customer instance that had issue fixed by the patch.

---

Otherwise, code looks good.
Comment 11 Nick Clemens (kidclamp) 2024-03-14 10:59:11 UTC
Created attachment 163132 [details] [review]
Bug 36233: Set select2 width to 100%
Comment 12 Nick Clemens (kidclamp) 2024-03-14 11:02:34 UTC
(In reply to Victor Grousset/tuxayo from comment #10)
> commit:
> > Fix width and enable clear option
> 
> Unfortunately that sets in stone the width at page load.
> Any resizing of the width of the page will have the Vendor <select> stay at
> the same width while the other filter are responsive.

Set to 100%, this seems to work
> 
> >  8 - Note only a partial list of vendors is loaded, confirm current vendor still selected
> 
> No, all my 31 vendors are there. Any additional reproduction step?

What is your RESTDefaltPageSize? The vendors can all be scrolled, however, if you watch the network tab in the console, you will see there is a paged request for vendors as you scroll
> 
> > In a system with many vendors this can cause slowness or crashes.
> 
> Neither a sign of that on my slowass PC 🐌

Yes, we have a site with ~270k vendors - I tested with 500 and noticed a wait :-)
Comment 13 Victor Grousset/tuxayo 2024-03-14 19:59:59 UTC
> Set to 100%, this seems to work

great, indeed, thanks :)

> What is your RESTDefaltPageSize? The vendors can all be scrolled, however, if you watch the network tab in the console, you will see there is a paged request for vendors as you scroll

I got confused, I though it was without patch and part of the issue. It works, I see the lazy loading when scrolling down, nice :)

> Yes, we have a site with ~270k vendors

270k 🤯

Ok, then no need to witness it to confirm that this will fix issues. I can't imagine the HTML size for the <select> with 270k vendors.

And search works :D
Comment 14 Victor Grousset/tuxayo 2024-03-14 20:00:17 UTC
Created attachment 163146 [details] [review]
Bug 36233: Use select2 to load vendors on invoice search

This patch moves the dropdown to use select2 and avoids loading all
vendors at page load.

To test:
 1 - Create some extra vendors in your system, ideally over 20
 2 - Search for a vendor in acquisitions
 3 - Click 'Invoices'
 4 - Note the dropdown of all vendors 'Vendor:' in search bar on left
 5 - The vendor you came from shoudl eb selected
 6 - Apply patch
 7 - Repeat
 8 - Note only a partial list of vendors is loaded, confirm current vendor still selected
 9 - Search in the dropdown and confirm vendors are returned
10 - Select a vendor and search
11 - confirm selection is retained

Signed-off-by: Lisette Scheer <lisette@bywatersolutions.com>
Rebased-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Comment 15 Victor Grousset/tuxayo 2024-03-14 20:00:20 UTC
Created attachment 163147 [details] [review]
Bug 36233: (follow-up) Fix width and enable clear option

Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Comment 16 Victor Grousset/tuxayo 2024-03-14 20:00:23 UTC
Created attachment 163148 [details] [review]
Bug 36233: Set select2 width to 100%

Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Comment 17 Victor Grousset/tuxayo 2024-03-14 20:00:59 UTC
Works, makes sense, QA script happy, code looks good, passing QA :)
Comment 18 Katrin Fischer 2024-03-15 08:40:17 UTC
Pushed for 24.05!

Well done everyone, thank you!
Comment 19 Fridolin Somers 2024-03-18 08:58:48 UTC
Pushed to 23.11.x for 23.11.04
Comment 20 Lucas Gass 2024-03-19 21:35:34 UTC
Backported to 23.05.x for upcoming 23.05.10