Lines 25-30
use warnings;
Link Here
|
25 |
|
25 |
|
26 |
use CGI; |
26 |
use CGI; |
27 |
use C4::Auth qw(:DEFAULT get_session); |
27 |
use C4::Auth qw(:DEFAULT get_session); |
|
|
28 |
use C4::Acquisition qw( SearchOrders ); |
28 |
use C4::Branch; |
29 |
use C4::Branch; |
29 |
use C4::Koha; |
30 |
use C4::Koha; |
30 |
use C4::Serials; #uses getsubscriptionfrom biblionumber |
31 |
use C4::Serials; #uses getsubscriptionfrom biblionumber |
Lines 487-502
if ( C4::Context->preference('HighlightOwnItemsOnOPAC') ) {
Link Here
|
487 |
|
488 |
|
488 |
my $dat = &GetBiblioData($biblionumber); |
489 |
my $dat = &GetBiblioData($biblionumber); |
489 |
|
490 |
|
490 |
my $itemtypes = GetItemTypes(); |
491 |
our $itemtypes = GetItemTypes(); |
491 |
# imageurl: |
492 |
# imageurl: |
492 |
my $itemtype = $dat->{'itemtype'}; |
493 |
my $itemtype = $dat->{'itemtype'}; |
493 |
if ( $itemtype ) { |
494 |
if ( $itemtype ) { |
494 |
$dat->{'imageurl'} = getitemtypeimagelocation( 'opac', $itemtypes->{$itemtype}->{'imageurl'} ); |
495 |
$dat->{'imageurl'} = getitemtypeimagelocation( 'opac', $itemtypes->{$itemtype}->{'imageurl'} ); |
495 |
$dat->{'description'} = $itemtypes->{$itemtype}->{'description'}; |
496 |
$dat->{'description'} = $itemtypes->{$itemtype}->{'description'}; |
496 |
} |
497 |
} |
497 |
my $shelflocations =GetKohaAuthorisedValues('items.location',$dat->{'frameworkcode'}, 'opac'); |
498 |
our $shelflocations =GetKohaAuthorisedValues('items.location',$dat->{'frameworkcode'}, 'opac'); |
498 |
my $collections = GetKohaAuthorisedValues('items.ccode',$dat->{'frameworkcode'}, 'opac'); |
499 |
our $collections = GetKohaAuthorisedValues('items.ccode',$dat->{'frameworkcode'}, 'opac'); |
499 |
my $copynumbers = GetKohaAuthorisedValues('items.copynumber',$dat->{'frameworkcode'}, 'opac'); |
500 |
our $copynumbers = GetKohaAuthorisedValues('items.copynumber',$dat->{'frameworkcode'}, 'opac'); |
500 |
|
501 |
|
501 |
#coping with subscriptions |
502 |
#coping with subscriptions |
502 |
my $subscriptionsnumber = CountSubscriptionFromBiblionumber($biblionumber); |
503 |
my $subscriptionsnumber = CountSubscriptionFromBiblionumber($biblionumber); |
Lines 532-538
$dat->{'count'} = scalar(@items);
Link Here
|
532 |
|
533 |
|
533 |
my $biblio_authorised_value_images = C4::Items::get_authorised_value_images( C4::Biblio::get_biblio_authorised_values( $biblionumber, $record ) ); |
534 |
my $biblio_authorised_value_images = C4::Items::get_authorised_value_images( C4::Biblio::get_biblio_authorised_values( $biblionumber, $record ) ); |
534 |
|
535 |
|
535 |
my (%item_reserves, %priority); |
536 |
our (%item_reserves, %priority); |
536 |
my ($show_holds_count, $show_priority); |
537 |
my ($show_holds_count, $show_priority); |
537 |
for ( C4::Context->preference("OPACShowHoldQueueDetails") ) { |
538 |
for ( C4::Context->preference("OPACShowHoldQueueDetails") ) { |
538 |
m/holds/o and $show_holds_count = 1; |
539 |
m/holds/o and $show_holds_count = 1; |
Lines 562-567
if ($currentbranch and C4::Context->preference('OpacSeparateHoldings')) {
Link Here
|
562 |
$template->param(SeparateHoldings => 1); |
563 |
$template->param(SeparateHoldings => 1); |
563 |
} |
564 |
} |
564 |
my $separatebranch = C4::Context->preference('OpacSeparateHoldingsBranch'); |
565 |
my $separatebranch = C4::Context->preference('OpacSeparateHoldingsBranch'); |
|
|
566 |
|
565 |
my $viewallitems = $query->param('viewallitems'); |
567 |
my $viewallitems = $query->param('viewallitems'); |
566 |
my $max_items_to_display = C4::Context->preference('OpacMaxItemsToDisplay') // 50; |
568 |
my $max_items_to_display = C4::Context->preference('OpacMaxItemsToDisplay') // 50; |
567 |
if ( not $viewallitems and @items > $max_items_to_display ) { |
569 |
if ( not $viewallitems and @items > $max_items_to_display ) { |
Lines 571-620
if ( not $viewallitems and @items > $max_items_to_display ) {
Link Here
|
571 |
); |
573 |
); |
572 |
} else { |
574 |
} else { |
573 |
for my $itm (@items) { |
575 |
for my $itm (@items) { |
574 |
$itm->{holds_count} = $item_reserves{ $itm->{itemnumber} }; |
576 |
$itm = _get_items_infos( $itm ); |
575 |
$itm->{priority} = $priority{ $itm->{itemnumber} }; |
|
|
576 |
$norequests = 0 |
577 |
if ( (not $itm->{'withdrawn'} ) |
578 |
&& (not $itm->{'itemlost'} ) |
579 |
&& ($itm->{'itemnotforloan'}<0 || not $itm->{'itemnotforloan'} ) |
580 |
&& (not $itemtypes->{$itm->{'itype'}}->{notforloan} ) |
581 |
&& ($itm->{'itemnumber'} ) ); |
582 |
|
577 |
|
583 |
# get collection code description, too |
|
|
584 |
my $ccode = $itm->{'ccode'}; |
585 |
$itm->{'ccode'} = $collections->{$ccode} if defined($ccode) && $collections && exists( $collections->{$ccode} ); |
586 |
my $copynumber = $itm->{'copynumber'}; |
587 |
$itm->{'copynumber'} = $copynumbers->{$copynumber} if ( defined($copynumbers) && defined($copynumber) && exists( $copynumbers->{$copynumber} ) ); |
588 |
if ( defined $itm->{'location'} ) { |
589 |
$itm->{'location_description'} = $shelflocations->{ $itm->{'location'} }; |
590 |
} |
591 |
if (exists $itm->{itype} && defined($itm->{itype}) && exists $itemtypes->{ $itm->{itype} }) { |
592 |
$itm->{'imageurl'} = getitemtypeimagelocation( 'opac', $itemtypes->{ $itm->{itype} }->{'imageurl'} ); |
593 |
$itm->{'description'} = $itemtypes->{ $itm->{itype} }->{'description'}; |
594 |
} |
595 |
foreach (qw(ccode enumchron copynumber itemnotes uri)) { |
596 |
$itemfields{$_} = 1 if ($itm->{$_}); |
597 |
} |
598 |
|
599 |
# walk through the item-level authorised values and populate some images |
600 |
my $item_authorised_value_images = C4::Items::get_authorised_value_images( C4::Items::get_item_authorised_values( $itm->{'itemnumber'} ) ); |
601 |
# warn( Data::Dumper->Dump( [ $item_authorised_value_images ], [ 'item_authorised_value_images' ] ) ); |
602 |
|
603 |
if ( $itm->{'itemlost'} ) { |
604 |
my $lostimageinfo = List::Util::first { $_->{'category'} eq 'LOST' } @$item_authorised_value_images; |
605 |
$itm->{'lostimageurl'} = $lostimageinfo->{ 'imageurl' }; |
606 |
$itm->{'lostimagelabel'} = $lostimageinfo->{ 'label' }; |
607 |
} |
608 |
my $reserve_status = C4::Reserves::GetReserveStatus($itm->{itemnumber}); |
609 |
if( $reserve_status eq "Waiting"){ $itm->{'waiting'} = 1; } |
610 |
if( $reserve_status eq "Reserved"){ $itm->{'onhold'} = 1; } |
611 |
|
612 |
my ( $transfertwhen, $transfertfrom, $transfertto ) = GetTransfers($itm->{itemnumber}); |
613 |
if ( defined( $transfertwhen ) && $transfertwhen ne '' ) { |
614 |
$itm->{transfertwhen} = $transfertwhen; |
615 |
$itm->{transfertfrom} = $branches->{$transfertfrom}{branchname}; |
616 |
$itm->{transfertto} = $branches->{$transfertto}{branchname}; |
617 |
} |
618 |
my $itembranch = $itm->{$separatebranch}; |
578 |
my $itembranch = $itm->{$separatebranch}; |
619 |
if ($currentbranch and C4::Context->preference('OpacSeparateHoldings')) { |
579 |
if ($currentbranch and C4::Context->preference('OpacSeparateHoldings')) { |
620 |
if ($itembranch and $itembranch eq $currentbranch) { |
580 |
if ($itembranch and $itembranch eq $currentbranch) { |
Lines 1068-1071
if ( C4::Context->preference('UseCourseReserves') ) {
Link Here
|
1068 |
} |
1028 |
} |
1069 |
} |
1029 |
} |
1070 |
|
1030 |
|
|
|
1031 |
if ( C4::Context->preference('OPACAcquisitionDetails') ) { |
1032 |
my $orders = C4::Acquisition::SearchOrders({ |
1033 |
biblionumber => $biblionumber, |
1034 |
pending => 1, |
1035 |
}); |
1036 |
|
1037 |
my @items; |
1038 |
my $total_quantity; |
1039 |
for my $order ( @$orders ) { |
1040 |
if ( C4::Context->preference('AcqCreateItem') eq 'ordering' ) { |
1041 |
for my $itemnumber ( C4::Acquisition::GetItemnumbersFromOrder( $order->{ordernumber} ) ) { |
1042 |
my $item = C4::Items::GetItem( $itemnumber ); |
1043 |
$item->{on_order} = 1; |
1044 |
push @items, _get_items_infos( $item ); |
1045 |
} |
1046 |
} |
1047 |
$total_quantity += $order->{quantity}; |
1048 |
} |
1049 |
$template->{VARS}->{acquisition_details} = { |
1050 |
orders => $orders, |
1051 |
items => \@items, |
1052 |
total_quantity => $total_quantity, |
1053 |
}; |
1054 |
} |
1055 |
|
1071 |
output_html_with_http_headers $query, $cookie, $template->output; |
1056 |
output_html_with_http_headers $query, $cookie, $template->output; |
1072 |
- |
1057 |
|
|
|
1058 |
sub _get_items_infos { |
1059 |
my ( $itm ) = @_; |
1060 |
$itm->{holds_count} = $item_reserves{ $itm->{itemnumber} }; |
1061 |
$itm->{priority} = $priority{ $itm->{itemnumber} }; |
1062 |
$norequests = 0 |
1063 |
if ( (not $itm->{'withdrawn'} ) |
1064 |
&& (not $itm->{'itemlost'} ) |
1065 |
&& ($itm->{'itemnotforloan'}<0 || not $itm->{'itemnotforloan'} ) |
1066 |
&& (not $itemtypes->{$itm->{'itype'}}->{notforloan} ) |
1067 |
&& ($itm->{'itemnumber'} ) ); |
1068 |
|
1069 |
# get collection code description, too |
1070 |
my $ccode = $itm->{'ccode'}; |
1071 |
$itm->{'ccode'} = $collections->{$ccode} if ( defined($collections) && exists( $collections->{$ccode} ) ); |
1072 |
my $copynumber = $itm->{'copynumber'}; |
1073 |
$itm->{'copynumber'} = $copynumbers->{$copynumber} if ( defined($copynumbers) && defined($copynumber) && exists( $copynumbers->{$copynumber} ) ); |
1074 |
if ( defined $itm->{'location'} ) { |
1075 |
$itm->{'location_description'} = $shelflocations->{ $itm->{'location'} }; |
1076 |
} |
1077 |
if (exists $itm->{itype} && defined($itm->{itype}) && exists $itemtypes->{ $itm->{itype} }) { |
1078 |
$itm->{'imageurl'} = getitemtypeimagelocation( 'opac', $itemtypes->{ $itm->{itype} }->{'imageurl'} ); |
1079 |
$itm->{'description'} = $itemtypes->{ $itm->{itype} }->{'description'}; |
1080 |
} |
1081 |
foreach (qw(ccode enumchron copynumber itemnotes uri)) { |
1082 |
$itemfields{$_} = 1 if ($itm->{$_}); |
1083 |
} |
1084 |
|
1085 |
# walk through the item-level authorised values and populate some images |
1086 |
my $item_authorised_value_images = C4::Items::get_authorised_value_images( C4::Items::get_item_authorised_values( $itm->{'itemnumber'} ) ); |
1087 |
|
1088 |
if ( $itm->{'itemlost'} ) { |
1089 |
my $lostimageinfo = List::Util::first { $_->{'category'} eq 'LOST' } @$item_authorised_value_images; |
1090 |
$itm->{'lostimageurl'} = $lostimageinfo->{ 'imageurl' }; |
1091 |
$itm->{'lostimagelabel'} = $lostimageinfo->{ 'label' }; |
1092 |
} |
1093 |
my $reserve_status = C4::Reserves::GetReserveStatus($itm->{itemnumber}); |
1094 |
if( $reserve_status eq "Waiting"){ $itm->{'waiting'} = 1; } |
1095 |
if( $reserve_status eq "Reserved"){ $itm->{'onhold'} = 1; } |
1096 |
|
1097 |
my ( $transfertwhen, $transfertfrom, $transfertto ) = GetTransfers($itm->{itemnumber}); |
1098 |
if ( defined( $transfertwhen ) && $transfertwhen ne '' ) { |
1099 |
$itm->{transfertwhen} = $transfertwhen; |
1100 |
$itm->{transfertfrom} = $branches->{$transfertfrom}{branchname}; |
1101 |
$itm->{transfertto} = $branches->{$transfertto}{branchname}; |
1102 |
} |
1103 |
return $itm; |
1104 |
} |