X-Git-Url: http://git.rot13.org/?a=blobdiff_plain;f=opac%2Fopac-ISBDdetail.pl;h=fe695643cfae2a5c5cd0480703c95ca788d7ef9f;hb=be0a897648e4ae1ebb429d0829c22a8534a81606;hp=c55829c30f1e2ac94e08ec09564d0e61cd051403;hpb=39487d634ecb2fbfe5819852ef295cdd3d214737;p=koha.git diff --git a/opac/opac-ISBDdetail.pl b/opac/opac-ISBDdetail.pl index c55829c30f..fe695643cf 100755 --- a/opac/opac-ISBDdetail.pl +++ b/opac/opac-ISBDdetail.pl @@ -50,11 +50,14 @@ use C4::Biblio; use C4::Items; use C4::Reserves; use C4::Acquisition; -use C4::Review; use C4::Serials; # uses getsubscriptionfrom biblionumber use C4::Koha; -use C4::Members; # GetMember +use Koha::IssuingRules; +use Koha::Items; +use Koha::ItemTypes; +use Koha::Patrons; use Koha::RecordProcessor; +use Koha::Biblios; my $query = CGI->new(); my ( $template, $loggedinuser, $cookie ) = get_template_and_user( @@ -78,8 +81,6 @@ if(my $cart_list = $query->cookie("bib_list")){ } } -$template->param( 'ItemsIssued' => CountItemsIssued( $biblionumber ) ); - my $marcflavour = C4::Context->preference("marcflavour"); my @items = GetItemsInfo($biblionumber); @@ -92,11 +93,16 @@ if (scalar @items >= 1) { } } -my $record = GetMarcBiblio($biblionumber,1); +my $record = GetMarcBiblio({ + biblionumber => $biblionumber, + embed_items => 1 }); if ( ! $record ) { print $query->redirect("/cgi-bin/koha/errors/404.pl"); exit; } + +my $biblio = Koha::Biblios->find( $biblionumber ); + my $framework = GetFrameworkCode( $biblionumber ); my $record_processor = Koha::RecordProcessor->new({ filters => 'ViewPolicy', @@ -162,9 +168,10 @@ my $res = GetISBDView({ 'framework' => $framework }); -my $itemtypes = GetItemTypes(); -my $borrower = GetMember( 'borrowernumber' => $loggedinuser ); +my $itemtypes = { map { $_->{itemtype} => $_ } @{ Koha::ItemTypes->search_with_localization->unblessed } }; +my $patron = Koha::Patrons->find( $loggedinuser ); for my $itm (@items) { + my $item = Koha::Items->find( $itm->{itemnumber} ); $norequests = 0 if $norequests && !$itm->{'withdrawn'} @@ -173,28 +180,19 @@ for my $itm (@items) { && !$itemtypes->{$itm->{'itype'}}->{notforloan} && $itm->{'itemnumber'}; - $allow_onshelf_holds = C4::Reserves::OnShelfHoldsAllowed($itm, $borrower) + $allow_onshelf_holds = Koha::IssuingRules->get_onshelfholds_policy( { item => $item, patron => $patron } ) unless $allow_onshelf_holds; } -my $reviews = getreviews( $biblionumber, 1 ); -foreach ( @$reviews ) { - my $borrower_number_review = $_->{borrowernumber}; - my $borrowerData = GetMember('borrowernumber' =>$borrower_number_review); - # setting some borrower info into this hash - $_->{title} = $borrowerData->{'title'}; - $_->{surname} = $borrowerData->{'surname'}; - $_->{firstname} = $borrowerData->{'firstname'}; +if( $allow_onshelf_holds || CountItemsIssued($biblionumber) || $biblio->has_items_waiting_or_intransit ) { + $template->param( ReservableItems => 1 ); } - $template->param( RequestOnOpac => C4::Context->preference("RequestOnOpac"), - AllowOnShelfHolds => $allow_onshelf_holds, norequests => $norequests, ISBD => $res, - biblionumber => $biblionumber, - reviews => $reviews, + biblio => $biblio, ); #Search for title in links @@ -219,4 +217,11 @@ if (my $search_for_title = C4::Context->preference('OPACSearchForTitleIn')){ $template->param('OPACSearchForTitleIn' => $search_for_title); } +if( C4::Context->preference('ArticleRequests') ) { + my $artreqpossible = $patron + ? $biblio->can_article_request( $patron ) + : Koha::ItemTypes->find($biblio->itemtype)->may_article_request; + $template->param( artreqpossible => $artreqpossible ); +} + output_html_with_http_headers $query, $cookie, $template->output;