Bug 28784: Remove code related to num_paragraph cookie
authorJonathan Druart <jonathan.druart@bugs.koha-community.org>
Tue, 3 Aug 2021 08:58:47 +0000 (10:58 +0200)
committerKyle M Hall <kyle@bywatersolutions.com>
Tue, 24 Aug 2021 13:51:19 +0000 (09:51 -0400)
commit18183bdf34d67e0a97b993ee06c996343c83cb84
tree2c336c29b1600f06dd36f948c6f474bd40d46176
parent488ceca3d1b7b0f858993b4ee9a7dbb939d8bdb6
Bug 28784: Remove code related to num_paragraph cookie

It could lead to server freeze if set to a big value (we are pushing
into an array and so RAM is being fulfilled, and CPU is looping).

I don't understand the point of this cookie.

        var numPar = $("#booleansearch fieldset p").size();
        if (numPar > [% search_boxes_count | html %]){
            jQuery.cookie("num_paragraph", numPar,{ path: '/'});
        }else{
            jQuery.removeCookie("num_paragraph", { path: '/'});
        }

But "#booleansearch fieldset p" does not exist, it's not 'p' but 'div'
elements.

I've removed the code related to num_paragraph and the "Return to the
last advanced search" feature still works as before.

From this comment:
    # determine what to display next to the search boxes (ie, boolean option
    # shouldn't appear on the first one, scan indexes should, adding a new
    # box should only appear on the last, etc.

The only bit that is not working as described is "adding a new box
should only appear on the last", but it has been working this way for
a long time already I think, and I don't see it as a bug.

Test plan:
Read the code, check that the above is correct.
Search for regression in this "return to last adv search" feature added
by bug 13307.

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-advsearch.tt
opac/opac-search.pl