Bug 30653 - "Check out" search with one result does not redirect to checkout
Summary: "Check out" search with one result does not redirect to checkout
Status: NEW
Alias: None
Product: Koha
Classification: Unclassified
Component: Circulation (show other bugs)
Version: 21.11
Hardware: All All
: P5 - low normal (vote)
Assignee: Bugs List
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-04-29 12:37 UTC by Magnus Enger
Modified: 2022-07-16 18:58 UTC (History)
3 users (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Magnus Enger 2022-04-29 12:37:26 UTC
I am seeing this on 21.11.04. I go to the front page of the intranet. The "Check out" tab of the header search is active as default. I type my name into the search box and press enter. This takes me to this page: 

/cgi-bin/koha/members/member.pl?quicksearch=1&circsearch=1&searchmember=magnus%20enger

This page shows one result, and the "Card" column links to:

/cgi-bin/koha/circ/circulation.pl?borrowernumber=1

while the "Name" column links to:

/cgi-bin/koha/members/moremember.pl?borrowernumber=1

If I choose my name in the typeahead/dropdown that appears below the search box, I am taken to this page:

/cgi-bin/koha/circ/circulation.pl?borrowernumber=1

Then I do the same thing in 21.05.05: Type my name in the "Check out" box and press Enter. There I am taken directly to:

/cgi-bin/koha/circ/circulation.pl

(This is a POST, so borrowernumber=1 is not visible in the URL). 


Looking more closely at the source of /cgi-bin/koha/members/member.pl?quicksearch=1&circsearch=1&searchmember=magnus%20enger in 21.11.04 I do see this: 

                    $.ajax({
                        'dataType': 'json',
                        'type': 'POST',
                        'url': sSource,
                        'data': aoData,
                        'success': function(json){
                            // redirect if there is only 1 result.
                            if ( json.aaData.length == 1 && aoData.iDisplayStart == 0 ) {
                                var borrowernumber = json.aaData[0].borrowernumber;
                                /* Overwrite history state of firstletter search since only one result was returned; This prevents a loop upon clicking back */
                                history.replaceState( {}, null, window.location.href.split("?" )[0]);
                                document.location.href="/cgi-bin/koha/circ/circulation.pl?borrowernumber="+borrowernumber;
                                return false;
                            }
                            fnCallback(json);
                        }
                    });

This seems to incorporate the fix from bug 29411, but it does not seem to be working. There is nothing in the console.
Comment 1 Jonathan Druart 2022-06-07 14:30:04 UTC
Looks ok for me on master. Are you able to confirm that?
Comment 2 Katrin Fischer 2022-07-16 18:58:43 UTC
(In reply to Jonathan Druart from comment #1)
> Looks ok for me on master. Are you able to confirm that?

I can confirm it works ok on master, couldn't test in 21.11 yet.