Fix for minor error in shelfbrowser queries
authorJesse Weaver <jesse.weaver@liblime.com>
Tue, 19 Aug 2008 22:11:21 +0000 (17:11 -0500)
committerHenri-Damien LAURENT <henridamien.laurent@biblibre.com>
Tue, 28 Oct 2008 21:09:24 +0000 (22:09 +0100)
Signed-off-by: Galen Charlton <galen.charlton@liblime.com>
opac/opac-detail.pl

index 7ba6c64..4370ec3 100755 (executable)
@@ -322,7 +322,7 @@ if (C4::Context->preference("OPACShelfBrowser")) {
         WHERE
             ((cn_sort = ? AND itemnumber < ?) OR cn_sort < ?) AND
             homebranch = ? AND location = ?
-        ORDER BY cn_sort DESC, itemnumber ASC LIMIT 3
+        ORDER BY cn_sort DESC, itemnumber LIMIT 3
         ");
     $sth_shelfbrowse_previous->execute($starting_cn_sort, $starting_itemnumber, $starting_cn_sort, $starting_homebranch->{code}, $starting_location->{code});
     my @previous_items;
@@ -338,9 +338,7 @@ if (C4::Context->preference("OPACShelfBrowser")) {
             }
         }
         unshift @previous_items, $this_item;
-        warn "p$this_item->{itemnumber}" . '@' . "$this_item->{biblionumber}: $this_item->{cn_sort}";
     }
-    warn "p: " . (@previous_items ? 'yes' : 'no');
     
     ## List of Next Items; this also intentionally catches the current item
     my $sth_shelfbrowse_next = $dbh->prepare("
@@ -349,7 +347,7 @@ if (C4::Context->preference("OPACShelfBrowser")) {
         WHERE
             ((cn_sort = ? AND itemnumber >= ?) OR cn_sort > ?) AND
             homebranch = ? AND location = ?
-        ORDER BY cn_sort DESC, itemnumber ASC LIMIT 3
+        ORDER BY cn_sort, itemnumber LIMIT 3
         ");
     $sth_shelfbrowse_next->execute($starting_cn_sort, $starting_itemnumber, $starting_cn_sort, $starting_homebranch->{code}, $starting_location->{code});
     my @next_items;
@@ -365,9 +363,7 @@ if (C4::Context->preference("OPACShelfBrowser")) {
             }
         }
         push @next_items, $this_item;
-        warn "n$this_item->{itemnumber}" . '@' . "$this_item->{biblionumber}: $this_item->{cn_sort}";
     }
-    warn "n: " . (@next_items ? 'yes' : 'no');
     
     # alas, these won't auto-vivify, see http://www.perlmonks.org/?node_id=508481
     my $shelfbrowser_next_itemnumber = $next_items[-1]->{itemnumber} if @next_items;