Bug 32126 - Adding item search fields is broken - can't add more than one field
Summary: Adding item search fields is broken - can't add more than one field
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Searching (show other bugs)
Version: Main
Hardware: All All
: P5 - low major
Assignee: Katrin Fischer
QA Contact: Testopia
URL:
Keywords: rel_22_11_candidate
Depends on: 31986
Blocks: 31406 32213
  Show dependency treegraph
 
Reported: 2022-11-07 19:27 UTC by David Nind
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:
23.05.00, 22.11.01
Circulation function:


Attachments
Bug 32126: Fix missing div breaking the form for adding more search fields (1.40 KB, patch)
2022-11-15 16:08 UTC, Katrin Fischer
Details | Diff | Splinter Review
Bug 32126: Fix missing div breaking the form for adding more search fields (1.45 KB, patch)
2022-11-15 19:03 UTC, David Nind
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description David Nind 2022-11-07 19:27:36 UTC
When adding item search fields (Administration > Catalog > Item search fields) in current master, you can only add one new field.

If you try and add another one, the body of the page is blank (navigation, etc is still in place).

I also checked this on the latest 22.05, and this problem doesn't occur - I can successfully add multiple item search fields.  So something has broken this in master.

I have also tried in different browsers (Firefox and Google Chrome).

To replicate:
1. Go to Administration > Catalog > Item search fields.
2. Click on 'New search field'.
3. Enter required details and submit:
   ==> table with the item search field added displayed.
4. Repeat step 2:
   ==> You now get a blank page (navigation, etc is still in place) and no add new item search field form.

Identified when testing bug 31406.
Comment 1 Katrin Fischer 2022-11-15 15:42:02 UTC
Confirmed.
Comment 2 Katrin Fischer 2022-11-15 15:55:21 UTC
This is related to our changes on the page, but I haven't quite figured out yet what's going on.

The visibility of the form on the page is managed with Javascript:

$(document).ready(function(){
    $("#add_field_form").hide();
    $("#new_search_field").on("click",function(e){
        e.preventDefault();
        $("#add_field_form").show();
        $(".dialog").hide();
        $("#search_fields_list").hide();
    });
    $(".hide_form").on("click",function(e){
        e.preventDefault();
        $("#add_field_form").hide();
        $(".dialog").show();
        $("#search_fields_list,#toolbar").show();
    });
Comment 3 Katrin Fischer 2022-11-15 16:08:55 UTC
Created attachment 143917 [details] [review]
Bug 32126: Fix missing div breaking the form for adding more search fields

The missing div caused a problem with the JS that controls
visibility of the list of search fields, the form and the toolbar.
With the div added, everything should now work as expected.

To test:
* Add a item search field, everything should work.
* Add a second item search field - intead of the form, you'll see an empty page.
* Apply patch.
* Add second and more search fields, all should work.
* Edit search fields.
* Delete search fields.
Comment 4 David Nind 2022-11-15 19:03:44 UTC
Created attachment 143923 [details] [review]
Bug 32126: Fix missing div breaking the form for adding more search fields

The missing div caused a problem with the JS that controls
visibility of the list of search fields, the form and the toolbar.
With the div added, everything should now work as expected.

To test:
* Add a item search field, everything should work.
* Add a second item search field - intead of the form, you'll see an empty page.
* Apply patch.
* Add second and more search fields, all should work.
* Edit search fields.
* Delete search fields.

Signed-off-by: David Nind <david@davidnind.com>
Comment 5 David Nind 2022-11-15 19:11:34 UTC
Thanks Katrin for fixing!

I did note (and it was doing it before this patch) that the form very briefly appears then disappears when there are no item search fields, or when going to Administration > Item search fields.

Another bug, or just the way this one works?

David
Comment 6 Katrin Fischer 2022-11-15 19:22:53 UTC
Just the way this works - elements get hidden/unhidden with Javascript, that's the flickering you see.
Comment 7 David Nind 2022-11-15 19:42:14 UTC
(In reply to Katrin Fischer from comment #6)
> Just the way this works - elements get hidden/unhidden with Javascript,
> that's the flickering you see.

Thanks Katrin!
Comment 8 Katrin Fischer 2022-11-27 10:57:38 UTC
A major bug, a silly easy fix, but noone to QA? :(
Comment 9 Tomás Cohen Arazi (tcohen) 2022-11-29 12:08:46 UTC
Pushed to master for 22.11.

Nice work everyone, thanks!
Comment 10 Martin Renvoize (ashimema) 2022-11-29 14:09:12 UTC
Pushed to 22.11.x for 22.11.01 release.

Thanks everyone.