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;
}
}
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("
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;
}
}
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;