Bug 7325 - Editing a list generates errors in the log

Checking for variables before trying to use them in
building the pagination menu

Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
Signed-off-by: Paul Poulain <paul.poulain@biblibre.com>
(cherry picked from commit 17df078261)

Signed-off-by: Chris Nighswonger <chris.nighswonger@gmail.com>
(cherry picked from commit ab27da89a9)

Signed-off-by: Chris Nighswonger <chris.nighswonger@gmail.com>
This commit is contained in:
Owen Leonard 2011-12-06 16:03:31 -05:00 committed by Chris Nighswonger
parent fac2d15449
commit c51d8a474b
1 changed files with 2 additions and 2 deletions

View File

@ -367,9 +367,9 @@ sub shelfpage ($$$$$) {
$qhash{$_} = $query->param($_) if $query->param($_);
}
( scalar keys %qhash ) and $url .= '?' . join '&', map { "$_=$qhash{$_}" } keys %qhash;
if ( $shelfnumber ) {
if ( $shelfnumber && $totitems ) {
$template->param( pagination_bar => pagination_bar( $url, ( int( $totitems / $shelflimit ) ) + ( ( $totitems % $shelflimit ) > 0 ? 1 : 0 ), $itemoff, "itemoff" ) );
} else {
} elsif ( $totshelves ) {
$template->param(
pagination_bar => pagination_bar( $url, ( int( $totshelves / $shelveslimit ) ) + ( ( $totshelves % $shelveslimit ) > 0 ? 1 : 0 ), $shelfoff, "shelfoff" ) );
}