Bug 7894

Summary: Broken detail page for first link on page 2 from search result page in OPAC
Product: Koha Reporter: Arslan Farooq <arslanone>
Component: OPACAssignee: MJ Ray (software.coop) <mjr>
Status: CLOSED FIXED QA Contact: Ian Walls <koha.sekjal>
Severity: blocker    
Priority: P5 - low CC: chris, jcamins, jonathan.druart+koha, magnus, mjr, paul.poulain, vinod_librarian
Version: 3.8   
Hardware: All   
OS: All   
See Also: http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=8293
Change sponsored?: --- Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Attachments: bug 7894: crude fix: convert results array into an arrayref
bug 7894: crude fix: convert results array into an arrayref
bug 7894 [SIGNED-OFF]: crude fix: convert results array into an arrayref

Description Arslan Farooq 2012-04-04 09:03:04 UTC

When you search the OPAC, clicking on the 1st result of page 2 always gives this error: 

"Software error:

Can't use string ("00800nam a22002537a 450000100050") as an ARRAY ref while "strict refs" in use at /usr/share/koha/lib/C4/Search.pm line 1493."

Screenshot: http://postimage.org/image/ouqivltox/

The error only happens when we search in the OPAC, go to page 2, and click on 1st record.

Search a different term and, that will result in some different record on page 2 top, and clicking that record will give same error.

Right click and copy the link of that record, and open it by directly pasting in another browser and the record will show properly. Meaning there is nothing wrong with the record itself.
Comment 1 MJ Ray (software.coop) 2012-04-04 09:25:41 UTC Comment hidden (obsolete)
Comment 2 MJ Ray (software.coop) 2012-04-04 09:26:53 UTC
Crude fix attached, but this functionality really should be optional and enabled by a system preference.
Comment 3 Jared Camins-Esakov 2012-04-04 10:53:43 UTC
Agreed about the syspref. This patch seems to break the results pagination on other records, though. With the patch applied, "Previous" and "Next" links are grayed out on other records.
Comment 4 Magnus Enger 2012-04-04 11:56:48 UTC
I tested the patch and while it does make the first record on the second page of results appear OK, the links in the "pager" thing on the right (Next/Previous) are somewhat broken. On record 20 the link to record 21 is inactive, and on record 21 the link to record 20 is inactive. So the next/previous links are noe working from one page of results to the next. This seems to be working on a 3.6.3 install though. 

Not sure if I should sign off so we can get the main fix in, or if it's worth waiting for a solution to the next/previous problem?
Comment 5 MJ Ray (software.coop) 2012-04-04 17:53:32 UTC
I've moved this back to Needs Signoff because I've confirmed that Next/Previous don't work across the boundary in 3.6.4 as running on http://catalog-test.nexpresslibrary.org/ - so that is a different bug and I think it's less severe than crashing out on the first result of later pages.

I've also confirmed that Next/Previous works for me within the first and second results pages.  I've discovered an entertaining bug which I will report now.
Comment 6 Magnus Enger 2012-04-04 21:35:57 UTC Comment hidden (obsolete)
Comment 7 Magnus Enger 2012-04-04 21:37:34 UTC
Created attachment 8890 [details] [review]
bug 7894 [SIGNED-OFF]: crude fix: convert results array into an arrayref

Signed-off-by: Magnus Enger <magnus@enger.priv.no>
This patch fixes the problem with the first record on the second
page, but there is still a problem with the next/previous links,
as described in comments 3 and 4 in the bug report. I'm signing
off since it's unclear wether that problem is directly linked to
the "first record on the second page" problem, and a partial fix
seems better than no fix at all.

Signed-off-by: Magnus Enger <magnus@enger.priv.no>
Comment 8 Paul Poulain 2012-04-06 16:12:33 UTC
QA comment: tiny patch, passed QA
Comment 9 Magnus Enger 2012-05-11 09:01:03 UTC
I'm seeing this in 3.6.4 too. Looks like the patch should be in 3.6.5, Jared? 

I'm also getting the same error from the RSS feeds in 3.6.4: 

Do a simple search from the front page, klick on the RSS icon and click on any title in the feed. I get this error: 

Can't use string ("02361    a2200565   450000100150") as an ARRAY ref while "strict refs" in use at /usr/share/koha/lib/C4/Search.pm line 1502.

Which is the same one i get for the first record on the second page. (I'm guessing some other change to Search.pm made the line with error move after Arslan's first report of this problem.)
Comment 10 Magnus Enger 2012-06-11 11:30:58 UTC
*** Bug 8225 has been marked as a duplicate of this bug. ***
Comment 11 Jonathan Druart 2012-08-23 14:13:37 UTC
See Bug 8293 for the next