From 8c5b665fbdffa630bc2bd972375f541dcaddaa73 Mon Sep 17 00:00:00 2001 From: Blou Date: Mon, 31 Oct 2016 15:42:30 -0400 Subject: [PATCH] Bug 17526 - OPAC lists require a sortfield Using the OPAC, going into the public lists, we click one of them and get DBIx::Class::Storage::DBI::_dbh_execute(): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'ASC LIMIT 10) `me` JOIN `biblio` `biblionumber` ON `biblionumber`.`biblionumber' THis is because the sortfield is empty and creates a SQL like GROUP BY ASC LIMIT 10. Missing the group by . In the intranet list, there's a default usage of 'title' that makes it all work. TESTING: 1) just create a public list with no sortfield. In the DB: - virtualshelves.category = 2 - virtualshelves.sortfield = '' 2) click on the list in the OPAC's public list. Boom! This simple patch uses 'title' if nothing else is specified. --- opac/opac-shelves.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/opac/opac-shelves.pl b/opac/opac-shelves.pl index b29ade6..ba79d52 100755 --- a/opac/opac-shelves.pl +++ b/opac/opac-shelves.pl @@ -225,7 +225,7 @@ if ( $op eq 'view' ) { if ( $shelf ) { if ( $shelf->can_be_viewed( $loggedinuser ) ) { $category = $shelf->category; - my $sortfield = $query->param('sortfield') || $shelf->sortfield; # Passed in sorting overrides default sorting + my $sortfield = $query->param('sortfield') || $shelf->sortfield || 'title'; # Passed in sorting overrides default sorting my $direction = $query->param('direction') || 'asc'; $direction = 'asc' if $direction ne 'asc' and $direction ne 'desc'; my ( $page, $rows ); -- 2.1.0