Lines 74-80
sub shelfpage {
Link Here
|
74 |
my $itemoff = ( $query->param('itemoff') ? $query->param('itemoff') : 1 ); |
74 |
my $itemoff = ( $query->param('itemoff') ? $query->param('itemoff') : 1 ); |
75 |
my $displaymode = ( $query->param('display') ? $query->param('display') : 'publicshelves' ); |
75 |
my $displaymode = ( $query->param('display') ? $query->param('display') : 'publicshelves' ); |
76 |
my ( $shelflimit, $shelfoffset, $shelveslimit, $shelvesoffset ); |
76 |
my ( $shelflimit, $shelfoffset, $shelveslimit, $shelvesoffset ); |
77 |
my $marcflavour = C4::Context->preference("marcflavour"); |
|
|
78 |
|
77 |
|
79 |
$shelflimit = ( $type eq 'opac' ? C4::Context->preference('OPACnumSearchResults') : C4::Context->preference('numSearchResults') ); |
78 |
$shelflimit = ( $type eq 'opac' ? C4::Context->preference('OPACnumSearchResults') : C4::Context->preference('numSearchResults') ); |
80 |
$shelflimit = $shelflimit || ShelvesMax('MGRPAGE'); |
79 |
$shelflimit = $shelflimit || ShelvesMax('MGRPAGE'); |
Lines 238-244
sub shelfpage {
Link Here
|
238 |
#check that the user can view the shelf |
237 |
#check that the user can view the shelf |
239 |
if ( ShelfPossibleAction( $loggedinuser, $shelfnumber, 'view' ) ) { |
238 |
if ( ShelfPossibleAction( $loggedinuser, $shelfnumber, 'view' ) ) { |
240 |
my $items; |
239 |
my $items; |
241 |
my $tag_quantity; |
|
|
242 |
my $sortfield = ( $sorton ? $sorton : 'title' ); |
240 |
my $sortfield = ( $sorton ? $sorton : 'title' ); |
243 |
$sortfield = $query->param('sort') || $sortfield; ## Passed in sorting overrides default sorting |
241 |
$sortfield = $query->param('sort') || $sortfield; ## Passed in sorting overrides default sorting |
244 |
my $direction = $query->param('direction') || 'asc'; |
242 |
my $direction = $query->param('direction') || 'asc'; |
Lines 246-253
sub shelfpage {
Link Here
|
246 |
sort => $sortfield, |
244 |
sort => $sortfield, |
247 |
direction => $direction, |
245 |
direction => $direction, |
248 |
); |
246 |
); |
249 |
( $items, $totitems ) = GetShelfContents( $shelfnumber, $shelflimit, $shelfoffset, $sortfield, $direction ); |
|
|
250 |
|
251 |
# get biblionumbers stored in the cart |
247 |
# get biblionumbers stored in the cart |
252 |
# Note that it's not use at the intranet |
248 |
# Note that it's not use at the intranet |
253 |
my @cart_list; |
249 |
my @cart_list; |
Lines 257-303
sub shelfpage {
Link Here
|
257 |
@cart_list = split(/\//, $cart_list); |
253 |
@cart_list = split(/\//, $cart_list); |
258 |
} |
254 |
} |
259 |
|
255 |
|
260 |
my $borrower = GetMember( 'borrowernumber' => $loggedinuser ); |
256 |
( $items, $totitems ) = shelf_contents({ |
261 |
|
257 |
borrower => GetMember( 'borrowernumber' => $loggedinuser ), |
262 |
for my $this_item (@$items) { |
258 |
shelfnumber => $shelfnumber, |
263 |
my $biblionumber = $this_item->{'biblionumber'}; |
259 |
shelflimit => $shelflimit, |
264 |
# Getting items infos for location display |
260 |
shelfoffset => $shelfoffset, |
265 |
my @items_infos = &GetItemsInfo( $this_item->{'biblionumber'}, "cn_sort" ); |
261 |
sortfield => $sortfield, |
266 |
my $record = GetMarcBiblio($biblionumber); |
262 |
direction => $direction, |
267 |
if (C4::Context->preference("OPACXSLTResultsDisplay") && $type eq 'opac') { |
263 |
type => $type, |
268 |
$this_item->{XSLTBloc} = XSLTParse4Display($biblionumber, $record, "OPACXSLTResultsDisplay", \@items_infos); |
264 |
cart_list => \@cart_list, |
269 |
} elsif (C4::Context->preference("XSLTResultsDisplay") && $type eq 'intranet') { |
265 |
}); |
270 |
$this_item->{XSLTBloc} = XSLTParse4Display($biblionumber, $record, "XSLTResultsDisplay", \@items_infos); |
|
|
271 |
} |
272 |
|
273 |
# the virtualshelfcontents table does not store these columns nor are they retrieved from the items |
274 |
# and itemtypes tables, so I'm commenting them out for now to quiet the log -crn |
275 |
#$this_item->{imageurl} = $imgdir."/".$itemtypes->{ $this_item->{itemtype} }->{'imageurl'}; |
276 |
#$this_item->{'description'} = $itemtypes->{ $this_item->{itemtype} }->{'description'}; |
277 |
$this_item->{'dateadded'} = format_date( $this_item->{'dateadded'} ); |
278 |
$this_item->{'imageurl'} = getitemtypeinfo( $this_item->{'itemtype'}, $type )->{'imageurl'}; |
279 |
$this_item->{'coins'} = GetCOinSBiblio( $record ); |
280 |
$this_item->{'subtitle'} = GetRecordValue('subtitle', $record, GetFrameworkCode($this_item->{'biblionumber'})); |
281 |
$this_item->{'normalized_upc'} = GetNormalizedUPC( $record,$marcflavour); |
282 |
$this_item->{'normalized_ean'} = GetNormalizedEAN( $record,$marcflavour); |
283 |
$this_item->{'normalized_oclc'} = GetNormalizedOCLCNumber($record,$marcflavour); |
284 |
$this_item->{'normalized_isbn'} = GetNormalizedISBN(undef,$record,$marcflavour); |
285 |
if(!defined($this_item->{'size'})) { $this_item->{'size'} = "" }; #TT has problems with size |
286 |
$this_item->{'itemsissued'} = CountItemsIssued( $this_item->{'biblionumber'} ); |
287 |
$this_item->{'ITEM_RESULTS'} = \@items_infos; |
288 |
if ( grep {$_ eq $biblionumber} @cart_list) { |
289 |
$this_item->{'incart'} = 1; |
290 |
} |
291 |
|
292 |
if (C4::Context->preference('TagsEnabled') and $tag_quantity = C4::Context->preference('TagsShowOnList')) { |
293 |
$this_item->{'TagLoop'} = get_tags({ |
294 |
biblionumber=>$this_item->{'biblionumber'}, approved=>1, 'sort'=>'-weight', |
295 |
limit=>$tag_quantity |
296 |
}); |
297 |
} |
298 |
|
299 |
$this_item->{'allow_onshelf_holds'} = C4::Reserves::OnShelfHoldsAllowed($this_item, $borrower); |
300 |
} |
301 |
if($type eq 'intranet'){ |
266 |
if($type eq 'intranet'){ |
302 |
# Build drop-down list for 'Add To:' menu... |
267 |
# Build drop-down list for 'Add To:' menu... |
303 |
my ($totalref, $pubshelves, $barshelves)= |
268 |
my ($totalref, $pubshelves, $barshelves)= |
Lines 501-506
sub shelfpage {
Link Here
|
501 |
output_html_with_http_headers $query, $cookie, $template->output; |
466 |
output_html_with_http_headers $query, $cookie, $template->output; |
502 |
} |
467 |
} |
503 |
|
468 |
|
|
|
469 |
sub shelf_contents { |
470 |
my ( $params ) = @_; |
471 |
my $borrower = $params->{borrower}; |
472 |
my $shelfnumber = $params->{shelfnumber}; |
473 |
my $shelflimit = $params->{shelflimit}; |
474 |
my $shelfoffset = $params->{shelfoffset}; |
475 |
my $sortfield = $params->{sortfield}; |
476 |
my $direction = $params->{direction}; |
477 |
my $type = $params->{type}; |
478 |
my $cart_list = $params->{cart_list}; |
479 |
|
480 |
my $marcflavour = C4::Context->preference("marcflavour"); |
481 |
my $tag_quantity = C4::Context->preference('TagsEnabled') |
482 |
? C4::Context->preference('TagsShowOnList') |
483 |
: undef; |
484 |
my ( $items, $totitems ) = GetShelfContents( $shelfnumber, $shelflimit, $shelfoffset, $sortfield, $direction ); |
485 |
for my $this_item (@$items) { |
486 |
my $biblionumber = $this_item->{'biblionumber'}; |
487 |
# Getting items infos for location display |
488 |
my @items_infos = &GetItemsInfo( $this_item->{'biblionumber'}, "cn_sort" ); |
489 |
my $record = GetMarcBiblio($biblionumber); |
490 |
if (C4::Context->preference("OPACXSLTResultsDisplay") && $type eq 'opac') { |
491 |
$this_item->{XSLTBloc} = XSLTParse4Display($biblionumber, $record, "OPACXSLTResultsDisplay", \@items_infos); |
492 |
} elsif (C4::Context->preference("XSLTResultsDisplay") && $type eq 'intranet') { |
493 |
$this_item->{XSLTBloc} = XSLTParse4Display($biblionumber, $record, "XSLTResultsDisplay", \@items_infos); |
494 |
} |
495 |
|
496 |
# the virtualshelfcontents table does not store these columns nor are they retrieved from the items |
497 |
# and itemtypes tables, so I'm commenting them out for now to quiet the log -crn |
498 |
#$this_item->{imageurl} = $imgdir."/".$itemtypes->{ $this_item->{itemtype} }->{'imageurl'}; |
499 |
#$this_item->{'description'} = $itemtypes->{ $this_item->{itemtype} }->{'description'}; |
500 |
$this_item->{'dateadded'} = format_date( $this_item->{'dateadded'} ); |
501 |
$this_item->{'imageurl'} = getitemtypeinfo( $this_item->{'itemtype'}, $type )->{'imageurl'}; |
502 |
$this_item->{'coins'} = GetCOinSBiblio( $record ); |
503 |
$this_item->{'subtitle'} = GetRecordValue('subtitle', $record, GetFrameworkCode($this_item->{'biblionumber'})); |
504 |
$this_item->{'normalized_upc'} = GetNormalizedUPC( $record,$marcflavour); |
505 |
$this_item->{'normalized_ean'} = GetNormalizedEAN( $record,$marcflavour); |
506 |
$this_item->{'normalized_oclc'} = GetNormalizedOCLCNumber($record,$marcflavour); |
507 |
$this_item->{'normalized_isbn'} = GetNormalizedISBN(undef,$record,$marcflavour); |
508 |
if(!defined($this_item->{'size'})) { $this_item->{'size'} = "" }; #TT has problems with size |
509 |
$this_item->{'itemsissued'} = CountItemsIssued( $this_item->{'biblionumber'} ); |
510 |
$this_item->{'ITEM_RESULTS'} = \@items_infos; |
511 |
if ( $cart_list && grep {$_ eq $biblionumber} @$cart_list) { |
512 |
$this_item->{'incart'} = 1; |
513 |
} |
514 |
|
515 |
if ($tag_quantity) { |
516 |
$this_item->{'TagLoop'} = get_tags({ |
517 |
biblionumber=>$this_item->{'biblionumber'}, approved=>1, 'sort'=>'-weight', |
518 |
limit=>$tag_quantity |
519 |
}); |
520 |
} |
521 |
|
522 |
$this_item->{'allow_onshelf_holds'} = C4::Reserves::OnShelfHoldsAllowed($this_item, $borrower); |
523 |
} |
524 |
return ( $items, $totitems ); |
525 |
} |
526 |
|
504 |
1; |
527 |
1; |
505 |
__END__ |
528 |
__END__ |
506 |
|
529 |
|