Merge remote branch 'kc/new/enh/bug_5560' into kcmaster
authorChris Cormack <chrisc@catalyst.net.nz>
Sun, 9 Jan 2011 20:11:50 +0000 (09:11 +1300)
committerChris Cormack <chrisc@catalyst.net.nz>
Sun, 9 Jan 2011 20:11:50 +0000 (09:11 +1300)
1  2 
C4/VirtualShelves/Page.pm

@@@ -62,13 -61,12 +62,13 @@@ sub shelfpage ($$$$$) 
      my $itemoff     = ( $query->param('itemoff')  ? $query->param('itemoff')  : 1 );
      my $displaymode = ( $query->param('display')  ? $query->param('display')  : 'publicshelves' );
      my ( $shelflimit, $shelfoffset, $shelveslimit, $shelvesoffset );
 +    my $marcflavour = C4::Context->preference("marcflavour");
  
-     # FIXME: These limits should not be hardcoded...
-     $shelflimit    = 20;                        # Limits number of items returned for a given query
-     $shelfoffset   = ( $itemoff - 1 ) * 20;     # Sets the offset to begin retrieving items at
-     $shelveslimit  = 20;                        # Limits number of shelves returned for a given query (row_count)
-     $shelvesoffset = ( $shelfoff - 1 ) * 20;    # Sets the offset to begin retrieving shelves at (offset)
+     $shelflimit = ( $type eq 'opac' ? C4::Context->preference('OPACnumSearchResults') : C4::Context->preference('numSearchResults') );
+     $shelflimit = $shelflimit || 20;
+     $shelfoffset   = ( $itemoff - 1 ) * $shelflimit;     # Sets the offset to begin retrieving items at
+     $shelveslimit  = $shelflimit;                        # Limits number of shelves returned for a given query (row_count)
+     $shelvesoffset = ( $shelfoff - 1 ) * $shelflimit;    # Sets the offset to begin retrieving shelves at (offset)
                                                  # getting the Shelves list
      my $category = ( ( $displaymode eq 'privateshelves' ) ? 1 : 2 );
      my ( $shelflist, $totshelves ) = GetShelves( $category, $shelveslimit, $shelvesoffset, $loggedinuser );