|
Lines 698-800
my $can_holds_be_placed = $patron ? 0 : $holdable_items;
Link Here
|
| 698 |
my ( $itemloop_has_images, $otheritemloop_has_images ); |
698 |
my ( $itemloop_has_images, $otheritemloop_has_images ); |
| 699 |
my $item_level_holds; |
699 |
my $item_level_holds; |
| 700 |
my $item_checkouts; |
700 |
my $item_checkouts; |
| 701 |
if ( not $viewallitems and $items->count > $max_items_to_display ) { |
701 |
my $library_info; |
| 702 |
$template->param( |
702 |
my $nb_items_processed = 0; |
| 703 |
too_many_items => 1, |
703 |
while ( my $item = $items->next ) { |
| 704 |
items_count => $items->count, |
704 |
if ( not $viewallitems and $nb_items_processed >= $max_items_to_display ) { |
| 705 |
); |
705 |
$template->param( |
| 706 |
} else { |
706 |
too_many_items => 1, |
| 707 |
my $library_info; |
707 |
items_count => $items->count, |
| 708 |
while ( my $item = $items->next ) { |
|
|
| 709 |
my $item_info = $item->unblessed; |
| 710 |
$item_info->{holds_count} = $item_reserves{ $item->itemnumber }; |
| 711 |
if ( $item_info->{holds_count} && $item_info->{holds_count} > 0 ) { $item_level_holds = 1; } |
| 712 |
$item_info->{priority} = $priority{ $item->itemnumber }; |
| 713 |
|
| 714 |
# Get opac_info from Additional contents for home and holding library |
| 715 |
my ( $opac_info_home, $opac_info_holding ); |
| 716 |
$opac_info_holding = $library_info->{ $item->holdingbranch } |
| 717 |
// $item->holding_branch->opac_info( { lang => $lang } ); |
| 718 |
$library_info->{ $item->holdingbranch } = $opac_info_holding; |
| 719 |
$opac_info_home = $library_info->{ $item->homebranch } // $item->home_branch->opac_info( { lang => $lang } ); |
| 720 |
$library_info->{ $item->homebranch } = $opac_info_home; |
| 721 |
$item_info->{holding_library_info} = $opac_info_holding->content if $opac_info_holding; |
| 722 |
$item_info->{home_library_info} = $opac_info_home->content if $opac_info_home; |
| 723 |
|
| 724 |
# We only need to check if we haven't determined holds can be placed |
| 725 |
# and if we don't have patron, we have already decided |
| 726 |
$can_holds_be_placed = |
| 727 |
$can_holds_be_placed || $patron && IsAvailableForItemLevelRequest( $item, $patron, undef ); |
| 728 |
|
| 729 |
# get collection code description, too |
| 730 |
my $ccode = $item->ccode; |
| 731 |
$item_info->{'ccode'} = $collections->{$ccode} |
| 732 |
if defined($ccode) |
| 733 |
&& $collections |
| 734 |
&& exists( $collections->{$ccode} ); |
| 735 |
|
| 736 |
my $copynumber = $item->copynumber; |
| 737 |
$item_info->{copynumber} = $copynumbers->{$copynumber} |
| 738 |
if ( defined($copynumbers) |
| 739 |
&& defined($copynumber) |
| 740 |
&& exists( $copynumbers->{$copynumber} ) ); |
| 741 |
|
| 742 |
if ( defined $item->location ) { |
| 743 |
$item_info->{'location_description'} = $shelflocations->{ $item->location }; |
| 744 |
} |
| 745 |
|
| 746 |
my $itemtype = $item->itemtype; |
| 747 |
$item_info->{'imageurl'} = getitemtypeimagelocation( |
| 748 |
'opac', |
| 749 |
$itemtypes->{ $itemtype->itemtype }->{'imageurl'} |
| 750 |
); |
708 |
); |
| 751 |
$item_info->{'description'} = |
709 |
last; |
| 752 |
$itemtypes->{ $itemtype->itemtype }->{translated_description}; |
710 |
} |
|
|
711 |
$nb_items_processed = $nb_items_processed + 1; |
| 712 |
|
| 713 |
my $item_info = $item->unblessed; |
| 714 |
$item_info->{holds_count} = $item_reserves{ $item->itemnumber }; |
| 715 |
if ( $item_info->{holds_count} && $item_info->{holds_count} > 0 ) { $item_level_holds = 1; } |
| 716 |
$item_info->{priority} = $priority{ $item->itemnumber }; |
| 717 |
|
| 718 |
# Get opac_info from Additional contents for home and holding library |
| 719 |
my ( $opac_info_home, $opac_info_holding ); |
| 720 |
$opac_info_holding = $library_info->{ $item->holdingbranch } |
| 721 |
// $item->holding_branch->opac_info( { lang => $lang } ); |
| 722 |
$library_info->{ $item->holdingbranch } = $opac_info_holding; |
| 723 |
$opac_info_home = $library_info->{ $item->homebranch } // $item->home_branch->opac_info( { lang => $lang } ); |
| 724 |
$library_info->{ $item->homebranch } = $opac_info_home; |
| 725 |
$item_info->{holding_library_info} = $opac_info_holding->content if $opac_info_holding; |
| 726 |
$item_info->{home_library_info} = $opac_info_home->content if $opac_info_home; |
| 727 |
|
| 728 |
# We only need to check if we haven't determined holds can be placed |
| 729 |
# and if we don't have patron, we have already decided |
| 730 |
$can_holds_be_placed = $can_holds_be_placed || $patron && IsAvailableForItemLevelRequest( $item, $patron, undef ); |
| 731 |
|
| 732 |
# get collection code description, too |
| 733 |
my $ccode = $item->ccode; |
| 734 |
$item_info->{'ccode'} = $collections->{$ccode} |
| 735 |
if defined($ccode) |
| 736 |
&& $collections |
| 737 |
&& exists( $collections->{$ccode} ); |
| 738 |
|
| 739 |
my $copynumber = $item->copynumber; |
| 740 |
$item_info->{copynumber} = $copynumbers->{$copynumber} |
| 741 |
if ( defined($copynumbers) |
| 742 |
&& defined($copynumber) |
| 743 |
&& exists( $copynumbers->{$copynumber} ) ); |
| 744 |
|
| 745 |
if ( defined $item->location ) { |
| 746 |
$item_info->{'location_description'} = $shelflocations->{ $item->location }; |
| 747 |
} |
| 753 |
|
748 |
|
| 754 |
$item_info->{checkout} = $item->checkout; |
749 |
my $itemtype = $item->itemtype; |
| 755 |
if ( $item_info->{checkout} && $item_info->{checkout} > 0 ) { $item_checkouts = 1; } |
750 |
$item_info->{'imageurl'} = getitemtypeimagelocation( |
|
|
751 |
'opac', |
| 752 |
$itemtypes->{ $itemtype->itemtype }->{'imageurl'} |
| 753 |
); |
| 754 |
$item_info->{'description'} = |
| 755 |
$itemtypes->{ $itemtype->itemtype }->{translated_description}; |
| 756 |
|
756 |
|
| 757 |
foreach my $field ( |
757 |
$item_info->{checkout} = $item->checkout; |
| 758 |
qw(ccode materials enumchron copynumber itemnotes location_description uri barcode itemcallnumber)) |
758 |
if ( $item_info->{checkout} && $item_info->{checkout} > 0 ) { $item_checkouts = 1; } |
| 759 |
{ |
|
|
| 760 |
$itemfields{$field} = 1 if $item_info->{$field}; |
| 761 |
} |
| 762 |
|
759 |
|
| 763 |
# FIXME The following must be Koha::Item->serial |
760 |
foreach |
| 764 |
my $serial_item = Koha::Serial::Items->find( $item->itemnumber ); |
761 |
my $field (qw(ccode materials enumchron copynumber itemnotes location_description uri barcode itemcallnumber)) |
| 765 |
if ($serial_item) { |
762 |
{ |
| 766 |
my $serial = Koha::Serials->find( $serial_item->serialid ); |
763 |
$itemfields{$field} = 1 if $item_info->{$field}; |
| 767 |
$item_info->{serial} = $serial if $serial; |
764 |
} |
| 768 |
} |
|
|
| 769 |
|
765 |
|
| 770 |
$item_info->{object} = $item; |
766 |
# FIXME The following must be Koha::Item->serial |
|
|
767 |
my $serial_item = Koha::Serial::Items->find( $item->itemnumber ); |
| 768 |
if ($serial_item) { |
| 769 |
my $serial = Koha::Serials->find( $serial_item->serialid ); |
| 770 |
$item_info->{serial} = $serial if $serial; |
| 771 |
} |
| 771 |
|
772 |
|
| 772 |
if ( C4::Context->preference("OPACLocalCoverImages") == 1 ) { |
773 |
$item_info->{object} = $item; |
| 773 |
$item_info->{cover_images} = $item->cover_images; |
|
|
| 774 |
} |
| 775 |
|
774 |
|
| 776 |
if ( C4::Context->preference('UseCourseReserves') ) { |
775 |
if ( C4::Context->preference("OPACLocalCoverImages") == 1 ) { |
| 777 |
$item_info->{course_reserves} = GetItemCourseReservesInfo( itemnumber => $item->itemnumber ); |
776 |
$item_info->{cover_images} = $item->cover_images; |
| 778 |
} |
777 |
} |
| 779 |
|
778 |
|
| 780 |
$item_info->{holding_branch} = $item->holding_branch; |
779 |
if ( C4::Context->preference('UseCourseReserves') ) { |
| 781 |
$item_info->{home_branch} = $item->home_branch; |
780 |
$item_info->{course_reserves} = GetItemCourseReservesInfo( itemnumber => $item->itemnumber ); |
|
|
781 |
} |
| 782 |
|
782 |
|
| 783 |
my $itembranch = $item->$separatebranch; |
783 |
$item_info->{holding_branch} = $item->holding_branch; |
| 784 |
if ( $currentbranch |
784 |
$item_info->{home_branch} = $item->home_branch; |
| 785 |
and C4::Context->preference('OpacSeparateHoldings') ) |
785 |
|
| 786 |
{ |
786 |
my $itembranch = $item->$separatebranch; |
| 787 |
if ( $itembranch and $itembranch eq $currentbranch ) { |
787 |
if ( $currentbranch |
| 788 |
push @itemloop, $item_info; |
788 |
and C4::Context->preference('OpacSeparateHoldings') ) |
| 789 |
$itemloop_has_images++ if $item->cover_images->count; |
789 |
{ |
| 790 |
} else { |
790 |
if ( $itembranch and $itembranch eq $currentbranch ) { |
| 791 |
push @otheritemloop, $item_info; |
|
|
| 792 |
$otheritemloop_has_images++ if $item->cover_images->count; |
| 793 |
} |
| 794 |
} else { |
| 795 |
push @itemloop, $item_info; |
791 |
push @itemloop, $item_info; |
| 796 |
$itemloop_has_images++ if $item->cover_images->count; |
792 |
$itemloop_has_images++ if $item->cover_images->count; |
|
|
793 |
} else { |
| 794 |
push @otheritemloop, $item_info; |
| 795 |
$otheritemloop_has_images++ if $item->cover_images->count; |
| 797 |
} |
796 |
} |
|
|
797 |
} else { |
| 798 |
push @itemloop, $item_info; |
| 799 |
$itemloop_has_images++ if $item->cover_images->count; |
| 798 |
} |
800 |
} |
| 799 |
} |
801 |
} |
| 800 |
|
802 |
|
| 801 |
- |
|
|