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)
committerJonathan Druart <jonathan.druart@bugs.koha-community.org>
Wed, 25 Aug 2021 12:57:43 +0000 (14:57 +0200)
commitf42412cb910d9dd3a1a32cc009e92a50d0c9d54a
tree75cbf16e6e78996e5e5768e8e7594ecf10696c43
parent36ef9a219de1f76bd460c2b75cdd4bb67e79ca68
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: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-advsearch.tt
opac/opac-search.pl