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