Lines 213-225
if ( $op eq 'view' ) {
Link Here
|
213 |
$category = $shelf->category; |
213 |
$category = $shelf->category; |
214 |
my $sortfield = $query->param('sortfield') || $shelf->sortfield; # Passed in sorting overrides default sorting |
214 |
my $sortfield = $query->param('sortfield') || $shelf->sortfield; # Passed in sorting overrides default sorting |
215 |
my $direction = $query->param('direction') || 'asc'; |
215 |
my $direction = $query->param('direction') || 'asc'; |
216 |
my ( $shelflimit, $shelfoffset, $itemoff ); |
216 |
my ( $page, $rows ); |
217 |
unless ( $query->param('print') or $query->param('rss') ) { |
217 |
unless ( $query->param('print') or $query->param('rss') ) { |
218 |
$shelflimit = C4::Context->preference('OPACnumSearchResults') || 20; |
218 |
$rows = C4::Context->preference('OPACnumSearchResults') || 20; |
219 |
$itemoff = ( $query->param('itemoff') ? $query->param('itemoff') : 1 ); |
219 |
$page = ( $query->param('page') ? $query->param('page') : 1 ); |
220 |
$shelfoffset = ( $itemoff - 1 ) * $shelflimit; # Sets the offset to begin retrieving items at |
|
|
221 |
} |
220 |
} |
222 |
my ( $items, $totitems ) = GetShelfContents( $shelfnumber, $shelflimit, $shelfoffset, $sortfield, $direction ); |
221 |
my $contents = $shelf->get_contents->search({}, { join => [ 'biblionumber' ], page => $page, rows => $rows, order_by => "$sortfield $direction", }); |
223 |
|
222 |
|
224 |
# get biblionumbers stored in the cart |
223 |
# get biblionumbers stored in the cart |
225 |
my @cart_list; |
224 |
my @cart_list; |
Lines 229-236
if ( $op eq 'view' ) {
Link Here
|
229 |
|
228 |
|
230 |
my $borrower = GetMember( borrowernumber => $loggedinuser ); |
229 |
my $borrower = GetMember( borrowernumber => $loggedinuser ); |
231 |
|
230 |
|
232 |
for my $this_item (@$items) { |
231 |
my @items; |
233 |
my $biblionumber = $this_item->{biblionumber}; |
232 |
while ( my $content = $contents->next ) { |
|
|
233 |
my $this_item; |
234 |
my $biblionumber = $content->biblionumber->biblionumber; |
234 |
my $record = GetMarcBiblio($biblionumber); |
235 |
my $record = GetMarcBiblio($biblionumber); |
235 |
|
236 |
|
236 |
if ( C4::Context->preference("OPACXSLTResultsDisplay") ) { |
237 |
if ( C4::Context->preference("OPACXSLTResultsDisplay") ) { |
Lines 238-246
if ( $op eq 'view' ) {
Link Here
|
238 |
} |
239 |
} |
239 |
|
240 |
|
240 |
my $marcflavour = C4::Context->preference("marcflavour"); |
241 |
my $marcflavour = C4::Context->preference("marcflavour"); |
241 |
$this_item->{'imageurl'} = getitemtypeinfo( $this_item->{'itemtype'}, 'intranet' )->{'imageurl'}; |
242 |
my $itemtypeinfo = getitemtypeinfo( $content->biblionumber->biblioitems->first->itemtype, 'intranet' ); |
|
|
243 |
$this_item->{imageurl} = $itemtypeinfo->{imageurl}; |
244 |
$this_item->{description} = $itemtypeinfo->{description}; |
245 |
$this_item->{notforloan} = $itemtypeinfo->{notforloan}; |
242 |
$this_item->{'coins'} = GetCOinSBiblio($record); |
246 |
$this_item->{'coins'} = GetCOinSBiblio($record); |
243 |
$this_item->{'subtitle'} = GetRecordValue( 'subtitle', $record, GetFrameworkCode( $this_item->{'biblionumber'} ) ); |
247 |
$this_item->{'subtitle'} = GetRecordValue( 'subtitle', $record, GetFrameworkCode( $biblionumber ) ); |
244 |
$this_item->{'normalized_upc'} = GetNormalizedUPC( $record, $marcflavour ); |
248 |
$this_item->{'normalized_upc'} = GetNormalizedUPC( $record, $marcflavour ); |
245 |
$this_item->{'normalized_ean'} = GetNormalizedEAN( $record, $marcflavour ); |
249 |
$this_item->{'normalized_ean'} = GetNormalizedEAN( $record, $marcflavour ); |
246 |
$this_item->{'normalized_oclc'} = GetNormalizedOCLCNumber( $record, $marcflavour ); |
250 |
$this_item->{'normalized_oclc'} = GetNormalizedOCLCNumber( $record, $marcflavour ); |
Lines 253-264
if ( $op eq 'view' ) {
Link Here
|
253 |
} |
257 |
} |
254 |
|
258 |
|
255 |
# Getting items infos for location display |
259 |
# Getting items infos for location display |
256 |
my @items_infos = &GetItemsLocationInfo( $this_item->{'biblionumber'} ); |
260 |
my @items_infos = &GetItemsLocationInfo( $biblionumber ); |
257 |
$this_item->{'ITEM_RESULTS'} = \@items_infos; |
261 |
$this_item->{'ITEM_RESULTS'} = \@items_infos; |
258 |
|
262 |
|
259 |
if (C4::Context->preference('TagsEnabled') and C4::Context->preference('TagsShowOnList')) { |
263 |
if (C4::Context->preference('TagsEnabled') and C4::Context->preference('TagsShowOnList')) { |
260 |
$this_item->{TagLoop} = get_tags({ |
264 |
$this_item->{TagLoop} = get_tags({ |
261 |
biblionumber=>$this_item->{'biblionumber'}, approved=>1, 'sort'=>'-weight', |
265 |
biblionumber => $biblionumber, approved=>1, 'sort'=>'-weight', |
262 |
limit => C4::Context->preference('TagsShowOnList'), |
266 |
limit => C4::Context->preference('TagsShowOnList'), |
263 |
}); |
267 |
}); |
264 |
} |
268 |
} |
Lines 273-280
if ( $op eq 'view' ) {
Link Here
|
273 |
if ( $query->param('rss') ) { |
277 |
if ( $query->param('rss') ) { |
274 |
$this_item->{title} = $content->biblionumber->title; |
278 |
$this_item->{title} = $content->biblionumber->title; |
275 |
$this_item->{author} = $content->biblionumber->author; |
279 |
$this_item->{author} = $content->biblionumber->author; |
276 |
$this_item->{biblionumber} = $biblionumber; |
|
|
277 |
} |
280 |
} |
|
|
281 |
|
282 |
$this_item->{biblionumber} = $biblionumber; |
278 |
push @items, $this_item; |
283 |
push @items, $this_item; |
279 |
} |
284 |
} |
280 |
|
285 |
|
Lines 290-304
if ( $op eq 'view' ) {
Link Here
|
290 |
can_remove_biblios => $shelf->can_biblios_be_removed($loggedinuser), |
295 |
can_remove_biblios => $shelf->can_biblios_be_removed($loggedinuser), |
291 |
can_add_biblios => $shelf->can_biblios_be_added($loggedinuser), |
296 |
can_add_biblios => $shelf->can_biblios_be_added($loggedinuser), |
292 |
sortfield => $sortfield, |
297 |
sortfield => $sortfield, |
293 |
itemsloop => $items, |
298 |
itemsloop => \@items, |
294 |
sortfield => $sortfield, |
299 |
sortfield => $sortfield, |
295 |
direction => $direction, |
300 |
direction => $direction, |
296 |
); |
301 |
); |
297 |
if ($shelflimit) { |
302 |
if ( $page ) { |
|
|
303 |
my $pager = $contents->pager; |
298 |
$template->param( |
304 |
$template->param( |
299 |
pagination_bar => pagination_bar( |
305 |
pagination_bar => pagination_bar( |
300 |
q||, ( int( $totitems / $shelflimit ) ) + ( ( $totitems % $shelflimit ) > 0 ? 1 : 0 ), |
306 |
q||, $pager->last_page - $pager->first_page + 1, |
301 |
$itemoff, "itemoff", { op => 'view', shelfnumber => $shelf->shelfnumber, sortfield => $sortfield, direction => $direction, } |
307 |
$page, "page", { op => 'view', shelfnumber => $shelf->shelfnumber, sortfield => $sortfield, direction => $direction, } |
302 |
), |
308 |
), |
303 |
); |
309 |
); |
304 |
} |
310 |
} |