Lines 39-44
use C4::Review;
Link Here
|
39 |
use C4::Members; |
39 |
use C4::Members; |
40 |
use C4::VirtualShelves; |
40 |
use C4::VirtualShelves; |
41 |
use C4::XSLT; |
41 |
use C4::XSLT; |
|
|
42 |
use C4::ShelfBrowser; |
42 |
|
43 |
|
43 |
BEGIN { |
44 |
BEGIN { |
44 |
if (C4::Context->preference('BakerTaylorEnabled')) { |
45 |
if (C4::Context->preference('BakerTaylorEnabled')) { |
Lines 197-203
for my $itm (@items) {
Link Here
|
197 |
my $dbh = C4::Context->dbh; |
198 |
my $dbh = C4::Context->dbh; |
198 |
my $marcflavour = C4::Context->preference("marcflavour"); |
199 |
my $marcflavour = C4::Context->preference("marcflavour"); |
199 |
my $marcnotesarray = GetMarcNotes ($record,$marcflavour); |
200 |
my $marcnotesarray = GetMarcNotes ($record,$marcflavour); |
200 |
my $marcisbnsarray = GetMarcISBN ($record,$marcflavour); |
|
|
201 |
my $marcauthorsarray = GetMarcAuthors ($record,$marcflavour); |
201 |
my $marcauthorsarray = GetMarcAuthors ($record,$marcflavour); |
202 |
my $marcsubjctsarray = GetMarcSubjects($record,$marcflavour); |
202 |
my $marcsubjctsarray = GetMarcSubjects($record,$marcflavour); |
203 |
my $marcseriesarray = GetMarcSeries ($record,$marcflavour); |
203 |
my $marcseriesarray = GetMarcSeries ($record,$marcflavour); |
Lines 210-216
my $subtitle = GetRecordValue('subtitle', $record, GetFrameworkCode($bib
Link Here
|
210 |
MARCAUTHORS => $marcauthorsarray, |
210 |
MARCAUTHORS => $marcauthorsarray, |
211 |
MARCSERIES => $marcseriesarray, |
211 |
MARCSERIES => $marcseriesarray, |
212 |
MARCURLS => $marcurlsarray, |
212 |
MARCURLS => $marcurlsarray, |
213 |
MARCISBNS => $marcisbnsarray, |
|
|
214 |
norequests => $norequests, |
213 |
norequests => $norequests, |
215 |
RequestOnOpac => C4::Context->preference("RequestOnOpac"), |
214 |
RequestOnOpac => C4::Context->preference("RequestOnOpac"), |
216 |
itemdata_ccode => $itemfields{ccode}, |
215 |
itemdata_ccode => $itemfields{ccode}, |
Lines 446-556
if ( C4::Context->preference("Babeltheque") ) {
Link Here
|
446 |
if (C4::Context->preference("OPACShelfBrowser")) { |
445 |
if (C4::Context->preference("OPACShelfBrowser")) { |
447 |
# pick the first itemnumber unless one was selected by the user |
446 |
# pick the first itemnumber unless one was selected by the user |
448 |
my $starting_itemnumber = $query->param('shelfbrowse_itemnumber'); # || $items[0]->{itemnumber}; |
447 |
my $starting_itemnumber = $query->param('shelfbrowse_itemnumber'); # || $items[0]->{itemnumber}; |
449 |
$template->param( OpenOPACShelfBrowser => 1) if $starting_itemnumber; |
448 |
if (defined($starting_itemnumber)) { |
450 |
# find the right cn_sort value for this item |
449 |
$template->param( OpenOPACShelfBrowser => 1) if $starting_itemnumber; |
451 |
my ($starting_cn_sort, $starting_homebranch, $starting_location); |
450 |
my $nearby = GetNearbyItems($starting_itemnumber,3); |
452 |
my $sth_get_cn_sort = $dbh->prepare("SELECT cn_sort,homebranch,location from items where itemnumber=?"); |
451 |
|
453 |
$sth_get_cn_sort->execute($starting_itemnumber); |
452 |
$template->param( |
454 |
while (my $result = $sth_get_cn_sort->fetchrow_hashref()) { |
453 |
starting_homebranch => $nearby->{starting_homebranch}->{description}, |
455 |
$starting_cn_sort = $result->{'cn_sort'}; |
454 |
starting_location => $nearby->{starting_location}->{description}, |
456 |
$starting_homebranch->{code} = $result->{'homebranch'}; |
455 |
starting_ccode => $nearby->{starting_ccode}->{description}, |
457 |
$starting_homebranch->{description} = $branches->{$result->{'homebranch'}}{branchname}; |
456 |
starting_itemnumber => $nearby->{starting_itemnumber}, |
458 |
$starting_location->{code} = $result->{'location'}; |
457 |
shelfbrowser_prev_itemnumber => $nearby->{prev_itemnumber}, |
459 |
$starting_location->{description} = GetAuthorisedValueDesc('','', $result->{'location'} ,'','','LOC', 'opac'); |
458 |
shelfbrowser_next_itemnumber => $nearby->{next_itemnumber}, |
460 |
|
459 |
shelfbrowser_prev_biblionumber => $nearby->{prev_biblionumber}, |
461 |
} |
460 |
shelfbrowser_next_biblionumber => $nearby->{next_biblionumber}, |
462 |
|
461 |
PREVIOUS_SHELF_BROWSE => $nearby->{prev}, |
463 |
## List of Previous Items |
462 |
NEXT_SHELF_BROWSE => $nearby->{next}, |
464 |
# order by cn_sort, which should include everything we need for ordering purposes (though not |
463 |
); |
465 |
# for limits, those need to be handled separately |
|
|
466 |
my $sth_shelfbrowse_previous; |
467 |
if (defined $starting_location->{code}) { |
468 |
$sth_shelfbrowse_previous = $dbh->prepare(" |
469 |
SELECT * |
470 |
FROM items |
471 |
WHERE |
472 |
((cn_sort = ? AND itemnumber < ?) OR cn_sort < ?) AND |
473 |
homebranch = ? AND location = ? |
474 |
ORDER BY cn_sort DESC, itemnumber LIMIT 3 |
475 |
"); |
476 |
$sth_shelfbrowse_previous->execute($starting_cn_sort, $starting_itemnumber, $starting_cn_sort, $starting_homebranch->{code}, $starting_location->{code}); |
477 |
} else { |
478 |
$sth_shelfbrowse_previous = $dbh->prepare(" |
479 |
SELECT * |
480 |
FROM items |
481 |
WHERE |
482 |
((cn_sort = ? AND itemnumber < ?) OR cn_sort < ?) AND |
483 |
homebranch = ? |
484 |
ORDER BY cn_sort DESC, itemnumber LIMIT 3 |
485 |
"); |
486 |
$sth_shelfbrowse_previous->execute($starting_cn_sort, $starting_itemnumber, $starting_cn_sort, $starting_homebranch->{code}); |
487 |
} |
488 |
my @previous_items; |
489 |
while (my $this_item = $sth_shelfbrowse_previous->fetchrow_hashref()) { |
490 |
my $sth_get_biblio = $dbh->prepare("SELECT biblio.*,biblioitems.isbn AS isbn FROM biblio LEFT JOIN biblioitems ON biblio.biblionumber=biblioitems.biblionumber WHERE biblio.biblionumber=?"); |
491 |
$sth_get_biblio->execute($this_item->{biblionumber}); |
492 |
while (my $this_biblio = $sth_get_biblio->fetchrow_hashref()) { |
493 |
$this_item->{'title'} = $this_biblio->{'title'}; |
494 |
my $this_record = GetMarcBiblio($this_biblio->{'biblionumber'}); |
495 |
$this_item->{'browser_normalized_upc'} = GetNormalizedUPC($this_record,$marcflavour); |
496 |
$this_item->{'browser_normalized_oclc'} = GetNormalizedOCLCNumber($this_record,$marcflavour); |
497 |
$this_item->{'browser_normalized_isbn'} = GetNormalizedISBN(undef,$this_record,$marcflavour); |
498 |
} |
499 |
unshift @previous_items, $this_item; |
500 |
} |
501 |
|
502 |
## List of Next Items; this also intentionally catches the current item |
503 |
my $sth_shelfbrowse_next; |
504 |
if (defined $starting_location->{code}) { |
505 |
$sth_shelfbrowse_next = $dbh->prepare(" |
506 |
SELECT * |
507 |
FROM items |
508 |
WHERE |
509 |
((cn_sort = ? AND itemnumber >= ?) OR cn_sort > ?) AND |
510 |
homebranch = ? AND location = ? |
511 |
ORDER BY cn_sort, itemnumber LIMIT 3 |
512 |
"); |
513 |
$sth_shelfbrowse_next->execute($starting_cn_sort, $starting_itemnumber, $starting_cn_sort, $starting_homebranch->{code}, $starting_location->{code}); |
514 |
} else { |
515 |
$sth_shelfbrowse_next = $dbh->prepare(" |
516 |
SELECT * |
517 |
FROM items |
518 |
WHERE |
519 |
((cn_sort = ? AND itemnumber >= ?) OR cn_sort > ?) AND |
520 |
homebranch = ? |
521 |
ORDER BY cn_sort, itemnumber LIMIT 3 |
522 |
"); |
523 |
$sth_shelfbrowse_next->execute($starting_cn_sort, $starting_itemnumber, $starting_cn_sort, $starting_homebranch->{code}); |
524 |
} |
525 |
my @next_items; |
526 |
while (my $this_item = $sth_shelfbrowse_next->fetchrow_hashref()) { |
527 |
my $sth_get_biblio = $dbh->prepare("SELECT biblio.*,biblioitems.isbn AS isbn FROM biblio LEFT JOIN biblioitems ON biblio.biblionumber=biblioitems.biblionumber WHERE biblio.biblionumber=?"); |
528 |
$sth_get_biblio->execute($this_item->{biblionumber}); |
529 |
while (my $this_biblio = $sth_get_biblio->fetchrow_hashref()) { |
530 |
$this_item->{'title'} = $this_biblio->{'title'}; |
531 |
my $this_record = GetMarcBiblio($this_biblio->{'biblionumber'}); |
532 |
$this_item->{'browser_normalized_upc'} = GetNormalizedUPC($this_record,$marcflavour); |
533 |
$this_item->{'browser_normalized_oclc'} = GetNormalizedOCLCNumber($this_record,$marcflavour); |
534 |
$this_item->{'browser_normalized_isbn'} = GetNormalizedISBN(undef,$this_record,$marcflavour); |
535 |
} |
536 |
push @next_items, $this_item; |
537 |
} |
464 |
} |
538 |
|
|
|
539 |
# alas, these won't auto-vivify, see http://www.perlmonks.org/?node_id=508481 |
540 |
my $shelfbrowser_next_itemnumber = $next_items[-1]->{itemnumber} if @next_items; |
541 |
my $shelfbrowser_next_biblionumber = $next_items[-1]->{biblionumber} if @next_items; |
542 |
|
543 |
$template->param( |
544 |
starting_homebranch => $starting_homebranch->{description}, |
545 |
starting_location => $starting_location->{description}, |
546 |
starting_itemnumber => $starting_itemnumber, |
547 |
shelfbrowser_prev_itemnumber => (@previous_items ? $previous_items[0]->{itemnumber} : 0), |
548 |
shelfbrowser_next_itemnumber => $shelfbrowser_next_itemnumber, |
549 |
shelfbrowser_prev_biblionumber => (@previous_items ? $previous_items[0]->{biblionumber} : 0), |
550 |
shelfbrowser_next_biblionumber => $shelfbrowser_next_biblionumber, |
551 |
PREVIOUS_SHELF_BROWSE => \@previous_items, |
552 |
NEXT_SHELF_BROWSE => \@next_items, |
553 |
); |
554 |
} |
465 |
} |
555 |
|
466 |
|
556 |
if (C4::Context->preference("BakerTaylorEnabled")) { |
467 |
if (C4::Context->preference("BakerTaylorEnabled")) { |
557 |
- |
|
|