From 063664c3d49c310f26849bdc5d03e66b45532eed Mon Sep 17 00:00:00 2001 From: Fridolyn SOMERS Date: Fri, 25 Oct 2013 11:44:26 +0200 Subject: [PATCH] Bug 11139 - opac-topissues does not work with CCODE When OPAC most populars uses collection code, it does not work. There are never results. This patch corrects two points: - SQL query uses 'ccode' as collection code authorised values category, it is CCODE uppercase - The constraint category='CCODE' must be inside join detween items and authorised_values, in this case items.ccode may be NULL Test plan : On a catalogue where items.ccode is defined and uses CCODE authorised values : - Set syspref AdvancedSearchTypes = ccode - Go to opac-topissues.pl - If no results, select "No limit" in "of the last:" and submit => You get results - Select in results a biblio and remove items.ccode from all its items - Refresh opac-topissues.pl (check "All collections" is selected in "Limit to:") => The biblio is still in results --- opac/opac-topissues.pl | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/opac/opac-topissues.pl b/opac/opac-topissues.pl index cdb572a..0ddb03f 100755 --- a/opac/opac-topissues.pl +++ b/opac/opac-topissues.pl @@ -86,10 +86,12 @@ if($advanced_search_types eq 'ccode'){ FROM biblio LEFT JOIN items USING (biblionumber) LEFT JOIN biblioitems USING (biblionumber) - LEFT JOIN authorised_values ON items.ccode = authorised_values.authorised_value + LEFT JOIN authorised_values ON ( + authorised_values.category = 'CCODE' + AND items.ccode = authorised_values.authorised_value + ) WHERE 1 $whereclause - AND authorised_values.category = 'ccode' GROUP BY biblio.biblionumber HAVING tot >0 ORDER BY tot DESC -- 1.8.3.2