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