[Koha-bugs] [Bug 8692] Authorities search form does not correspond to current search query

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Mon Aug 27 15:27:01 CEST 2012


http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=8692

Fridolyn SOMERS <fridolyn.somers at biblibre.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |Needs Signoff
           Assignee|gmcharlt at gmail.com          |fridolyn.somers at biblibre.co
                   |                            |m

--- Comment #1 from Fridolyn SOMERS <fridolyn.somers at biblibre.com> ---
Created attachment 11842
  -->
http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=11842&action=edit
Proposed patch

Proposed patch.

I also corrected a odd bug.
When searching with an empty value, the results are all authorities, but the
search form gets "authtypecode" as search term.

This comes form authorities-home.pl :
  $template->param(
    marclist       => $query->param('marclist'),
    and_or         => $query->param('and_or'),
    excluding      => $query->param('excluding'),
    operator       => $query->param('operator'),
    orderby        => $query->param('orderby'),
    value          => $query->param('value'),
    authtypecode   => $query->param('authtypecode'),
    startfrom      => $startfrom,
    resultsperpage => $resultsperpage,
);

It appears $template->param() is an array context.
$query->param('value') return an array in array context so when value is empty
an empty array.
So you get a wrong number of args in $template->param() (17 instead of 18),
which causes a warn in error logs and "authtypecode" in value.
I think one should never use $query->param() in $template->param(). If the
parameter in CGI query is repeatable, parameter in template must be an array
ref, and if not repeatable a string or scalar.
In our case, CGI query params corresponding to search are not repeatable so
there is no need to get an array of params.

Test plan : 
-----------
In authorities module :

Select an authority type, select an operator (not first one), enter a search
term and select a sort order (not first one).
Click on 'Submit'.
=> Search form does not change.

Click on "Search main heading".
=> Search form does not change.

Click on "Search all headings".
=> Search form does not change.

Click on a page result (search must have more than 20 results).
=> Search form does not change.

Delete an authority.
=> Search form does not change.

Perform a search with an empty search term.
=> Search term in form is empty.

-- 
You are receiving this mail because:
You are watching all bug changes.


More information about the Koha-bugs mailing list